Package krati.util

Examples of krati.util.SourceWaterMarks


*/
public class TestMultiSourceArrayStoreElement extends TestArrayStoreElement {
 
  public void testMultiSource() throws Exception {
    ScnFactory scnFactory = new SystemTimeScnFactory();
    SourceWaterMarks waterMarks = new SourceWaterMarks(new File(getStoreHomeDir(), "sourceWaterMarks.scn"));
   
    String sourceA = getClass().getSimpleName() + ".A";
    String sourceB = getClass().getSimpleName() + ".B";
    String sourceC = getClass().getSimpleName() + ".C";
   
View Full Code Here


public class TestVirtualArrayStoreElement extends TestArrayStoreElement {
 
  protected ArrayStoreElement<SimpleElement> createElementStore() throws Exception {
    String source = getClass().getSimpleName();
    ScnFactory scnFactory = new SystemTimeScnFactory();
    SourceWaterMarks waterMarks = new SourceWaterMarks(new File(getStoreHomeDir(), "sourceWaterMarks.scn"));
    ArrayStoreElement<SimpleElement> store = super.createElementStore();
   
    return new VirtualArrayStoreElement<SimpleElement>(source, scnFactory, store, waterMarks);
  }
View Full Code Here

        // 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);
View Full Code Here

        // 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 StorePartitionConfig(homeDir, arrayStoreIndexStart, arrayStoreCapacity);
View Full Code Here

   
    @Override
    protected void setUp() {
        try {
            _sourceWaterMarksFile = new File(DirUtils.getTestDir(getClass()), "sourceWaterMarks.scn");
            _sourceWaterMarks = new SourceWaterMarks(_sourceWaterMarksFile);
            ArrayList<String> sources = new ArrayList<String>();
            sources.add("member_picture");
            sources.add("member_profile");
            sources.add("member_flex_store");
            sources.add("member_contact");
View Full Code Here

            _sources.add(source1);
            _sources.add(source2);
            _sources.add(source3);
           
            File sourceWaterMarksFile = new File(getHomeDir(), "sourceWaterMarks.scn");
            SourceWaterMarks sourceWaterMarks = new SourceWaterMarks(sourceWaterMarksFile);
            _clock = new SourceWaterMarksClock(_sources, sourceWaterMarks);
            _retention = createRetention();
            _store = createStore();
        } catch(Exception e) {
            e.printStackTrace();
View Full Code Here

        }
    }

    public void testApiBasics() {
        int counter = 1;
        SourceWaterMarks swm = new SourceWaterMarks(scnFile);
        swm.syncWaterMarks();

        String source1 = "database.source1";
        long scn = System.currentTimeMillis();
        swm.setLWMScn(source1, scn);
        swm.setHWMScn(source1, scn);
        assertEquals(swm.getHWMScn(source1), swm.getLWMScn(source1));

        scn = System.currentTimeMillis() + counter++;
        swm.saveHWMark(source1, scn);
        assertTrue(swm.getLWMScn(source1) < swm.getHWMScn(source1));

        scn = System.currentTimeMillis() + counter++;
        swm.setWaterMarks(source1, scn, scn);
        assertEquals(scn, swm.getLWMScn(source1));
        assertEquals(swm.getLWMScn(source1), swm.getHWMScn(source1));

        scn = System.currentTimeMillis() + counter++;
        swm.saveHWMark(source1, scn);
        assertTrue(swm.getLWMScn(source1) < swm.getHWMScn(source1));

        swm.syncWaterMarks();
        assertEquals(swm.getHWMScn(source1), swm.getLWMScn(source1));

        String source2 = "database.source2";
        scn = System.currentTimeMillis() + counter++;
        swm.setLWMScn(source2, scn);
        swm.setHWMScn(source2, scn);
        assertEquals(swm.getHWMScn(source2), swm.getLWMScn(source2));

        assertEquals(2, swm.sources().size());

        scn = System.currentTimeMillis() + counter++;
        swm.saveHWMark(source1, scn);
        swm.saveHWMark(source2, scn);
        assertTrue(swm.getLWMScn(source1) < swm.getHWMScn(source1));
        assertTrue(swm.getLWMScn(source2) < swm.getHWMScn(source2));

        swm.syncWaterMarks();
        assertEquals(swm.getHWMScn(source1), swm.getLWMScn(source1));
        assertEquals(swm.getHWMScn(source2), swm.getLWMScn(source2));
        assertTrue(swm.getFile().exists());
        assertTrue(swm.getFileOriginal().exists());

        SourceWaterMarks swm1 = new SourceWaterMarks(swm.getFile());
        assertEquals(swm.getLWMScn(source1), swm1.getLWMScn(source1));
        assertEquals(swm.getHWMScn(source1), swm1.getHWMScn(source1));
        assertEquals(swm.getLWMScn(source2), swm1.getLWMScn(source2));
        assertEquals(swm.getHWMScn(source2), swm1.getHWMScn(source2));

        // make file and fileOriginal have the same water marks
        swm.syncWaterMarks();

        SourceWaterMarks swm2 = new SourceWaterMarks(swm.getFileOriginal());
        assertEquals(swm.getLWMScn(source1), swm2.getLWMScn(source1));
        assertEquals(swm.getHWMScn(source1), swm2.getHWMScn(source1));
        assertEquals(swm.getLWMScn(source2), swm2.getLWMScn(source2));
        assertEquals(swm.getHWMScn(source2), swm2.getHWMScn(source2));

        swm.clear();
        assertFalse(swm.getFileOriginal().exists());
        assertEquals(0, new SourceWaterMarks(swm.getFile()).sources().size());
    }
View Full Code Here

TOP

Related Classes of krati.util.SourceWaterMarks

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.