use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.
the class ProcessDefinitionCandidateTest method shouldPropagateTenantIdToCandidateStarterUser.
@Test
public void shouldPropagateTenantIdToCandidateStarterUser() {
// when
DeploymentBuilder builder = repositoryService.createDeployment().addClasspathResource(CANDIDATE_STARTER_USER).tenantId(TENANT_ONE);
testRule.deploy(builder);
// then
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
List<IdentityLink> links = repositoryService.getIdentityLinksForProcessDefinition(processDefinition.getId());
assertEquals(1, links.size());
IdentityLink link = links.get(0);
assertNotNull(link.getTenantId());
assertEquals(TENANT_ONE, link.getTenantId());
}
use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.
the class ProcessDefinitionCandidateTest method shouldPropagateTenantIdToCandidateStarterGroup.
@Test
public void shouldPropagateTenantIdToCandidateStarterGroup() {
// when
DeploymentBuilder builder = repositoryService.createDeployment().addClasspathResource(CANDIDATE_STARTER_GROUP).tenantId(TENANT_ONE);
testRule.deploy(builder);
// then
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
List<IdentityLink> links = repositoryService.getIdentityLinksForProcessDefinition(processDefinition.getId());
assertEquals(1, links.size());
IdentityLink link = links.get(0);
assertNotNull(link.getTenantId());
assertEquals(TENANT_ONE, link.getTenantId());
}
use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.
the class MultiTenancyHistoricIdentityLinkLogQueryTest method identityLinksForProcessDefinitionWithTenantId.
@SuppressWarnings("deprecation")
@Test
public void identityLinksForProcessDefinitionWithTenantId() throws Exception {
String resourceName = "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml";
testRule.deployForTenant(TENANT_1, resourceName);
testRule.deployForTenant(TENANT_2, resourceName);
ProcessDefinition processDefinition1 = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).list().get(0);
assertNotNull(processDefinition1);
// Add candidate group with process definition 1
repositoryService.addCandidateStarterGroup(processDefinition1.getId(), GROUP_1);
// Add candidate user for process definition 2
repositoryService.addCandidateStarterUser(processDefinition1.getId(), USER_1);
ProcessDefinition processDefinition2 = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).list().get(1);
assertNotNull(processDefinition2);
// Add candidate group with process definition 2
repositoryService.addCandidateStarterGroup(processDefinition2.getId(), GROUP_1);
// Add candidate user for process definition 2
repositoryService.addCandidateStarterUser(processDefinition2.getId(), USER_1);
// Identity link test
List<IdentityLink> identityLinks = repositoryService.getIdentityLinksForProcessDefinition(processDefinition1.getId());
assertEquals(identityLinks.size(), 2);
assertEquals(identityLinks.get(0).getTenantId(), TENANT_1);
assertEquals(identityLinks.get(1).getTenantId(), TENANT_1);
identityLinks = repositoryService.getIdentityLinksForProcessDefinition(processDefinition2.getId());
assertEquals(identityLinks.size(), 2);
assertEquals(identityLinks.get(0).getTenantId(), TENANT_2);
assertEquals(identityLinks.get(1).getTenantId(), TENANT_2);
}
use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.
the class InvoiceTestCase method testHappyPathV2.
@Deployment(resources = { "invoice.v2.bpmn", "invoiceBusinessDecisions.dmn" })
public void testHappyPathV2() {
InputStream invoiceInputStream = InvoiceProcessApplication.class.getClassLoader().getResourceAsStream("invoice.pdf");
VariableMap variables = Variables.createVariables().putValue("creditor", "Great Pizza for Everyone Inc.").putValue("amount", 300.0d).putValue("invoiceCategory", "Travel Expenses").putValue("invoiceNumber", "GPFE-23232323").putValue("invoiceDocument", fileValue("invoice.pdf").file(invoiceInputStream).mimeType("application/pdf").create());
ProcessInstance pi = runtimeService.startProcessInstanceByKey("invoice", variables);
Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
assertEquals("approveInvoice", task.getTaskDefinitionKey());
List<IdentityLink> links = taskService.getIdentityLinksForTask(task.getId());
Set<String> approverGroups = new HashSet<String>();
for (IdentityLink link : links) {
approverGroups.add(link.getGroupId());
}
assertEquals(2, approverGroups.size());
assertTrue(approverGroups.contains("accounting"));
assertTrue(approverGroups.contains("sales"));
variables.clear();
variables.put("approved", Boolean.TRUE);
taskService.complete(task.getId(), variables);
task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
assertEquals("prepareBankTransfer", task.getTaskDefinitionKey());
taskService.complete(task.getId());
Job archiveInvoiceJob = managementService.createJobQuery().singleResult();
assertNotNull(archiveInvoiceJob);
managementService.executeJob(archiveInvoiceJob.getId());
assertProcessEnded(pi.getId());
}
use of org.camunda.bpm.engine.task.IdentityLink in project camunda-bpm-platform by camunda.
the class InvoiceTestCase method testHappyPathV1.
@Deployment(resources = { "invoice.v1.bpmn", "invoiceBusinessDecisions.dmn" })
public void testHappyPathV1() {
InputStream invoiceInputStream = InvoiceProcessApplication.class.getClassLoader().getResourceAsStream("invoice.pdf");
VariableMap variables = Variables.createVariables().putValue("creditor", "Great Pizza for Everyone Inc.").putValue("amount", 300.0d).putValue("invoiceCategory", "Travel Expenses").putValue("invoiceNumber", "GPFE-23232323").putValue("invoiceDocument", fileValue("invoice.pdf").file(invoiceInputStream).mimeType("application/pdf").create());
ProcessInstance pi = runtimeService.startProcessInstanceByKey("invoice", variables);
Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
assertEquals("approveInvoice", task.getTaskDefinitionKey());
List<IdentityLink> links = taskService.getIdentityLinksForTask(task.getId());
Set<String> approverGroups = new HashSet<String>();
for (IdentityLink link : links) {
approverGroups.add(link.getGroupId());
}
assertEquals(2, approverGroups.size());
assertTrue(approverGroups.contains("accounting"));
assertTrue(approverGroups.contains("sales"));
variables.clear();
variables.put("approved", Boolean.TRUE);
taskService.complete(task.getId(), variables);
task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
assertEquals("prepareBankTransfer", task.getTaskDefinitionKey());
taskService.complete(task.getId());
Job archiveInvoiceJob = managementService.createJobQuery().singleResult();
assertNotNull(archiveInvoiceJob);
managementService.executeJob(archiveInvoiceJob.getId());
assertProcessEnded(pi.getId());
}
Aggregations