public void checkEquality(PdxTypesReflectionTest other) { byte[][] baa = other.m_byteByteArray; m_byteByteArray = compareByteByteArray(baa, m_byteByteArray); m_char = GenericValCompare(other.m_char, m_char); m_bool = GenericValCompare(other.m_bool, m_bool); m_boolArray = GenericCompare(other.m_boolArray, m_boolArray); m_byte = GenericValCompare(other.m_byte, m_byte); m_byteArray = GenericCompare(other.m_byteArray, m_byteArray); m_charArray = GenericCompare(other.m_charArray, m_charArray); List <object> tmpl = new List <object>(); m_arraylist = compareCompareCollection(other.m_arraylist, m_arraylist); m_LinkedList = compareCompareCollection(other.m_LinkedList, m_LinkedList); IDictionary <object, object> tmpM = other.m_map; if (tmpM.Count != m_map.Count) { throw new IllegalStateException("Not got expected value for type: " + m_map.GetType().ToString()); } Hashtable tmpH = other.m_hashtable; if (tmpH.Count != m_hashtable.Count) { throw new IllegalStateException("Not got expected value for type: " + m_hashtable.GetType().ToString()); } ArrayList arrAl = other.m_vector; if (arrAl.Count != m_vector.Count) { throw new IllegalStateException("Not got expected value for type: " + m_vector.GetType().ToString()); } CacheableHashSet rmpChs = other.m_chs; if (rmpChs.Count != m_chs.Count) { throw new IllegalStateException("Not got expected value for type: " + m_chs.GetType().ToString()); } CacheableLinkedHashSet rmpClhs = other.m_clhs; if (rmpClhs.Count != m_clhs.Count) { throw new IllegalStateException("Not got expected value for type: " + m_clhs.GetType().ToString()); } m_string = GenericValCompare(other.m_string, m_string); m_dateTime = compareData(other.m_dateTime, m_dateTime); m_double = GenericValCompare(other.m_double, m_double); m_doubleArray = GenericCompare(other.m_doubleArray, m_doubleArray); m_float = GenericValCompare(other.m_float, m_float); m_floatArray = GenericCompare(other.m_floatArray, m_floatArray); m_int16 = GenericValCompare(other.m_int16, m_int16); m_int32 = GenericValCompare(other.m_int32, m_int32); m_long = GenericValCompare(other.m_long, m_long); m_int32Array = GenericCompare(other.m_int32Array, m_int32Array); m_longArray = GenericCompare(other.m_longArray, m_longArray); m_int16Array = GenericCompare(other.m_int16Array, m_int16Array); m_sbyte = GenericValCompare(other.m_sbyte, m_sbyte); m_sbyteArray = GenericCompare(other.m_sbyteArray, m_sbyteArray); m_stringArray = GenericCompare(other.m_stringArray, m_stringArray); m_uint16 = GenericValCompare(other.m_uint16, m_uint16); m_uint32 = GenericValCompare(other.m_uint32, m_uint32); m_ulong = GenericValCompare(other.m_ulong, m_ulong); m_uint32Array = GenericCompare(other.m_uint32Array, m_uint32Array); m_ulongArray = GenericCompare(other.m_ulongArray, m_ulongArray); m_uint16Array = GenericCompare(other.m_uint16Array, m_uint16Array); byte[] ret = other.m_byte252; if (ret.Length != 252) { throw new Exception("Array len 252 not found"); } ret = other.m_byte253; if (ret.Length != 253) { throw new Exception("Array len 253 not found"); } ret = other.m_byte65535; if (ret.Length != 65535) { throw new Exception("Array len 65535 not found"); } ret = other.m_byte65536; if (ret.Length != 65536) { throw new Exception("Array len 65536 not found"); } if (other.m_pdxEnum != m_pdxEnum) { throw new Exception("Pdx enum is not equal"); } //byte[] m_byte252 = new byte[252]; //byte[] m_byte253 = new byte[253]; //byte[] m_byte65535 = new byte[65535]; //byte[] m_byte65536 = new byte[65536]; AddressR[] otherA = other.m_address; for (int i = 0; i < m_address.Length; i++) { if (!m_address[i].Equals(otherA[i])) { throw new Exception("AddressR array is not equal " + i); } } }
public void FromData(IPdxReader reader) { //byte[][] baa = reader.ReadArrayOfByteArrays("m_byteByteArray"); //m_byteByteArray = compareByteByteArray(baa, m_byteByteArray); //bool bl = reader.ReadBoolean("m_bool"); //m_bool = compareBool(bl, m_bool); //m_boolArray = compareBoolArray(reader.ReadBooleanArray("m_boolArray"), m_boolArray); //m_byte = compareByte(reader.ReadByte("m_byte"), m_byte); //m_byteArray = compareByteArray(reader.ReadByteArray("m_byteArray"), m_byteArray); //m_charArray = compareCharArray(reader.ReadCharArray("m_charArray"), m_charArray); //List<object> tmpl = new List<object>(); //reader.ReadCollection("m_list", tmpl); //m_list = compareCompareCollection(tmpl, m_list); //m_dateTime = compareData(reader.ReadDate("m_dateTime"), m_dateTime); //m_double = compareDouble(reader.ReadDouble("m_double"), m_double); //m_doubleArray = compareDoubleArray(reader.ReadDoubleArray("m_doubleArray"), m_doubleArray); //m_float = compareFloat(reader.ReadFloat("m_float"), m_float); //m_floatArray = compareFloatArray(reader.ReadFloatArray("m_floatArray"), m_floatArray); //m_int16 = compareInt16(reader.ReadInt16("m_int16"), m_int16); //m_int32 = compareInt32(reader.ReadInt32("m_int32"), m_int32); //m_long = compareInt64(reader.ReadInt64("m_long"), m_long); //m_int32Array = compareIntArray(reader.ReadIntArray("m_int32Array"), m_int32Array); //m_longArray = compareLongArray(reader.ReadLongArray("m_longArray"), m_longArray); //m_int16Array = compareSHortArray(reader.ReadShortArray("m_int16Array"), m_int16Array); //m_sbyte = compareSByte(reader.ReadSByte("m_sbyte"), m_sbyte); //m_sbyteArray = compareSByteArray(reader.ReadSByteArray("m_sbyteArray"), m_sbyteArray); //m_stringArray = compareStringArray(reader.ReadStringArray("m_stringArray"), m_stringArray); //m_uint16 = compareUInt16(reader.ReadUInt16("m_uint16"), m_uint16); //m_uint32 = compareUInt32(reader.ReadUInt32("m_uint32") , m_uint32); //m_ulong = compareUint64(reader.ReadUInt64("m_ulong"), m_ulong); //m_uint32Array = compareUnsignedIntArray(reader.ReadUnsignedIntArray("m_uint32Array"), m_uint32Array); //m_ulongArray = compareUnsignedLongArray(reader.ReadUnsignedLongArray("m_ulongArray"), m_ulongArray); //m_uint16Array = compareUnsignedShortArray(reader.ReadUnsignedShortArray("m_uint16Array"), m_uint16Array); byte[][] baa = reader.ReadArrayOfByteArrays("m_byteByteArray"); m_byteByteArray = compareByteByteArray(baa, m_byteByteArray); m_char = GenericValCompare(reader.ReadChar("m_char"), m_char); bool bl = reader.ReadBoolean("m_bool"); m_bool = GenericValCompare(bl, m_bool); m_boolArray = GenericCompare(reader.ReadBooleanArray("m_boolArray"), m_boolArray); m_byte = GenericValCompare(reader.ReadByte("m_byte"), m_byte); m_byteArray = GenericCompare(reader.ReadByteArray("m_byteArray"), m_byteArray); m_charArray = GenericCompare(reader.ReadCharArray("m_charArray"), m_charArray); List <object> tmpl = new List <object>(); tmpl = (List <object>)reader.ReadObject("m_arraylist"); m_arraylist = compareCompareCollection(tmpl, m_arraylist); IDictionary <object, object> tmpM = (IDictionary <object, object>)reader.ReadObject("m_map"); if (tmpM.Count != m_map.Count) { throw new IllegalStateException("Not got expected value for type: " + m_map.GetType().ToString()); } Hashtable tmpH = (Hashtable)reader.ReadObject("m_hashtable"); if (tmpH.Count != m_hashtable.Count) { throw new IllegalStateException("Not got expected value for type: " + m_hashtable.GetType().ToString()); } ArrayList arrAl = (ArrayList)reader.ReadObject("m_vector"); if (arrAl.Count != m_vector.Count) { throw new IllegalStateException("Not got expected value for type: " + m_vector.GetType().ToString()); } CacheableHashSet rmpChs = (CacheableHashSet)reader.ReadObject("m_chs"); if (rmpChs.Count != m_chs.Count) { throw new IllegalStateException("Not got expected value for type: " + m_chs.GetType().ToString()); } CacheableLinkedHashSet rmpClhs = (CacheableLinkedHashSet)reader.ReadObject("m_clhs"); if (rmpClhs.Count != m_clhs.Count) { throw new IllegalStateException("Not got expected value for type: " + m_clhs.GetType().ToString()); } m_string = GenericValCompare(reader.ReadString("m_string"), m_string); m_dateTime = compareData(reader.ReadDate("m_dateTime"), m_dateTime); m_double = GenericValCompare(reader.ReadDouble("m_double"), m_double); m_doubleArray = GenericCompare(reader.ReadDoubleArray("m_doubleArray"), m_doubleArray); m_float = GenericValCompare(reader.ReadFloat("m_float"), m_float); m_floatArray = GenericCompare(reader.ReadFloatArray("m_floatArray"), m_floatArray); m_int16 = GenericValCompare(reader.ReadShort("m_int16"), m_int16); m_int32 = GenericValCompare(reader.ReadInt("m_int32"), m_int32); m_long = GenericValCompare(reader.ReadLong("m_long"), m_long); m_int32Array = GenericCompare(reader.ReadIntArray("m_int32Array"), m_int32Array); m_longArray = GenericCompare(reader.ReadLongArray("m_longArray"), m_longArray); m_int16Array = GenericCompare(reader.ReadShortArray("m_int16Array"), m_int16Array); m_sbyte = GenericValCompare(reader.ReadByte("m_sbyte"), m_sbyte); m_sbyteArray = GenericCompare(reader.ReadByteArray("m_sbyteArray"), m_sbyteArray); m_stringArray = GenericCompare(reader.ReadStringArray("m_stringArray"), m_stringArray); m_uint16 = GenericValCompare(reader.ReadShort("m_uint16"), m_uint16); m_uint32 = GenericValCompare(reader.ReadInt("m_uint32"), m_uint32); m_ulong = GenericValCompare(reader.ReadLong("m_ulong"), m_ulong); m_uint32Array = GenericCompare(reader.ReadIntArray("m_uint32Array"), m_uint32Array); m_ulongArray = GenericCompare(reader.ReadLongArray("m_ulongArray"), m_ulongArray); m_uint16Array = GenericCompare(reader.ReadShortArray("m_uint16Array"), m_uint16Array); byte[] ret = reader.ReadByteArray("m_byte252"); if (ret.Length != 252) { throw new Exception("Array len 252 not found"); } ret = reader.ReadByteArray("m_byte253"); if (ret.Length != 253) { throw new Exception("Array len 253 not found"); } ret = reader.ReadByteArray("m_byte65535"); if (ret.Length != 65535) { throw new Exception("Array len 65535 not found"); } ret = reader.ReadByteArray("m_byte65536"); if (ret.Length != 65536) { throw new Exception("Array len 65536 not found"); } pdxEnumTest retenum = (pdxEnumTest)reader.ReadObject("m_pdxEnum"); if (retenum != m_pdxEnum) { throw new Exception("Enum is not equal"); } //byte[] m_byte252 = new byte[252]; //byte[] m_byte253 = new byte[253]; //byte[] m_byte65535 = new byte[65535]; //byte[] m_byte65536 = new byte[65536]; Address[] addressArray = (Address[])reader.ReadObject("m_address"); { for (int i = 0; i < m_address.Length; i++) { if (!m_address[i].Equals(addressArray[i])) { Debug.WriteLine(m_address[i]); Debug.WriteLine(addressArray[i]); throw new Exception("Address array not mateched " + i); } } } List <object> retoa = reader.ReadObjectArray("m_objectArray"); for (int i = 0; i < m_objectArray.Count; i++) { if (!m_objectArray[i].Equals(retoa[i])) { throw new Exception("Object array not mateched " + i); } } }
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()); } }