public static String annotationDeploymentSetUp(ProcessEngine processEngine, Class<?> testClass, String methodName) { String deploymentId = null; Method method = null; try { method = testClass.getMethod(methodName, (Class<?>[]) null); } catch (Exception e) { log.warn("Could not get method by reflection. This could happen if you are using @Parameters in combination with annotations.", e); return null; } Deployment deploymentAnnotation = method.getAnnotation(Deployment.class); if (deploymentAnnotation != null) { log.debug("annotation @Deployment creates deployment for {}.{}", testClass.getSimpleName(), methodName); String[] resources = deploymentAnnotation.resources(); if (resources.length == 0) { String name = method.getName(); String resource = getBpmnProcessDefinitionResource(testClass, name); resources = new String[] { resource }; } DeploymentBuilder deploymentBuilder = processEngine.getRepositoryService().createDeployment().name(testClass.getSimpleName() + "." + methodName); for (String resource : resources) { deploymentBuilder.addClasspathResource(resource); } if (deploymentAnnotation.tenantId() != null && deploymentAnnotation.tenantId().length() > 0) { deploymentBuilder.tenantId(deploymentAnnotation.tenantId()); } deploymentId = deploymentBuilder.deploy().getId(); } return deploymentId; }
.name(modelData.getName()) .category(modelData.getCategory()) .tenantId(modelData.getTenantId())
deploymentBuilder.tenantId(tenantId);
public static String annotationDeploymentSetUp(ProcessEngine processEngine, Class<?> testClass, String methodName) { String deploymentId = null; Method method = null; try { method = testClass.getMethod(methodName, (Class<?>[]) null); } catch (Exception e) { log.warn("Could not get method by reflection. This could happen if you are using @Parameters in combination with annotations.", e); return null; } Deployment deploymentAnnotation = method.getAnnotation(Deployment.class); if (deploymentAnnotation != null) { log.debug("annotation @Deployment creates deployment for {}.{}", testClass.getSimpleName(), methodName); String[] resources = deploymentAnnotation.resources(); if (resources.length == 0) { String name = method.getName(); String resource = getBpmnProcessDefinitionResource(testClass, name); resources = new String[] { resource }; } DeploymentBuilder deploymentBuilder = processEngine.getRepositoryService().createDeployment().name(testClass.getSimpleName() + "." + methodName); for (String resource : resources) { deploymentBuilder.addClasspathResource(resource); } if (deploymentAnnotation.tenantId() != null && deploymentAnnotation.tenantId().length() > 0) { deploymentBuilder.tenantId(deploymentAnnotation.tenantId()); } deploymentId = deploymentBuilder.deploy().getId(); } return deploymentId; }
db.tenantId(tenantId); db.category(categoryId);
deploymentBuilder.tenantId(activiti6DeploymentBuilder.getDeployment().getTenantId());