示例#1
0
        public virtual void testSelectHistoricSerializedValuesUpdate()
        {
            ProcessInstance instance = runtimeService.startProcessInstanceByKey("oneTaskProcess");

            JsonSerializable bean = new JsonSerializable("a String", 42, false);

            runtimeService.setVariable(instance.Id, "simpleBean", objectValue(bean).serializationDataFormat(JSON_FORMAT_NAME));

            if (ProcessEngineConfiguration.HISTORY_FULL.Equals(processEngineConfiguration.History))
            {
                HistoricVariableUpdate historicUpdate = (HistoricVariableUpdate)historyService.createHistoricDetailQuery().variableUpdates().singleResult();

                assertNotNull(historicUpdate.Value);
                assertNull(historicUpdate.ErrorMessage);

                assertEquals(ValueType.OBJECT.Name, historicUpdate.TypeName);
                assertEquals(ValueType.OBJECT.Name, historicUpdate.VariableTypeName);

                JsonSerializable historyValue = (JsonSerializable)historicUpdate.Value;
                assertEquals(bean.StringProperty, historyValue.StringProperty);
                assertEquals(bean.IntProperty, historyValue.IntProperty);
                assertEquals(bean.BooleanProperty, historyValue.BooleanProperty);

                ObjectValue typedValue = (ObjectValue)historicUpdate.TypedValue;
                assertEquals(JSON_FORMAT_NAME, typedValue.SerializationDataFormat);
                JSONAssert.assertEquals(bean.toExpectedJsonString(), new string(typedValue.ValueSerialized), true);
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
                assertEquals(typeof(JsonSerializable).FullName, typedValue.ObjectTypeName);
            }
        }
示例#2
0
        public virtual void testSelectHistoricSerializedValues()
        {
            if (processEngineConfiguration.HistoryLevel.Id >= org.camunda.bpm.engine.impl.history.HistoryLevel_Fields.HISTORY_LEVEL_AUDIT.Id)
            {
                ProcessInstance instance = runtimeService.startProcessInstanceByKey("oneTaskProcess");

                JsonSerializable bean = new JsonSerializable("a String", 42, false);
                runtimeService.setVariable(instance.Id, "simpleBean", objectValue(bean).serializationDataFormat(JSON_FORMAT_NAME));

                HistoricVariableInstance historicVariable = historyService.createHistoricVariableInstanceQuery().singleResult();
                assertNotNull(historicVariable.Value);
                assertNull(historicVariable.ErrorMessage);

                ObjectValue typedValue = (ObjectValue)historicVariable.TypedValue;
                assertEquals(JSON_FORMAT_NAME, typedValue.SerializationDataFormat);
                JSONAssert.assertEquals(bean.toExpectedJsonString(), new string(typedValue.ValueSerialized), true);
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
                assertEquals(typeof(JsonSerializable).FullName, typedValue.ObjectTypeName);
            }
        }