use of org.apache.helix.model.builder.ConstraintItemBuilder in project helix by apache.
the class TestPreferenceListAsQueue method testReprioritizedWithConstraint.
/**
* This test ensures successful creation when the state model has OFFLINE --> deprioritized and
* a partition-level constraint enforces parallelism
* @throws Exception
*/
@Test
public void testReprioritizedWithConstraint() throws Exception {
_stateModel = "OnlineOfflineReprioritized";
// Add a state model with the transition to ONLINE deprioritized
_clusterSetup.addStateModelDef(_clusterName, _stateModel, createReprioritizedStateModelDef(_stateModel));
// Add a constraint of one transition per partition
ConstraintItemBuilder constraintItemBuilder = new ConstraintItemBuilder();
constraintItemBuilder.addConstraintAttribute(ConstraintAttribute.MESSAGE_TYPE.toString(), "STATE_TRANSITION").addConstraintAttribute(ConstraintAttribute.PARTITION.toString(), ".*").addConstraintAttribute(ConstraintAttribute.CONSTRAINT_VALUE.toString(), String.valueOf(PARALLELISM));
_admin.setConstraint(_clusterName, ConstraintType.MESSAGE_CONSTRAINT, "constraint_1", constraintItemBuilder.build());
runTest();
}
Aggregations