Exemple #1
0
        public void testGetUserTypeIdentifierWithUnknownTypeName()
        {
            var ctx = new SafeConfigurablePofContext();

            Assert.IsTrue(ctx.GetUserTypeIdentifier(typeof(NestedType).AssemblyQualifiedName)
                          == SafeConfigurablePofContext.TYPE_PORTABLE);
        }
Exemple #2
0
        public void testGetUserTypeIdentifierWithUnknownObject()
        {
            var ctx = new SafeConfigurablePofContext();

            Assert.IsTrue(ctx.GetUserTypeIdentifier(new NestedType())
                          == SafeConfigurablePofContext.TYPE_PORTABLE);
        }
Exemple #3
0
        public void testSerialization()
        {
            var ctx    = new SafeConfigurablePofContext();
            var uuid   = new UUID();
            var buffer = new MemoryStream(1024);

            ctx.Serialize(new DataWriter(buffer), uuid);

            buffer.Position = 0;
            Object o = ctx.Deserialize(new DataReader(buffer));

            Assert.AreEqual(o, uuid);

            var person = new PortablePerson("Aleksandar Seovic",
                                            new DateTime(74, 7, 24));

            person.Address  = new Address("208 Myrtle Ridge Rd", "Lutz", "FL", "33549");
            person.Children = new Person[]
            {
                new PortablePerson("Aleksandar Seovic JR.", new DateTime(174, 1, 1))
            };

            buffer.Position = 0;
            ctx.Serialize(new DataWriter(buffer), person);

            buffer.Position = 0;
            o = ctx.Deserialize(new DataReader(buffer));
            Assert.AreEqual(o, person);
        }
Exemple #4
0
        public void testGetUserTypeIdentifierWithUnknownType()
        {
            var ctx = new SafeConfigurablePofContext();

            Assert.IsTrue(ctx.GetUserTypeIdentifier(typeof(NestedType))
                          == SafeConfigurablePofContext.TYPE_PORTABLE);

            // COH-5584: repeat the test to verify that NestedType is now
            // cached in ConfigurablePofContext.
            Assert.IsTrue(ctx.GetUserTypeIdentifier(typeof(NestedType))
                          == SafeConfigurablePofContext.TYPE_PORTABLE);
        }
Exemple #5
0
        public void testEvolvableSerialization()
        {
            var ctx    = new SafeConfigurablePofContext();
            var person = new EvolvablePortablePerson("Aleksandar Seovic",
                                                     new DateTime(74, 7, 24));

            person.Address     = new Address("208 Myrtle Ridge Rd", "Lutz", "FL", "33549");
            person.DataVersion = 2;

            var buffer = new MemoryStream(1024);

            ctx.Serialize(new DataWriter(buffer), person);

            buffer.Position = 0;
            Object o = ctx.Deserialize(new DataReader(buffer));

            Assert.IsTrue((((EvolvablePortablePerson)o).DataVersion == 2));
            Assert.AreEqual(o, person);
        }
Exemple #6
0
        public void testSetSerializer()
        {
            IPofContext ctx = new ConfigurablePofContext("assembly://Coherence.Tests/Tangosol.Resources/s4hc-test-config.xml");
            var         set = new HashSet();

            Assert.IsTrue(ctx.IsUserType(set));
            Assert.IsTrue(ctx.IsUserType(typeof(HashSet)));
            Assert.IsTrue(ctx.IsUserType(typeof(HashSet).AssemblyQualifiedName));

            var buffer = new MemoryStream(1024);
            var writer = new DataWriter(buffer);

            ctx.Serialize(writer, new HashSet());

            var reader = new DataReader(buffer);

            buffer.Position = 0;
            object o = ctx.Deserialize(reader);

            Assert.IsTrue(o is HashSet);
            buffer.Close();

            ctx = new SafeConfigurablePofContext("assembly://Coherence.Tests/Tangosol.Resources/s4hc-test-config.xml");
            Assert.IsTrue(ctx.IsUserType(set));
            Assert.IsTrue(ctx.IsUserType(typeof(HashSet)));
            Assert.IsTrue(ctx.IsUserType(typeof(HashSet).AssemblyQualifiedName));

            buffer = new MemoryStream(1024);
            writer = new DataWriter(buffer);
            ctx.Serialize(writer, new HashSet());

            reader          = new DataReader(buffer);
            buffer.Position = 0;
            o = ctx.Deserialize(reader);
            Assert.IsTrue(o is HashSet);
            buffer.Close();
        }
Exemple #7
0
        public void testIsUserTypeWithKnownObject()
        {
            var ctx = new SafeConfigurablePofContext();

            Assert.IsTrue(ctx.IsUserType(new Exception()));
        }
Exemple #8
0
        public void testGetPofSerializerWithKnownTypeId()
        {
            var ctx = new SafeConfigurablePofContext();

            Assert.IsTrue(ctx.GetPofSerializer(1) is PortableObjectSerializer);
        }
Exemple #9
0
        public void testGetUserTypeIdentifierWithNullTypeName()
        {
            var ctx = new SafeConfigurablePofContext();

            ctx.GetUserTypeIdentifier((String)null);
        }
Exemple #10
0
        public void testIsUserTypeWithKnownTypeName()
        {
            var ctx = new SafeConfigurablePofContext();

            Assert.IsTrue(ctx.IsUserType(typeof(Exception).AssemblyQualifiedName));
        }
Exemple #11
0
        public void testGetUserTypeIdentifierWithPofType()
        {
            var ctx = new SafeConfigurablePofContext();

            ctx.GetUserTypeIdentifier(typeof(HashDictionary));
        }
Exemple #12
0
        public void testGetUserTypeIdentifierWithPofTypeName()
        {
            var ctx = new SafeConfigurablePofContext();

            ctx.GetUserTypeIdentifier(typeof(HashDictionary).AssemblyQualifiedName);
        }
Exemple #13
0
        public void testGetTypeWithUnknownTypeId()
        {
            var ctx = new SafeConfigurablePofContext();

            ctx.GetType(12358);
        }
Exemple #14
0
        public void testGetTypeWithNegativeTypeId()
        {
            var ctx = new SafeConfigurablePofContext();

            ctx.GetType(-1);
        }
Exemple #15
0
        public void testIsUserTypeWithPofObject()
        {
            var ctx = new SafeConfigurablePofContext();

            Assert.IsFalse(ctx.IsUserType(new HashDictionary()));
        }
Exemple #16
0
        public void testIsUserTypeWithUnknownObject()
        {
            var ctx = new SafeConfigurablePofContext();

            Assert.IsFalse(ctx.IsUserType(this));
        }
Exemple #17
0
        public void testIsUserTypeWithNullObject()
        {
            var ctx = new SafeConfigurablePofContext();

            ctx.IsUserType((Object)null);
        }
Exemple #18
0
        public void testGetUserTypeIdentifierWithKnownTypeName()
        {
            var ctx = new SafeConfigurablePofContext();

            Assert.IsTrue(ctx.GetUserTypeIdentifier(typeof(Exception).AssemblyQualifiedName) == 0);
        }
Exemple #19
0
        public void testGetPofSerializerWithUnknownTypeId()
        {
            var ctx = new SafeConfigurablePofContext();

            ctx.GetPofSerializer(12358);
        }
Exemple #20
0
        public void testGetPofSerializerWithNegativeTypeId()
        {
            var ctx = new SafeConfigurablePofContext();

            ctx.GetPofSerializer(-1);
        }
Exemple #21
0
        public void testGetTypeWithKnownTypeId()
        {
            var ctx = new SafeConfigurablePofContext();

            Assert.IsTrue(typeof(Exception).Equals(ctx.GetType(0)));
        }
Exemple #22
0
        public void testIsUserTypeWithNullTypeName()
        {
            var ctx = new SafeConfigurablePofContext();

            ctx.IsUserType((String)null);
        }
Exemple #23
0
        public void testGetUserTypeIdentifierWithNullObject()
        {
            var ctx = new SafeConfigurablePofContext();

            ctx.GetUserTypeIdentifier((object)null);
        }
Exemple #24
0
        public void testIsUserTypeWithUnknownTypeName()
        {
            var ctx = new SafeConfigurablePofContext();

            Assert.IsFalse(ctx.IsUserType(typeof(SafeConfigurablePofContextTests).AssemblyQualifiedName));
        }
Exemple #25
0
        public void testGetUserTypeIdentifierWithPofObject()
        {
            var ctx = new SafeConfigurablePofContext();

            ctx.GetUserTypeIdentifier(new HashDictionary());
        }
Exemple #26
0
        public void testIsUserTypeWithPofTypeName()
        {
            var ctx = new SafeConfigurablePofContext();

            Assert.IsFalse(ctx.IsUserType(typeof(HashDictionary).AssemblyQualifiedName));
        }