Search in sources :

Example 16 with Deployment

use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.

the class DeploymentAuthorizationTest method testCreateDeployment.

public void testCreateDeployment() {
    // given
    createGrantAuthorization(DEPLOYMENT, ANY, userId, CREATE);
    // when
    Deployment deployment = repositoryService.createDeployment().addClasspathResource(FIRST_RESOURCE).deploy();
    // then
    disableAuthorization();
    DeploymentQuery query = repositoryService.createDeploymentQuery();
    verifyQueryResults(query, 1);
    enableAuthorization();
    deleteDeployment(deployment.getId());
}
Also used : DeploymentQuery(org.camunda.bpm.engine.repository.DeploymentQuery) Deployment(org.camunda.bpm.engine.repository.Deployment)

Example 17 with Deployment

use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.

the class MultiTenancyRepositoryServiceTest method deploymentWithTenantId.

@Test
public void deploymentWithTenantId() {
    createDeploymentBuilder().tenantId(TENANT_ONE).deploy();
    Deployment deployment = repositoryService.createDeploymentQuery().singleResult();
    assertThat(deployment, is(notNullValue()));
    assertThat(deployment.getTenantId(), is(TENANT_ONE));
}
Also used : Deployment(org.camunda.bpm.engine.repository.Deployment) Test(org.junit.Test)

Example 18 with Deployment

use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.

the class MultiTenancyTimerStartEventTest method deleteJobsWhileUndeployment.

@Test
public void deleteJobsWhileUndeployment() {
    Deployment deploymentForTenantOne = testRule.deployForTenant(TENANT_ONE, PROCESS);
    Deployment deploymentForTenantTwo = testRule.deployForTenant(TENANT_TWO, PROCESS);
    JobQuery query = managementService.createJobQuery();
    assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
    assertThat(query.tenantIdIn(TENANT_TWO).count(), is(1L));
    repositoryService.deleteDeployment(deploymentForTenantOne.getId(), true);
    assertThat(query.tenantIdIn(TENANT_ONE).count(), is(0L));
    assertThat(query.tenantIdIn(TENANT_TWO).count(), is(1L));
    repositoryService.deleteDeployment(deploymentForTenantTwo.getId(), true);
    assertThat(query.tenantIdIn(TENANT_ONE).count(), is(0L));
    assertThat(query.tenantIdIn(TENANT_TWO).count(), is(0L));
}
Also used : Deployment(org.camunda.bpm.engine.repository.Deployment) JobQuery(org.camunda.bpm.engine.runtime.JobQuery) Test(org.junit.Test)

Example 19 with Deployment

use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.

the class CallingTaskItemHandler method initializeCallableElement.

protected void initializeCallableElement(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) {
    Deployment deployment = context.getDeployment();
    String deploymentId = null;
    if (deployment != null) {
        deploymentId = deployment.getId();
    }
    BaseCallableElement callableElement = createCallableElement();
    callableElement.setDeploymentId(deploymentId);
    // set callableElement on behavior
    CallingTaskActivityBehavior behavior = (CallingTaskActivityBehavior) activity.getActivityBehavior();
    behavior.setCallableElement(callableElement);
    // definition key
    initializeDefinitionKey(element, activity, context, callableElement);
    // binding
    initializeBinding(element, activity, context, callableElement);
    // version
    initializeVersion(element, activity, context, callableElement);
    // tenant-id
    initializeTenantId(element, activity, context, callableElement);
}
Also used : CallingTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.CallingTaskActivityBehavior) BaseCallableElement(org.camunda.bpm.engine.impl.core.model.BaseCallableElement) Deployment(org.camunda.bpm.engine.repository.Deployment)

Example 20 with Deployment

use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.

the class CaseHandler method initializeActivity.

protected void initializeActivity(Case element, CmmnActivity activity, CmmnHandlerContext context) {
    CaseDefinitionEntity definition = (CaseDefinitionEntity) activity;
    Deployment deployment = context.getDeployment();
    definition.setKey(element.getId());
    definition.setName(element.getName());
    definition.setDeploymentId(deployment.getId());
    definition.setTaskDefinitions(new HashMap<String, TaskDefinition>());
    definition.setHistoryTimeToLive(ParseUtil.parseHistoryTimeToLive(element.getCamundaHistoryTimeToLiveString()));
    CmmnModelInstance model = context.getModel();
    Definitions definitions = model.getDefinitions();
    String category = definitions.getTargetNamespace();
    definition.setCategory(category);
}
Also used : TaskDefinition(org.camunda.bpm.engine.impl.task.TaskDefinition) CaseDefinitionEntity(org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity) Definitions(org.camunda.bpm.model.cmmn.instance.Definitions) Deployment(org.camunda.bpm.engine.repository.Deployment) CmmnModelInstance(org.camunda.bpm.model.cmmn.CmmnModelInstance)

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