Package krati.io.serializer

Examples of krati.io.serializer.StringSerializer


        try {
            File storeDir = DirUtils.getTestDir(getClass());
            _store = new SimpleAvroStore<String>(
                    createDataStore(storeDir, 1000),
                    createSchema(),
                    new StringSerializer());
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here


* @since 09/25, 2011
*/
public class TestSerializer extends TestCase {
   
    public void testStringSerializer() {
        Serializer<String> serializer = new StringSerializer();
       
        String str1 = TestSerializer.class.getSimpleName();
        String str2 = serializer.deserialize(serializer.serialize(str1));
        assertEquals(str1, str2);
    }
View Full Code Here

       
        // STEP-1
        // Create simple event retention
        RetentionConfig<String> config = new RetentionConfig<String>(0, new File(homeDir, "EventBus"));
        config.setBatchSize(3000);
        config.setEventValueSerializer(new StringSerializer());
        config.setEventClockSerializer(new ClockSerializer());
        Retention<String> eventRetention = new SimpleRetention<String>(config);
       
        // STEP-2
        // Create water marks based vector clock
        List<String> sources = new ArrayList<String>();
        sources.add("Person");
        sources.add("Address");
        SourceWaterMarks sourceWaterMarks = new SourceWaterMarks(new File(homeDir, "sourceWaterMarks.scn"));
        WaterMarksClock waterMarksClock = new SourceWaterMarksClock(sources, sourceWaterMarks);
       
        // STEP-3
        // Create store configuration template
        StoreConfig configTemplate = new StoreConfig(homeDir, initialCapacity);
        configTemplate.setSegmentCompactFactor(0.68);
        configTemplate.setSegmentFactory(new MappedSegmentFactory());
        configTemplate.setSegmentFileSizeMB(32);
        configTemplate.setNumSyncBatches(2);
        configTemplate.setBatchSize(100);
       
        // Create multi-tenant store responder
        DataStoreFactory storeFactory = new IndexedDataStoreFactory();
        StoreResponderFactory responderFactory = new BasicDataStoreResponderFactory(storeFactory);
        MultiTenantStoreResponder mtStoreResponder = new MultiTenantStoreResponder(homeDir, configTemplate, responderFactory);
       
        String source;
        StoreResponder responder;
        DataStore<byte[], byte[]> baseStore;
        Serializer<String> keySerializer = new StringSerializer();
        Map<String, AvroStore<String>> map = new HashMap<String, AvroStore<String>>();
       
        // Create "Person" AvroStore
        source = "Person";
        responder = mtStoreResponder.createTenant(source);
View Full Code Here

public class AvroStoreBusHttpClient {
   
    public static void main(String[] args) throws Exception {
        URL url = new URL("http://localhost:8080");
        String source = "AvroStoreBusHttpServer";
        AvroStoreBusClientHttp<String> client = new AvroStoreBusClientHttp<String>(url, source, new StringSerializer());
       
        System.out.println(client.getSchema());
       
        String key;
        GenericRecord value;
View Full Code Here

public class AvroStoreJoinerHttpClient {
   
    public static void main(String[] args) throws Exception {
        URL url = new URL("http://localhost:8080");
        String source = "AvroStoreJoinerHttpServer";
        AvroStoreClientHttp<String> client = new AvroStoreClientHttp<String>(url, source, new StringSerializer());
       
        Chronos c = new Chronos();
       
        // get
        for(int i = 0; i < 100; i++) {
View Full Code Here

        MultiTenantStoreResponder mtStoreResponder = new MultiTenantStoreResponder(homeDir, configTemplate, responderFactory);
       
        String source;
        StoreResponder responder;
        DataStore<byte[], byte[]> baseStore;
        Serializer<String> keySerializer = new StringSerializer();
        Map<String, AvroStore<String>> map = new HashMap<String, AvroStore<String>>();
       
        // Create "Person" AvroStore
        source = "Person";
        responder = mtStoreResponder.createTenant(source);
View Full Code Here

    }
   
    public static void main(String[] args) throws Exception {
        URL url = new URL("http://localhost:8080");
        String source = "SingleAvroStoreHtterServerDemo";
        AvroStoreClientHttp<String> client = new AvroStoreClientHttp<String>(url, source, new StringSerializer());
       
        String key;
        GenericRecord value;
        Chronos c = new Chronos();
       
View Full Code Here

        return new RetentionPolicyOnSize(getNumRetentionBatches());
    }
   
    @Override
    protected Serializer<String> createEventValueSerializer() {
        return new StringSerializer();
    }
View Full Code Here

        batch.setCompletionTime(System.currentTimeMillis());
       
        EventBatchHeader header = batch.getHeader();
       
        SimpleEventBatchSerializer<String> batchSerializer =
            new SimpleEventBatchSerializer<String>(new StringSerializer(), new ClockSerializer());
        byte[] bytes = batchSerializer.serialize(batch);
        EventBatch<String> batch2 = batchSerializer.deserialize(bytes);
        EventBatchHeader header2 = batch2.getHeader();
       
        assertEquals(header.getVersion(), header2.getVersion());
View Full Code Here

TOP

Related Classes of krati.io.serializer.StringSerializer

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.