REPO-3206 - Rewrite Lucene-based Tests in TAS for LockServiceImplTest

This commit is contained in:
Andrei Forascu
2018-02-14 13:28:48 +00:00
parent 0ae0193041
commit 7a5693f675
15 changed files with 19 additions and 70 deletions
@@ -174,19 +174,6 @@ public class GetFavoriteSiteTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
description = "Verify invalid request returns status 404 when personId is invalid")
public void getFavoriteSiteWithInvalidPersonId() throws Exception
{
UserModel userSpecialChars = dataUser.usingAdmin().createUser(RandomStringUtils.randomAlphabetic(2) + "~!@#$%^&*()_+[]{}|;'d", "password");
userSpecialChars.setUsername(RandomStringUtils.randomAlphabetic(2) + "~!%40%23%24%25%5E%26*()_%2B%5B%5D%7B%7D%7C%5C%3B%27%3A%22%2C.%2F%3C%3E");
restClient.authenticateUser(userModel).withCoreAPI().usingUser(userSpecialChars).getFavoriteSite(siteModel1);
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, userSpecialChars.getUsername()));
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
description = "Verify request with empty site id")
@@ -287,24 +287,6 @@ public class GetFavoriteSitesTests extends RestTest
.assertThat().paginationField("skipCount").is("999999999");
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
description = "Verify admin gets favorite sites for username with special chars with Rest API and response status is NOT_FOUND (404)")
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION })
public void getFavoriteSitesRequestForPersonIDWithSpecialCharacters() throws Exception
{
String randomData = RandomData.getRandomAlphanumeric();
UserModel userSpecialChars = dataUser.usingAdmin().createUser(randomData + "~!@#$%^&[]{}|\\;':\",./<>", "password");
//setting the encoded text for username
userSpecialChars.setUsername(randomData + "~!%40%23%24%25%5E%26%5B%5D%7B%7D%7C%5C%3B%27%3A%22%2C.%2F%3C%3E");
restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingUser(userSpecialChars).getFavoriteSites();
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
.containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, randomData + "~!%40%23%24%25%5E%26%5B%5D%7B%7D%7C%5C%3B%27%3A%22%2C.%2F%3C%3E"))
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
.stackTraceIs(RestErrorModel.STACKTRACE);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
description = "Verify that user can retrieve the last 2 favorite sites")
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION })
@@ -451,19 +451,6 @@ public class GetFavoritesTests extends RestTest
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, networkUserModel.getUsername()));
}
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify get favorites using special chars in where parameter for request")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
public void userIsNotAbleToGetFavoritesWhenUsingSpecialCharsInWhereParameter() throws Exception
{
userFavorites = restClient.withCoreAPI().usingAuthUser().where().invalidWhereParameter("~!%40%23%24%25%5E%26*()_%2B%5B%5D%7B%7D%7C%5C%3B%27%3A%22%2C.%2F%3C%3E").getFavorites();
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
.assertLastError().containsSummary(String.format(RestErrorModel.INVALID_ARGUMENT, "WHERE query"))
.containsErrorKey(RestErrorModel.INVALID_QUERY_ERRORKEY)
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
.stackTraceIs(RestErrorModel.STACKTRACE);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.FAVORITES }, executionType = ExecutionType.REGRESSION,
description = "Verify get favorites using AND instead of OR in where parameter for request")
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION })
@@ -16,6 +16,7 @@ import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@Test(groups = {TestGroup.REQUIRE_SOLR})
public class GroupsTests extends RestTest
{
private UserModel adminUser, userModel;
@@ -672,7 +672,7 @@ public class NodesLockTests extends RestTest
.assertThat().field("properties").contains("lockType=READ_ONLY_LOCK");
}
@Test(groups = { TestGroup.REST_API, TestGroup.NODES, TestGroup.REGRESSION })
@Test(groups = { TestGroup.REST_API, TestGroup.NODES, TestGroup.REGRESSION, TestGroup.REQUIRE_SOLR })
@TestRail(section = { TestGroup.REST_API, TestGroup.NODES }, executionType = ExecutionType.REGRESSION,
description = "Verify that child nodes can be locked differently and unlocked")
public void testLockUnlockParentChild() throws Exception
@@ -728,7 +728,7 @@ public class NodesLockTests extends RestTest
query.setIncludeRequest(false);
// Allow indexing to complete.
Utility.sleep(1000, 180000, () ->
Utility.sleep(1000, 60000, () ->
{
SearchResponse response = query(query);
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -745,7 +745,7 @@ public class NodesLockTests extends RestTest
STEP("7. Verify that childNode1 and childNode2 are not found in the query results.");
// Allow indexing to complete.
Utility.sleep(1000, 180000, () ->
Utility.sleep(1000, 60000, () ->
{
SearchResponse response = query(query);
restClient.assertStatusCodeIs(HttpStatus.OK);
@@ -64,22 +64,6 @@ public class GetPeopleFullTests extends RestTest
.and().field("emailNotificationsEnabled").is(newUser.getEmailNotificationsEnabled());
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user gets a person with special chars in username with Rest API and response is not found")
public void userChecksIfPersonWithSpecilCharsInUsernameIsNotFound() throws Exception
{
UserModel userSpecialChars = dataUser.usingAdmin().createUser(RandomStringUtils.randomAlphabetic(2) + "~!@#$%^&*()_+[]{}|\\;':\",./<>", "password");
//setting the encoded text for username
userSpecialChars.setUsername(RandomStringUtils.randomAlphabetic(2) + "~!%40%23%24%25%5E%26*()_%2B%5B%5D%7B%7D%7C%5C%3B%27%3A%22%2C.%2F%3C%3E");
personModel = restClient.authenticateUser(managerUser).withCoreAPI().usingUser(userSpecialChars).getPerson();
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
.assertLastError().containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, userSpecialChars.getUsername()))
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
.stackTraceIs(RestErrorModel.STACKTRACE);
}
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION })
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify user gets a person with empty personId with Rest API and response is successful")
public void userGetPersonWithEmptyPersonId() throws Exception
@@ -11,6 +11,7 @@ import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@Test(groups = {TestGroup.REQUIRE_SOLR})
public class GetTagTests extends TagsDataPrep
{
@@ -12,6 +12,7 @@ import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@Test(groups = {TestGroup.REQUIRE_SOLR})
public class GetTagsTests extends TagsDataPrep
{
@@ -11,8 +11,11 @@ import org.alfresco.utility.data.RandomData;
import org.alfresco.utility.model.FileModel;
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.testng.annotations.Test;
@Test(groups = {TestGroup.REQUIRE_SOLR})
public class TagsDataPrep extends RestTest
{
@@ -19,6 +19,7 @@ import org.testng.annotations.Test;
/**
* Created by Claudia Agache on 10/4/2016.
*/
@Test(groups = {TestGroup.REQUIRE_SOLR})
public class UpdateTagTests extends TagsDataPrep
{
private RestTagModel oldTag;
@@ -23,6 +23,7 @@ import org.testng.annotations.Test;
/**
* Created by Claudia Agache on 10/3/2016.
*/
@Test(groups = {TestGroup.REQUIRE_SOLR})
public class AddTagTests extends TagsDataPrep
{
private String tagValue;
@@ -19,6 +19,7 @@ import org.testng.annotations.Test;
/**
* Created by Claudia Agache on 10/7/2016.
*/
@Test(groups = {TestGroup.REQUIRE_SOLR})
public class AddTagsTests extends TagsDataPrep
{
private FileModel contributorDoc;
@@ -21,6 +21,7 @@ import org.testng.annotations.Test;
/**
* Created by Claudia Agache on 10/4/2016.
*/
@Test(groups = {TestGroup.REQUIRE_SOLR})
public class DeleteTagTests extends TagsDataPrep
{
private RestTagModel tag;
@@ -16,6 +16,7 @@ import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@Test(groups = {TestGroup.REQUIRE_SOLR})
public class GetNodeTagsTests extends TagsDataPrep
{
private String tagValue;
@@ -180,7 +180,7 @@ public class GetDeletedNodesTests extends RestTest
restClient.onResponse().getResponse().body().asString().contains("Sample text.");
}
@TestRail(section = { TestGroup.REST_API, TestGroup.TRASHCAN }, executionType = ExecutionType.SANITY,
@TestRail(section = { TestGroup.REST_API, TestGroup.TRASHCAN, TestGroup.REQUIRE_SOLR }, executionType = ExecutionType.SANITY,
description = "Sanity tests for GET /deleted-nodes/{nodeId}/renditions, GET /deleted-nodes/{nodeId}/renditions/{renditionId}, GET /deleted-nodes/{nodeId}/renditions/{renditionId}/content")
@Test(groups = { TestGroup.REST_API, TestGroup.TRASHCAN, TestGroup.SANITY })
public void testGetDeletedNodesRenditions() throws Exception
@@ -196,14 +196,12 @@ public class GetDeletedNodesTests extends RestTest
// GET /deleted-nodes/{nodeId}/renditions
Utility.sleep(1000, 30000, () ->
{
nodeRenditionInfoCollection = restClient.authenticateUser(adminUserModel).withCoreAPI().usingTrashcan().usingParams("where=(status='CREATED')").getDeletedNodeRenditions(file3);
nodeRenditionInfoCollection = restClient.authenticateUser(adminUserModel).withCoreAPI().usingTrashcan().getDeletedNodeRenditions(file3);
restClient.assertStatusCodeIs(HttpStatus.OK);
// All renditions, created or not are retrieved. List is ordered
nodeRenditionInfoCollection.assertThat().entriesListCountIs(2);
nodeRenditionInfoCollection.getEntryByIndex(0).assertThat().field("id").is("doclib").and()
.field("status").is("CREATED");
nodeRenditionInfoCollection.getEntryByIndex(1).assertThat().field("id").is("pdf").and()
// Check if renditions are retrieved, created or not. Entries are ordered
nodeRenditionInfoCollection.assertThat().entriesListContains("id", "doclib");
nodeRenditionInfoCollection.getEntryByIndex(5).assertThat().field("id").is("pdf").and()
.field("status").is("CREATED");
});