Package voldemort.serialization

Examples of voldemort.serialization.Serializer


    public void testMapTypeKeyOrder() {
        String typeSig = "{\"name\":\"string\", \"color\":\"string\", \"age\":\"int32\"}";
        Object data = ImmutableMap.of("name", "xxx", "color", "yyy", "age", 28);

        Serializer outOfOrderSerializer = new JsonTypeSerializer(new JsonTypeDefinition(ImmutableMap.of("name",
                                                                                                        JsonTypes.STRING,
                                                                                                        "color",
                                                                                                        JsonTypes.STRING,
                                                                                                        "age",
                                                                                                        JsonTypes.INT32)));
        assertEquals("Key order in Map should not matter while serializing/deserializing",
                     data,
                     outOfOrderSerializer.toObject(getSerializer(typeSig).toBytes(data)));

        outOfOrderSerializer = new JsonTypeSerializer(new JsonTypeDefinition(ImmutableMap.of("color",
                                                                                             JsonTypes.STRING,
                                                                                             "age",
                                                                                             JsonTypes.INT32,
                                                                                             "name",
                                                                                             JsonTypes.STRING)));
        assertEquals("Key order in Map should not matter while serializing/deserializing",
                     data,
                     outOfOrderSerializer.toObject(getSerializer(typeSig).toBytes(data)));

        outOfOrderSerializer = new JsonTypeSerializer(new JsonTypeDefinition(ImmutableMap.of("age",
                                                                                             JsonTypes.INT32,
                                                                                             "name",
                                                                                             JsonTypes.STRING,
                                                                                             "color",
                                                                                             JsonTypes.STRING)));
        assertEquals("Key order in Map should not matter while serializing/deserializing",
                     data,
                     outOfOrderSerializer.toObject(getSerializer(typeSig).toBytes(data)));

        outOfOrderSerializer = new JsonTypeSerializer(new JsonTypeDefinition(ImmutableMap.of("color",
                                                                                             JsonTypes.STRING,
                                                                                             "name",
                                                                                             JsonTypes.STRING,
                                                                                             "age",
                                                                                             JsonTypes.INT32)));
        assertEquals("Key order in Map should not matter while serializing/deserializing",
                     data,
                     outOfOrderSerializer.toObject(getSerializer(typeSig).toBytes(data)));

    }
View Full Code Here


        } else {

            // Local benchmark
            String storageEngineClass = benchmarkProps.getString(STORAGE_CONFIGURATION_CLASS);
            this.keyType = benchmarkProps.getString(KEY_TYPE, STRING_KEY_TYPE);
            Serializer serializer = findKeyType(this.keyType);
            Store<Object, Object, Object> store = null;

            StorageConfiguration conf = (StorageConfiguration) ReflectUtils.callConstructor(ReflectUtils.loadClass(storageEngineClass),
                                                                                            new Object[] { ServerTestUtils.getVoldemortConfig() });
View Full Code Here

                                                                           1000000));
            current++;
        }

        SerializerFactory factory = new DefaultSerializerFactory();
        Serializer keySerializer = factory.getSerializer(storeDefinition.getKeySerializer());
        Serializer valueSerializer = factory.getSerializer(storeDefinition.getValueSerializer());

        logger.info("Reading items...");
        int count = 0;
        ExternalSorter<KeyValuePair> sorter = new ExternalSorter<KeyValuePair>(new KeyValuePairSerializer(),
                                                                               new KeyMd5Comparator(),
View Full Code Here

            datas[current] = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(dataFile)));
            current++;
        }

        SerializerFactory factory = new DefaultSerializerFactory();
        Serializer keySerializer = factory.getSerializer(storeDefinition.getKeySerializer());
        Serializer valueSerializer = factory.getSerializer(storeDefinition.getValueSerializer());

        logger.info("Reading items...");
        int count = 0;
        ExternalSorter<KeyValuePair> sorter = new ExternalSorter<KeyValuePair>(new KeyValuePairSerializer(),
                                                                               new KeyMd5Comparator(),
View Full Code Here

TOP

Related Classes of voldemort.serialization.Serializer

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.