Package org.exoplatform.commons.serialization.model

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


public class TestObjectFactory extends AbstractGateInTest
{

   public void testCustomFactory() throws Exception
   {
      TypeDomain domain = new TypeDomain();
      domain.addTypeModel(A2.class);
      SerializationContext context = new SerializationContext(domain);
      context.addFactory(new A1());
      A2 a2 = new A2();
      assertSame(A1.instance, context.clone(a2));
   }
View Full Code Here


      assertSame(A1.instance, context.clone(a2));
   }

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

public class TestConverter extends AbstractGateInTest
{

   public void testConvertSerializedType() throws Exception
   {
      TypeDomain domain = new TypeDomain();
      domain.addTypeModel(A1.class);
      A1 a = new A1("foo");

      //
      A3.delegate = new TypeConverter<A1, A2>()
      {
View Full Code Here

      assertEquals("foo", a.state);
   }

   public void testConvertSerializableType() throws Exception
   {
      TypeDomain domain = new TypeDomain();
      domain.addTypeModel(B1.class);
      B1 b = new B1("foo");

      //
      SerializationContext context = new SerializationContext(domain);
      b = context.clone(b);
View Full Code Here

      assertEquals("foo", b.state);
   }

   public void testConverterWriteThrowsException() throws Exception
   {
      TypeDomain domain = new TypeDomain();
      domain.addTypeModel(A1.class);
      A1 a = new A1("foo");

      //
      final Exception e = new Exception();
      A3.delegate = new TypeConverter<A1, A2>()
View Full Code Here

      }
   }

   public void testConverterWriteReturnsNull() throws Exception
   {
      TypeDomain domain = new TypeDomain();
      domain.addTypeModel(A1.class);
      A1 a = new A1("foo");

      //
      A3.delegate = new TypeConverter<A1, A2>()
      {
View Full Code Here

      }
   }

   public void testConverterReadReturnsNull() throws Exception
   {
      TypeDomain domain = new TypeDomain();
      domain.addTypeModel(A1.class);
      A1 a = new A1("foo");

      //
      A3.delegate = new TypeConverter<A1, A2>()
      {
View Full Code Here

      }
   }

   public void testConverterReadThrowsException() throws Exception
   {
      TypeDomain domain = new TypeDomain();
      domain.addTypeModel(A1.class);
      A1 a = new A1("foo");

      //
      final Exception e = new Exception();
      A3.delegate = new TypeConverter<A1, A2>()
View Full Code Here

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

   public void testObjectClassType() throws Exception
   {
      DomainMetaData domainMD = new DomainMetaData();
      domainMD.addClassType(Object.class, false);
      TypeDomain typeDomain = new TypeDomain(domainMD);
      ClassTypeModel<Object> objectTM = (ClassTypeModel<Object>)typeDomain.addTypeModel(Object.class);
      assertEquals(SerializationMode.NONE, objectTM.getSerializationMode());
   }
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.