WIP: REPO-5266 Remove duplicate TAS code (#2)

This commit is contained in:
Alan Davis
2020-07-30 08:42:48 +01:00
committed by GitHub
parent 19480aca36
commit bce77b4516
14 changed files with 3681 additions and 3556 deletions

View File

@@ -10,7 +10,7 @@ services:
cache:
directories:
- $HOME/.m2
# the cache can grow constantly
before_cache:
- rm -rf $HOME/.m2/repository/org/alfresco/alfresco-community-repo
- rm -rf $HOME/.m2/repository/org/alfresco/alfresco-core
@@ -25,6 +25,12 @@ branches:
only:
- master
- /release\/.*/
- feature/REPO-5266_dup_tas_code
env:
global:
- TAS_SCRIPTS=../alfresco-community-repo/packaging/tests/scripts
- TAS_COMMUNITY=../alfresco-community-repo/packaging/tests/environment
stages:
- name: test
@@ -176,60 +182,58 @@ jobs:
- name: "REST API TAS tests part1"
jdk: openjdk11
install:
- docker images
- ./packaging/tests/scripts/start-compose.sh ./packaging/tests/environment/docker-compose-minimal+transforms.yml
- docker images
- ./packaging/tests/scripts/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_COMMUNITY}/docker-compose-minimal+transforms.yml
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
script:
- travis_wait 60 mvn install -f packaging/tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part1 -Denvironment=default -DrunBugs=false
- name: "REST API TAS tests part2"
jdk: openjdk11
install:
- ./packaging/tests/scripts/start-compose.sh ./packaging/tests/environment/docker-compose-minimal+transforms.yml
- ./packaging/tests/scripts/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_COMMUNITY}/docker-compose-minimal+transforms.yml
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
script:
- travis_wait 60 mvn install -f packaging/tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part2 -Denvironment=default -DrunBugs=false
- name: "REST API TAS tests part3"
jdk: openjdk11
install:
- ./packaging/tests/scripts/start-compose.sh ./packaging/tests/environment/docker-compose-minimal+transforms.yml
- ./packaging/tests/scripts/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_COMMUNITY}/docker-compose-minimal+transforms.yml
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
script:
- travis_wait 60 mvn install -f packaging/tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part3 -Denvironment=default -DrunBugs=false
- name: "CMIS TAS tests"
jdk: openjdk11
install:
- ./packaging/tests/scripts/start-compose.sh ./packaging/tests/environment/docker-compose-minimal+transforms.yml
- ./packaging/tests/scripts/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_COMMUNITY}/docker-compose-minimal+transforms.yml
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
script:
- travis_wait 40 mvn install -q -f packaging/tests/tas-cmis/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
- travis_wait 40 mvn install -f packaging/tests/tas-cmis/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
- name: "Email TAS tests"
jdk: openjdk11
install:
- ./packaging/tests/scripts/start-compose.sh ./packaging/tests/environment/docker-compose-minimal.yml
- ./packaging/tests/scripts/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_COMMUNITY}/docker-compose-minimal.yml
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
script:
- travis_wait 30 mvn install -q -f packaging/tests/tas-email/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
- travis_wait 30 mvn install -f packaging/tests/tas-email/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
- name: "WebDAV TAS tests"
jdk: openjdk11
install:
- ./packaging/tests/scripts/start-compose.sh ./packaging/tests/environment/docker-compose-minimal.yml
- ./packaging/tests/scripts/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_COMMUNITY}/docker-compose-minimal.yml
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
script:
- travis_wait 30 mvn install -q -f packaging/tests/tas-webdav/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
- travis_wait 30 mvn install -f packaging/tests/tas-webdav/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
- name: "Integration TAS tests"
jdk: openjdk11
install:
- ./packaging/tests/scripts/start-compose.sh ./packaging/tests/environment/docker-compose-minimal.yml
- ./packaging/tests/scripts/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
- ${TAS_SCRIPTS}/start-compose.sh ${TAS_COMMUNITY}/docker-compose-minimal.yml
- ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
script:
- travis_wait 30 mvn install -q -f packaging/tests/tas-integration/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
- travis_wait 30 mvn install -f packaging/tests/tas-integration/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
# Comment out for now to avoid pushing 8.300 to nuxus until we are ready
# - stage: release

View File

@@ -162,7 +162,7 @@
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<version>${dependency.maven-jar-plugin.version}</version>
<executions>
<execution>
<goals>

View File

@@ -79,7 +79,7 @@
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<version>${dependency.maven-jar-plugin.version}</version>
<executions>
<execution>
<goals>

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env bash
export DOCKER_COMPOSE_PATH=$1
export CLEAN_UP="$2"
if [ -z "$DOCKER_COMPOSE_PATH" ]
then
@@ -8,6 +9,22 @@ then
exit 1
fi
# Cleans up any generated images. These are created if the docker-compose file has "build:" clauses. They are not
# recreated if an image with the same name already exist. Also cleans up existing containers. Generally only needed on
# dev systems, however...
# The second parameter can be used to avoid doing a clean up if we are doing a restart test.
if [ "$CLEAN_UP" != "no-clean-up" ]
then
docker-compose --file "${DOCKER_COMPOSE_PATH}" kill
docker-compose --file "${DOCKER_COMPOSE_PATH}" rm -f
export GENERATED_IMAGES=$(docker images | grep '^environment_' | awk '{ print $3 }')
if [ -n "$GENERATED_IMAGES" ]
then
docker image rm -f $GENERATED_IMAGES
fi
fi
echo "Starting ACS stack in ${DOCKER_COMPOSE_PATH}"
# .env files are picked up from project directory correctly on docker-compose 1.23.0+

View File

@@ -19,6 +19,9 @@ public abstract class EmailTest extends AbstractTestNGSpringContextTests
{
private static Logger LOG = LogFactory.getLogger();
@Autowired
protected EmailProperties emailProperties;
@Autowired
ServerHealth serverHealth;
@@ -73,8 +76,7 @@ public abstract class EmailTest extends AbstractTestNGSpringContextTests
dataGroup.usingUser(anonymousUser).addUserToGroup(GroupModel.getEmailContributorsGroup());
}
String jmxUseJolokiaAgent = System.getProperty("jmx.useJolokiaAgent");
if ("true".equals(jmxUseJolokiaAgent))
if (emailProperties.getUseJolokiaAgent())
{
imapProtocol.assertThat().protocolIsEnabled();
smtpProtocol.assertThat().protocolIsEnabled();

View File

@@ -73,15 +73,6 @@ public class ImapReadMessagesTests extends EmailTest
.then().assertThat().messageContainsFlags(Flags.Flag.SEEN);
}
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
description = "Verify that site manager can see wiki pages via IMAP")
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })
public void siteManagerCanViewWikiPages() throws Exception
{
dataWiki.usingUser(testUser).usingSite(testSite).createRandomWiki();
imapProtocol.authenticateUser(testUser).usingSiteWikiContainer(testSite).assertThat().countMessagesIs(1);
}
@TestRail(section = { TestGroup.PROTOCOLS, TestGroup.IMAP }, executionType = ExecutionType.REGRESSION,
description = "Verify that collaborator can see files created by self")
@Test(groups = { TestGroup.PROTOCOLS, TestGroup.IMAP, TestGroup.CORE })

View File

@@ -1323,22 +1323,22 @@ public class IntegrationCoreTests extends IntegrationTest
STEP("5. Using IMAP bulk delete doc1 and doc2");
imapProtocol.authenticateUser(testUser1).usingSite(testSitePublic).deleteMessage(testFile1.getName(), testFile2.getName()).assertThat().doesNotContainMessages(testFile1, testFile2);
Utility.waitToLoopTime(10);
STEP("6. Using CMIS verify that doc1 and doc2 are deleted");
cmisAPI.authenticateUser(testUser1)
.usingResource(testFile1).assertThat().doesNotExistInRepo()
.and().usingResource(testFile2).assertThat().doesNotExistInRepo();
Utility.sleep(500, 10000, () ->
cmisAPI.authenticateUser(testUser1)
.usingResource(testFile1).assertThat().doesNotExistInRepo()
.and().usingResource(testFile2).assertThat().doesNotExistInRepo());
STEP("7. Using IMAP delete childDoc1 to childDoc4");
imapProtocol.authenticateUser(testUser1).usingResource(parentFolder1).deleteMessage(childDoc1.getName(), childDoc2.getName(), childDoc3.getName(), childDoc4.getName())
.assertThat().doesNotContainMessages(childDoc1, childDoc2, childDoc3, childDoc4);
Utility.waitToLoopTime(10);
STEP("8. Using WebDAV and FTP verify if docs are deleted from their folders");
webDavProtocol.authenticateUser(testUser1).usingResource(parentFolder1).assertThat().hasFiles(childDoc5)
.and().usingResource(childDoc1).assertThat().doesNotExistInRepo()
.and().usingResource(childDoc2).assertThat().doesNotExistInRepo();
Utility.sleep(500, 10000, () ->
webDavProtocol.authenticateUser(testUser1).usingResource(parentFolder1).assertThat().hasFiles(childDoc5)
.and().usingResource(childDoc1).assertThat().doesNotExistInRepo()
.and().usingResource(childDoc2).assertThat().doesNotExistInRepo());
ftpProtocol.authenticateUser(testUser1).usingResource(childDoc3)
.assertThat().doesNotExistInRepo()

View File

@@ -1,17 +1,33 @@
package org.alfresco.rest.nodes;
import static org.junit.Assert.assertEquals;
import javax.json.Json;
import javax.json.JsonObject;
import org.alfresco.dataprep.CMISUtil;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.core.RestRequest;
import org.alfresco.rest.core.RestResponse;
import org.alfresco.rest.core.RestWrapper;
import org.alfresco.rest.model.RestNodeBodyMoveCopyModel;
import org.alfresco.rest.model.RestNodeModel;
import org.alfresco.rest.model.builder.NodesBuilder;
import org.alfresco.rest.model.builder.NodesBuilder.NodeDetail;
import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.model.ContentModel;
import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.TestGroup;
import org.alfresco.utility.model.UserModel;
import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.testng.annotations.Test;
import io.restassured.RestAssured;
/**
* Handles tests related to api-explorer/#!/nodes
*/
@@ -53,4 +69,61 @@ public class NodesTests extends RestTest
*/
response.assertThat().field("parentId").is(destinationFolder.getId());
}
@TestRail(section = { TestGroup.SANITY },
executionType = ExecutionType.SANITY,
description = "Verify 403 is received for files where the user lacks permissions.")
@Test(groups = {TestGroup.SANITY})
public void siteConsumerWillGet403OnFileWithDisabledInherittedPermissions() throws Exception
{
// https://issues.alfresco.com/jira/browse/REPO-4859
// Authenticate as admin to fulfill the preconditions
UserModel adminUser = dataContent.getAdminUser();
RestWrapper restWrapper = this.restClient.authenticateUser(adminUser);
// Create the file using CMIS
testSite = dataSite.createPublicRandomSite();
FileModel file = dataContent
.usingUser(adminUser)
.usingSite(testSite)
.createContent(CMISUtil.DocumentType.TEXT_PLAIN);
// Add a consumer user via CMIS
DataUser.ListUserWithRoles listUserWithRoles = dataUser.usingUser(adminUser)
.addUsersWithRolesToSite(testSite, UserRole.SiteConsumer);
// Disable the permission inheritance
JsonObject activateModelJson = Json.createObjectBuilder().add("permissions",
Json.createObjectBuilder().add("isInheritanceEnabled", false))
.build();
restWrapper.withCoreAPI().usingNode(file).updateNode(activateModelJson.toString());
restWrapper.assertStatusCodeIs(HttpStatus.OK);
// Authenticate as the consumer user
UserModel consumerUser = listUserWithRoles.getOneUserWithRole(UserRole.SiteConsumer);
// Assert the consumer gets a 403 VIA REST Call
RestResponse restApiResponse = restClient.authenticateUser(consumerUser).withCoreAPI()
.usingNode(file).getNodeContent();
int restApiStatusCode = restApiResponse.getResponse().getStatusCode();
logger.info("REST API call response status code is: " + restApiStatusCode);
assertEquals(HttpStatus.FORBIDDEN.value(), restApiStatusCode);
// Assert the consumer gets a 403 VIA CMIS API
// Implement the CMIS call as it is not supported under .withCMISApi()
// This is done similar to {@link IntegrationWithCmisTests#verifyGetChildrenReturnsUniqueValues}
RestAssured.basePath = "alfresco/api/-default-/public/cmis/versions/1.1/browser";
restWrapper.configureRequestSpec().setBasePath(RestAssured.basePath);
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET,
"/root/Sites/" + testSite.getTitle() + "/documentLibrary/" + file.getName() + "?cmisselector=object&succinct=true");
RestResponse cmisApiResponse = restWrapper.authenticateUser(consumerUser).process(request);
int cmisApiStatusCode = cmisApiResponse.getResponse().getStatusCode();
logger.info("CMIS API call response status code is: " + cmisApiStatusCode);
assertEquals(HttpStatus.FORBIDDEN.value(), cmisApiStatusCode);
}
}

View File

@@ -38,7 +38,7 @@ public class GetPeopleFullTests extends RestTest
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify entry details for get person response with Rest API")
public void checkResponseSchemaForGetPerson() throws Exception
{
RestPersonModel newUser = RestPersonModel.getRandomPersonModel("aspectNames", "avatarId", "statusUpdatedAt","displayName");
RestPersonModel newUser = RestPersonModel.getRandomPersonModel("aspectNames", "avatarId", "statusUpdatedAt","displayName", "quota", "quotaUsed");
newUser = restClient.authenticateUser(adminUser).withCoreAPI().usingAuthUser().createPerson(newUser);
restClient.assertStatusCodeIs(HttpStatus.CREATED);

View File

@@ -386,7 +386,7 @@ public class GetSiteMemberTests extends RestTest
{
restClient.authenticateUser(manager)
.withCoreAPI().usingSite(publicSiteModel).usingParams("properties=id").getSiteMember(consumer)
.assertThat().fieldsCount().is(1)
.assertThat().fieldsCount().is(2)
.and().field("id").isNotEmpty()
.and().field("role").isNull()
.and().field("person").isNull();

View File

@@ -310,7 +310,7 @@ public class GetSiteMembersTests extends RestTest
siteMembers.assertThat().paginationField("count").is("1");
siteMembers.assertThat().paginationField("hasMoreItems").is("true");
siteMembers.assertThat().paginationField("maxItems").is("1");
siteMembers.assertThat().paginationField("totalItems").isNotPresent();
siteMembers.assertThat().paginationField("totalItems").is("4");
siteMembers.assertThat().entriesListContains("id", firstSiteMember.getId())
.and().entriesListContains("role", firstSiteMember.getRole().toString())
.and().entriesListDoesNotContain("id", secondSiteMember.getId())

View File

@@ -242,7 +242,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<version>${dependency.maven-jar-plugin.version}</version>
<configuration>
<source>${maven.build.sourceVersion}</source>
</configuration>

54
pom.xml
View File

@@ -22,6 +22,8 @@
</modules>
<properties>
<dependency.alfresco-community-repo.version>${project.version}</dependency.alfresco-community-repo.version>
<acs.version.major>7</acs.version.major>
<acs.version.minor>0</acs.version.minor>
<acs.version.revision>0</acs.version.revision>
@@ -62,6 +64,7 @@
<dependency.gson.version>2.8.2</dependency.gson.version>
<dependency.httpclient.version>4.5.12</dependency.httpclient.version>
<dependency.xercesImpl.version>2.12.0-alfresco-patched-20191004</dependency.xercesImpl.version>
<dependency.maven-jar-plugin.version>3.2.0</dependency.maven-jar-plugin.version>
<alfresco.googledrive.version>3.2.0</alfresco.googledrive.version>
<alfresco.aos-module.version>1.3.1</alfresco.aos-module.version>
@@ -120,23 +123,23 @@
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-core</artifactId>
<version>${project.version}</version>
<version>${dependency.alfresco-community-repo.version}</version>
</dependency>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-core</artifactId>
<version>${project.version}</version>
<version>${dependency.alfresco-community-repo.version}</version>
<classifier>tests</classifier>
</dependency>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-data-model</artifactId>
<version>${project.version}</version>
<version>${dependency.alfresco-community-repo.version}</version>
</dependency>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-data-model</artifactId>
<version>${project.version}</version>
<version>${dependency.alfresco-community-repo.version}</version>
<classifier>tests</classifier>
</dependency>
<dependency>
@@ -147,23 +150,23 @@
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-remote-api</artifactId>
<version>${project.version}</version>
<version>${dependency.alfresco-community-repo.version}</version>
</dependency>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-remote-api</artifactId>
<version>${project.version}</version>
<version>${dependency.alfresco-community-repo.version}</version>
<classifier>tests</classifier>
</dependency>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-repository</artifactId>
<version>${project.version}</version>
<version>${dependency.alfresco-community-repo.version}</version>
</dependency>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-repository</artifactId>
<version>${project.version}</version>
<version>${dependency.alfresco-community-repo.version}</version>
<classifier>tests</classifier>
</dependency>
<dependency>
@@ -578,6 +581,41 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.alfresco.tas</groupId>
<artifactId>alfresco-community-repo-cmis-test</artifactId>
<version>${dependency.alfresco-community-repo.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.alfresco.tas</groupId>
<artifactId>alfresco-community-repo-email-test</artifactId>
<version>${dependency.alfresco-community-repo.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.alfresco.tas</groupId>
<artifactId>alfresco-community-repo-integration-test</artifactId>
<version>${dependency.alfresco-community-repo.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.alfresco.tas</groupId>
<artifactId>alfresco-community-repo-restapi-test</artifactId>
<version>${dependency.alfresco-community-repo.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.alfresco.tas</groupId>
<artifactId>alfresco-community-repo-webdav-test</artifactId>
<version>${dependency.alfresco-community-repo.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.alfresco.tas</groupId>
<artifactId>utility</artifactId>