Skip to content

Commit

Permalink
Chore: use Java Text Blocks (JDK15+)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbmalkovsky committed Nov 29, 2023
1 parent 63b8ca2 commit 1ad9965
Show file tree
Hide file tree
Showing 12 changed files with 193 additions and 173 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,21 @@
* @see <a href="https://github.com/flowable/flowable-engine/issues/474">Issue 474</a>
*/
class MultiInstanceTaskConverterTest {
private static final String PARTICIPANT_VALUE = "[\n" +
" {\n" +
" \"principalType\" : \"User\",\n" +
" \"role\" : \"PotentialOwner\",\n" +
" \"principal\" : \"wfuser1\",\n" +
" \"version\" : 1\n" +
" },\n" +
" {\n" +
" \"principalType\" : \"User\",\n" +
" \"role\" : \"PotentialOwner\",\n" +
" \"principal\" : \"wfuser2\",\n" +
" \"version\" : 1\n" +
" }\n" +
" ]";
private static final String PARTICIPANT_VALUE = """
[
{
"principalType" : "User",
"role" : "PotentialOwner",
"principal" : "wfuser1",
"version" : 1
},
{
"principalType" : "User",
"role" : "PotentialOwner",
"principal" : "wfuser2",
"version" : 1
}
]""";

@BpmnXmlConverterTest("multiinstancemodel.bpmn")
void validateModel(BpmnModel model) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,21 @@
* @see <a href="https://github.com/flowable/flowable-engine/issues/474">Issue 474</a>
*/
class MultiInstanceTaskConverterTest2 {
private static final String PARTICIPANT_VALUE = "[\n" +
" {\n" +
" \"principalType\" : \"User\",\n" +
" \"role\" : \"PotentialOwner\",\n" +
" \"principal\" : \"wfuser1\",\n" +
" \"version\" : 1\n" +
" },\n" +
" {\n" +
" \"principalType\" : \"User\",\n" +
" \"role\" : \"PotentialOwner\",\n" +
" \"principal\" : \"wfuser2\",\n" +
" \"version\" : 1\n" +
" }\n" +
" ]";
private static final String PARTICIPANT_VALUE = """
[
{
"principalType" : "User",
"role" : "PotentialOwner",
"principal" : "wfuser1",
"version" : 1
},
{
"principalType" : "User",
"role" : "PotentialOwner",
"principal" : "wfuser2",
"version" : 1
}
]""";

@BpmnXmlConverterTest("multiinstancemodel2.bpmn")
void validateModel(BpmnModel model) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,30 @@
*/
public class CaseWithFormTest extends AbstractProcessEngineIntegrationTest {

public static final String ONE_TASK_CASE = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<definitions xmlns=\"http://www.omg.org/spec/CMMN/20151109/MODEL\"\n"
+ " xmlns:flowable=\"http://flowable.org/cmmn\"\n"
+ "\n"
+ " targetNamespace=\"http://flowable.org/cmmn\">\n"
+ "\n"
+ "\n"
+ " <case id=\"oneTaskCaseWithForm\">\n"
+ " <casePlanModel id=\"myPlanModel\" name=\"My CasePlanModel\" flowable:formKey=\"form1\" flowable:formFieldValidation=\"CASE_VALIDATE_VALUE\">\n"
+ "\n"
+ " <planItem id=\"planItem1\" name=\"Task One\" definitionRef=\"theTask\" />\n"
+ "\n"
+ " <humanTask id=\"theTask\" name=\"The Task\" flowable:formKey=\"form1\" flowable:formFieldValidation=\"TASK_VALIDATE_VALUE\">\n"
+ " <extensionElements>\n"
+ " <flowable:taskListener event=\"create\" class=\"org.flowable.cmmn.test.validate.SideEffectTaskListener\"></flowable:taskListener>\n"
+ " <flowable:taskListener event=\"complete\" class=\"org.flowable.cmmn.test.validate.SideEffectTaskListener\"></flowable:taskListener>\n"
+ " </extensionElements>\n"
+ " </humanTask>\n"
+ "\n"
+ " </casePlanModel>\n"
+ " </case>\n"
+ "</definitions>\n";
public static final String ONE_TASK_CASE = """
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/CMMN/20151109/MODEL"
xmlns:flowable="http://flowable.org/cmmn"
targetNamespace="http://flowable.org/cmmn">
<case id="oneTaskCaseWithForm">
<casePlanModel id="myPlanModel" name="My CasePlanModel" flowable:formKey="form1" flowable:formFieldValidation="CASE_VALIDATE_VALUE">
<planItem id="planItem1" name="Task One" definitionRef="theTask" />
<humanTask id="theTask" name="The Task" flowable:formKey="form1" flowable:formFieldValidation="TASK_VALIDATE_VALUE">
<extensionElements>
<flowable:taskListener event="create" class="org.flowable.cmmn.test.validate.SideEffectTaskListener"></flowable:taskListener>
<flowable:taskListener event="complete" class="org.flowable.cmmn.test.validate.SideEffectTaskListener"></flowable:taskListener>
</extensionElements>
</humanTask>
</casePlanModel>
</case>
</definitions>
""";

@Rule
public MockitoRule mockitoRule = MockitoJUnit.rule().strictness(Strictness.STRICT_STUBS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,22 @@ public void testGetOrDefaultMultiExpressions() {
Map<String, Object> variables = new HashMap<>();
variables.put("loadRef", null);
VariableContainer variableContainer = new VariableContainerWrapper(variables);
assertThat(executeExpression("<ul>\n"
+ " <li><b>Reference:</b>${vars:getOrDefault(loadRef, 'unknown')}</li>\n"
+ " <li><b>Currency:</b>${vars:getOrDefault(currencyRef, 'unknown')} (looked up from first loads LoadCostCurrency.)</ls>\n"
+ " <li><b>Customer:</b>${vars:getOrDefault(custRef, 'unknown')} (looked up from load.CustomerId)</li>\n"
+ " <li><b>Vendor:</b>${vars:getOrDefault(vendorRef, 'unknown')} (looked up from load.HaulierId)</li>\n"
+ " <li><b>Item:</b>${vars:getOrDefault(itemRef, 'unknown')} (ref data based on companyId)</li>\n"
+ " </ul>", variableContainer))
.isEqualTo("<ul>\n"
+ " <li><b>Reference:</b>unknown</li>\n"
+ " <li><b>Currency:</b>unknown (looked up from first loads LoadCostCurrency.)</ls>\n"
+ " <li><b>Customer:</b>unknown (looked up from load.CustomerId)</li>\n"
+ " <li><b>Vendor:</b>unknown (looked up from load.HaulierId)</li>\n"
+ " <li><b>Item:</b>unknown (ref data based on companyId)</li>\n"
+ " </ul>");
assertThat(executeExpression("""
<ul>
<li><b>Reference:</b>${vars:getOrDefault(loadRef, 'unknown')}</li>
<li><b>Currency:</b>${vars:getOrDefault(currencyRef, 'unknown')} (looked up from first loads LoadCostCurrency.)</ls>
<li><b>Customer:</b>${vars:getOrDefault(custRef, 'unknown')} (looked up from load.CustomerId)</li>
<li><b>Vendor:</b>${vars:getOrDefault(vendorRef, 'unknown')} (looked up from load.HaulierId)</li>
<li><b>Item:</b>${vars:getOrDefault(itemRef, 'unknown')} (ref data based on companyId)</li>
</ul>""", variableContainer))
.isEqualTo("""
<ul>
<li><b>Reference:</b>unknown</li>
<li><b>Currency:</b>unknown (looked up from first loads LoadCostCurrency.)</ls>
<li><b>Customer:</b>unknown (looked up from load.CustomerId)</li>
<li><b>Vendor:</b>unknown (looked up from load.HaulierId)</li>
<li><b>Item:</b>unknown (ref data based on companyId)</li>
</ul>""");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,12 @@ public void setEventRegistry(EventRegistry eventRegistry) {
}

public void testSendXmlEvent() {
String event = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<customerEvent>\n"
+ " <customerId>12345</customerId>\n"
+ " <name>Customer name</name>\n"
+ "</customerEvent>";
String event = """
<?xml version="1.0" encoding="UTF-8"?>
<customerEvent>
<customerId>12345</customerId>
<name>Customer name</name>
</customerEvent>""";

eventRegistry.eventReceived(inboundChannelModel, event);
}
Expand Down
Loading

0 comments on commit 1ad9965

Please sign in to comment.