Package org.exoplatform.commons.serialization.model

Examples of org.exoplatform.commons.serialization.model.TypeDomain


   public void testStringSerializedClassType() throws Exception
   {
      DomainMetaData domainMD = new DomainMetaData();
      domainMD.addClassType(String.class, true);
      TypeDomain typeDomain = new TypeDomain(domainMD);
      ClassTypeModel<String> stringTM = (ClassTypeModel<String>)typeDomain.addTypeModel(String.class);
      assertEquals(SerializationMode.SERIALIZED, stringTM.getSerializationMode());
   }
View Full Code Here


   public void testStringClassType() throws Exception
   {
      DomainMetaData domainMD = new DomainMetaData();
      domainMD.addClassType(String.class, false);
      TypeDomain typeDomain = new TypeDomain(domainMD);
      ClassTypeModel<String> stringTM = (ClassTypeModel<String>)typeDomain.addTypeModel(String.class);
      assertEquals(SerializationMode.SERIALIZABLE, stringTM.getSerializationMode());
   }
View Full Code Here

   public void testThreadConvertedType() throws Exception
   {
      DomainMetaData domainMD = new DomainMetaData();
      domainMD.addConvertedType(Thread.class, ThreadTypeConverter.class);
      TypeDomain typeDomain = new TypeDomain(domainMD);
      ConvertedTypeModel<Thread, String> objectTM = (ConvertedTypeModel<Thread, String>)typeDomain.addTypeModel(Thread.class);
      assertEquals(ThreadTypeConverter.class, objectTM.getConverterJavaType());
   }
View Full Code Here

   public void testArrayListConvertedType() throws Exception
   {
      DomainMetaData domainMD = new DomainMetaData();
      domainMD.addConvertedType(ArrayList.class, ArrayListTypeConverter.class);
      TypeDomain typeDomain = new TypeDomain(domainMD);
      ConvertedTypeModel<ArrayList, LinkedList> arrayListTM = (ConvertedTypeModel<ArrayList, LinkedList>)typeDomain.addTypeModel(ArrayList.class);
      assertEquals(ArrayListTypeConverter.class, arrayListTM.getConverterJavaType());
   }
View Full Code Here

public class TestSerialization extends AbstractGateInTest
{

   public void testState() throws Exception
   {
      TypeDomain domain = new TypeDomain();
      domain.addTypeModel(A.class);
      A a = new A();
      a.a = "foo";
      a.b = 2;
      a.c = true;
      SerializationContext context = new SerializationContext(domain);
View Full Code Here

      assertEquals(true, a.c);
   }

   public void testMultipleReference1() throws Exception
   {
      TypeDomain domain = new TypeDomain();
      domain.addTypeModel(B.class);
      B b = new B();
      b.ref = new B(b);
      SerializationContext context = new SerializationContext(domain);
      b = context.clone(b);
      assertNotNull(b.ref);
View Full Code Here

      assertSame(b, b.ref.ref);
   }

   public void testStaticField() throws Exception
   {
      TypeDomain domain = new TypeDomain();
      domain.addTypeModel(D.class);
      D d = new D();
      d.b = "bar";
      SerializationContext context = new SerializationContext(domain);
      byte[] bytes =  context.write(d);
      D.a = "foo";
View Full Code Here

      assertEquals("bar", d.b);
   }

   public void testMultipleReference2() throws Exception
   {
      TypeDomain domain = new TypeDomain();
      domain.addTypeModel(E2.class);
      E2 e = new E2();
      e.left = new E2();
      ((E2)e.left).left = new E1();
      ((E2)e.left).right = new E1();
      e.right = new E2();
View Full Code Here

      assertSame(((E2)e.left).right, ((E2)e.right).right);
   }

   public void testListOfReplicatable() throws Exception
   {
      TypeDomain domain = new TypeDomain();
      domain.addTypeModel(F.class);

      //
      F f1 = new F();
      F f2 = new F();
      f1.children.add(f2);
View Full Code Here

      assertSame(f1, f1.children.get(0).parent);
   }

   public void testNotSerializable() throws Exception
   {
      TypeDomain domain = new TypeDomain();
      domain.addTypeModel(ByteArrayInputStream.class);

      SerializationContext context = new SerializationContext(domain);
      try
      {
         context.write(new ByteArrayInputStream(new byte[0]));
View Full Code Here

TOP

Related Classes of org.exoplatform.commons.serialization.model.TypeDomain

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.