use of org.camunda.bpm.application.impl.EmbeddedProcessApplication in project camunda-bpm-platform by camunda.
the class UserOperationLogDeploymentTest method testCreateDeploymentPa.
public void testCreateDeploymentPa() {
// given
EmbeddedProcessApplication application = new EmbeddedProcessApplication();
// when
Deployment deployment = repositoryService.createDeployment(application.getReference()).name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_NAME, createProcessWithServiceTask(PROCESS_KEY)).deploy();
// then
UserOperationLogEntry userOperationLogEntry = historyService.createUserOperationLogQuery().singleResult();
assertNotNull(userOperationLogEntry);
assertEquals(EntityTypes.DEPLOYMENT, userOperationLogEntry.getEntityType());
assertEquals(deployment.getId(), userOperationLogEntry.getDeploymentId());
assertEquals(UserOperationLogEntry.OPERATION_TYPE_CREATE, userOperationLogEntry.getOperationType());
assertEquals("duplicateFilterEnabled", userOperationLogEntry.getProperty());
assertNull(userOperationLogEntry.getOrgValue());
assertFalse(Boolean.valueOf(userOperationLogEntry.getNewValue()));
assertEquals(USER_ID, userOperationLogEntry.getUserId());
assertNull(userOperationLogEntry.getJobDefinitionId());
assertNull(userOperationLogEntry.getProcessInstanceId());
assertNull(userOperationLogEntry.getProcessDefinitionId());
assertNull(userOperationLogEntry.getProcessDefinitionKey());
assertNull(userOperationLogEntry.getCaseInstanceId());
assertNull(userOperationLogEntry.getCaseDefinitionId());
}
use of org.camunda.bpm.application.impl.EmbeddedProcessApplication in project camunda-bpm-platform by camunda.
the class DeploymentAuthorizationTest method testGetProcessApplicationForDeploymentWithoutAuthorization.
// get process application for deployment ///////////////////////////////////
public void testGetProcessApplicationForDeploymentWithoutAuthorization() {
// given
EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication();
String deploymentId = createDeployment(null, FIRST_RESOURCE).getId();
ProcessApplicationReference reference = processApplication.getReference();
registerProcessApplication(deploymentId, reference);
try {
// when
managementService.getProcessApplicationForDeployment(deploymentId);
fail("Exception expected: It should not be possible to get the process application");
} catch (AuthorizationException e) {
// then
String message = e.getMessage();
assertTextPresent("ENGINE-03029 Required authenticated group 'camunda-admin'", message);
}
deleteDeployment(deploymentId);
}
use of org.camunda.bpm.application.impl.EmbeddedProcessApplication in project camunda-bpm-platform by camunda.
the class DeploymentAuthorizationTest method testUnregisterProcessApplicationWithoutAuthorization.
// unregister process application ///////////////////////////////////
public void testUnregisterProcessApplicationWithoutAuthorization() {
// given
EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication();
String deploymentId = createDeployment(null, FIRST_RESOURCE).getId();
ProcessApplicationReference reference = processApplication.getReference();
registerProcessApplication(deploymentId, reference);
try {
// when
managementService.unregisterProcessApplication(deploymentId, true);
fail("Exception expected: It should not be possible to unregister a process application");
} catch (AuthorizationException e) {
// then
String message = e.getMessage();
assertTextPresent("ENGINE-03029 Required authenticated group 'camunda-admin'", message);
}
deleteDeployment(deploymentId);
}
use of org.camunda.bpm.application.impl.EmbeddedProcessApplication in project camunda-bpm-platform by camunda.
the class DeploymentAuthorizationTest method testGetProcessApplicationForDeploymentAsCamundaAdmin.
public void testGetProcessApplicationForDeploymentAsCamundaAdmin() {
// given
identityService.setAuthentication(userId, Collections.singletonList(Groups.CAMUNDA_ADMIN));
EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication();
String deploymentId = createDeployment(null, FIRST_RESOURCE).getId();
ProcessApplicationReference reference = processApplication.getReference();
registerProcessApplication(deploymentId, reference);
// when
String application = managementService.getProcessApplicationForDeployment(deploymentId);
// then
assertNotNull(application);
deleteDeployment(deploymentId);
}
use of org.camunda.bpm.application.impl.EmbeddedProcessApplication in project camunda-bpm-platform by camunda.
the class ProcessApplicationEventListenerTest method testTaskListener.
@Deployment
public void testTaskListener() {
final List<String> events = new ArrayList<String>();
EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication() {
public TaskListener getTaskListener() {
return new TaskListener() {
public void notify(DelegateTask delegateTask) {
events.add(delegateTask.getEventName());
}
};
}
};
// register app so that it is notified about events
managementService.registerProcessApplication(deploymentId, processApplication.getReference());
// start process instance
ProcessInstance taskListenerProcess = runtimeService.startProcessInstanceByKey("taskListenerProcess");
// create event received
assertEquals(1, events.size());
assertEquals(TaskListener.EVENTNAME_CREATE, events.get(0));
Task task = taskService.createTaskQuery().singleResult();
// assign task:
taskService.setAssignee(task.getId(), "jonny");
assertEquals(2, events.size());
assertEquals(TaskListener.EVENTNAME_ASSIGNMENT, events.get(1));
// complete task
taskService.complete(task.getId());
assertEquals(4, events.size());
assertEquals(TaskListener.EVENTNAME_COMPLETE, events.get(2));
// next task was created
assertEquals(TaskListener.EVENTNAME_CREATE, events.get(3));
// delete process instance so last task will be deleted
runtimeService.deleteProcessInstance(taskListenerProcess.getProcessInstanceId(), "test delete event");
assertEquals(5, events.size());
assertEquals(TaskListener.EVENTNAME_DELETE, events.get(4));
}
Aggregations