Search in sources :

Example 51 with Deployment

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());
}
Also used : UserOperationLogEntry(org.camunda.bpm.engine.history.UserOperationLogEntry) Deployment(org.camunda.bpm.engine.repository.Deployment) UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery)

Example 52 with Deployment

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());
}
Also used : Deployment(org.camunda.bpm.engine.repository.Deployment) UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery)

Example 53 with Deployment

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());
}
Also used : UserOperationLogEntry(org.camunda.bpm.engine.history.UserOperationLogEntry) Deployment(org.camunda.bpm.engine.repository.Deployment) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery)

Example 54 with Deployment

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);
}
Also used : JobDefinitionQuery(org.camunda.bpm.engine.management.JobDefinitionQuery) InputStream(java.io.InputStream) Deployment(org.camunda.bpm.engine.repository.Deployment) DeploymentBuilder(org.camunda.bpm.engine.repository.DeploymentBuilder) JobDefinition(org.camunda.bpm.engine.management.JobDefinition) Test(org.junit.Test)

Example 55 with Deployment

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);
}
Also used : JobDefinitionQuery(org.camunda.bpm.engine.management.JobDefinitionQuery) InputStream(java.io.InputStream) Deployment(org.camunda.bpm.engine.repository.Deployment) DeploymentBuilder(org.camunda.bpm.engine.repository.DeploymentBuilder) JobDefinition(org.camunda.bpm.engine.management.JobDefinition) Test(org.junit.Test)

Aggregations

Deployment (org.camunda.bpm.engine.repository.Deployment)137 Test (org.junit.Test)62 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)39 ProcessApplicationDeployment (org.camunda.bpm.engine.repository.ProcessApplicationDeployment)36 ProcessDefinitionQuery (org.camunda.bpm.engine.repository.ProcessDefinitionQuery)19 Resource (org.camunda.bpm.engine.repository.Resource)19 InputStream (java.io.InputStream)14 DeploymentBuilder (org.camunda.bpm.engine.repository.DeploymentBuilder)11 DeploymentQuery (org.camunda.bpm.engine.repository.DeploymentQuery)11 ProcessApplicationReference (org.camunda.bpm.application.ProcessApplicationReference)10 UserOperationLogQuery (org.camunda.bpm.engine.history.UserOperationLogQuery)10 JobDefinitionQuery (org.camunda.bpm.engine.management.JobDefinitionQuery)10 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)9 UserOperationLogEntry (org.camunda.bpm.engine.history.UserOperationLogEntry)8 JobDefinition (org.camunda.bpm.engine.management.JobDefinition)8 RepositoryService (org.camunda.bpm.engine.RepositoryService)4 Job (org.camunda.bpm.engine.runtime.Job)4 Response (com.jayway.restassured.response.Response)3 HashMap (java.util.HashMap)2 Authorization (org.camunda.bpm.engine.authorization.Authorization)2