Beispiel #1
0
//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)
        {
            JavaSerializable dataObject = (JavaSerializable)execution.getVariable("varName");

            Assert.assertNotNull(dataObject);
            Assert.assertEquals("foo", dataObject.Property);
        }
Beispiel #2
0
        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 (string.ReferenceEquals(property, null))
            {
                if (!string.ReferenceEquals(other.property, null))
                {
                    return(false);
                }
            }
            else if (!property.Equals(other.property))
            {
                return(false);
            }
            return(true);
        }
Beispiel #3
0
        public virtual void testSetJavaObjectSerializedEmptySerializationDataFormat()
        {
            ProcessInstance instance = runtimeService.startProcessInstanceByKey("oneTaskProcess");

            JavaSerializable javaSerializable = new JavaSerializable("foo");

            MemoryStream baos = new MemoryStream();

            (new ObjectOutputStream(baos)).writeObject(javaSerializable);
            string serializedObject = StringUtil.fromBytes(Base64.encodeBase64(baos.toByteArray()), engineRule.ProcessEngine);

            thrown.expect(typeof(ProcessEngineException));
            thrown.expectMessage("Cannot set variable with name simpleBean. Java serialization format is prohibited");

//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
            runtimeService.setVariable(instance.Id, "simpleBean", serializedObjectValue(serializedObject).objectTypeName(typeof(JavaSerializable).FullName).create());
        }
Beispiel #4
0
        public virtual void testSetJavaObject()
        {
            ProcessInstance instance = runtimeService.startProcessInstanceByKey("oneTaskProcess");

            JavaSerializable javaSerializable = new JavaSerializable("foo");

            runtimeService.setVariable(instance.Id, "simpleBean", objectValue(javaSerializable).serializationDataFormat(JAVA_DATA_FORMAT).create());

            // validate untyped value
            JavaSerializable value = (JavaSerializable)runtimeService.getVariable(instance.Id, "simpleBean");

            assertEquals(javaSerializable, value);

            // validate typed value
            ObjectValue typedValue = runtimeService.getVariableTyped(instance.Id, "simpleBean");

            assertObjectValueDeserialized(typedValue, javaSerializable);
            assertObjectValueSerializedJava(typedValue, javaSerializable);
        }