protected internal override bool canWriteValue(TypedValue value) { if (value == null || value.Type == null) { // untyped value return(false); } return(value.Type.Name.Equals(Name)); }
public virtual void execute(DelegateExecution execution) { execution.setVariable("jsonVariable", Variables.untypedValue(jsonValue("{}"), true)); // when TypedValue typedValue = execution.getVariableTyped("jsonVariable"); // then assertThat(typedValue.Transient, @is(true)); }
protected internal override bool canWriteValue(TypedValue value) { if (isDeserializedObjectValue(value) || value is UntypedValueImpl) { return(value.Value == null || mappings.isJPAEntity(value.Value)); } else { return(false); } }
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); }
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: public org.camunda.bpm.engine.impl.variable.serializer.TypedValueSerializer<?> getSerializer(org.camunda.bpm.engine.variable.value.TypedValue value) public virtual TypedValueSerializer <object> getSerializer(TypedValue value) { if (value is ObjectValue) { ObjectValue objectValue = (ObjectValue)value; if (objectValue.SerializationDataFormat != null && !objectValue.Deserialized) { return(new FallbackSpinObjectValueSerializer(objectValue.SerializationDataFormat)); } } return(null); }
public virtual void testProcessVariableTypeAnnotation() { BusinessProcess businessProcess = getBeanInstance(typeof(BusinessProcess)); VariableMap variables = Variables.createVariables().putValue("injectedValue", "camunda"); businessProcess.startProcessByKey("keyOfTheProcess", variables); TypedValue value = getBeanInstance(typeof(DeclarativeProcessController)).InjectedValue; assertNotNull(value); assertTrue(value is StringValue); assertEquals(ValueType.STRING, value.Type); assertEquals("camunda", value.Value); }
/* 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 bool matches(object argument) { if (argument == null || !argument.GetType().IsAssignableFrom(typeof(TypedValue))) { return(false); } TypedValue typedValue = (TypedValue)argument; if (type_Renamed != null && !type_Renamed.Equals(typedValue.Type)) { return(false); } return(true); }
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 virtual object mapDecisionResult(DmnDecisionResult decisionResult) { try { TypedValue typedValue = decisionResult.SingleEntryTyped; if (typedValue != null) { return(typedValue); } else { return(Variables.untypedNullValue()); } } catch (DmnEngineException e) { throw LOG.decisionResultMappingException(decisionResult, this, e); } }
public virtual void testStartProcessByKey() { assertNull(runtimeService.createProcessInstanceQuery().singleResult()); getBeanInstance(typeof(DeclarativeProcessController)).startProcessByKey(); BusinessProcess businessProcess = getBeanInstance(typeof(BusinessProcess)); assertNotNull(runtimeService.createProcessInstanceQuery().singleResult()); assertEquals("camunda", businessProcess.getVariable("name")); TypedValue nameTypedValue = businessProcess.getVariableTyped("name"); assertNotNull(nameTypedValue); assertTrue(nameTypedValue is StringValue); assertEquals(ValueType.STRING, nameTypedValue.Type); assertEquals("camunda", nameTypedValue.Value); assertEquals("untypedName", businessProcess.getVariable("untypedName")); TypedValue untypedNameTypedValue = businessProcess.getVariableTyped("untypedName"); assertNotNull(untypedNameTypedValue); assertTrue(untypedNameTypedValue is StringValue); assertEquals(ValueType.STRING, untypedNameTypedValue.Type); assertEquals("untypedName", untypedNameTypedValue.Value); assertEquals("typedName", businessProcess.getVariable("typedName")); TypedValue typedNameTypedValue = businessProcess.getVariableTyped("typedName"); assertNotNull(typedNameTypedValue); assertTrue(typedNameTypedValue is StringValue); assertEquals(ValueType.STRING, typedNameTypedValue.Type); assertEquals("typedName", typedNameTypedValue.Value); businessProcess.startTask(taskService.createTaskQuery().singleResult().Id); businessProcess.completeTask(); }
public virtual MockVariableInstanceBuilder typedValue(TypedValue value) { this.typedValue_Renamed = value; return(this); }
protected internal override bool canWriteValue(TypedValue value) { return(value.Value == null); }
public virtual MockHistoricVariableUpdateBuilder typedValue(TypedValue value) { this.typedValue_Renamed = value; return(this); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception public virtual void execute(DelegateExecution execution) { TypedValue typedValue = execution.getVariableTyped("varName", false); Assert.assertNotNull(typedValue); }
public virtual VariableInstanceEntity build(string name, TypedValue value, bool isTransient) { return(VariableInstanceEntity.create(name, value, isTransient)); }
public virtual SimpleVariableInstance build(string name, TypedValue value, bool isTransient) { return(new SimpleVariableInstance(name, value)); }
public override TypedValue convertToModelValue(TypedValue propertyValue) { return(convertValue(propertyValue)); }
protected internal virtual bool isDeserializedObjectValue(TypedValue value) { return(value is ObjectValue && ((ObjectValue)value).Deserialized); }
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: public org.camunda.bpm.engine.impl.variable.serializer.TypedValueSerializer<?> getSerializer(org.camunda.bpm.engine.variable.value.TypedValue value) public virtual TypedValueSerializer <object> getSerializer(TypedValue value) { return(new ExampleSerializer()); }
protected internal abstract TypedValue convertValue(TypedValue propertyValue);
public SimpleVariableInstance(string name, TypedValue value) { this.name = name; this.value = value; }