public virtual void testSingleEntryMapping() { ProcessInstance processInstance = startTestProcess("single entry"); assertEquals("foo", runtimeService.getVariable(processInstance.Id, "result")); assertEquals(Variables.stringValue("foo"), runtimeService.getVariableTyped(processInstance.Id, "result")); }
public virtual void testSingleEntry() { startTestProcess("single entry"); DmnDecisionResultEntries firstOutput = results.get(0); assertEquals("foo", firstOutput.FirstEntry); assertEquals(Variables.stringValue("foo"), firstOutput.FirstEntryTyped); }
public virtual void testCustomOutputMapping() { ProcessInstance processInstance = startTestProcess("multiple entries"); assertEquals("foo", runtimeService.getVariable(processInstance.Id, "result1")); assertEquals(Variables.stringValue("foo"), runtimeService.getVariableTyped(processInstance.Id, "result1")); assertEquals("bar", runtimeService.getVariable(processInstance.Id, "result2")); assertEquals(Variables.stringValue("bar"), runtimeService.getVariableTyped(processInstance.Id, "result2")); }
public virtual void testProcessVariableMapLocal() { BusinessProcess businessProcess = getBeanInstance(typeof(BusinessProcess)); businessProcess.startProcessByKey("businessProcessBeanTest"); VariableMap variables = (VariableMap)getBeanInstance("processVariableMapLocal"); assertNotNull(variables); /////////////////////////////////////////////////////////////////// // Put a variable via BusinessProcess and get it via VariableMap // /////////////////////////////////////////////////////////////////// string aValue = "aValue"; businessProcess.setVariableLocal(VARNAME_1, Variables.stringValue(aValue)); // Legacy API assertEquals(aValue, variables.get(VARNAME_1)); // Typed variable API TypedValue aTypedValue = variables.getValueTyped(VARNAME_1); assertEquals(ValueType.STRING, aTypedValue.Type); assertEquals(aValue, aTypedValue.Value); assertEquals(aValue, variables.getValue(VARNAME_1, typeof(string))); // Type API with wrong type try { variables.getValue(VARNAME_1, typeof(Integer)); fail("ClassCastException expected!"); } catch (System.InvalidCastException ex) { assertEquals("Cannot cast variable named 'aVariable' with value 'aValue' to type 'class java.lang.Integer'.", ex.Message); } /////////////////////////////////////////////////////////////////// // Put a variable via VariableMap and get it via BusinessProcess // /////////////////////////////////////////////////////////////////// string anotherValue = "anotherValue"; variables.put(VARNAME_2, Variables.stringValue(anotherValue)); // Legacy API assertEquals(anotherValue, businessProcess.getVariableLocal(VARNAME_2)); // Typed variable API TypedValue anotherTypedValue = businessProcess.getVariableLocalTyped(VARNAME_2); assertEquals(ValueType.STRING, anotherTypedValue.Type); assertEquals(anotherValue, anotherTypedValue.Value); }
public virtual void testSingleEntryList() { startTestProcess("single entry list"); assertEquals(2, results.size()); foreach (DmnDecisionResultEntries output in results) { assertEquals("foo", output.FirstEntry); assertEquals(Variables.stringValue("foo"), output.FirstEntryTyped); } }
public virtual void testMultipleEntries() { startTestProcess("multiple entries"); DmnDecisionResultEntries firstOutput = results.get(0); assertEquals("foo", firstOutput.get("result1")); assertEquals("bar", firstOutput.get("result2")); assertEquals(Variables.stringValue("foo"), firstOutput.getEntryTyped("result1")); assertEquals(Variables.stringValue("bar"), firstOutput.getEntryTyped("result2")); }
/* General test asserting that the business process bean is functional */ //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test @Deployment public void test() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void test() { BusinessProcess businessProcess = getBeanInstance(typeof(BusinessProcess)); // start the process businessProcess.startProcessByKey("businessProcessBeanTest").Id; // ensure that the process is started: assertNotNull(processEngine.RuntimeService.createProcessInstanceQuery().singleResult()); // ensure that there is a single task waiting Task task = processEngine.TaskService.createTaskQuery().singleResult(); assertNotNull(task); string value = "value"; businessProcess.setVariable("key", Variables.stringValue(value)); assertEquals(value, businessProcess.getVariable("key")); // Typed variable API TypedValue typedValue = businessProcess.getVariableTyped("key"); assertEquals(ValueType.STRING, typedValue.Type); assertEquals(value, typedValue.Value); // Local variables string localValue = "localValue"; businessProcess.setVariableLocal("localKey", Variables.stringValue(localValue)); assertEquals(localValue, businessProcess.getVariableLocal("localKey")); // Local typed variable API TypedValue typedLocalValue = businessProcess.getVariableLocalTyped("localKey"); assertEquals(ValueType.STRING, typedLocalValue.Type); assertEquals(localValue, typedLocalValue.Value); // complete the task assertEquals(task.Id, businessProcess.startTask(task.Id).Id); businessProcess.completeTask(); // assert the task is completed assertNull(processEngine.TaskService.createTaskQuery().singleResult()); // assert that the process is ended: assertNull(processEngine.RuntimeService.createProcessInstanceQuery().singleResult()); }
public virtual void testMultipleEntriesList() { startTestProcess("multiple entries list"); assertEquals(2, results.size()); foreach (DmnDecisionResultEntries output in results) { assertEquals(2, output.size()); assertEquals("foo", output.get("result1")); assertEquals("bar", output.get("result2")); assertEquals(Variables.stringValue("foo"), output.getEntryTyped("result1")); assertEquals(Variables.stringValue("bar"), output.getEntryTyped("result2")); } }
public override TypedValue convertValue(TypedValue propertyValue) { if (propertyValue is StringValue) { return(propertyValue); } else { object value = propertyValue.Value; if (value == null) { return(Variables.stringValue(null, propertyValue.Transient)); } else { return(Variables.stringValue(value.ToString(), propertyValue.Transient)); } } }
public override StringValue readValue(ValueFields valueFields) { return(Variables.stringValue(valueFields.TextValue)); }
public virtual StringValue convertToTypedValue(UntypedValueImpl untypedValue) { return(Variables.stringValue((string)untypedValue.Value, untypedValue.Transient)); }
public virtual void startProcessByKey() { name = "camunda"; untypedName = "untypedName"; typedName = Variables.stringValue("typedName"); }