public void Init()
        {
            m_char   = 'C';
            m_bool   = true;
            m_byte   = 0x74;
            m_sbyte  = 0x67;
            m_int16  = 0xab;
            m_uint16 = 0x2dd5;
            m_int32  = 0x2345abdc;
            m_uint32 = 0x2a65c434;
            m_long   = 324897980;
            m_ulong  = 238749898;
            m_float  = 23324.324f;
            m_double = 3243298498d;

            m_string = "gfestring";

            m_boolArray  = new bool[] { true, false, true };
            m_byteArray  = new byte[] { 0x34, 0x64 };
            m_sbyteArray = new byte[] { 0x34, 0x64 };

            m_charArray = new char[] { 'c', 'v' };

            long ticks = 634460644691540000L;

            m_dateTime = new DateTime(ticks);
            Console.WriteLine(m_dateTime.Ticks);

            m_int16Array  = new short[] { 0x2332, 0x4545 };
            m_uint16Array = new short[] { 0x3243, 0x3232 };

            m_int32Array  = new int[] { 23, 676868, 34343, 2323 };
            m_uint32Array = new int[] { 435, 234324, 324324, 23432432 };

            m_longArray  = new long[] { 324324L, 23434545L };
            m_ulongArray = new Int64[] { 3245435, 3425435 };

            m_floatArray  = new float[] { 232.565f, 2343254.67f };
            m_doubleArray = new double[] { 23423432d, 4324235435d };

            m_byteByteArray = new byte[][] { new byte[] { 0x23 },
                                             new byte[] { 0x34, 0x55 } };

            m_stringArray = new string[] { "one", "two" };

            m_arraylist = new List <object>();
            m_arraylist.Add(1);
            m_arraylist.Add(2);

            m_LinkedList = new LinkedList <Object>();
            m_LinkedList.AddFirst("Item1");
            m_LinkedList.AddLast("Item2");
            m_LinkedList.AddLast("Item3");


            m_map = new Dictionary <object, object>();
            m_map.Add(1, 1);
            m_map.Add(2, 2);

            m_hashtable = new Hashtable();
            m_hashtable.Add(1, "1111111111111111");
            m_hashtable.Add(2, "2222222222221111111111111111");

            m_vector = new ArrayList();
            m_vector.Add(1);
            m_vector.Add(2);
            m_vector.Add(3);

            m_chs.Add(1);
            m_clhs.Add(1);
            m_clhs.Add(2);
            m_pdxEnum = pdxEnumTest.pdx3;

            m_address = new AddressR[10];

            for (int i = 0; i < m_address.Length; i++)
            {
                m_address[i] = new AddressR(i, "street" + i, "city" + i);
            }
        }
Exemple #2
0
        public void Init()
        {
            m_char   = 'C';
            m_bool   = true;
            m_byte   = 0x74;
            m_sbyte  = 0x67;
            m_int16  = 0xab;
            m_uint16 = 0x2dd5;
            m_int32  = 0x2345abdc;
            m_uint32 = 0x2a65c434;
            m_long   = 324897980;
            m_ulong  = 238749898;
            m_float  = 23324.324f;
            m_double = 3243298498d;

            m_string = "gfestring";

            m_boolArray  = new bool[] { true, false, true };
            m_byteArray  = new byte[] { 0x34, 0x64 };
            m_sbyteArray = new byte[] { 0x34, 0x64 };

            m_charArray = new char[] { 'c', 'v' };

            DateTime n = new DateTime((62135596800000 /*epoch*/ + 1310447869154) * 10000, DateTimeKind.Utc);

            m_dateTime = n.ToLocalTime();

            Debug.WriteLine(m_dateTime.Ticks);

            m_int16Array  = new short[] { 0x2332, 0x4545 };
            m_uint16Array = new short[] { 0x3243, 0x3232 };

            m_int32Array  = new int[] { 23, 676868, 34343, 2323 };
            m_uint32Array = new int[] { 435, 234324, 324324, 23432432 };

            m_longArray  = new long[] { 324324L, 23434545L };
            m_ulongArray = new Int64[] { 3245435, 3425435 };

            m_floatArray  = new float[] { 232.565f, 2343254.67f };
            m_doubleArray = new double[] { 23423432d, 4324235435d };

            m_byteByteArray = new byte[][] { new byte[] { 0x23 },
                                             new byte[] { 0x34, 0x55 } };

            m_stringArray = new string[] { "one", "two" };

            m_arraylist = new List <object>();
            m_arraylist.Add(1);
            m_arraylist.Add(2);


            m_map = new Dictionary <object, object>();
            m_map.Add(1, 1);
            m_map.Add(2, 2);

            m_hashtable = new Hashtable();
            m_hashtable.Add(1, "1111111111111111");
            m_hashtable.Add(2, "2222222222221111111111111111");

            m_vector = new ArrayList();
            m_vector.Add(1);
            m_vector.Add(2);
            m_vector.Add(3);

            m_chs.Add(1);
            m_clhs.Add(1);
            m_clhs.Add(2);

            m_pdxEnum = pdxEnumTest.pdx2;

            m_address = new Address[10];

            for (int i = 0; i < 10; i++)
            {
                m_address[i] = new Address(i + 1, "street" + i.ToString(), "city" + i.ToString());
            }

            m_objectArray = new List <object>();
            for (int i = 0; i < 10; i++)
            {
                m_objectArray.Add(new Address(i + 1, "street" + i.ToString(), "city" + i.ToString()));
            }
        }
        public void BuiltInSerializableTypes()
        {
            using (var cluster = new Cluster(output, CreateTestCaseDirectoryName(), 1, 1))
            {
                Assert.True(cluster.Start());
                Assert.Equal(0, cluster.Gfsh.create()
                             .region()
                             .withName("testRegion")
                             .withType("REPLICATE")
                             .execute());

                var cache = cluster.CreateCache();

                var region = cache.CreateRegionFactory(RegionShortcut.PROXY)
                             .SetPoolName("default")
                             .Create <object, object>("testRegion");
                Assert.NotNull(region);

                putAndCheck(region, "CacheableString", "foo");
                putAndCheck(region, "CacheableByte", (Byte)8);
                putAndCheck(region, "CacheableInt16", (Int16)16);
                putAndCheck(region, "CacheableInt32", (Int32)32);
                putAndCheck(region, "CacheableInt64", (Int64)64);
                putAndCheck(region, "CacheableBoolean", (Boolean)true);
                putAndCheck(region, "CacheableCharacter", 'c');
                putAndCheck(region, "CacheableDouble", (Double)1.5);
                putAndCheck(region, "CacheableFloat", (float)2.5);

                putAndCheck(region, "CacheableStringArray", new String[] { "foo", "bar" });
                putAndCheck(region, "CacheableBytes", new Byte[] { 8, 8 });
                putAndCheck(region, "CacheableInt16Array", new Int16[] { 16, 16 });
                putAndCheck(region, "CacheableInt32Array", new Int32[] { 32, 32 });
                putAndCheck(region, "CacheableInt64Array", new Int64[] { 64, 64 });
                putAndCheck(region, "CacheableBooleanArray", new Boolean[] { true, false });
                putAndCheck(region, "CacheableCharacterArray", new Char[] { 'c', 'a' });
                putAndCheck(region, "CacheableDoubleArray", new Double[] { 1.5, 1.7 });
                putAndCheck(region, "CacheableFloatArray", new float[] { 2.5F, 2.7F });

                putAndCheck(region, "CacheableDate", new DateTime());

                putAndCheck(region, "CacheableHashMap", new Dictionary <int, string>()
                {
                    { 1, "one" }, { 2, "two" }
                });
                putAndCheck(region, "CacheableHashTable", new Hashtable()
                {
                    { 1, "one" }, { 2, "two" }
                });
                putAndCheck(region, "CacheableVector", new ArrayList()
                {
                    "one", "two"
                });
                putAndCheck(region, "CacheableArrayList", new List <string>()
                {
                    "one", "two"
                });
                putAndCheck(region, "CacheableLinkedList", new LinkedList <object>(new string[] { "one", "two" }));
                putAndCheck(region, "CacheableStack", new Stack <object>(new string[] { "one", "two" }));

                {
                    var cacheableHashSet = new CacheableHashSet();
                    cacheableHashSet.Add("one");
                    cacheableHashSet.Add("two");
                    putAndCheck(region, "CacheableHashSet", cacheableHashSet);
                }

                {
                    var cacheableLinkedHashSet = new CacheableLinkedHashSet();
                    cacheableLinkedHashSet.Add("one");
                    cacheableLinkedHashSet.Add("two");
                    putAndCheck(region, "CacheableLinkedHashSet", cacheableLinkedHashSet);
                }

                cache.TypeRegistry.RegisterPdxType(PdxType.CreateDeserializable);
                putAndCheck(region, "PdxType", new PdxType());
            }
        }