Package com.bubble.serializer.objects

Examples of com.bubble.serializer.objects.PrimitivePojo


public class MultipleTest {
  public static void main(String[] args) throws Exception {
    AbstractSerializeTest test1 = new AbstractSerializeTest(2000, 10) {
      protected Object createTestObject() {
        return new PrimitivePojo(true, (byte)1, (short)2, 3, 4, 5, 6, 'c');
      };
    };

    AbstractSerializeTest test2 = new AbstractSerializeTest(2000, 10) {
      protected Object createTestObject() {
View Full Code Here


    long longValue = generateLongTestValue();
    float floatValue = generateFloatTestValue();
    double doubleValue = generateDoubleTestValue();
    char charValue = generateCharTestValue();
   
    PrimitivePojo pojo = new PrimitivePojo(
        boolValue,
        byteValue,
        shortValue,
        intValue,
        longValue,
        floatValue,
        doubleValue,
        charValue
    );   
   
    SerializationContext ctx = new SerializationContext();
    ByteBuffer buffer = ByteBuffer.allocate(1024);
    ctx.serialize(pojo, buffer);
    buffer.flip();
    DeserializationContext dctx = new DeserializationContext();
    Object obj = dctx.deserialize(buffer);
    assertTrue("Object must be a PrimitivePojo", obj instanceof PrimitivePojo);
    PrimitivePojo response = (PrimitivePojo)obj;
    assertEquals(boolValue, response.isBooleanField());
    assertEquals(byteValue, response.getByteField());
    assertEquals(shortValue, response.getShortField());
    assertEquals(intValue, response.getIntField());
    assertEquals(longValue, response.getLongField());
    assertEquals(floatValue, response.getFloatField(), 0.0);
    assertEquals(doubleValue, response.getDoubleField(), 0.0);
    assertEquals(charValue, response.getCharField());
    System.out.println(pojo);
    System.out.println(response);
  }
View Full Code Here

    long longValue = generateLongTestValue();
    float floatValue = generateFloatTestValue();
    double doubleValue = generateDoubleTestValue();
    char charValue = generateCharTestValue();
   
    PrimitivePojo pojo = new PrimitivePojo(
        boolValue,
        byteValue,
        shortValue,
        intValue,
        longValue,
        floatValue,
        doubleValue,
        charValue
    );   
   
    SerializationContext ctx = new SerializationContext();
    ByteBuffer buffer = ByteBuffer.allocate(1024);
    ctx.serialize(pojo, buffer);
    buffer.flip();
    DeserializationContext dctx = new DeserializationContext();
    Object obj = dctx.deserialize(buffer);
    assertTrue("Object must be a PrimitivePojo", obj instanceof PrimitivePojo);
    PrimitivePojo response = (PrimitivePojo)obj;
    assertEquals(boolValue, response.isBooleanField());
    assertEquals(byteValue, response.getByteField());
    assertEquals(shortValue, response.getShortField());
    assertEquals(intValue, response.getIntField());
    assertEquals(longValue, response.getLongField());
    assertEquals(floatValue, response.getFloatField(), 0.0);
    assertEquals(doubleValue, response.getDoubleField(), 0.0);
    assertEquals(charValue, response.getCharField());
    System.out.println(pojo);
    System.out.println(response);
  }
View Full Code Here

TOP

Related Classes of com.bubble.serializer.objects.PrimitivePojo

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.