Package org.apache.helix

Examples of org.apache.helix.HelixDataAccessor


    Map<String, String> statFields = getStatFields("0", "0");
    _statsHolder.applyStat(incomingStatName, statFields);
    _statsHolder.persistStats();

    // check persistent stats
    HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
    Builder keyBuilder = accessor.keyBuilder();

    ZNRecord rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();

    System.out.println("rec: " + rec.toString());
    String persistentStat = "accumulate()(dbFoo.partition10.latency)";
    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "0.0"));
    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "0.0"));
View Full Code Here


    Map<String, String> statFields = getStatFields("1", "10");
    _statsHolder.applyStat(incomingStatName, statFields);
    _statsHolder.persistStats();

    // check persistent stats
    HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
    Builder keyBuilder = accessor.keyBuilder();

    ZNRecord rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();

    System.out.println("rec: " + rec.toString());
    String persistentStat = "accumulate()(instance10.reportingage)";
    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "1.0"));
    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "10.0"));
View Full Code Here

    statFields = getStatFields("5", "10");
    _statsHolder.applyStat(incomingStatName, statFields);
    _statsHolder.persistStats();

    // check persistent stats
    HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
    Builder keyBuilder = accessor.keyBuilder();

    ZNRecord rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();

    System.out.println("rec: " + rec.toString());
    String persistentStat = "accumulate()(dbFoo.partition10.latency)";
    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "1.0"));
    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "10.0"));
View Full Code Here

    Map<String, String> statFields = getStatFields("0", "0");
    _statsHolder.applyStat(incomingStatName, statFields);
    _statsHolder.persistStats();

    // check persistent stats
    HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
    Builder keyBuilder = accessor.keyBuilder();

    ZNRecord rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();

    System.out.println("rec: " + rec.toString());
    String persistentStat = "window(3)(dbFoo.partition10.latency)";
    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "0.0"));
    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "0.0"));

    // add 2nd stat
    statFields = getStatFields("10", "1");
    _statsHolder.applyStat(incomingStatName, statFields);
    _statsHolder.persistStats();

    rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();

    System.out.println("rec: " + rec.toString());
    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "0.0,10.0"));
    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "0.0,1.0"));

    // add 3rd stat
    statFields = getStatFields("20", "2");
    _statsHolder.applyStat(incomingStatName, statFields);
    _statsHolder.persistStats();
   
    rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();

    System.out.println("rec: " + rec.toString());
    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "0.0,10.0,20.0"));
    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "0.0,1.0,2.0"));
View Full Code Here

    String incomingStatName = "dbFoo.partition10.latency";
    Map<String, String> statFields = getStatFields("30", "3");
    _statsHolder.applyStat(incomingStatName, statFields);
    _statsHolder.persistStats();

    HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
    Builder keyBuilder = accessor.keyBuilder();

    ZNRecord rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();

    System.out.println("rec: " + rec.toString());
    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "10.0,20.0,30.0"));
    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "1.0,2.0,3.0"));
  }
View Full Code Here

    String incomingStatName = "dbFoo.partition10.latency";
    Map<String, String> statFields = getStatFields("10", "1");
    _statsHolder.applyStat(incomingStatName, statFields);
    _statsHolder.persistStats();

    HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
    Builder keyBuilder = accessor.keyBuilder();

    ZNRecord rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();

    System.out.println("rec: " + rec.toString());
    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "0.0,10.0,20.0"));
    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "0.0,1.0,2.0"));
  }
View Full Code Here

    Map<String, String> statFields = getStatFields("0", "0");
    _statsHolder.applyStat(incomingStatName, statFields);
    _statsHolder.persistStats();

    // check persistent stats
    HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
    Builder keyBuilder = accessor.keyBuilder();

    ZNRecord rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();

    System.out.println("rec: " + rec.toString());
    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStatOne, "0.0"));
    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStatOne, "0.0"));
    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStatTwo, "0.0"));
View Full Code Here

        getStatFields(valTuple.toString(), timeTuple.toString());
    _statsHolder.applyStat(incomingStatName, statFields);
    _statsHolder.persistStats();

    // check persistent stats
    HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
    Builder keyBuilder = accessor.keyBuilder();

    ZNRecord rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();
    System.out.println("rec: " + rec.toString());
    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "20.0,30.0,40.0"));
    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "2.0,3.0,4.0"));
  }
View Full Code Here

        getStatFields(valTuple.toString(), timeTuple.toString());
    _statsHolder.applyStat(incomingStatName, statFields);
    _statsHolder.persistStats();

    // check persistent stats
    HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
    Builder keyBuilder = accessor.keyBuilder();

    ZNRecord rec = accessor.getProperty(keyBuilder.persistantStat()).getRecord();
    System.out.println("rec: " + rec.toString());
    AssertJUnit.assertTrue(statRecordHasValue(rec, persistentStat, "0.0,10.0,20.0"));
    AssertJUnit.assertTrue(statRecordHasTimestamp(rec, persistentStat, "0.0,1.0,2.0"));
  }
View Full Code Here

    ZNRecord record = DefaultIdealStateCalculator.calculateIdealState(
        instances, partitions, replicas, resourceName, "MASTER", "SLAVE");
    IdealState idealState = new IdealState(record);
    idealState.setStateModelDefRef("MasterSlave");
   
    HelixDataAccessor accessor = manager.getHelixDataAccessor();
    Builder keyBuilder = accessor.keyBuilder();
    accessor.setProperty(keyBuilder.idealStates(resourceName),
                                          idealState);
    ResourceComputationStage stage = new ResourceComputationStage();
    runStage(event, new ReadClusterDataStage());
    runStage(event, stage);
View Full Code Here

TOP

Related Classes of org.apache.helix.HelixDataAccessor

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.