mirror of
https://github.com/Alfresco/acs-community-packaging.git
synced 2025-09-10 14:12:09 +00:00
Compare commits
10 Commits
25.2.0
...
acs-commun
Author | SHA1 | Date | |
---|---|---|---|
|
ea3ac8166d | ||
|
3503b8e45f | ||
|
28ef9bb0d5 | ||
|
2ccf55c81d | ||
|
fc77880b0c | ||
|
6be05950ec | ||
|
9c027929a9 | ||
|
50be336cea | ||
|
66664d40de | ||
|
2ed4dc48ce |
@@ -27,6 +27,8 @@ branches:
|
||||
stages:
|
||||
- name: test
|
||||
if: commit_message !~ /\[skip tests\]/
|
||||
- name: docker_latest
|
||||
if: fork = false AND type != pull_request AND branch = develop
|
||||
- release
|
||||
- publish
|
||||
|
||||
@@ -101,6 +103,11 @@ jobs:
|
||||
- ./tests/scripts/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
script:
|
||||
- travis_wait 30 mvn install -q -f tests/tas-integration/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
|
||||
|
||||
- stage: docker_latest
|
||||
name: "Update Docker latest images"
|
||||
script: travis_retry travis_wait 30 mvn -B -V clean install -DskipTests -Dmaven.javadoc.skip=true -Pmaster
|
||||
|
||||
- stage: Release
|
||||
name: "Maven release"
|
||||
if: commit_message ~= /\[release\]/ AND fork = false AND branch =~ ^(master|develop)$ AND type != pull_request
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>acs-community-packaging</artifactId>
|
||||
<version>6.2.2-SNAPSHOT</version>
|
||||
<version>6.2.2-RC1</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -75,6 +75,14 @@
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
<excludes>
|
||||
<exclude>keystore/**</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources/keystore</directory>
|
||||
<targetPath>keystore</targetPath>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
|
@@ -2,6 +2,7 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
|
||||
<id>distribution</id>
|
||||
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
|
Binary file not shown.
@@ -14,6 +14,7 @@ ARG TOMCAT_DIR=/usr/local/tomcat
|
||||
|
||||
# Create prerequisite to store tools and properties
|
||||
RUN mkdir -p ${TOMCAT_DIR}/shared/classes/alfresco/extension && \
|
||||
mkdir -p ${TOMCAT_DIR}/shared/classes/alfresco/extension/keystore && \
|
||||
mkdir ${TOMCAT_DIR}/alfresco-mmt
|
||||
RUN touch ${TOMCAT_DIR}/shared/classes/alfresco-global.properties
|
||||
|
||||
@@ -68,6 +69,9 @@ RUN yum install -y fontconfig-2.13.0-4.3.el7 \
|
||||
dejavu-sans-fonts-2.33-6.el7 && \
|
||||
yum clean all
|
||||
|
||||
# Copy default keystore
|
||||
COPY target/distribution/keystore/metadata-keystore/keystore ${TOMCAT_DIR}/shared/classes/alfresco/extension/keystore/
|
||||
|
||||
# The standard configuration is to have all Tomcat files owned by root with group GROUPNAME and whilst owner has read/write privileges,
|
||||
# group only has restricted permissions and world has no permissions.
|
||||
RUN mkdir -p ${TOMCAT_DIR}/conf/Catalina/localhost && \
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>acs-community-packaging</artifactId>
|
||||
<version>6.2.2-SNAPSHOT</version>
|
||||
<version>6.2.2-RC1</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -145,6 +145,13 @@
|
||||
<type>war</type>
|
||||
<outputDirectory>${project.build.directory}/war/_vti_bin</outputDirectory>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-content-services-community-distribution</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
<outputDirectory>${project.build.directory}/distribution</outputDirectory>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
29
pom.xml
29
pom.xml
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>acs-community-packaging</artifactId>
|
||||
<name>Alfresco Content Services Community Packaging</name>
|
||||
<version>6.2.2-SNAPSHOT</version>
|
||||
<version>6.2.2-RC1</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<parent>
|
||||
@@ -15,7 +15,7 @@
|
||||
<connection>scm:git:https://github.com/Alfresco/acs-community-packaging.git</connection>
|
||||
<developerConnection>scm:git:https://github.com/Alfresco/acs-community-packaging.git</developerConnection>
|
||||
<url>https://github.com/Alfresco/acs-community-packaging</url>
|
||||
<tag>HEAD</tag>
|
||||
<tag>acs-community-packaging-6.2.2-RC1</tag>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
@@ -34,10 +34,10 @@
|
||||
<version.edition>Community</version.edition>
|
||||
<image.tag>latest</image.tag>
|
||||
|
||||
<dependency.alfresco-remote-api.version>7.147</dependency.alfresco-remote-api.version>
|
||||
<dependency.alfresco-repository.version>7.200</dependency.alfresco-repository.version>
|
||||
<dependency.alfresco-data-model.version>8.50.18</dependency.alfresco-data-model.version>
|
||||
<dependency.alfresco-core.version>7.34</dependency.alfresco-core.version>
|
||||
<dependency.alfresco-remote-api.version>7.156</dependency.alfresco-remote-api.version>
|
||||
<dependency.alfresco-repository.version>7.219</dependency.alfresco-repository.version>
|
||||
<dependency.alfresco-data-model.version>8.50.21</dependency.alfresco-data-model.version>
|
||||
<dependency.alfresco-core.version>7.35</dependency.alfresco-core.version>
|
||||
|
||||
<dependency.alfresco-hb-data-sender.version>1.0.12</dependency.alfresco-hb-data-sender.version>
|
||||
|
||||
@@ -53,8 +53,8 @@
|
||||
|
||||
<dependency.spring.version>5.1.15.RELEASE</dependency.spring.version>
|
||||
<dependency.fabric8.version>4.4.0</dependency.fabric8.version>
|
||||
<dependency.jackson.version>2.10.2</dependency.jackson.version>
|
||||
<dependency.jackson-databind.version>2.10.1</dependency.jackson-databind.version>
|
||||
<dependency.jackson.version>2.10.5</dependency.jackson.version>
|
||||
<dependency.jackson-databind.version>2.10.5</dependency.jackson-databind.version>
|
||||
<dependency.cxf.version>3.3.6</dependency.cxf.version>
|
||||
|
||||
<!-- Alfresco Share version -->
|
||||
@@ -71,7 +71,7 @@
|
||||
<alfresco.package.name>alfresco-community</alfresco.package.name>
|
||||
<alfresco.distribution.name>${alfresco.package.name}-distribution</alfresco.distribution.name>
|
||||
|
||||
<dependency.postgresql.version>42.2.12</dependency.postgresql.version>
|
||||
<dependency.postgresql.version>42.2.14</dependency.postgresql.version>
|
||||
|
||||
<dependency.tas-utility.version>3.0.20</dependency.tas-utility.version>
|
||||
<dependency.rest-assured.version>3.3.0</dependency.rest-assured.version>
|
||||
@@ -82,7 +82,7 @@
|
||||
<dependency.tas-webdav.version>1.6</dependency.tas-webdav.version>
|
||||
<dependency.tas-ftp.version>1.5</dependency.tas-ftp.version>
|
||||
<dependency.tas-dataprep.version>2.3</dependency.tas-dataprep.version>
|
||||
|
||||
|
||||
<maven.build.sourceVersion>11</maven.build.sourceVersion>
|
||||
</properties>
|
||||
|
||||
@@ -97,6 +97,7 @@
|
||||
<id>communityDocker</id>
|
||||
<modules>
|
||||
<module>war</module>
|
||||
<module>distribution</module>
|
||||
<module>docker-alfresco</module>
|
||||
</modules>
|
||||
</profile>
|
||||
@@ -548,11 +549,11 @@
|
||||
<artifactId>jsoup</artifactId>
|
||||
<version>1.13.1</version>
|
||||
</dependency>
|
||||
<!-- Newer metadata-extractor, used in TIKA, see ACS-370 -->
|
||||
<!--REPO-5235 -->
|
||||
<dependency>
|
||||
<groupId>com.drewnoakes</groupId>
|
||||
<artifactId>metadata-extractor</artifactId>
|
||||
<version>2.13.0</version>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.8.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>acs-community-packaging</artifactId>
|
||||
<version>6.2.2-SNAPSHOT</version>
|
||||
<version>6.2.2-RC1</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<packaging>pom</packaging>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
TRANSFORMERS_TAG=2.3.1
|
||||
SOLR6_TAG=1.4.2
|
||||
POSTGRES_TAG=11.4
|
||||
TRANSFORMERS_TAG=2.3.5
|
||||
SOLR6_TAG=2.0.0
|
||||
POSTGRES_TAG=11.7
|
||||
ACTIVEMQ_TAG=5.15.8
|
||||
|
@@ -11,6 +11,16 @@ services:
|
||||
environment:
|
||||
CATALINA_OPTS : "-agentlib:jdwp=transport=dt_socket,address=*:8000,server=y,suspend=n"
|
||||
# Some properties are built in Dockerfile because of cron expressions
|
||||
JAVA_TOOL_OPTIONS: "
|
||||
-Dencryption.keystore.type=JCEKS
|
||||
-Dencryption.cipherAlgorithm=DESede/CBC/PKCS5Padding
|
||||
-Dencryption.keyAlgorithm=DESede
|
||||
-Dencryption.keystore.location=/usr/local/tomcat/shared/classes/alfresco/extension/keystore/keystore
|
||||
-Dmetadata-keystore.password=mp6yc0UD9e
|
||||
-Dmetadata-keystore.aliases=metadata
|
||||
-Dmetadata-keystore.metadata.password=oKIWzVdEdA
|
||||
-Dmetadata-keystore.metadata.algorithm=DESede
|
||||
"
|
||||
JAVA_OPTS :
|
||||
"
|
||||
-Ddb.driver=org.postgresql.Driver
|
||||
|
@@ -10,6 +10,16 @@ services:
|
||||
image: alfresco/alfresco-content-repository-community:latest
|
||||
environment:
|
||||
CATALINA_OPTS : "-agentlib:jdwp=transport=dt_socket,address=*:8000,server=y,suspend=n"
|
||||
JAVA_TOOL_OPTIONS: "
|
||||
-Dencryption.keystore.type=JCEKS
|
||||
-Dencryption.cipherAlgorithm=DESede/CBC/PKCS5Padding
|
||||
-Dencryption.keyAlgorithm=DESede
|
||||
-Dencryption.keystore.location=/usr/local/tomcat/shared/classes/alfresco/extension/keystore/keystore
|
||||
-Dmetadata-keystore.password=mp6yc0UD9e
|
||||
-Dmetadata-keystore.aliases=metadata
|
||||
-Dmetadata-keystore.metadata.password=oKIWzVdEdA
|
||||
-Dmetadata-keystore.metadata.algorithm=DESede
|
||||
"
|
||||
JAVA_OPTS :
|
||||
"
|
||||
-Ddb.driver=org.postgresql.Driver
|
||||
|
@@ -1,13 +1,13 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>content-repository-community-tas-tests-parent</artifactId>
|
||||
<version>6.2.2-SNAPSHOT</version>
|
||||
<version>6.2.2-RC1</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>acs-community-packaging</artifactId>
|
||||
<version>6.2.2-SNAPSHOT</version>
|
||||
<version>6.2.2-RC1</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@@ -27,5 +27,9 @@ if (("$COUNTER" < "$TIMEOUT")) ; then
|
||||
else
|
||||
echo "Waited $COUNTER seconds"
|
||||
echo "Alfresco Could not start in time."
|
||||
docker ps -a
|
||||
ALFCONTAINER=`docker ps -a | grep _alfresco | awk '{ print $1 }'`
|
||||
echo "Last 200 lines from alfresco.log on container $ALFCONTAINER:"
|
||||
docker logs --tail=200 $ALFCONTAINER
|
||||
exit 1
|
||||
fi
|
@@ -4,13 +4,13 @@
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>content-repository-community-cmis-test</artifactId>
|
||||
<name>content-repository-community-cmis-test</name>
|
||||
<version>6.2.2-SNAPSHOT</version>
|
||||
<version>6.2.2-RC1</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>content-repository-community-tas-tests-parent</artifactId>
|
||||
<version>6.2.2-SNAPSHOT</version>
|
||||
<version>6.2.2-RC1</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@@ -4,13 +4,13 @@
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>content-repository-community-email-test</artifactId>
|
||||
<name>content-repository-community-email-test</name>
|
||||
<version>6.2.2-SNAPSHOT</version>
|
||||
<version>6.2.2-RC1</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>content-repository-community-tas-tests-parent</artifactId>
|
||||
<version>6.2.2-SNAPSHOT</version>
|
||||
<version>6.2.2-RC1</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@@ -4,13 +4,13 @@
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>content-repository-community-integration-test</artifactId>
|
||||
<name>content-repository-community-integration-test</name>
|
||||
<version>6.2.2-SNAPSHOT</version>
|
||||
<version>6.2.2-RC1</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>content-repository-community-tas-tests-parent</artifactId>
|
||||
<version>6.2.2-SNAPSHOT</version>
|
||||
<version>6.2.2-RC1</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@@ -4,13 +4,13 @@
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>content-repository-community-restapi-test</artifactId>
|
||||
<name>content-repository-community-restapi-test</name>
|
||||
<version>6.2.2-SNAPSHOT</version>
|
||||
<version>6.2.2-RC1</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>content-repository-community-tas-tests-parent</artifactId>
|
||||
<version>6.2.2-SNAPSHOT</version>
|
||||
<version>6.2.2-RC1</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@@ -0,0 +1,324 @@
|
||||
package org.alfresco.rest.servlet;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.core.RestResponse;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FileType;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.report.Bug;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
public class DownloadContentServletTests extends RestTest
|
||||
{
|
||||
private static final String CONTENT_DISPOSITION = "Content-Disposition";
|
||||
private static final String FILENAME_HEADER = "filename=\"%s\"";
|
||||
private static final String ATTACHMENT = "attachment";
|
||||
private static final String FILE_CONTENT = "The content of the file.";
|
||||
|
||||
private static String downloadContentServletAttach = "alfresco/d/a/workspace/SpacesStore/";
|
||||
private static String downloadContentServletDirect = "alfresco/d/d/workspace/SpacesStore/";
|
||||
|
||||
private UserModel testUser;
|
||||
private FileModel testContentFile;
|
||||
private String authHeaderEncoded;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
testUser = dataUser.createRandomTestUser();
|
||||
SiteModel testSite = dataSite.usingUser(testUser).createPublicRandomSite();
|
||||
FolderModel testFolder = dataContent.usingUser(testUser).usingSite(testSite).createFolder();
|
||||
testContentFile = dataContent.usingUser(testUser).usingResource(testFolder)
|
||||
.createContent(new FileModel("hotOuside", FileType.TEXT_PLAIN, FILE_CONTENT));
|
||||
|
||||
String authHeader = String.format("%s:%s", testUser.getUsername(), testUser.getPassword());
|
||||
authHeaderEncoded = new String(Base64.encodeBase64(authHeader.getBytes()));
|
||||
|
||||
RestAssured.basePath = "";
|
||||
restClient.configureRequestSpec().setBasePath(RestAssured.basePath);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify DownloadContentServlet retrieve content using short descriptor and attach short descriptor.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.ENTERPRISE})
|
||||
@Bug(id ="MNT-21602", status=Bug.Status.FIXED)
|
||||
public void verifyDCSShortAttachShort()
|
||||
{
|
||||
authenticateTestUser();
|
||||
RestRequest request = RestRequest.simpleRequest(
|
||||
HttpMethod.GET, downloadContentServletAttach + testContentFile.getNodeRef() + "/" + testContentFile.getName());
|
||||
RestResponse response = restClient.process(request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
assertEquals(FILE_CONTENT, response.getResponse().body().asString());
|
||||
restClient.assertHeaderValueContains(CONTENT_DISPOSITION, ATTACHMENT);
|
||||
restClient.assertHeaderValueContains(CONTENT_DISPOSITION, String.format(FILENAME_HEADER, testContentFile.getName()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify DownloadContentServlet retrieve content using short descriptor and attach long descriptor.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.ENTERPRISE})
|
||||
@Bug(id ="MNT-21602", status=Bug.Status.FIXED)
|
||||
public void verifyDCSShortAttachLong()
|
||||
{
|
||||
authenticateTestUser();
|
||||
String downloadContentServletAttachLong = "alfresco/d/attach/workspace/SpacesStore/";
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET,
|
||||
downloadContentServletAttachLong + testContentFile.getNodeRef() + "/" + testContentFile.getName());
|
||||
RestResponse response = restClient.process(request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
assertEquals(FILE_CONTENT, response.getResponse().body().asString());
|
||||
restClient.assertHeaderValueContains(CONTENT_DISPOSITION, ATTACHMENT);
|
||||
restClient.assertHeaderValueContains(CONTENT_DISPOSITION, String.format(FILENAME_HEADER, testContentFile.getName()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify DownloadContentServlet retrieve content using short descriptor and direct short descriptor.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.ENTERPRISE})
|
||||
@Bug(id ="MNT-21602", status=Bug.Status.FIXED)
|
||||
public void verifyDCSShortDirectShort()
|
||||
{
|
||||
authenticateTestUser();
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET,
|
||||
downloadContentServletDirect + testContentFile.getNodeRef() + "/" + testContentFile.getName());
|
||||
RestResponse response = restClient.process(request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
assertEquals(FILE_CONTENT, response.getResponse().body().asString());
|
||||
restClient.assertHeaderValueContains(CONTENT_DISPOSITION, ATTACHMENT);
|
||||
restClient.assertHeaderValueContains(CONTENT_DISPOSITION, String.format(FILENAME_HEADER, testContentFile.getName()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify DownloadContentServlet retrieve content using short descriptor and direct long descriptor.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.ENTERPRISE})
|
||||
@Bug(id ="MNT-21602", status=Bug.Status.FIXED)
|
||||
public void verifyDCSShortDirectLong()
|
||||
{
|
||||
authenticateTestUser();
|
||||
String downloadContentServletDirectLong = "alfresco/d/direct/workspace/SpacesStore/";
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET,
|
||||
downloadContentServletDirectLong + testContentFile.getNodeRef() + "/" + testContentFile.getName());
|
||||
RestResponse response = restClient.process(request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
assertEquals(FILE_CONTENT, response.getResponse().body().asString());
|
||||
restClient.assertHeaderValueContains(CONTENT_DISPOSITION, ATTACHMENT);
|
||||
restClient.assertHeaderValueContains(CONTENT_DISPOSITION, String.format(FILENAME_HEADER, testContentFile.getName()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify DownloadContentServlet retrieve content using long descriptor and attach short descriptor.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.ENTERPRISE})
|
||||
@Bug(id ="MNT-21602", status=Bug.Status.FIXED)
|
||||
public void verifyDCSLongAttachShort()
|
||||
{
|
||||
authenticateTestUser();
|
||||
String downloadContentLongServletAttach = "alfresco/download/a/workspace/SpacesStore/";
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET,
|
||||
downloadContentLongServletAttach + testContentFile.getNodeRef() + "/" + testContentFile.getName());
|
||||
RestResponse response = restClient.process(request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
assertEquals(FILE_CONTENT, response.getResponse().body().asString());
|
||||
restClient.assertHeaderValueContains(CONTENT_DISPOSITION, ATTACHMENT);
|
||||
restClient.assertHeaderValueContains(CONTENT_DISPOSITION, String.format(FILENAME_HEADER, testContentFile.getName()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify DownloadContentServlet retrieve content using long descriptor and attach long descriptor.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.ENTERPRISE})
|
||||
@Bug(id ="MNT-21602", status=Bug.Status.FIXED)
|
||||
public void verifyDCSLongAttachLong()
|
||||
{
|
||||
authenticateTestUser();
|
||||
String downloadContentLongServletAttachLong = "alfresco/download/attach/workspace/SpacesStore/";
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET,
|
||||
downloadContentLongServletAttachLong + testContentFile.getNodeRef() + "/" + testContentFile.getName());
|
||||
RestResponse response = restClient.process(request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
assertEquals(FILE_CONTENT, response.getResponse().body().asString());
|
||||
restClient.assertHeaderValueContains(CONTENT_DISPOSITION, ATTACHMENT);
|
||||
restClient.assertHeaderValueContains(CONTENT_DISPOSITION, String.format(FILENAME_HEADER, testContentFile.getName()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify DownloadContentServlet retrieve content using long descriptor and direct short descriptor.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.ENTERPRISE})
|
||||
@Bug(id ="MNT-21602", status=Bug.Status.FIXED)
|
||||
public void verifyDCSLongDirectShort()
|
||||
{
|
||||
authenticateTestUser();
|
||||
String downloadContentLongServletDirect = "alfresco/download/d/workspace/SpacesStore/";
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET,
|
||||
downloadContentLongServletDirect + testContentFile.getNodeRef() + "/" + testContentFile.getName());
|
||||
RestResponse response = restClient.process(request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
assertEquals(FILE_CONTENT, response.getResponse().body().asString());
|
||||
restClient.assertHeaderValueContains(CONTENT_DISPOSITION, ATTACHMENT);
|
||||
restClient.assertHeaderValueContains(CONTENT_DISPOSITION, String.format(FILENAME_HEADER, testContentFile.getName()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify DownloadContentServlet retrieve content using long descriptor and direct long descriptor.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.ENTERPRISE})
|
||||
@Bug(id ="MNT-21602", status=Bug.Status.FIXED)
|
||||
public void verifyDCSLongDirectLong()
|
||||
{
|
||||
authenticateTestUser();
|
||||
String downloadContentLongServletDirectLong = "alfresco/download/direct/workspace/SpacesStore/";
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET,
|
||||
downloadContentLongServletDirectLong + testContentFile.getNodeRef() + "/" + testContentFile.getName());
|
||||
RestResponse response = restClient.process(request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
assertEquals(FILE_CONTENT, response.getResponse().body().asString());
|
||||
restClient.assertHeaderValueContains(CONTENT_DISPOSITION, ATTACHMENT);
|
||||
restClient.assertHeaderValueContains(CONTENT_DISPOSITION, String.format(FILENAME_HEADER, testContentFile.getName()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify DownloadContentServlet retrieve content using short descriptor and attach short uppercase descriptor.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.ENTERPRISE})
|
||||
@Bug(id ="MNT-21602", status=Bug.Status.FIXED)
|
||||
public void verifyDCSShortAttachUppercaseShort()
|
||||
{
|
||||
authenticateTestUser();
|
||||
String downloadContentAttachUppercase = "alfresco/d/A/workspace/SpacesStore/";
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET,
|
||||
downloadContentAttachUppercase + testContentFile.getNodeRef() + "/" + testContentFile.getName());
|
||||
RestResponse response = restClient.process(request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
assertEquals(FILE_CONTENT, response.getResponse().body().asString());
|
||||
restClient.assertHeaderValueContains(CONTENT_DISPOSITION, ATTACHMENT);
|
||||
restClient.assertHeaderValueContains(CONTENT_DISPOSITION, String.format(FILENAME_HEADER, testContentFile.getName()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify DownloadContentServlet retrieve content using short descriptor and direct short uppercase descriptor.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.ENTERPRISE})
|
||||
@Bug(id ="MNT-21602", status=Bug.Status.FIXED)
|
||||
public void verifyDCSShortDirectUppercaseShort()
|
||||
{
|
||||
authenticateTestUser();
|
||||
String downloadContentDirectUppercase = "alfresco/d/D/workspace/SpacesStore/";
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET,
|
||||
downloadContentDirectUppercase + testContentFile.getNodeRef() + "/" + testContentFile.getName());
|
||||
RestResponse response = restClient.process(request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
assertEquals(FILE_CONTENT, response.getResponse().body().asString());
|
||||
restClient.assertHeaderValueContains(CONTENT_DISPOSITION, ATTACHMENT);
|
||||
restClient.assertHeaderValueContains(CONTENT_DISPOSITION, String.format(FILENAME_HEADER, testContentFile.getName()));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify DownloadContentServlet retrieve content using attach without specifying {storeType}.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.ENTERPRISE})
|
||||
@Bug(id ="MNT-21602", status=Bug.Status.FIXED)
|
||||
public void verifyDCSAttachWithoutStoreType()
|
||||
{
|
||||
authenticateTestUser();
|
||||
String downloadContentLessPathAttach = "alfresco/d/a/SpacesStore/";
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET,
|
||||
downloadContentLessPathAttach + testContentFile.getNodeRef() + "/" + testContentFile.getName());
|
||||
restClient.process(request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify DownloadContentServlet retrieve content using direct without specifying {storeType}.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.ENTERPRISE})
|
||||
@Bug(id ="MNT-21602", status=Bug.Status.FIXED)
|
||||
public void verifyDCSDirectWithoutStoreType()
|
||||
{
|
||||
authenticateTestUser();
|
||||
String downloadContentLessPathDirect = "alfresco/d/d/SpacesStore/";
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET,
|
||||
downloadContentLessPathDirect + testContentFile.getNodeRef() + "/" + testContentFile.getName());
|
||||
restClient.process(request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify DownloadContentServlet retrieve content using direct without specifying {storeType}.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.ENTERPRISE})
|
||||
@Bug(id ="MNT-21602", status=Bug.Status.FIXED)
|
||||
public void verifyDCSDirectWithInvalidStoreType()
|
||||
{
|
||||
authenticateTestUser();
|
||||
String downloadContentLessPathDirect = "alfresco/download/d/badWorkspace/SpacesStore/";
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET,
|
||||
downloadContentLessPathDirect + testContentFile.getNodeRef() + "/" + testContentFile.getName());
|
||||
restClient.process(request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify DownloadContentServlet retrieve content using direct without specifying {storeType}.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.ENTERPRISE})
|
||||
@Bug(id ="MNT-21602", status=Bug.Status.FIXED)
|
||||
public void verifyDCSDirectWithInvalidStoreId()
|
||||
{
|
||||
authenticateTestUser();
|
||||
String downloadContentLessPathDirect = "alfresco/download/d/workspace/badSpacesStore/";
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET,
|
||||
downloadContentLessPathDirect + testContentFile.getNodeRef() + "/" + testContentFile.getName());
|
||||
restClient.process(request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify DownloadContentServlet retrieve content using attach without authentication.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.ENTERPRISE})
|
||||
@Bug(id ="MNT-21602", status=Bug.Status.FIXED)
|
||||
public void verifyDCSAttachWithoutAuthentication()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET,
|
||||
downloadContentServletAttach + testContentFile.getNodeRef() + "/" + testContentFile.getName());
|
||||
restClient.process(request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify DownloadContentServlet retrieve content using direct without authentication.")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FULL, TestGroup.ENTERPRISE})
|
||||
@Bug(id ="MNT-21602", status=Bug.Status.FIXED)
|
||||
public void verifyDCSDirectWithoutAuthentication()
|
||||
{
|
||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET,
|
||||
downloadContentServletDirect + testContentFile.getNodeRef() + "/" + testContentFile.getName());
|
||||
restClient.process(request);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
private void authenticateTestUser()
|
||||
{
|
||||
restClient.configureRequestSpec()
|
||||
.addHeader("Authorization", String.format("Basic %s", authHeaderEncoded))
|
||||
.build();
|
||||
}
|
||||
}
|
@@ -14,6 +14,7 @@
|
||||
<package name="org.alfresco.rest.comments.*"/>
|
||||
<package name="org.alfresco.rest.downloads.*"/>
|
||||
<package name="org.alfresco.rest.favorites.*"/>
|
||||
<package name="org.alfresco.rest.servlet.*"/>
|
||||
</packages>
|
||||
</test>
|
||||
</suite>
|
||||
|
@@ -4,13 +4,13 @@
|
||||
<groupId>org.alfresco.tas</groupId>
|
||||
<artifactId>content-repository-community-webdav-test</artifactId>
|
||||
<name>content-repository-community-webdav-test</name>
|
||||
<version>6.2.2-SNAPSHOT</version>
|
||||
<version>6.2.2-RC1</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>content-repository-community-tas-tests-parent</artifactId>
|
||||
<version>6.2.2-SNAPSHOT</version>
|
||||
<version>6.2.2-RC1</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>acs-community-packaging</artifactId>
|
||||
<version>6.2.2-SNAPSHOT</version>
|
||||
<version>6.2.2-RC1</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository WAR Community
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.web.app.servlet;
|
||||
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.extensions.surf.util.URLDecoder;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
* Servlet responsible for streaming node content from the repo directly to the response stream.
|
||||
* The appropriate mimetype is calculated based on filename extension.
|
||||
* <p>
|
||||
* The URL to the servlet should be generated thus:
|
||||
* <pre>/alfresco/download/attach/workspace/SpacesStore/0000-0000-0000-0000/myfile.pdf</pre>
|
||||
* or
|
||||
* <pre>/alfresco/download/direct/workspace/SpacesStore/0000-0000-0000-0000/myfile.pdf</pre></p>
|
||||
* <p>
|
||||
* The 'attach' or 'direct' element is used to indicate whether to display the stream directly
|
||||
* in the browser or download it as a file attachment.</p>
|
||||
* <p>
|
||||
* Since ACS 6.X, this Servlet redirects to GET /nodes/{nodeId}/content V1 REST API.
|
||||
*
|
||||
*
|
||||
* @author Kevin Roast
|
||||
* @author gavinc
|
||||
*/
|
||||
public class DownloadContentServlet extends HttpServlet
|
||||
{
|
||||
private static final long serialVersionUID = -576405943603122206L;
|
||||
|
||||
private static Log logger = LogFactory.getLog(DownloadContentServlet.class);
|
||||
|
||||
private static final String URL_ATTACH = "a";
|
||||
private static final String URL_ATTACH_LONG = "attach";
|
||||
private static final String URL_DIRECT = "d";
|
||||
private static final String URL_DIRECT_LONG = "direct";
|
||||
|
||||
/**
|
||||
* @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest, HttpServletResponse)
|
||||
*/
|
||||
protected void doGet(final HttpServletRequest req, final HttpServletResponse res)
|
||||
throws IOException
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
String queryString = req.getQueryString();
|
||||
logger.debug("Authenticating (GET) request to URL: " + req.getRequestURI() +
|
||||
((queryString != null && queryString.length() > 0) ? ("?" + queryString) : ""));
|
||||
}
|
||||
|
||||
// remove request context.
|
||||
String requestURI = req.getRequestURI();
|
||||
requestURI = requestURI.substring(req.getContextPath().length());
|
||||
|
||||
StringTokenizer t = new StringTokenizer(requestURI, "/");
|
||||
int tokenCount = t.countTokens();
|
||||
t.nextToken(); // skip servlet name
|
||||
|
||||
// expect a minimum of 6 URL tokens.
|
||||
// /d/{attach|direct}/{storeType}/{storeId}/{nodeId}/{nodeName}
|
||||
if(tokenCount < 6)
|
||||
{
|
||||
throw new IllegalArgumentException("Download URL did not contain all required args: " + requestURI);
|
||||
}
|
||||
|
||||
// attachment mode (either 'attach' or 'direct')
|
||||
String attachToken = t.nextToken();
|
||||
boolean isAttachment = URL_ATTACH.equalsIgnoreCase(attachToken) || URL_ATTACH_LONG.equalsIgnoreCase(attachToken);
|
||||
boolean isDirect = URL_DIRECT.equalsIgnoreCase(attachToken) || URL_DIRECT_LONG.equalsIgnoreCase(attachToken);
|
||||
if (!(isAttachment || isDirect))
|
||||
{
|
||||
throw new IllegalArgumentException("Attachment mode is not properly specified: " + requestURI);
|
||||
}
|
||||
|
||||
// allow only nodes from workspace://SpaceStore/ storeRef
|
||||
StoreRef storeRef = new StoreRef(URLDecoder.decode(t.nextToken()), URLDecoder.decode(t.nextToken()));
|
||||
boolean isWorkspaceStoreType = storeRef.getProtocol().equalsIgnoreCase("workspace");
|
||||
boolean isSpacesStoreStoreId = storeRef.getIdentifier().equalsIgnoreCase("SpacesStore");
|
||||
|
||||
if (!isWorkspaceStoreType || !isSpacesStoreStoreId)
|
||||
{
|
||||
throw new IllegalArgumentException("Servlet accepts only nodes from workspace://SpaceStore/ storeRef: " + requestURI);
|
||||
}
|
||||
|
||||
String nodeId = URLDecoder.decode(t.nextToken());
|
||||
|
||||
// build redirect URL to V1 GET /nodes/{nodeId}/content
|
||||
String redirectUrl = String
|
||||
.format("%s/api/-default-/public/alfresco/versions/1/nodes/%s/content?attachment=%b",
|
||||
req.getContextPath(), nodeId, isAttachment);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Request redirected to URL: " + redirectUrl);
|
||||
}
|
||||
res.sendRedirect(redirectUrl);
|
||||
}
|
||||
}
|
@@ -243,6 +243,10 @@
|
||||
</listener>
|
||||
|
||||
<!-- Enterprise listener placeholder -->
|
||||
<servlet>
|
||||
<servlet-name>downloadContent</servlet-name>
|
||||
<servlet-class>org.alfresco.web.app.servlet.DownloadContentServlet</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>WebDAV</servlet-name>
|
||||
@@ -384,6 +388,16 @@
|
||||
|
||||
<!-- Enterprise servlet placeholder -->
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>downloadContent</servlet-name>
|
||||
<url-pattern>/download/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>downloadContent</servlet-name>
|
||||
<url-pattern>/d/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>WebDAV</servlet-name>
|
||||
<url-pattern>/webdav/*</url-pattern>
|
||||
|
Reference in New Issue
Block a user