mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
TAS - 2896 getProcessDefinitionStartFormModel
This commit is contained in:
@@ -78,6 +78,16 @@ public class DeleteDeploymentSanityTests extends RestTest
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, processTask.getId()));
|
||||
}
|
||||
|
||||
//check getProcessDefinitionStartFormModel after deletion of process definition
|
||||
restClient.withWorkflowAPI().usingProcessDefinitions(processDefinitionAssociated).getProcessDefinitionStartFormModel();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, processDefinitionAssociated.getId()));
|
||||
|
||||
//check getProcessDefinitionImage after deletion of process definition
|
||||
restClient.withWorkflowAPI().usingProcessDefinitions(processDefinitionAssociated).getProcessDefinitionImage();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, processDefinitionAssociated.getId()));
|
||||
|
||||
//delete deployment twice
|
||||
restClient.withWorkflowAPI().usingDeployment(deployment).deleteDeployment();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
|
||||
+8
-5
@@ -36,7 +36,7 @@ public class GetProcessDefinitionStartFormModelCoreTests extends RestTest
|
||||
public void nonNetworkUserGetsStartFormModel() throws Exception
|
||||
{
|
||||
UserModel nonNetworkUser = dataUser.createRandomTestUser();
|
||||
randomProcessDefinition = allProcessDefinitions.getOneRandomEntry();
|
||||
randomProcessDefinition = allProcessDefinitions.getOneRandomEntry().onModel();
|
||||
restClient.authenticateUser(nonNetworkUser).withWorkflowAPI()
|
||||
.usingProcessDefinitions(randomProcessDefinition).getProcessDefinitionStartFormModel()
|
||||
.assertThat().entriesListIsNotEmpty();
|
||||
@@ -50,13 +50,16 @@ public class GetProcessDefinitionStartFormModelCoreTests extends RestTest
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESS_DEFINITION, TestGroup.CORE })
|
||||
public void getStartFormModelUsingInvalidProcessDefinitionId() throws Exception
|
||||
{
|
||||
randomProcessDefinition = allProcessDefinitions.getOneRandomEntry();
|
||||
randomProcessDefinition = allProcessDefinitions.getOneRandomEntry().onModel();
|
||||
randomProcessDefinition.onModel().setId("invalidID");
|
||||
|
||||
restClient.authenticateUser(adminUser).withWorkflowAPI()
|
||||
.usingProcessDefinitions(randomProcessDefinition).getProcessDefinitionStartFormModel();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, "invalidID"));
|
||||
.assertLastError().containsSummary(String.format("no deployed process definition found with id '%s'", "invalidID"))
|
||||
.containsErrorKey(RestErrorModel.API_DEFAULT_ERRORKEY)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@Bug(id = "ALF-20187")
|
||||
@@ -66,7 +69,7 @@ public class GetProcessDefinitionStartFormModelCoreTests extends RestTest
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESS_DEFINITION, TestGroup.CORE })
|
||||
public void getStartFormModelUsingEmptyProcessDefinitionId() throws Exception
|
||||
{
|
||||
randomProcessDefinition = allProcessDefinitions.getOneRandomEntry();
|
||||
randomProcessDefinition = allProcessDefinitions.getOneRandomEntry().onModel();
|
||||
randomProcessDefinition.onModel().setId("");
|
||||
|
||||
restClient.authenticateUser(adminUser).withWorkflowAPI()
|
||||
@@ -86,7 +89,7 @@ public class GetProcessDefinitionStartFormModelCoreTests extends RestTest
|
||||
.usingTenant().createTenant(adminTenantUser);
|
||||
UserModel tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
|
||||
randomProcessDefinition = restClient.authenticateUser(adminTenantUser).withWorkflowAPI()
|
||||
.getAllProcessDefinitions().getOneRandomEntry();
|
||||
.getAllProcessDefinitions().getOneRandomEntry().onModel();
|
||||
restClient.authenticateUser(tenantUser).withWorkflowAPI()
|
||||
.usingProcessDefinitions(randomProcessDefinition).getProcessDefinitionStartFormModel()
|
||||
.assertThat().entriesListIsNotEmpty();
|
||||
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
package org.alfresco.rest.workflow.processDefinitions;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestFormModelsCollection;
|
||||
import org.alfresco.rest.model.RestProcessDefinitionModel;
|
||||
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.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Created by Claudia Agache on 1/31/2017.
|
||||
*/
|
||||
public class GetProcessDefinitionStartFormModelFullTests extends RestTest
|
||||
{
|
||||
private UserModel adminUser;
|
||||
private RestProcessDefinitionModel activitiAdhoc;
|
||||
private RestFormModelsCollection returnedResponse;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
{
|
||||
adminUser = dataUser.getAdminUser();
|
||||
activitiAdhoc = restClient.authenticateUser(adminUser).withWorkflowAPI().getAllProcessDefinitions().getProcessDefinitionByDeploymentId("1");
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESS_DEFINITION },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin gets a model of the start form type definition for specific process definition using REST API and status code is OK (200)")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESS_DEFINITION, TestGroup.FULL })
|
||||
public void adminGetsStartFormModelForActivitiAdhocProcessDefinition() throws Exception
|
||||
{
|
||||
returnedResponse = restClient.authenticateUser(adminUser).withWorkflowAPI()
|
||||
.usingProcessDefinitions(activitiAdhoc).getProcessDefinitionStartFormModel();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedResponse.assertThat().entriesListContains("qualifiedName", "{http://www.alfresco.org/model/bpm/1.0}workflowPriority");
|
||||
returnedResponse.getStartFormModelByQualifiedName("{http://www.alfresco.org/model/bpm/1.0}workflowPriority")
|
||||
.assertThat().field("defaultValue").is("2")
|
||||
.and().field("dataType").is("d:int")
|
||||
.and().field("name").is("bpm_workflowPriority")
|
||||
.and().field("title").is("Workflow Priority")
|
||||
.and().field("required").is("false")
|
||||
.and().field("allowedValues").is(Arrays.asList("1", "2", "3"));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESS_DEFINITION },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify admin gets a model of the start form type definition with properties parameter applied using REST API and status code is OK (200)")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESS_DEFINITION, TestGroup.FULL })
|
||||
public void adminGetsStartFormModelWithPropertiesParameterApplied() throws Exception
|
||||
{
|
||||
returnedResponse = restClient.authenticateUser(adminUser).withParams("properties=qualifiedName,dataType,title").withWorkflowAPI()
|
||||
.usingProcessDefinitions(activitiAdhoc).getProcessDefinitionStartFormModel();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
returnedResponse.assertThat().entriesListContains("qualifiedName", "{http://www.alfresco.org/model/bpm/1.0}workflowPriority");
|
||||
returnedResponse.getStartFormModelByQualifiedName("{http://www.alfresco.org/model/bpm/1.0}workflowPriority")
|
||||
.assertThat().fieldsCount().is(3)
|
||||
.and().field("qualifiedName").is("{http://www.alfresco.org/model/bpm/1.0}workflowPriority")
|
||||
.and().field("defaultValue").isNull()
|
||||
.and().field("dataType").is("d:int")
|
||||
.and().field("name").isNull()
|
||||
.and().field("title").is("Workflow Priority")
|
||||
.and().field("required").isNull()
|
||||
.and().field("allowedValues").isNull();
|
||||
}
|
||||
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESS_DEFINITION },
|
||||
executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify Tenant User doesn't get a model of the start form type definition for another network deployment using REST API")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESS_DEFINITION, TestGroup.FULL, TestGroup.NETWORKS })
|
||||
public void networkUserIsNotAbleToGetStartFormModelForAnotherNetwork() throws Exception
|
||||
{
|
||||
UserModel adminTenantUser1 = UserModel.getAdminTenantUser();
|
||||
UserModel adminTenantUser2 = UserModel.getAdminTenantUser();
|
||||
restClient.authenticateUser(adminUser).usingTenant().createTenant(adminTenantUser1);
|
||||
restClient.usingTenant().createTenant(adminTenantUser2);
|
||||
|
||||
RestProcessDefinitionModel randomProcessDefinition = restClient.authenticateUser(adminTenantUser1).withWorkflowAPI()
|
||||
.getAllProcessDefinitions().getOneRandomEntry().onModel();
|
||||
restClient.authenticateUser(adminTenantUser2).withWorkflowAPI()
|
||||
.usingProcessDefinitions(randomProcessDefinition).getProcessDefinitionStartFormModel();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, randomProcessDefinition.getId()));
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -32,7 +32,7 @@ public class GetProcessDefinitionStartFormModelSanityTests extends RestTest
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESS_DEFINITION, TestGroup.SANITY })
|
||||
public void nonNetworkAdminGetsStartFormModel() throws Exception
|
||||
{
|
||||
randomProcessDefinition = restClient.withWorkflowAPI().getAllProcessDefinitions().getOneRandomEntry();
|
||||
randomProcessDefinition = restClient.withWorkflowAPI().getAllProcessDefinitions().getOneRandomEntry().onModel();
|
||||
restClient.withWorkflowAPI().usingProcessDefinitions(randomProcessDefinition).getProcessDefinitionStartFormModel().assertThat().entriesListIsNotEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class GetProcessDefinitionStartFormModelSanityTests extends RestTest
|
||||
{
|
||||
restClient.usingTenant().createTenant(adminTenantUser);
|
||||
restClient.authenticateUser(adminTenantUser);
|
||||
randomProcessDefinition = restClient.withWorkflowAPI().getAllProcessDefinitions().getOneRandomEntry();
|
||||
randomProcessDefinition = restClient.withWorkflowAPI().getAllProcessDefinitions().getOneRandomEntry().onModel();
|
||||
restClient.withWorkflowAPI().usingProcessDefinitions(randomProcessDefinition).getProcessDefinitionStartFormModel().assertThat().entriesListIsNotEmpty();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user