use of org.camunda.bpm.engine.repository.DeploymentBuilder in project camunda-bpm-platform by camunda.
the class DeploymentResourceImpl method tryToRedeploy.
protected DeploymentWithDefinitions tryToRedeploy(RedeploymentDto redeployment) {
RepositoryService repositoryService = getProcessEngine().getRepositoryService();
DeploymentBuilder builder = repositoryService.createDeployment();
builder.nameFromDeployment(deploymentId);
String tenantId = getDeployment().getTenantId();
if (tenantId != null) {
builder.tenantId(tenantId);
}
if (redeployment != null) {
builder = addRedeploymentResources(builder, redeployment);
} else {
builder.addDeploymentResources(deploymentId);
}
return builder.deployWithResult();
}
use of org.camunda.bpm.engine.repository.DeploymentBuilder in project camunda-bpm-platform by camunda.
the class TestHelper method annotationDeploymentSetUp.
public static String annotationDeploymentSetUp(ProcessEngine processEngine, Class<?> testClass, String methodName, Deployment deploymentAnnotation) {
String deploymentId = null;
Method method = null;
boolean onMethod = true;
try {
method = getMethod(testClass, methodName);
} catch (Exception e) {
if (deploymentAnnotation == null) {
// we have neither the annotation, nor can look it up from the method
return null;
}
}
if (deploymentAnnotation == null) {
deploymentAnnotation = method.getAnnotation(Deployment.class);
}
// if not found on method, try on class level
if (deploymentAnnotation == null) {
onMethod = false;
Class<?> lookForAnnotationClass = testClass;
while (lookForAnnotationClass != Object.class) {
deploymentAnnotation = lookForAnnotationClass.getAnnotation(Deployment.class);
if (deploymentAnnotation != null) {
testClass = lookForAnnotationClass;
break;
}
lookForAnnotationClass = lookForAnnotationClass.getSuperclass();
}
}
if (deploymentAnnotation != null) {
LOG.debug("annotation @Deployment creates deployment for {}.{}", ClassNameUtil.getClassNameWithoutPackage(testClass), methodName);
String[] resources = deploymentAnnotation.resources();
if (resources.length == 0 && method != null) {
String name = onMethod ? method.getName() : null;
String resource = getBpmnProcessDefinitionResource(testClass, name);
resources = new String[] { resource };
}
DeploymentBuilder deploymentBuilder = processEngine.getRepositoryService().createDeployment().name(ClassNameUtil.getClassNameWithoutPackage(testClass) + "." + methodName);
for (String resource : resources) {
deploymentBuilder.addClasspathResource(resource);
}
deploymentId = deploymentBuilder.deploy().getId();
}
return deploymentId;
}
use of org.camunda.bpm.engine.repository.DeploymentBuilder in project camunda-bpm-platform by camunda.
the class HistoricExternalTaskLogAuthorizationTest method setUp.
@Override
public void setUp() throws Exception {
DeploymentBuilder deploymentbuilder = repositoryService.createDeployment();
BpmnModelInstance defaultModel = createDefaultExternalTaskModel().build();
BpmnModelInstance modifiedModel = createDefaultExternalTaskModel().processKey(ANOTHER_PROCESS_KEY).build();
deploymentId = deployment(deploymentbuilder, defaultModel, modifiedModel);
super.setUp();
}
use of org.camunda.bpm.engine.repository.DeploymentBuilder in project camunda-bpm-platform by camunda.
the class ProcessDefinitionCandidateTest method shouldPropagateTenantIdToCandidateStarterGroups.
@Test
public void shouldPropagateTenantIdToCandidateStarterGroups() {
// when
DeploymentBuilder builder = repositoryService.createDeployment().addClasspathResource(CANDIDATE_STARTER_GROUPS).tenantId(TENANT_ONE);
testRule.deploy(builder);
// then
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
List<IdentityLink> links = repositoryService.getIdentityLinksForProcessDefinition(processDefinition.getId());
assertEquals(3, links.size());
for (IdentityLink link : links) {
assertNotNull(link.getTenantId());
assertEquals(TENANT_ONE, link.getTenantId());
}
}
use of org.camunda.bpm.engine.repository.DeploymentBuilder in project camunda-bpm-platform by camunda.
the class ProcessDefinitionCandidateTest method shouldPropagateTenantIdToCandidateStarterUsers.
@Test
public void shouldPropagateTenantIdToCandidateStarterUsers() {
// when
DeploymentBuilder builder = repositoryService.createDeployment().addClasspathResource(CANDIDATE_STARTER_USERS).tenantId(TENANT_ONE);
testRule.deploy(builder);
// then
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
List<IdentityLink> links = repositoryService.getIdentityLinksForProcessDefinition(processDefinition.getId());
assertEquals(3, links.size());
for (IdentityLink link : links) {
assertNotNull(link.getTenantId());
assertEquals(TENANT_ONE, link.getTenantId());
}
}
Aggregations