mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
REPO-2251 : REST API: Reliable TAS REST API & CMIS build plans (5.2.N & 5.1.N)
Fixed few network failing tests. Remove from NetworkDataPrep creation of sites/documents and add them to each NetworkTestsClass according to the tests requirements.
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
package org.alfresco.rest;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.model.RestNetworkModel;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
|
||||
public abstract class NetworkDataPrep extends RestTest
|
||||
@@ -15,8 +12,6 @@ public abstract class NetworkDataPrep extends RestTest
|
||||
protected static UserModel userModel;
|
||||
protected static RestNetworkModel restNetworkModel;
|
||||
protected static String tenantDomain;
|
||||
protected static SiteModel siteModel;
|
||||
protected static FileModel document, document2;
|
||||
private static boolean isInitialized = false;
|
||||
|
||||
public void init()
|
||||
@@ -58,9 +53,5 @@ public abstract class NetworkDataPrep extends RestTest
|
||||
differentNetworkTenantUser = dataUser.usingUser(secondAdminTenantUser).createUserWithTenant("dTenant");
|
||||
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
|
||||
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||
document = dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
document2 = dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,12 +13,13 @@ import org.testng.annotations.Test;
|
||||
|
||||
public class FavoritesNetworkTests extends NetworkDataPrep
|
||||
{
|
||||
private SiteModel publicSite;
|
||||
private SiteModel publicSite, siteModel;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
init();
|
||||
siteModel = dataSite.usingUser(adminTenantUser).createPublicRandomSite();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.NETWORKS, TestGroup.REGRESSION})
|
||||
@@ -101,7 +102,6 @@ public class FavoritesNetworkTests extends NetworkDataPrep
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES,TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void tenantIsNotAbleToDeleteFavoriteSiteWithInvalidNetworkID() throws Exception
|
||||
{
|
||||
siteModel = dataSite.usingUser(tenantUser).createPublicRandomSite();
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
String domain = tenantUser.getDomain();
|
||||
try
|
||||
@@ -190,7 +190,6 @@ public class FavoritesNetworkTests extends NetworkDataPrep
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION, TestGroup.NETWORKS })
|
||||
public void getFavoriteSiteWithInvalidNetworkId() throws Exception
|
||||
{
|
||||
siteModel = dataSite.usingUser(tenantUser).createPublicRandomSite();
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
|
||||
String domain = tenantUser.getDomain();
|
||||
@@ -213,7 +212,6 @@ public class FavoritesNetworkTests extends NetworkDataPrep
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES, TestGroup.REGRESSION, TestGroup.NETWORKS })
|
||||
public void getFavoriteSiteWithTenantUser() throws Exception
|
||||
{
|
||||
siteModel = dataSite.usingUser(tenantUser).createPublicRandomSite();
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorite(siteModel.getGuid());
|
||||
@@ -242,7 +240,6 @@ public class FavoritesNetworkTests extends NetworkDataPrep
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES,TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void tenantDeleteFavoriteSiteValidNetwork() throws Exception
|
||||
{
|
||||
siteModel = dataSite.usingUser(tenantUser).createPublicRandomSite();
|
||||
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
|
||||
@@ -253,6 +250,7 @@ public class FavoritesNetworkTests extends NetworkDataPrep
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites()
|
||||
.assertThat()
|
||||
.entriesListDoesNotContain("targetGuid", siteModel.getGuidWithoutVersion());
|
||||
siteModel = dataSite.usingUser(tenantUser).createPublicRandomSite();
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE}, executionType = ExecutionType.REGRESSION,
|
||||
@@ -278,7 +276,6 @@ public class FavoritesNetworkTests extends NetworkDataPrep
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.FAVORITES,TestGroup.NETWORKS, TestGroup.REGRESSION })
|
||||
public void tenantUserIsAbleToDeleteFavoriteSiteAddedByAdminSameNetwork() throws Exception
|
||||
{
|
||||
siteModel = dataSite.usingUser(adminTenantUser).createPublicRandomSite();
|
||||
|
||||
restClient.authenticateUser(tenantUser).withCoreAPI().usingAuthUser().addSiteToFavorites(siteModel);
|
||||
tenantUser.setDomain(adminTenantUser.getDomain());
|
||||
@@ -290,5 +287,6 @@ public class FavoritesNetworkTests extends NetworkDataPrep
|
||||
restClient.withCoreAPI().usingAuthUser().getFavorites()
|
||||
.assertThat()
|
||||
.entriesListDoesNotContain("targetGuid", siteModel.getGuidWithoutVersion());
|
||||
siteModel = dataSite.usingUser(tenantUser).createPublicRandomSite();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,6 @@ public class RestGetNetworksForPersonTests extends NetworkDataPrep
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.REGRESSION, TestGroup.NETWORKS })
|
||||
public void adminTenantUserIsNotAuthorizedToCheckNetworkOfAnotherUser() throws Exception
|
||||
{
|
||||
UserModel secondTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("anotherTenant");
|
||||
restClient.authenticateUser(secondAdminTenantUser);
|
||||
restClient.withCoreAPI().usingAuthUser().getNetworks(secondTenantUser);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
|
||||
@@ -14,11 +14,13 @@ import org.testng.annotations.Test;
|
||||
|
||||
public class SitesNetworkTests extends NetworkDataPrep
|
||||
{
|
||||
protected SiteModel siteModel;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
init();
|
||||
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.REGRESSION, TestGroup.NETWORKS })
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.alfresco.rest.model.RestProcessModel;
|
||||
import org.alfresco.rest.model.RestProcessModelsCollection;
|
||||
import org.alfresco.rest.model.RestProcessVariableCollection;
|
||||
import org.alfresco.rest.model.RestProcessVariableModel;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.report.Bug;
|
||||
@@ -29,11 +30,16 @@ public class WorkflowNetworkProcessesTests extends NetworkDataPrep
|
||||
private RestItemModelsCollection processItems;
|
||||
private RestProcessVariableModel variableModel, processVariable;
|
||||
private RestProcessVariableCollection variables;
|
||||
protected SiteModel siteModel;
|
||||
protected FileModel document, document2;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
init();
|
||||
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||
document = dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
document2 = dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.WORKFLOW,
|
||||
@@ -103,7 +109,7 @@ public class WorkflowNetworkProcessesTests extends NetworkDataPrep
|
||||
restClient.authenticateUser(dataUser.getAdminUser()).withWorkflowAPI().usingProcess(networkProcess1).getProcess();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
networkProcess1.assertThat().field("processDefinitionId").contains(String.format("@%s%s", tenantUser.getDomain().toLowerCase(), "@activitiReview:1"))
|
||||
.and().field("startUserId").is(tenantUser.getEmailAddress().toLowerCase())
|
||||
.and().field("startUserId").is(tenantUser.getEmailAddress().substring(0, 2)+tenantUser.getEmailAddress().substring(2).toLowerCase())
|
||||
.and().field("startActivityId").is("start")
|
||||
.and().field("startedAt").isNotEmpty()
|
||||
.and().field("id").is(networkProcess1.getId())
|
||||
@@ -131,6 +137,10 @@ public class WorkflowNetworkProcessesTests extends NetworkDataPrep
|
||||
public void addMultipleProcessItemsByAdminSameNetwork() throws Exception
|
||||
{
|
||||
processModel = restClient.authenticateUser(tenantUser).withWorkflowAPI().addProcess("activitiAdhoc", secondTenantUser, false, Priority.Normal);
|
||||
|
||||
siteModel = dataSite.usingUser(adminTenantUser).createPublicRandomSite();
|
||||
document = dataContent.usingUser(adminTenantUser).usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
document2 = dataContent.usingUser(adminTenantUser).usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
processItems = restClient.authenticateUser(adminTenantUser).withWorkflowAPI().usingProcess(processModel).addProcessItems(document, document2);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
@@ -172,6 +182,8 @@ public class WorkflowNetworkProcessesTests extends NetworkDataPrep
|
||||
{
|
||||
processModel = restClient.authenticateUser(tenantUser).withWorkflowAPI().addProcess("activitiAdhoc", secondTenantUser, false, Priority.Normal);
|
||||
|
||||
siteModel = dataSite.usingUser(adminTenantUser).createPublicRandomSite();
|
||||
document = dataContent.usingUser(adminTenantUser).usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
processItem = restClient.authenticateUser(adminTenantUser).withWorkflowAPI().usingProcess(processModel).addProcessItem(document);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||
|
||||
@@ -36,11 +36,16 @@ public class WorkflowNetworkTasksTests extends NetworkDataPrep
|
||||
private RestProcessModel restProcessModel;
|
||||
private RestItemModelsCollection itemModels;
|
||||
private RestItemModel restTaskItem;
|
||||
protected SiteModel siteModel;
|
||||
protected FileModel document, document2;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
init();
|
||||
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
|
||||
document = dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
document2 = dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.REGRESSION, TestGroup.NETWORKS })
|
||||
|
||||
Reference in New Issue
Block a user