test- fixed issues

This commit is contained in:
mionescu
2017-02-22 14:40:02 +02:00
parent be9986b3dc
commit 1bd859e823
3 changed files with 20 additions and 31 deletions
@@ -59,8 +59,9 @@ public class DeleteTagFullTests extends RestTest
public void collaboratorCanDeleteLongTag() throws JsonToModelConversionException, Exception
{
String longTag = RandomStringUtils.randomAlphanumeric(10000);
document = dataContent.usingSite(siteModel).usingUser(adminUserModel).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
tagReturnedModel = restClient.authenticateUser(adminUserModel)
RestTagModel tagReturnedModel = restClient.authenticateUser(adminUserModel)
.withCoreAPI().usingResource(document).addTag(longTag);
restClient.authenticateUser(usersWithRoles.getOneUserWithRole(UserRole.SiteCollaborator))
@@ -121,22 +121,19 @@ public class AddProcessItemCoreTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.CORE, TestGroup.NETWORKS })
public void addProcessItemByAdminSameNetwork() throws Exception
{
restClient.authenticateUser(adminUser);
adminTenantUser = UserModel.getAdminTenantUser();
restClient.usingTenant().createTenant(adminTenantUser);
restClient.authenticateUser(dataUser.getAdminUser()).usingTenant().createTenant(adminTenantUser);
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
tenantUserAssignee = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenantAssignee");
processModel = restClient.authenticateUser(tenantUser).withWorkflowAPI().addProcess("activitiAdhoc", tenantUserAssignee, false, Priority.Normal);
siteModel = dataSite.usingUser(adminTenantUser).createPublicRandomSite();
dataWorkflow.usingUser(tenantUser).usingSite(siteModel).usingResource(document).createNewTaskAndAssignTo(tenantUserAssignee);
processModel = restClient.withWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
processItem = restClient.withWorkflowAPI().usingProcess(processModel).addProcessItem(document);
document = dataContent.usingUser(adminTenantUser).usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
processItem = restClient.authenticateUser(adminTenantUser).withWorkflowAPI().usingProcess(processModel).addProcessItem(document);
restClient.assertStatusCodeIs(HttpStatus.CREATED);
processItem.assertThat().field("createdAt").isNotEmpty().and().field("size").is("19").and().field("createdBy").is(adminUser.getUsername()).and()
.field("modifiedAt").isNotEmpty().and().field("name").is(document.getName()).and().field("modifiedBy").is(adminUser.getUsername()).and()
processItem.assertThat().field("createdAt").isNotEmpty().and().field("size").is("19").and().field("createdBy").is(adminTenantUser.getUsername().toLowerCase()).and()
.field("modifiedAt").isNotEmpty().and().field("name").is(document.getName()).and().field("modifiedBy").is(adminTenantUser.getUsername().toLowerCase()).and()
.field("id").isNotEmpty().and().field("mimeType").is(document.getFileType().mimeType);
}
@@ -145,36 +142,34 @@ public class AddProcessItemCoreTests extends RestTest
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.CORE, TestGroup.NETWORKS })
public void addMultipleProcessItemsByAdminSameNetwork() throws Exception
{
restClient.authenticateUser(adminUser);
adminTenantUser = UserModel.getAdminTenantUser();
restClient.usingTenant().createTenant(adminTenantUser);
restClient.authenticateUser(dataUser.getAdminUser()).usingTenant().createTenant(adminTenantUser);
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
tenantUserAssignee = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenantAssignee");
processModel = restClient.authenticateUser(tenantUser).withWorkflowAPI().addProcess("activitiAdhoc", tenantUserAssignee, false, Priority.Normal);
siteModel = dataSite.usingUser(adminTenantUser).createPublicRandomSite();
dataWorkflow.usingUser(tenantUser).usingSite(siteModel).usingResource(document).createNewTaskAndAssignTo(tenantUserAssignee);
processModel = restClient.withWorkflowAPI().getProcesses().getOneRandomEntry().onModel();
processItems = restClient.withWorkflowAPI().usingProcess(processModel).addProcessItems(document, document2);
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);
processItems.getEntries().get(0).onModel().assertThat()
.field("createdAt").isNotEmpty().and()
.field("size").is("19").and()
.field("createdBy").is(adminUser.getUsername()).and()
.field("createdBy").is(adminTenantUser.getUsername().toLowerCase()).and()
.field("modifiedAt").isNotEmpty().and()
.field("name").is(document.getName()).and()
.field("modifiedBy").is(adminUser.getUsername()).and()
.field("modifiedBy").is(adminTenantUser.getUsername().toLowerCase()).and()
.field("id").isNotEmpty().and()
.field("mimeType").is(document.getFileType().mimeType);
processItems.getEntries().get(1).onModel().assertThat()
.field("createdAt").isNotEmpty().and()
.field("size").is("19").and()
.field("createdBy").is(adminUser.getUsername()).and()
.field("createdBy").is(adminTenantUser.getUsername().toLowerCase()).and()
.field("modifiedAt").isNotEmpty().and()
.field("name").is(document2.getName()).and()
.field("modifiedBy").is(adminUser.getUsername()).and()
.field("modifiedBy").is(adminTenantUser.getUsername().toLowerCase()).and()
.field("id").isNotEmpty().and()
.field("mimeType").is(document2.getFileType().mimeType);
}
@@ -1,7 +1,7 @@
package org.alfresco.rest.workflow.processes.items;
import org.alfresco.dataprep.CMISUtil;
import org.alfresco.dataprep.CMISUtil.DocumentType;
import org.alfresco.dataprep.CMISUtil.Priority;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.exception.EmptyRestModelCollectionException;
import org.alfresco.rest.model.RestErrorModel;
@@ -10,7 +10,6 @@ import org.alfresco.rest.model.RestItemModelsCollection;
import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.ProcessModel;
import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.TaskModel;
import org.alfresco.utility.model.TestGroup;
import org.alfresco.utility.model.UserModel;
import org.alfresco.utility.testrail.ExecutionType;
@@ -42,11 +41,8 @@ public class DeleteProcessItemFullTests extends RestTest
@BeforeMethod(alwaysRun = true)
public void createProcess() throws Exception
{
TaskModel task = dataWorkflow.usingUser(userWhoStartsProcess).usingSite(siteModel).usingResource(document)
.createNewTaskAndAssignTo(assignee);
processModel = new ProcessModel();
processModel.setId(task.getProcessId());
processModel = restClient.authenticateUser(adminUser).withWorkflowAPI().usingProcess(processModel).getProcess();
processModel = restClient.authenticateUser(userWhoStartsProcess).withWorkflowAPI()
.addProcess("activitiAdhoc", assignee, false, Priority.Normal);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW,TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
@@ -199,9 +195,6 @@ public class DeleteProcessItemFullTests extends RestTest
expectedExceptions = EmptyRestModelCollectionException.class)
public void deleteProcessItemsForProcessWithoutItems() throws Exception
{
processModel = restClient.authenticateUser(userWhoStartsProcess).withWorkflowAPI()
.addProcess("activitiAdhoc", assignee, false, CMISUtil.Priority.Normal);
items = restClient.withWorkflowAPI().usingProcess(processModel).getProcessItems();
restClient.assertStatusCodeIs(HttpStatus.OK);
items.assertThat().entriesListIsEmpty();