コード例 #1
0
        /// <summary>
        /// This test ensures that when the <seealso cref="ProcessApplicationContext"/> API is used,
        /// the context switch is only performed for outer-most command and not if a second, nested
        /// command is executed; => in nested commands, the engine is already in the correct context
        /// </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test @OperateOnDeployment("pa1") public void testNoContextSwitchOnInnerCommand() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void testNoContextSwitchOnInnerCommand()
        {
            ProcessInstance pi = withProcessApplicationContext(new CallableAnonymousInnerClass(this)
                                                               , "pa2");

            JsonSerializable expectedJsonSerializable = RuntimeServiceDelegate.createJsonSerializable();
            string           expectedJsonString       = expectedJsonSerializable.toExpectedJsonString(JsonDataFormatConfigurator.DATE_FORMAT);

            SerializableValue serializedValue  = runtimeService.getVariableTyped(pi.Id, RuntimeServiceDelegate.VARIABLE_NAME, false);
            string            actualJsonString = serializedValue.ValueSerialized;

            ObjectMapper objectMapper     = new ObjectMapper();
            JsonNode     actualJsonTree   = objectMapper.readTree(actualJsonString);
            JsonNode     expectedJsonTree = objectMapper.readTree(expectedJsonString);

            // JsonNode#equals makes a deep comparison
            Assert.assertEquals(expectedJsonTree, actualJsonTree);
        }