Package org.nustaq.serialization

Examples of org.nustaq.serialization.FSTConfiguration.asObject()


        FSTConfiguration conf = FSTConfiguration.createDefaultConfiguration();
        conf.registerClass(Versioning.class);

        byte[] bytes = conf.asByteArray(v);
        Versioning res = (Versioning) conf.asObject(bytes);

        assertTrue(DeepEquals.deepEquals(v,res));


        FSTConfiguration old = FSTConfiguration.createDefaultConfiguration();
View Full Code Here


    @Test
    public void testExternalizableOverride() {
        FSTConfiguration conf = FSTConfiguration.createDefaultConfiguration();
        Object original[] = {"A", new SubClassedAList().$("A").$("B").$("C"), "Ensure stream not corrupted" };
        Object deser = conf.asObject(conf.asByteArray(original));
        assertTrue( DeepEquals.deepEquals(original, deser) );
    }

    static class NotSer {
        int x;
View Full Code Here

    @Test
    public void testNotSerializable() {
        FSTConfiguration conf = FSTConfiguration.createDefaultConfiguration().setForceSerializable(true);
        NotSer ser = new NotSer(11,12);
        assertTrue(DeepEquals.deepEquals(ser, conf.asObject(conf.asByteArray(ser))) );
        NotSerSub sersub = new NotSerSub(11,12);
        final Object deser = conf.asObject(conf.asByteArray(sersub));
        assertTrue(DeepEquals.deepEquals(sersub, deser) );
        assertTrue(((NotSerSub) deser).pubConsCalled);
    }
View Full Code Here

    public void testNotSerializable() {
        FSTConfiguration conf = FSTConfiguration.createDefaultConfiguration().setForceSerializable(true);
        NotSer ser = new NotSer(11,12);
        assertTrue(DeepEquals.deepEquals(ser, conf.asObject(conf.asByteArray(ser))) );
        NotSerSub sersub = new NotSerSub(11,12);
        final Object deser = conf.asObject(conf.asByteArray(sersub));
        assertTrue(DeepEquals.deepEquals(sersub, deser) );
        assertTrue(((NotSerSub) deser).pubConsCalled);
    }

View Full Code Here

    // 1. serialize
    FSTConfiguration config = FSTConfiguration.createDefaultConfiguration();
    byte[] data2 = config.asByteArray(object);

    // 2. deserialize
    ExternalizableTestClass object2 = (ExternalizableTestClass) config.asObject(data2);

    Assert.assertEquals(1, object2.getInteger());
  }

}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.