Search in sources :

Example 31 with NotificationContext

use of org.apache.helix.NotificationContext in project helix by apache.

the class TestDistControllerStateModel method testOnBecomeLeaderFromStandby.

@Test()
public void testOnBecomeLeaderFromStandby() {
    Message message = new Message(MessageType.STATE_TRANSITION, "0");
    message.setPartitionName(clusterName);
    message.setTgtName("controller_0");
    try {
        stateModel.onBecomeLeaderFromStandby(message, new NotificationContext(null));
    } catch (Exception e) {
        LOG.error("Exception becoming leader from standby", e);
    }
    stateModel.onBecomeStandbyFromLeader(message, new NotificationContext(null));
}
Also used : NotificationContext(org.apache.helix.NotificationContext) Message(org.apache.helix.model.Message) Test(org.testng.annotations.Test)

Example 32 with NotificationContext

use of org.apache.helix.NotificationContext in project helix by apache.

the class TestDistControllerStateModel method testOnBecomeStandbyFromLeader.

@Test()
public void testOnBecomeStandbyFromLeader() {
    Message message = new Message(MessageType.STATE_TRANSITION, "0");
    message.setPartitionName(clusterName);
    message.setTgtName("controller_0");
    stateModel.onBecomeStandbyFromLeader(message, new NotificationContext(null));
}
Also used : NotificationContext(org.apache.helix.NotificationContext) Message(org.apache.helix.model.Message) Test(org.testng.annotations.Test)

Example 33 with NotificationContext

use of org.apache.helix.NotificationContext in project helix by apache.

the class TestDistControllerStateModel method testRollbackOnError.

@Test()
public void testRollbackOnError() {
    Message message = new Message(MessageType.STATE_TRANSITION, "0");
    message.setPartitionName(clusterName);
    message.setTgtName("controller_0");
    try {
        stateModel.onBecomeLeaderFromStandby(message, new NotificationContext(null));
    } catch (Exception e) {
        LOG.error("Exception becoming leader from standby", e);
    }
    stateModel.rollbackOnError(message, new NotificationContext(null), null);
}
Also used : NotificationContext(org.apache.helix.NotificationContext) Message(org.apache.helix.model.Message) Test(org.testng.annotations.Test)

Example 34 with NotificationContext

use of org.apache.helix.NotificationContext in project ambry by linkedin.

the class MockHelixManager method triggerRoutingTableNotification.

void triggerRoutingTableNotification() {
    NotificationContext notificationContext = new NotificationContext(this);
    routingTableProvider.onStateChange(instanceName, Collections.emptyList(), notificationContext);
}
Also used : NotificationContext(org.apache.helix.NotificationContext)

Example 35 with NotificationContext

use of org.apache.helix.NotificationContext in project ambry by linkedin.

the class MockHelixManager method addExternalViewChangeListener.

@Override
public void addExternalViewChangeListener(ExternalViewChangeListener externalViewChangeListener) throws Exception {
    if (beBadException != null) {
        throw beBadException;
    }
    this.externalViewChangeListener = externalViewChangeListener;
    NotificationContext notificationContext = new NotificationContext(this);
    notificationContext.setType(NotificationContext.Type.INIT);
    this.externalViewChangeListener.onExternalViewChange(Collections.emptyList(), notificationContext);
}
Also used : NotificationContext(org.apache.helix.NotificationContext)

Aggregations

NotificationContext (org.apache.helix.NotificationContext)35 Message (org.apache.helix.model.Message)11 Test (org.testng.annotations.Test)11 HelixManager (org.apache.helix.HelixManager)10 HelixException (org.apache.helix.HelixException)9 Date (java.util.Date)6 ArrayList (java.util.ArrayList)4 ZkNoNodeException (org.I0Itec.zkclient.exception.ZkNoNodeException)4 ControllerChangeListener (org.apache.helix.ControllerChangeListener)4 LiveInstance (org.apache.helix.model.LiveInstance)4 HashMap (java.util.HashMap)3 List (java.util.List)3 Set (java.util.Set)3 HelixTimerTask (org.apache.helix.HelixTimerTask)3 PropertyKey (org.apache.helix.PropertyKey)3 GenericHelixController (org.apache.helix.controller.GenericHelixController)3 DistributedLeaderElection (org.apache.helix.manager.zk.DistributedLeaderElection)3 MessageHandler (org.apache.helix.messaging.handling.MessageHandler)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 ResultSet (java.sql.ResultSet)2