Package org.apache.helix.api.id

Examples of org.apache.helix.api.id.ParticipantId.stringify()


      return false;
    }

    ParticipantId participantId = participant.getId();
    InstanceConfig existConfig =
        _accessor.getProperty(_keyBuilder.instanceConfig(participantId.stringify()));
    if (existConfig != null && isParticipantStructureValid(participantId)) {
      LOG.error("Config for participant: " + participantId + " already exists in cluster: "
          + _clusterId);
      return false;
    }
View Full Code Here


    // clear and rebuild the participant structure
    clearParticipantStructure(participantId);
    initParticipantStructure(participantId);

    // add the config
    _accessor.setProperty(_keyBuilder.instanceConfig(participantId.stringify()),
        participant.getInstanceConfig());
    return true;
  }

  /**
 
View Full Code Here

    // create a participant with the same id
    boolean created2 = createParticipant(participantId, accessor, MODIFIER, 2);
    Assert.assertFalse(created2); // should fail since participant exists

    // remove a required property
    helixAccessor.removeProperty(helixAccessor.keyBuilder().messages(participantId.stringify()));

    // try again, should work this time
    created2 = createParticipant(participantId, accessor, MODIFIER, 2);
    Assert.assertTrue(created2);
View Full Code Here

    ExternalView ev = accessor.getProperty(kb.externalView(TEST_DB));
    for (PartitionId p : idealState.getPartitionIdSet()) {
      ParticipantId idealMaster = idealState.getPreferenceList(p).get(0);
      Assert.assertTrue(ev.getStateMap(p).get(idealMaster).equals(State.from("ERROR")));

      TimeOutStateModel model = factories.get(idealMaster.stringify()).getTransitionHandler(p);
      Assert.assertEquals(model._errorCallcount, 1);
      Assert.assertEquals(model._error.getCode(), ErrorCode.TIMEOUT);
    }
  }
}
View Full Code Here

    // create a participant with the same id
    boolean created2 = createParticipant(participantId, accessor, MODIFIER, 2);
    Assert.assertFalse(created2); // should fail since participant exists

    // remove a required property
    helixAccessor.removeProperty(helixAccessor.keyBuilder().messages(participantId.stringify()));

    // try again, should work this time
    created2 = createParticipant(participantId, accessor, MODIFIER, 2);
    Assert.assertTrue(created2);
View Full Code Here

    ExternalView ev = accessor.getProperty(kb.externalView(TEST_DB));
    for (PartitionId p : idealState.getPartitionIdSet()) {
      ParticipantId idealMaster = idealState.getPreferenceList(p).get(0);
      Assert.assertTrue(ev.getStateMap(p).get(idealMaster).equals(State.from("ERROR")));

      TimeOutStateModel model = factories.get(idealMaster.stringify()).getStateModel(p.stringify());
      Assert.assertEquals(model._errorCallcount, 1);
      Assert.assertEquals(model._error.getCode(), ErrorCode.TIMEOUT);
    }
  }
}
View Full Code Here

    }

    ParticipantAccessor participantAccessor = new ParticipantAccessor(_accessor);
    ParticipantId participantId = participant.getId();
    InstanceConfig existConfig =
        _accessor.getProperty(_keyBuilder.instanceConfig(participantId.stringify()));
    if (existConfig != null && participantAccessor.isParticipantStructureValid(participantId)) {
      LOG.error("Config for participant: " + participantId + " already exists in cluster: "
          + _clusterId);
      return false;
    }
View Full Code Here

    }
    Set<PartitionId> disabledPartitions = participant.getDisabledPartitions();
    for (PartitionId partitionId : disabledPartitions) {
      instanceConfig.setParticipantEnabledForPartition(partitionId, false);
    }
    _accessor.setProperty(_keyBuilder.instanceConfig(participantId.stringify()), instanceConfig);
    return true;
  }

  /**
   * drop a participant from cluster
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.