mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
ALF-19858: Fixed instance cleanup and added more unit tests
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@54602 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -25,10 +25,14 @@ import static org.junit.Assert.fail;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.tenant.TenantUtil;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.rest.api.tests.AbstractTestFixture;
|
||||
import org.alfresco.rest.api.tests.RepoService.TestNetwork;
|
||||
import org.alfresco.rest.api.tests.client.PublicApiClient.ListResponse;
|
||||
import org.alfresco.rest.api.tests.client.PublicApiException;
|
||||
import org.alfresco.rest.api.tests.client.RequestContext;
|
||||
@@ -118,40 +122,53 @@ public class DeploymentWorkflowApiTest extends EnterpriseWorkflowTestApi
|
||||
assertEquals(activitiDeployment.getDeploymentTime(), adhocDeployment.getDeployedAt());
|
||||
}
|
||||
|
||||
// @Test
|
||||
// public void testGetDeploymentsEmpty() throws Exception
|
||||
// {
|
||||
// // Create a new test-network, not added to the test-fixture to prevent being used
|
||||
// // in other tests
|
||||
// String networkName = AbstractTestFixture.TEST_DOMAIN_PREFIX + UUID.randomUUID();
|
||||
// TestNetwork testNetwork = repoService.createNetworkWithAlias(networkName, true);
|
||||
// testNetwork.create();
|
||||
//
|
||||
// // Delete all deployments in the network
|
||||
// List<org.activiti.engine.repository.Deployment> deployments = activitiProcessEngine.getRepositoryService()
|
||||
// .createDeploymentQuery()
|
||||
// .processDefinitionKeyLike("@" + networkName + "@")
|
||||
// .list();
|
||||
//
|
||||
// for(org.activiti.engine.repository.Deployment deployment : deployments) {
|
||||
// activitiProcessEngine.getRepositoryService().deleteDeployment(deployment.getId(), true);
|
||||
// }
|
||||
//
|
||||
// // Fetch deployments using tenant-admin
|
||||
// String tenantAdmin = AuthenticationUtil.getAdminUserName() + "@" + networkName;
|
||||
// publicApiClient.setRequestContext(new RequestContext(TenantUtil.DEFAULT_TENANT, tenantAdmin));
|
||||
//
|
||||
// DeploymentsClient deploymentsClient = publicApiClient.deploymentsClient();
|
||||
//
|
||||
// ListResponse<Deployment> deploymentResponse = deploymentsClient.getDeployments();
|
||||
// assertEquals(0, deploymentResponse.getList().size());
|
||||
// }
|
||||
@Test
|
||||
public void testGetDeploymentsEmpty() throws Exception
|
||||
{
|
||||
// Create a new test-network, not added to the test-fixture to prevent being used
|
||||
// in other tests
|
||||
String networkName = AbstractTestFixture.TEST_DOMAIN_PREFIX + "999";
|
||||
final TestNetwork testNetwork = repoService.createNetworkWithAlias(networkName, true);
|
||||
transactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
|
||||
{
|
||||
@SuppressWarnings("synthetic-access")
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
||||
|
||||
testNetwork.create();
|
||||
|
||||
return null;
|
||||
}
|
||||
}, false, true);
|
||||
|
||||
// Delete all deployments in the network
|
||||
List<org.activiti.engine.repository.Deployment> deployments = activitiProcessEngine.getRepositoryService()
|
||||
.createDeploymentQuery()
|
||||
.processDefinitionKeyLike("@" + testNetwork.getId() + "@%")
|
||||
.list();
|
||||
|
||||
for(org.activiti.engine.repository.Deployment deployment : deployments)
|
||||
{
|
||||
activitiProcessEngine.getRepositoryService().deleteDeployment(deployment.getId(), true);
|
||||
}
|
||||
|
||||
// Fetch deployments using tenant-admin
|
||||
String tenantAdmin = AuthenticationUtil.getAdminUserName() + "@" + testNetwork.getId();
|
||||
publicApiClient.setRequestContext(new RequestContext(testNetwork.getId(), tenantAdmin));
|
||||
|
||||
DeploymentsClient deploymentsClient = publicApiClient.deploymentsClient();
|
||||
|
||||
ListResponse<Deployment> deploymentResponse = deploymentsClient.getDeployments();
|
||||
assertEquals(0, deploymentResponse.getList().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetDeploymentById() throws Exception
|
||||
{
|
||||
// Use admin-user for tenant
|
||||
RequestContext requestContext = initApiClientWithTestUser();
|
||||
|
||||
String tenantAdmin = AuthenticationUtil.getAdminUserName() + "@" + requestContext.getNetworkId();
|
||||
publicApiClient.setRequestContext(new RequestContext(TenantUtil.DEFAULT_TENANT, tenantAdmin));
|
||||
|
||||
@@ -174,6 +191,28 @@ public class DeploymentWorkflowApiTest extends EnterpriseWorkflowTestApi
|
||||
assertEquals(activitiDeployment.getCategory(), deployment.getCategory());
|
||||
assertEquals(activitiDeployment.getName(), deployment.getName());
|
||||
assertEquals(activitiDeployment.getDeploymentTime(), deployment.getDeployedAt());
|
||||
|
||||
try
|
||||
{
|
||||
deploymentsClient.findDeploymentById("fakeid");
|
||||
fail("Expected exception");
|
||||
}
|
||||
catch (PublicApiException e)
|
||||
{
|
||||
assertEquals(404, e.getHttpResponse().getStatusCode());
|
||||
}
|
||||
|
||||
// get deployment with default user
|
||||
try
|
||||
{
|
||||
publicApiClient.setRequestContext(requestContext);
|
||||
deploymentsClient.findDeploymentById(activitiDeployment.getId());
|
||||
fail("Expected exception");
|
||||
}
|
||||
catch (PublicApiException e)
|
||||
{
|
||||
assertEquals(403, e.getHttpResponse().getStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
protected String createProcessDefinitionKey(String key, RequestContext requestContext) {
|
||||
|
@@ -175,12 +175,30 @@ public class ProcessDefinitionWorkflowApiTest extends EnterpriseWorkflowTestApi
|
||||
assertTrue(processDefinitionMap.containsKey("activitiAdhoc"));
|
||||
assertEquals(1, processDefinitionMap.size());
|
||||
|
||||
// Use AND operator
|
||||
processDefinitionMap = getProcessDefinitions(processDefinitionsClient, "(category = 'http://alfresco.org' AND name = 'Adhoc Activiti Process')");
|
||||
assertTrue(processDefinitionMap.containsKey("activitiAdhoc"));
|
||||
assertEquals(1, processDefinitionMap.size());
|
||||
|
||||
// Use OR operator
|
||||
try
|
||||
{
|
||||
processDefinitionMap = getProcessDefinitions(processDefinitionsClient, "(category = 'http://alfresco.org' OR name = 'Adhoc Activiti Process')");
|
||||
fail("Expected exception");
|
||||
}
|
||||
catch (PublicApiException e)
|
||||
{
|
||||
assertEquals(400, e.getHttpResponse().getStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetProcessDefinitionById() throws Exception
|
||||
{
|
||||
RequestContext requestContext = initApiClientWithTestUser();
|
||||
|
||||
String tenantAdmin = AuthenticationUtil.getAdminUserName() + "@" + requestContext.getNetworkId();
|
||||
RequestContext adminContext = new RequestContext(requestContext.getNetworkId(), tenantAdmin);
|
||||
|
||||
String adhocKey = createProcessDefinitionKey("activitiAdhoc", requestContext);
|
||||
org.activiti.engine.repository.ProcessDefinition activitiDefinition = activitiProcessEngine.getRepositoryService()
|
||||
@@ -204,6 +222,15 @@ public class ProcessDefinitionWorkflowApiTest extends EnterpriseWorkflowTestApi
|
||||
assertEquals(activitiDefinition.getVersion(), adhocDefinition.getVersion());
|
||||
assertEquals(((ProcessDefinitionEntity) activitiDefinition).isGraphicalNotationDefined(), adhocDefinition.isGraphicNotationDefined());
|
||||
assertEquals("wf:submitAdhocTask", adhocDefinition.getStartFormResourceKey());
|
||||
|
||||
// get process definition with admin
|
||||
publicApiClient.setRequestContext(adminContext);
|
||||
adhocDefinition = processDefinitionsClient.findProcessDefinitionById(activitiDefinition.getId());
|
||||
assertNotNull(adhocDefinition);
|
||||
|
||||
// Check fields of a resulting process-definition
|
||||
assertEquals(activitiDefinition.getId(), adhocDefinition.getId());
|
||||
assertEquals("activitiAdhoc", adhocDefinition.getKey());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -227,6 +254,10 @@ public class ProcessDefinitionWorkflowApiTest extends EnterpriseWorkflowTestApi
|
||||
public void testGetProcessDefinitionStartModel() throws Exception
|
||||
{
|
||||
RequestContext requestContext = initApiClientWithTestUser();
|
||||
|
||||
String tenantAdmin = AuthenticationUtil.getAdminUserName() + "@" + requestContext.getNetworkId();
|
||||
RequestContext adminContext = new RequestContext(requestContext.getNetworkId(), tenantAdmin);
|
||||
|
||||
ProcessDefinitionsClient processDefinitionsClient = publicApiClient.processDefinitionsClient();
|
||||
|
||||
String adhocKey = createProcessDefinitionKey("activitiAdhoc", requestContext);
|
||||
@@ -322,6 +353,43 @@ public class ProcessDefinitionWorkflowApiTest extends EnterpriseWorkflowTestApi
|
||||
assertTrue(allowedValues.contains("On Hold"));
|
||||
assertTrue(allowedValues.contains("Cancelled"));
|
||||
assertTrue(allowedValues.contains("Completed"));
|
||||
|
||||
// get start form model with admin
|
||||
publicApiClient.setRequestContext(adminContext);
|
||||
model = processDefinitionsClient.findStartFormModel(activitiDefinition.getId());
|
||||
assertNotNull(model);
|
||||
|
||||
entries = (JSONArray) model.get("entries");
|
||||
assertNotNull(entries);
|
||||
|
||||
// Add all entries to a map, to make lookup easier
|
||||
modelFieldsByName = new HashMap<String, JSONObject>();
|
||||
for(int i=0; i<entries.size(); i++)
|
||||
{
|
||||
entry = (JSONObject) entries.get(i);
|
||||
assertNotNull(entry);
|
||||
entry = (JSONObject) entry.get("entry");
|
||||
assertNotNull(entry);
|
||||
modelFieldsByName.put((String) entry.get("name"), entry);
|
||||
}
|
||||
|
||||
// Check well-known properties and their types
|
||||
|
||||
// Validate bpm:description
|
||||
modelEntry = modelFieldsByName.get("bpm_workflowDescription");
|
||||
assertNotNull(modelEntry);
|
||||
assertEquals("Description", modelEntry.get("title"));
|
||||
assertEquals("{http://www.alfresco.org/model/bpm/1.0}workflowDescription", modelEntry.get("qualifiedName"));
|
||||
assertEquals("d:text", modelEntry.get("dataType"));
|
||||
assertFalse((Boolean)modelEntry.get("required"));
|
||||
|
||||
// Validate bpm:description
|
||||
modelEntry = modelFieldsByName.get("bpm_completionDate");
|
||||
assertNotNull(modelEntry);
|
||||
assertEquals("Completion Date", modelEntry.get("title"));
|
||||
assertEquals("{http://www.alfresco.org/model/bpm/1.0}completionDate", modelEntry.get("qualifiedName"));
|
||||
assertEquals("d:date", modelEntry.get("dataType"));
|
||||
assertFalse((Boolean)modelEntry.get("required"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -37,6 +37,7 @@ import org.alfresco.repo.tenant.TenantUtil;
|
||||
import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork;
|
||||
import org.alfresco.repo.workflow.activiti.ActivitiScriptNode;
|
||||
import org.alfresco.rest.api.tests.RepoService.TestNetwork;
|
||||
import org.alfresco.rest.api.tests.client.HttpResponse;
|
||||
import org.alfresco.rest.api.tests.client.PublicApiClient.ListResponse;
|
||||
import org.alfresco.rest.api.tests.client.PublicApiException;
|
||||
import org.alfresco.rest.api.tests.client.RequestContext;
|
||||
@@ -218,6 +219,69 @@ public class ProcessWorkflowApiTest extends EnterpriseWorkflowTestApi
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateProcessInstanceWithNoParams() throws Exception
|
||||
{
|
||||
initApiClientWithTestUser();
|
||||
|
||||
ProcessesClient processesClient = publicApiClient.processesClient();
|
||||
|
||||
JSONObject createProcessObject = new JSONObject();
|
||||
try
|
||||
{
|
||||
processesClient.createProcess(createProcessObject.toJSONString());
|
||||
fail("Exception excpected");
|
||||
}
|
||||
catch (PublicApiException e)
|
||||
{
|
||||
assertEquals(400, e.getHttpResponse().getStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMethodNotAllowedURIs() throws Exception
|
||||
{
|
||||
RequestContext requestContext = initApiClientWithTestUser();
|
||||
HttpResponse response = publicApiClient.get("public", "processes", null, null, null, null);
|
||||
assertEquals(200, response.getStatusCode());
|
||||
response = publicApiClient.put("public", "processes", null, null, null, null, null);
|
||||
assertEquals(405, response.getStatusCode());
|
||||
|
||||
final ProcessInfo processInfo = startAdhocProcess(requestContext, null);
|
||||
|
||||
try
|
||||
{
|
||||
response = publicApiClient.get("public", "processes", processInfo.getId(), null, null, null);
|
||||
assertEquals(200, response.getStatusCode());
|
||||
response = publicApiClient.post("public", "processes", processInfo.getId(), null, null, null);
|
||||
assertEquals(405, response.getStatusCode());
|
||||
response = publicApiClient.put("public", "processes", processInfo.getId(), null, null, null, null);
|
||||
assertEquals(405, response.getStatusCode());
|
||||
|
||||
response = publicApiClient.get("public", "processes", processInfo.getId(), "activities", null, null);
|
||||
assertEquals(200, response.getStatusCode());
|
||||
response = publicApiClient.post("public", "processes", processInfo.getId(), "activities", null, null);
|
||||
assertEquals(405, response.getStatusCode());
|
||||
response = publicApiClient.delete("public", "processes", processInfo.getId(), "activities", null);
|
||||
assertEquals(405, response.getStatusCode());
|
||||
response = publicApiClient.put("public", "processes", processInfo.getId(), "activities", null, null, null);
|
||||
assertEquals(405, response.getStatusCode());
|
||||
|
||||
response = publicApiClient.get("public", "processes", processInfo.getId(), "tasks", null, null);
|
||||
assertEquals(200, response.getStatusCode());
|
||||
response = publicApiClient.post("public", "processes", processInfo.getId(), "tasks", null, null);
|
||||
assertEquals(405, response.getStatusCode());
|
||||
response = publicApiClient.delete("public", "processes", processInfo.getId(), "tasks", null);
|
||||
assertEquals(405, response.getStatusCode());
|
||||
response = publicApiClient.put("public", "processes", processInfo.getId(), "tasks", null, null, null);
|
||||
assertEquals(405, response.getStatusCode());
|
||||
}
|
||||
finally
|
||||
{
|
||||
cleanupProcessInstance(processInfo.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateProcessInstanceForPooledReview() throws Exception
|
||||
{
|
||||
@@ -225,6 +289,7 @@ public class ProcessWorkflowApiTest extends EnterpriseWorkflowTestApi
|
||||
final ProcessInfo processInfo = startReviewPooledProcess(requestContext);
|
||||
assertNotNull(processInfo);
|
||||
assertNotNull(processInfo.getId());
|
||||
cleanupProcessInstance(processInfo.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -234,11 +299,12 @@ public class ProcessWorkflowApiTest extends EnterpriseWorkflowTestApi
|
||||
final ProcessInfo processInfo = startParallelReviewProcess(requestContext);
|
||||
assertNotNull(processInfo);
|
||||
assertNotNull(processInfo.getId());
|
||||
cleanupProcessInstance(processInfo.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testCreateProcessInstanceFormOtherNetwork() throws Exception
|
||||
public void testCreateProcessInstanceFromOtherNetwork() throws Exception
|
||||
{
|
||||
final RequestContext requestContext = initApiClientWithTestUser();
|
||||
|
||||
@@ -432,10 +498,13 @@ public class ProcessWorkflowApiTest extends EnterpriseWorkflowTestApi
|
||||
initApiClientWithTestUser();
|
||||
ProcessesClient processesClient = publicApiClient.processesClient();
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
processesClient.findProcessById("unexisting");
|
||||
fail("Exception expected");
|
||||
} catch(PublicApiException expected) {
|
||||
}
|
||||
catch(PublicApiException expected)
|
||||
{
|
||||
assertEquals(HttpStatus.NOT_FOUND.value(), expected.getHttpResponse().getStatusCode());
|
||||
assertErrorSummary("The entity with id: unexisting was not found", expected.getHttpResponse());
|
||||
}
|
||||
@@ -922,6 +991,25 @@ public class ProcessWorkflowApiTest extends EnterpriseWorkflowTestApi
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getProcessImage() throws Exception
|
||||
{
|
||||
final RequestContext requestContext = initApiClientWithTestUser();
|
||||
final ProcessInfo processRest = startAdhocProcess(requestContext, null);
|
||||
HttpResponse response = publicApiClient.processesClient().getImage(processRest.getId());
|
||||
assertEquals(200, response.getStatusCode());
|
||||
cleanupProcessInstance(processRest.getId());
|
||||
try
|
||||
{
|
||||
response = publicApiClient.processesClient().getImage("fakeId");
|
||||
fail("Exception expected");
|
||||
}
|
||||
catch (PublicApiException e)
|
||||
{
|
||||
assertEquals(404, e.getHttpResponse().getStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetProcessItems() throws Exception
|
||||
{
|
||||
@@ -974,6 +1062,16 @@ public class ProcessWorkflowApiTest extends EnterpriseWorkflowTestApi
|
||||
assertTrue(doc2Found);
|
||||
|
||||
cleanupProcessInstance(processRest.getId());
|
||||
|
||||
try
|
||||
{
|
||||
processesClient.findProcessItems("fakeid");
|
||||
fail("Exception expected");
|
||||
}
|
||||
catch (PublicApiException e)
|
||||
{
|
||||
assertEquals(404, e.getHttpResponse().getStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -987,7 +1085,6 @@ public class ProcessWorkflowApiTest extends EnterpriseWorkflowTestApi
|
||||
|
||||
final String newProcessInstanceId = processRest.getId();
|
||||
ProcessesClient processesClient = publicApiClient.processesClient();
|
||||
System.out.println("node ref " + docNodeRefs[0].toString());
|
||||
JSONObject itemJSON = processesClient.findProcessItem(newProcessInstanceId, docNodeRefs[0].getId());
|
||||
assertNotNull(itemJSON);
|
||||
|
||||
@@ -1107,6 +1204,80 @@ public class ProcessWorkflowApiTest extends EnterpriseWorkflowTestApi
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteProcessItemWithAdmin() throws Exception
|
||||
{
|
||||
final RequestContext requestContext = initApiClientWithTestUser();
|
||||
|
||||
String tenantAdmin = AuthenticationUtil.getAdminUserName() + "@" + requestContext.getNetworkId();
|
||||
final RequestContext adminContext = new RequestContext(requestContext.getNetworkId(), tenantAdmin);
|
||||
publicApiClient.setRequestContext(adminContext);
|
||||
|
||||
// start process with admin user
|
||||
NodeRef[] docNodeRefs = createTestDocuments(adminContext);
|
||||
final ProcessInfo processRest = startAdhocProcess(adminContext, docNodeRefs);
|
||||
try
|
||||
{
|
||||
assertNotNull(processRest);
|
||||
|
||||
final String newProcessInstanceId = processRest.getId();
|
||||
ProcessesClient processesClient = publicApiClient.processesClient();
|
||||
|
||||
// Delete the item
|
||||
processesClient.deleteProcessItem(newProcessInstanceId, docNodeRefs[0].getId());
|
||||
|
||||
// Fetching the item should result in 404
|
||||
try
|
||||
{
|
||||
publicApiClient.processesClient().findProcessItem(newProcessInstanceId, docNodeRefs[0].getId());
|
||||
fail("Exception expected");
|
||||
}
|
||||
catch(PublicApiException expected)
|
||||
{
|
||||
assertEquals(HttpStatus.NOT_FOUND.value(), expected.getHttpResponse().getStatusCode());
|
||||
assertErrorSummary("The entity with id: " + docNodeRefs[0].getId() + " was not found", expected.getHttpResponse());
|
||||
}
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
cleanupProcessInstance(processRest.getId());
|
||||
}
|
||||
|
||||
// start process with default user and delete item with admin
|
||||
publicApiClient.setRequestContext(requestContext);
|
||||
docNodeRefs = createTestDocuments(requestContext);
|
||||
final ProcessInfo processRestDefaultUser = startAdhocProcess(requestContext, docNodeRefs);
|
||||
try
|
||||
{
|
||||
assertNotNull(processRestDefaultUser);
|
||||
|
||||
publicApiClient.setRequestContext(adminContext);
|
||||
final String newProcessInstanceId = processRestDefaultUser.getId();
|
||||
ProcessesClient processesClient = publicApiClient.processesClient();
|
||||
|
||||
// Delete the item
|
||||
processesClient.deleteProcessItem(newProcessInstanceId, docNodeRefs[0].getId());
|
||||
|
||||
// Fetching the item should result in 404
|
||||
try
|
||||
{
|
||||
publicApiClient.processesClient().findProcessItem(newProcessInstanceId, docNodeRefs[0].getId());
|
||||
fail("Exception expected");
|
||||
}
|
||||
catch(PublicApiException expected)
|
||||
{
|
||||
assertEquals(HttpStatus.NOT_FOUND.value(), expected.getHttpResponse().getStatusCode());
|
||||
assertErrorSummary("The entity with id: " + docNodeRefs[0].getId() + " was not found", expected.getHttpResponse());
|
||||
}
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
cleanupProcessInstance(processRestDefaultUser.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetProcessVariables() throws Exception
|
||||
{
|
||||
@@ -1458,16 +1629,20 @@ public class ProcessWorkflowApiTest extends EnterpriseWorkflowTestApi
|
||||
{
|
||||
initApiClientWithTestUser();
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
publicApiClient.processesClient().deleteVariable("unexisting", "deleteMe");
|
||||
fail("Exception expected");
|
||||
} catch(PublicApiException expected) {
|
||||
}
|
||||
catch(PublicApiException expected)
|
||||
{
|
||||
assertEquals(HttpStatus.NOT_FOUND.value(), expected.getHttpResponse().getStatusCode());
|
||||
assertErrorSummary("The entity with id: unexisting was not found", expected.getHttpResponse());
|
||||
}
|
||||
}
|
||||
|
||||
protected void completeAdhocTasks(String instanceId, RequestContext requestContext) {
|
||||
protected void completeAdhocTasks(String instanceId, RequestContext requestContext)
|
||||
{
|
||||
final Task task = activitiProcessEngine.getTaskService().createTaskQuery().processInstanceId(instanceId).singleResult();
|
||||
assertEquals(requestContext.getRunAsUser(), task.getAssignee());
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -158,6 +158,12 @@ public class WorkflowApiClient extends PublicApiClient
|
||||
return list;
|
||||
}
|
||||
|
||||
public HttpResponse getImage(String processInstanceId) throws PublicApiException
|
||||
{
|
||||
HttpResponse response = getSingle("processes", processInstanceId, "image", null, "Failed to get image of processInstanceId " + processInstanceId);
|
||||
return response;
|
||||
}
|
||||
|
||||
public JSONObject findProcessItems(String processInstanceId) throws PublicApiException
|
||||
{
|
||||
HttpResponse response = getAll("processes", processInstanceId, "items", null, null,
|
||||
@@ -283,6 +289,34 @@ public class WorkflowApiClient extends PublicApiClient
|
||||
JSONObject list = (JSONObject) response.getJsonResponse().get("list");
|
||||
return list;
|
||||
}
|
||||
|
||||
public JSONObject findTaskItems(String taskId) throws PublicApiException
|
||||
{
|
||||
HttpResponse response = getAll("tasks", taskId, "items", null, null,
|
||||
"Failed to get the items of the task");
|
||||
JSONObject list = (JSONObject) response.getJsonResponse().get("list");
|
||||
return list;
|
||||
}
|
||||
|
||||
public JSONObject addTaskItem(String taskId, String body) throws PublicApiException
|
||||
{
|
||||
HttpResponse response = create("tasks", taskId, "items", null, body, "Failed to add item");
|
||||
JSONObject entry = (JSONObject) response.getJsonResponse().get("entry");
|
||||
return entry;
|
||||
}
|
||||
|
||||
public void deleteTaskItem(String taskId, String itemId) throws PublicApiException
|
||||
{
|
||||
remove("tasks", taskId, "items", itemId, "Failed to delete item");
|
||||
}
|
||||
|
||||
public JSONObject findTaskItem(String taskId, String itemId) throws PublicApiException
|
||||
{
|
||||
HttpResponse response = getAll("tasks", taskId, "items", itemId, null,
|
||||
"Failed to get the item of the task");
|
||||
JSONObject entry = (JSONObject) response.getJsonResponse().get("entry");
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
|
||||
public static Date parseDate(JSONObject entry, String fieldName) {
|
||||
|
Reference in New Issue
Block a user