public virtual void testSerializationAsJava() { ProcessInstance instance = runtimeService.startProcessInstanceByKey("oneTaskProcess"); JavaSerializable bean = new JavaSerializable("a String", 42, true); // request object to be serialized as Java runtimeService.setVariable(instance.Id, "simpleBean", objectValue(bean).serializationDataFormat(Variables.SerializationDataFormats.JAVA).create()); // validate untyped value object value = runtimeService.getVariable(instance.Id, "simpleBean"); assertEquals(bean, value); // validate typed value ObjectValue typedValue = runtimeService.getVariableTyped(instance.Id, "simpleBean"); assertEquals(ValueType.OBJECT, typedValue.Type); assertTrue(typedValue.Deserialized); assertEquals(bean, typedValue.Value); assertEquals(bean, typedValue.getValue(typeof(JavaSerializable))); assertEquals(typeof(JavaSerializable), typedValue.ObjectType); assertEquals(Variables.SerializationDataFormats.JAVA.Name, typedValue.SerializationDataFormat); //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: assertEquals(typeof(JavaSerializable).FullName, typedValue.ObjectTypeName); }
public override bool Equals(object obj) { if (this == obj) { return(true); } if (obj == null) { return(false); } if (this.GetType() != obj.GetType()) { return(false); } JavaSerializable other = (JavaSerializable)obj; if (booleanProperty != other.booleanProperty) { return(false); } if (intProperty != other.intProperty) { return(false); } if (string.ReferenceEquals(stringProperty, null)) { if (!string.ReferenceEquals(other.stringProperty, null)) { return(false); } } else if (!stringProperty.Equals(other.stringProperty)) { return(false); } return(true); }