Examples of TypeA


Examples of com.netflix.zeno.testpojos.TypeA

        FastBlobSchema listSchema = listSerializer.getFastBlobSchema();
        FastBlobSerializationRecord rec = new FastBlobSerializationRecord(listSchema);
        rec.setImageMembershipsFlags(FastBlobImageUtils.ONE_TRUE);

        List<TypeA> list = new ArrayList<TypeA>();
        list.add(new TypeA(3, 3));
        list.add(new TypeA(0, 0));
        list.add(null);
        list.add(new TypeA(2, 2));
        list.add(new TypeA(6, 6));
        list.add(new TypeA(5, 5));

        listSerializer.serialize(list, rec);

        FastBlobDeserializationRecord deserializationRec = createDeserializationRecord(listSchema, rec);

        FastBlobDeserializationRecord remappedRec = remapOrdinals(listSchema, deserializationRec);

        List<TypeA> typeAs = listSerializer.deserialize(remappedRec);

        Assert.assertEquals(6, typeAs.size());
        Assert.assertEquals(new TypeA(1, 1), typeAs.get(0));
        Assert.assertEquals(new TypeA(4, 4), typeAs.get(1));
        Assert.assertNull(typeAs.get(2));
        Assert.assertEquals(new TypeA(2, 2), typeAs.get(3));
    }
View Full Code Here

Examples of com.netflix.zeno.testpojos.TypeA

        FastBlobSchema setSchema = setSerializer.getFastBlobSchema();
        FastBlobSerializationRecord rec = new FastBlobSerializationRecord(setSchema);
        rec.setImageMembershipsFlags(FastBlobImageUtils.ONE_TRUE);

        Set<TypeA> set = new HashSet<TypeA>();
        set.add(new TypeA(1, 1));
        set.add(new TypeA(4, 4));
        set.add(null);

        setSerializer.serialize(set, rec);

        FastBlobDeserializationRecord deserializationRec = createDeserializationRecord(setSchema, rec);

        FastBlobDeserializationRecord remappedRec = remapOrdinals(setSchema, deserializationRec);

        Set<TypeA> typeAs = setSerializer.deserialize(remappedRec);

        Assert.assertEquals(3, typeAs.size());
        Assert.assertTrue(typeAs.contains(new TypeA(3, 3)));
        Assert.assertTrue(typeAs.contains(new TypeA(0, 0)));
        Assert.assertTrue(typeAs.contains(null));
    }
View Full Code Here

Examples of com.netflix.zeno.testpojos.TypeA

        FastBlobSchema mapSchema = mapSerializer.getFastBlobSchema();
        FastBlobSerializationRecord rec = new FastBlobSerializationRecord(mapSchema);
        rec.setImageMembershipsFlags(FastBlobImageUtils.ONE_TRUE);

        Map<TypeA, TypeA> map = new HashMap<TypeA, TypeA>();
        map.put(new TypeA(1, 1), new TypeA(4, 4));
        map.put(new TypeA(3, 3), new TypeA(1, 1));
        map.put(null, new TypeA(1, 1));
        map.put(new TypeA(4, 4), null);

        mapSerializer.serialize(map, rec);

        FastBlobDeserializationRecord deserializationRec = createDeserializationRecord(mapSchema, rec);

        FastBlobDeserializationRecord remappedRec = remapOrdinals(mapSchema, deserializationRec);

        Map<TypeA, TypeA> typeAs = mapSerializer.deserialize(remappedRec);

        Assert.assertEquals(4, typeAs.size());
        Assert.assertEquals(new TypeA(0, 0), typeAs.get(new TypeA(3, 3)));
        Assert.assertEquals(new TypeA(3, 3), typeAs.get(new TypeA(1, 1)));
        Assert.assertEquals(new TypeA(3, 3), typeAs.get(null));
        Assert.assertEquals(null, typeAs.get(new TypeA(0, 0)));
    }
View Full Code Here

Examples of com.netflix.zeno.testpojos.TypeA

        NFTypeSerializer<TypeD> serializer = stateEngine.getSerializer("TypeD");
        FastBlobSchema typeDSchema = serializer.getFastBlobSchema();
        FastBlobSerializationRecord rec = new FastBlobSerializationRecord(typeDSchema);
        rec.setImageMembershipsFlags(FastBlobImageUtils.ONE_TRUE);

        TypeD typeD = new TypeD(100, new TypeA(3, 3));

        serializer.serialize(typeD, rec);

        FastBlobDeserializationRecord deserializationRec = createDeserializationRecord(typeDSchema, rec);

        FastBlobDeserializationRecord remappedRec = remapOrdinals(typeDSchema, deserializationRec);

        TypeD deserializedTypeD = serializer.deserialize(remappedRec);

        Assert.assertEquals(Integer.valueOf(100), deserializedTypeD.getVal());
        Assert.assertEquals(new TypeA(1, 1), deserializedTypeD.getTypeA());
    }
View Full Code Here

Examples of com.netflix.zeno.testpojos.TypeA

    @Test
    public void canReserializeDeserializedData() throws Exception {
        FastBlobStateEngine stateEngine = typeAStateEngine();

        stateEngine.add("TypeA", new TypeA(1, 2));
        stateEngine.add("TypeA", new TypeA(3, 4));

        stateEngine.prepareForWrite();

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
View Full Code Here

Examples of com.netflix.zeno.testpojos.TypeA

    @Test
    public void serializesAndDeserializesDeltas() throws Exception {
        serializationState = new FastBlobStateEngine(serializersFactory);

        cache("TypeA", new TypeA(1, 2));
        cache("TypeA", new TypeA(3, 4));

        serializeAndDeserializeSnapshot();

        cache("TypeA", new TypeA(1, 2));
        cache("TypeA", new TypeA(5, 6));

        serializeAndDeserializeDelta();

        final List<TypeA>allAs = getAll("TypeA");

        Assert.assertEquals(2, allAs.size());
        Assert.assertTrue(allAs.contains(new TypeA(1, 2)));
        Assert.assertTrue(allAs.contains(new TypeA(5, 6)));
        Assert.assertFalse(allAs.contains(new TypeA(3, 4)));
    }
View Full Code Here

Examples of com.netflix.zeno.testpojos.TypeA

    @Test
    public void serializeObjects() throws Exception {
        serializationState = new FastBlobStateEngine(serializersFactory);

        cache("TypeA", new TypeA(23523452, 2));
        cache("TypeB", new TypeB(3, "four"));

        serializeAndDeserializeSnapshot();

        final List<TypeA> typeAList = getAll("TypeA");
View Full Code Here

Examples of com.netflix.zeno.testpojos.TypeA

    @Test
    public void deserializeWithoutKnowingAboutSomeObjectTypes() throws Exception {
        serializationState = new FastBlobStateEngine(serializersFactory);

        cache("TypeA", new TypeA(23523452, 2));
        cache("TypeB", new TypeB(3, "four"));

        final byte data[] = serializeSnapshot();
        serializationState = new FastBlobStateEngine(serializersFactory);
        deserializeSnapshot(data);
View Full Code Here

Examples of com.netflix.zeno.testpojos.TypeA

    @Test
    public void deserializedObjectsShareReferences() throws Exception {
        serializationState = new FastBlobStateEngine(serializersFactory);

        final TypeA theTypeA = new TypeA(1, 2);

        cache("TypeA", theTypeA);

        cache("TypeD", new TypeD(1, theTypeA));
        cache("TypeD", new TypeD(2, theTypeA));
View Full Code Here

Examples of com.netflix.zeno.testpojos.TypeA

        Assert.assertTrue(getAll("TypeB").contains(deserializedC.getTypeBs().get(1)));
    }

    private Map<String, TypeA> typeAMap() {
        final Map<String, TypeA> map = new HashMap<String, TypeA>();
        map.put("ED", new TypeA(12, 34));
        map.put("BR", new TypeA(56, 78));
        return map;
    }
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.