diff --git a/remote-api/src/test/java/org/alfresco/rest/DeletedNodesTest.java b/remote-api/src/test/java/org/alfresco/rest/DeletedNodesTest.java index fcbe066ffc..0fb7f53415 100644 --- a/remote-api/src/test/java/org/alfresco/rest/DeletedNodesTest.java +++ b/remote-api/src/test/java/org/alfresco/rest/DeletedNodesTest.java @@ -2,7 +2,7 @@ * #%L * Alfresco Remote API * %% - * Copyright (C) 2005 - 2020 Alfresco Software Limited + * Copyright (C) 2005 - 2021 Alfresco Software Limited * %% * This file is part of the Alfresco software. * If the software was purchased under a paid Alfresco license, the terms of @@ -704,6 +704,34 @@ public class DeletedNodesTest extends AbstractSingleNetworkSiteTest assertNull("We don't show the parent id for a deleted node",aNode.getParentId()); } + @Test + public void testRequestArchivedContentDirectUrl() throws Exception + { + setRequestContext(user1); + + String myNodeId = getMyNodeId(); + + String fileName = "TestDocumentToArchive.txt"; + Document testDocumentToArchive = new Document(); + testDocumentToArchive.setName(fileName); + testDocumentToArchive.setNodeType(TYPE_CM_CONTENT); + + // create *empty* text file + HttpResponse response = post(getNodeChildrenUrl(myNodeId), toJsonAsStringNonNull(testDocumentToArchive), 201); + Document document = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class); + + final String contentNodeId = document.getId(); + deleteNode(contentNodeId); + + // Check the upload response + assertEquals(fileName, document.getName()); + ContentInfo contentInfo = document.getContent(); + assertNotNull(contentInfo); + assertEquals(MimetypeMap.MIMETYPE_TEXT_PLAIN, contentInfo.getMimeType()); + + HttpResponse dauResponse = post(getRequestArchivedContentDirectUrl(contentNodeId), null, null, null, null, 501); + } + private String getDeletedNodeRenditionsUrl(String nodeId) { return URL_DELETED_NODES + "/" + nodeId + "/" + URL_RENDITIONS; diff --git a/remote-api/src/test/java/org/alfresco/rest/api/tests/AbstractBaseApiTest.java b/remote-api/src/test/java/org/alfresco/rest/api/tests/AbstractBaseApiTest.java index 0090c4de2d..568ad7c667 100644 --- a/remote-api/src/test/java/org/alfresco/rest/api/tests/AbstractBaseApiTest.java +++ b/remote-api/src/test/java/org/alfresco/rest/api/tests/AbstractBaseApiTest.java @@ -68,7 +68,6 @@ import org.junit.After; import org.junit.Before; import org.junit.experimental.categories.Category; import org.springframework.util.ResourceUtils; -import org.alfresco.service.cmr.repository.DirectAccessUrl; import java.io.ByteArrayInputStream; import java.io.File; @@ -97,6 +96,7 @@ public abstract class AbstractBaseApiTest extends EnterpriseTestApi private static final String RESOURCE_PREFIX = "publicapi/upload/"; protected static final String URL_NODES = "nodes"; + protected static final String URL_DELETED_NODES = "deleted-nodes"; protected static final String URL_RENDITIONS = "renditions"; protected static final String URL_VERSIONS = "versions"; @@ -219,6 +219,11 @@ public abstract class AbstractBaseApiTest extends EnterpriseTestApi return URL_NODES + "/" + nodeId + "/" + REQUEST_DIRECT_ACCESS_URL; } + protected String getRequestArchivedContentDirectUrl(String nodeId) + { + return URL_DELETED_NODES + "/" + nodeId + "/" + REQUEST_DIRECT_ACCESS_URL; + } + /** * The api scope. either public or private *