use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class UserOperationLogDeploymentTest method testDeleteDeploymentCascading.
public void testDeleteDeploymentCascading() {
// given
Deployment deployment = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_NAME, createProcessWithServiceTask(PROCESS_KEY)).deploy();
UserOperationLogQuery query = historyService.createUserOperationLogQuery().operationType(UserOperationLogEntry.OPERATION_TYPE_DELETE);
// when
repositoryService.deleteDeployment(deployment.getId(), true);
// then
assertEquals(1, query.count());
UserOperationLogEntry log = query.singleResult();
assertNotNull(log);
assertEquals(EntityTypes.DEPLOYMENT, log.getEntityType());
assertEquals(deployment.getId(), log.getDeploymentId());
assertEquals(UserOperationLogEntry.OPERATION_TYPE_DELETE, log.getOperationType());
assertEquals("cascade", log.getProperty());
assertNull(log.getOrgValue());
assertTrue(Boolean.valueOf(log.getNewValue()));
assertEquals(USER_ID, log.getUserId());
assertNull(log.getJobDefinitionId());
assertNull(log.getProcessInstanceId());
assertNull(log.getProcessDefinitionId());
assertNull(log.getProcessDefinitionKey());
assertNull(log.getCaseInstanceId());
assertNull(log.getCaseDefinitionId());
}
use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class UserOperationLogDeploymentTest method testDeleteDeploymentWithoutCascadingShouldKeepCreateUserOperationLog.
public void testDeleteDeploymentWithoutCascadingShouldKeepCreateUserOperationLog() {
// given
Deployment deployment = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_NAME, createProcessWithServiceTask(PROCESS_KEY)).deploy();
UserOperationLogQuery query = historyService.createUserOperationLogQuery().operationType(UserOperationLogEntry.OPERATION_TYPE_CREATE);
assertEquals(1, query.count());
// when
repositoryService.deleteDeployment(deployment.getId(), false);
// then
assertEquals(1, query.count());
}
use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class UserOperationLogDeploymentTest method testPropertiesDuplicateFilteringAndDeployChangedOnly.
public void testPropertiesDuplicateFilteringAndDeployChangedOnly() {
// given
BpmnModelInstance model = createProcessWithServiceTask(PROCESS_KEY);
// when
Deployment deployment = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_NAME, model).enableDuplicateFiltering(true).deploy();
// then
UserOperationLogQuery query = historyService.createUserOperationLogQuery();
assertEquals(2, query.count());
// (1): duplicate filter enabled property
UserOperationLogEntry logDuplicateFilterEnabledProperty = query.property("duplicateFilterEnabled").singleResult();
assertNotNull(logDuplicateFilterEnabledProperty);
assertEquals(EntityTypes.DEPLOYMENT, logDuplicateFilterEnabledProperty.getEntityType());
assertEquals(deployment.getId(), logDuplicateFilterEnabledProperty.getDeploymentId());
assertEquals(UserOperationLogEntry.OPERATION_TYPE_CREATE, logDuplicateFilterEnabledProperty.getOperationType());
assertEquals(USER_ID, logDuplicateFilterEnabledProperty.getUserId());
assertEquals("duplicateFilterEnabled", logDuplicateFilterEnabledProperty.getProperty());
assertNull(logDuplicateFilterEnabledProperty.getOrgValue());
assertTrue(Boolean.valueOf(logDuplicateFilterEnabledProperty.getNewValue()));
// (2): deploy changed only
UserOperationLogEntry logDeployChangedOnlyProperty = query.property("deployChangedOnly").singleResult();
assertNotNull(logDeployChangedOnlyProperty);
assertEquals(EntityTypes.DEPLOYMENT, logDeployChangedOnlyProperty.getEntityType());
assertEquals(deployment.getId(), logDeployChangedOnlyProperty.getDeploymentId());
assertEquals(UserOperationLogEntry.OPERATION_TYPE_CREATE, logDeployChangedOnlyProperty.getOperationType());
assertEquals(USER_ID, logDeployChangedOnlyProperty.getUserId());
assertEquals("deployChangedOnly", logDeployChangedOnlyProperty.getProperty());
assertNull(logDeployChangedOnlyProperty.getOrgValue());
assertTrue(Boolean.valueOf(logDeployChangedOnlyProperty.getNewValue()));
// (3): operation id
assertEquals(logDuplicateFilterEnabledProperty.getOperationId(), logDeployChangedOnlyProperty.getOperationId());
}
use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class JobDefinitionCreationAndDeletionWithParseListenerTest method testDeleteNonExistingAndCreateNewJobDefinitionWithParseListener.
@Test
public void testDeleteNonExistingAndCreateNewJobDefinitionWithParseListener() {
// given
String modelFileName = "jobCreationWithinParseListener.bpmn20.xml";
InputStream in = JobDefinitionCreationWithParseListenerTest.class.getResourceAsStream(modelFileName);
DeploymentBuilder builder = engineRule.getRepositoryService().createDeployment().addInputStream(modelFileName, in);
// when the asyncBefore is set to false and the asyncAfter to true in the parse listener
Deployment deployment = builder.deploy();
engineRule.manageDeployment(deployment);
// then there exists one job definition
JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery();
JobDefinition jobDef = query.singleResult();
assertNotNull(jobDef);
assertEquals(jobDef.getProcessDefinitionKey(), "oneTaskProcess");
assertEquals(jobDef.getActivityId(), "servicetask1");
assertEquals(jobDef.getJobConfiguration(), MessageJobDeclaration.ASYNC_AFTER);
}
use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class JobDefinitionCreationBothAsyncWithParseListenerTest method testCreateBothJobDefinitionWithParseListenerAndAsynBothInXml.
@Test
public void testCreateBothJobDefinitionWithParseListenerAndAsynBothInXml() {
// given the asyncBefore AND asyncAfter is set in the xml
String modelFileName = "jobAsyncBothCreationWithinParseListener.bpmn20.xml";
InputStream in = JobDefinitionCreationWithParseListenerTest.class.getResourceAsStream(modelFileName);
DeploymentBuilder builder = engineRule.getRepositoryService().createDeployment().addInputStream(modelFileName, in);
// when the asyncBefore and asyncAfter is set to true in the parse listener
Deployment deployment = builder.deploy();
engineRule.manageDeployment(deployment);
// then there exists two job definitions
JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery();
List<JobDefinition> definitions = query.orderByJobConfiguration().asc().list();
assertEquals(definitions.size(), 2);
// asyncAfter
JobDefinition asyncAfterAfter = definitions.get(0);
assertEquals(asyncAfterAfter.getProcessDefinitionKey(), "oneTaskProcess");
assertEquals(asyncAfterAfter.getActivityId(), "servicetask1");
assertEquals(asyncAfterAfter.getJobConfiguration(), MessageJobDeclaration.ASYNC_AFTER);
// asyncBefore
JobDefinition asyncAfterBefore = definitions.get(1);
assertEquals(asyncAfterBefore.getProcessDefinitionKey(), "oneTaskProcess");
assertEquals(asyncAfterBefore.getActivityId(), "servicetask1");
assertEquals(asyncAfterBefore.getJobConfiguration(), MessageJobDeclaration.ASYNC_BEFORE);
}
Aggregations