diff --git a/examples/invoice/src/main/java/org/camunda/bpm/example/invoice/InvoiceProcessApplication.java b/examples/invoice/src/main/java/org/camunda/bpm/example/invoice/InvoiceProcessApplication.java
index 2f83444c240..a3f9d0fcf0f 100644
--- a/examples/invoice/src/main/java/org/camunda/bpm/example/invoice/InvoiceProcessApplication.java
+++ b/examples/invoice/src/main/java/org/camunda/bpm/example/invoice/InvoiceProcessApplication.java
@@ -84,7 +84,7 @@ public void createDeployment(String processArchiveName, DeploymentBuilder deploy
repositoryService.createDeployment(this.getReference())
.addInputStream("invoice.v1.bpmn", classLoader.getResourceAsStream("invoice.v1.bpmn"))
.addInputStream("invoiceBusinessDecisions.dmn", classLoader.getResourceAsStream("invoiceBusinessDecisions.dmn"))
- .addInputStream("review-invoice.cmmn", classLoader.getResourceAsStream("review-invoice.cmmn"))
+ .addInputStream("reviewInvoice.bpmn", classLoader.getResourceAsStream("reviewInvoice.bpmn"))
.deploy();
}
}
diff --git a/examples/invoice/src/main/resources/META-INF/processes.xml b/examples/invoice/src/main/resources/META-INF/processes.xml
index 35509387264..21ac2ba46b4 100644
--- a/examples/invoice/src/main/resources/META-INF/processes.xml
+++ b/examples/invoice/src/main/resources/META-INF/processes.xml
@@ -8,7 +8,7 @@
default
invoice.v2.bpmn
invoiceBusinessDecisions.dmn
- review-invoice.cmmn
+ reviewInvoice.bpmn
false
false
diff --git a/examples/invoice/src/main/resources/invoice.v1.bpmn b/examples/invoice/src/main/resources/invoice.v1.bpmn
index 7b1679838ca..101218a8889 100644
--- a/examples/invoice/src/main/resources/invoice.v1.bpmn
+++ b/examples/invoice/src/main/resources/invoice.v1.bpmn
@@ -1,5 +1,5 @@
-
+
@@ -9,10 +9,10 @@
-
- approveInvoice
- invoice_approved
- ServiceTask_06mdb3v
+
+ prepareBankTransfer
+ invoiceProcessed
+ ServiceTask_1
assignApprover
@@ -21,22 +21,23 @@
invoiceNotProcessed
reviewInvoice
-
- prepareBankTransfer
- invoiceProcessed
- ServiceTask_1
+
+ approveInvoice
+ invoice_approved
+ ServiceTask_06mdb3v
+
Approve the invoice (or not).
- if(!!task.getVariable('approver')) {
task.setAssignee(approver);
-}]]>
+}
-
+ task.setVariable('approver', task.getAssignee());
sequenceFlow_178
@@ -48,19 +49,6 @@
invoiceNotApproved
invoiceApproved
-
- ${!approved}
-
-
-
-
- ${approved}
-
-
- ${clarified}
-
-
-
SequenceFlow_1
sequenceFlow_178
@@ -68,7 +56,6 @@
SequenceFlow_1
-
sequenceFlow_183
reviewNotSuccessful
@@ -78,6 +65,11 @@
Prepare the bank transfer.
SequenceFlow_1pcdtz2
SequenceFlow_2
+
+
+ DataStoreReference_1
+ Property_16iplb1
+
SequenceFlow_3
@@ -86,12 +78,6 @@
SequenceFlow_2
SequenceFlow_3
-
- ${!clarified}
-
-
-
-
reviewNotSuccessful
@@ -99,7 +85,7 @@
invoiceApproved
SequenceFlow_1pcdtz2
-
+
@@ -111,161 +97,179 @@
invoiceNotApproved
sequenceFlow_183
-
+
+
+
+
+ ${!clarified}
+
+
+
+
+ ${clarified}
+
+
+ ${approved}
+
+
+
+
+ ${!approved}
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
+
+
+
-
+
-
-
+
+
-
-
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
+
+
+
-
+
-
-
+
+
-
+
-
-
-
-
+
+
+
+
-
+
-
-
+
+
-
+
-
+
-
-
+
+
-
+
-
-
+
+
-
-
-
-
+
+
+
+
-
+
-
+
+
+
+
+
diff --git a/examples/invoice/src/main/resources/invoice.v2.bpmn b/examples/invoice/src/main/resources/invoice.v2.bpmn
index be8f91c3b0b..8159dffde37 100644
--- a/examples/invoice/src/main/resources/invoice.v2.bpmn
+++ b/examples/invoice/src/main/resources/invoice.v2.bpmn
@@ -1,5 +1,5 @@
-
+
@@ -9,9 +9,10 @@
-
- approveInvoice
- invoice_approved
+
+ prepareBankTransfer
+ invoiceProcessed
+ ServiceTask_1
reviewSuccessful_gw
@@ -20,22 +21,22 @@
invoiceNotProcessed
reviewInvoice
-
- prepareBankTransfer
- invoiceProcessed
- ServiceTask_1
+
+ approveInvoice
+ invoice_approved
+
Approve the invoice (or not).
- if(!!task.getVariable('approver')) {
task.setAssignee(approver);
-}]]>
+}
-
+ task.setVariable('approver', task.getAssignee());
sequenceFlow_178
@@ -56,32 +57,19 @@
Prepare the bank transfer.
invoiceApproved
SequenceFlow_2
+
+
+ DataStoreReference_1
+ Property_0bzbsgl
+
-
- ${!approved}
-
-
-
-
- ${approved}
-
-
- ${!clarified}
-
-
- ${clarified}
-
-
SequenceFlow_1
sequenceFlow_178
-
-
SequenceFlow_1
-
reviewNotSuccessful
@@ -92,8 +80,7 @@
SequenceFlow_2
SequenceFlow_3
-
-
+
@@ -105,151 +92,168 @@
invoiceNotApproved
sequenceFlow_183
-
+
+
+
+
+
+ ${clarified}
+
+
+ ${!clarified}
+
+
+ ${approved}
+
+
+
+
+ ${!approved}
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
+
+
+
-
+
-
-
+
+
-
-
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
-
+
-
-
+
+
-
+
-
-
-
-
+
+
+
+
-
+
-
-
+
+
-
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
+
+
+
+
diff --git a/examples/invoice/src/main/resources/review-invoice.cmmn b/examples/invoice/src/main/resources/review-invoice.cmmn
deleted file mode 100644
index 4512dbe8ee0..00000000000
--- a/examples/invoice/src/main/resources/review-invoice.cmmn
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
-
-
-
- complete
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/invoice/src/main/resources/reviewInvoice.bpmn b/examples/invoice/src/main/resources/reviewInvoice.bpmn
new file mode 100644
index 00000000000..fbdf01e59f7
--- /dev/null
+++ b/examples/invoice/src/main/resources/reviewInvoice.bpmn
@@ -0,0 +1,50 @@
+
+
+
+
+ SequenceFlow_1ggutts
+
+
+
+
+ SequenceFlow_0vvoxt0
+
+
+
+ SequenceFlow_1ggutts
+ SequenceFlow_144f11w
+
+
+ SequenceFlow_144f11w
+ SequenceFlow_0vvoxt0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/invoice/src/test/java/org/camunda/bpm/example/invoice/InvoiceTestCase.java b/examples/invoice/src/test/java/org/camunda/bpm/example/invoice/InvoiceTestCase.java
index 00f240aeca2..db873c18177 100644
--- a/examples/invoice/src/test/java/org/camunda/bpm/example/invoice/InvoiceTestCase.java
+++ b/examples/invoice/src/test/java/org/camunda/bpm/example/invoice/InvoiceTestCase.java
@@ -141,7 +141,7 @@ public void testApproveInvoiceAssignment() {
.startBeforeActivity("approveInvoice")
.execute();
- // givent that the process instance is waiting at task "approveInvoice"
+ // given that the process instance is waiting at task "approveInvoice"
Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
assertEquals("approveInvoice", task.getTaskDefinitionKey());
@@ -163,7 +163,56 @@ public void testApproveInvoiceAssignment() {
// then the variable "approver" exists and is set to mary
assertEquals("mary", taskService.getVariable(task.getId(), "approver"));
+ }
+
+ @Deployment(resources= {"invoice.v2.bpmn", "reviewInvoice.bpmn", "invoiceBusinessDecisions.dmn"})
+ public void testNonSuccessfulPath() {
+ 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 links = taskService.getIdentityLinksForTask(task.getId());
+ Set approverGroups = new HashSet();
+ 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.FALSE);
+ taskService.complete(task.getId(), variables);
+
+ task = taskService.createTaskQuery().singleResult();
+
+ assertEquals("assignReviewer", task.getTaskDefinitionKey());
+ variables.clear();
+ variables.put("reviewer", "peter");
+ taskService.complete(task.getId(), variables);
+
+ task = taskService.createTaskQuery().singleResult();
+
+ assertEquals("reviewInvoice", task.getTaskDefinitionKey());
+ variables.clear();
+ variables.put("clarified", Boolean.FALSE);
+ taskService.complete(task.getId(), variables);
+
+ assertProcessEnded(task.getProcessInstanceId());
+ assertProcessEnded(pi.getId());
}
+
}