예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testTransientVariables() throws java.net.URISyntaxException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void testTransientVariables()
        {
            VariableMap variableMap = createVariables().putValueTyped("foo", doubleValue(10.0, true)).putValueTyped("bar", integerValue(10, true)).putValueTyped("aa", booleanValue(true, true)).putValueTyped("bb", stringValue("bb", true)).putValueTyped("test", byteArrayValue("test".GetBytes(), true)).putValueTyped("blob", fileValue(new File(this.GetType().ClassLoader.getResource("org/camunda/bpm/engine/test/variables/simpleFile.txt").toURI()), true)).putValueTyped("val", dateValue(DateTime.Now, true)).putValueTyped("var", objectValue(new int?(10), true).create()).putValueTyped("short", shortValue((short)12, true)).putValueTyped("long", longValue((long)10, true)).putValueTyped("file", fileValue("org/camunda/bpm/engine/test/variables/simpleFile.txt").setTransient(true).create()).putValueTyped("hi", untypedValue("stringUntyped", true)).putValueTyped("null", untypedValue(null, true)).putValueTyped("ser", serializedObjectValue("{\"name\" : \"foo\"}", true).create());

            foreach (KeyValuePair <string, object> e in variableMap.SetOfKeyValuePairs())
            {
                TypedValue value = (TypedValue)variableMap.getValueTyped(e.Key);
                assertTrue(value.Transient);
            }
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testVariableMapCompatibility()
        public virtual void testVariableMapCompatibility()
        {
            // test compatibility with Map<String, Object>
            VariableMap map1 = createVariables().putValue("foo", 10).putValue("bar", 20);

            // assert the map is assignable to Map<String,Object>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unused") java.util.Map<String, Object> assignable = map1;
            IDictionary <string, object> assignable = map1;

            VariableMap map2 = createVariables().putValueTyped("foo", integerValue(10)).putValueTyped("bar", integerValue(20));

            IDictionary <string, object> map3 = new Dictionary <string, object>();

            map3["foo"] = 10;
            map3["bar"] = 20;

            // equals()
            assertEquals(map1, map2);
            assertEquals(map2, map3);
            assertEquals(map1, fromMap(map1));
            assertEquals(map1, fromMap(map3));

            // hashCode()
            assertEquals(map1.GetHashCode(), map2.GetHashCode());
            assertEquals(map2.GetHashCode(), map3.GetHashCode());

            // values()
            VariableMap.ValueCollection values1 = map1.Values;
            VariableMap.ValueCollection values2 = map2.Values;
            IDictionary <string, object> .ValueCollection values3 = map3.Values;
            assertTrue(values1.containsAll(values2));
            assertTrue(values2.containsAll(values1));
            assertTrue(values2.containsAll(values3));
            assertTrue(values3.containsAll(values2));

            // entry set
            assertEquals(map1.SetOfKeyValuePairs(), map2.SetOfKeyValuePairs());
            assertEquals(map2.SetOfKeyValuePairs(), map3.SetOfKeyValuePairs());
        }