use of org.apache.gobblin.cluster.TestShutdownMessageHandlerFactory in project incubator-gobblin by apache.
the class GobblinAWSClusterLauncherTest method testSendShutdownRequest.
@Test(dependsOnMethods = "testGetReconnectableApplicationId")
public void testSendShutdownRequest() throws Exception {
// Connect to Helix as Controller and register a shutdown request handler
this.helixManager.connect();
this.helixManager.getMessagingService().registerMessageHandlerFactory(GobblinHelixConstants.SHUTDOWN_MESSAGE_TYPE, new TestShutdownMessageHandlerFactory(this));
// Make Gobblin AWS Cluster launcher start a shutdown
this.gobblinAwsClusterLauncher.connectHelixManager();
this.gobblinAwsClusterLauncher.sendShutdownRequest();
Assert.assertEquals(this.curatorFramework.checkExists().forPath(String.format("/%s/CONTROLLER/MESSAGES", this.helixClusterName)).getVersion(), 0);
GetControllerMessageNumFunc getCtrlMessageNum = new GetControllerMessageNumFunc(this.helixClusterName, this.curatorFramework);
// Assert to check if shutdown message was issued
AssertWithBackoff assertWithBackoff = AssertWithBackoff.create().logger(LoggerFactory.getLogger("testSendShutdownRequest")).timeoutMs(20000);
assertWithBackoff.assertEquals(getCtrlMessageNum, 1, "1 controller message queued");
// Assert to check if shutdown message was processed
// Give Helix sometime to handle the message
assertWithBackoff.assertEquals(getCtrlMessageNum, 0, "all controller messages processed");
}
use of org.apache.gobblin.cluster.TestShutdownMessageHandlerFactory in project incubator-gobblin by apache.
the class GobblinYarnAppLauncherTest method testSendShutdownRequest.
@Test(dependsOnMethods = "testCreateHelixCluster")
public void testSendShutdownRequest() throws Exception {
this.helixManager.connect();
this.helixManager.getMessagingService().registerMessageHandlerFactory(GobblinHelixConstants.SHUTDOWN_MESSAGE_TYPE, new TestShutdownMessageHandlerFactory(this));
this.gobblinYarnAppLauncher.connectHelixManager();
this.gobblinYarnAppLauncher.sendShutdownRequest();
Assert.assertEquals(this.curatorFramework.checkExists().forPath(String.format("/%s/CONTROLLER/MESSAGES", GobblinYarnAppLauncherTest.class.getSimpleName())).getVersion(), 0);
YarnSecurityManagerTest.GetControllerMessageNumFunc getCtrlMessageNum = new YarnSecurityManagerTest.GetControllerMessageNumFunc(GobblinYarnAppLauncherTest.class.getSimpleName(), this.curatorFramework);
AssertWithBackoff assertWithBackoff = AssertWithBackoff.create().logger(LoggerFactory.getLogger("testSendShutdownRequest")).timeoutMs(20000);
assertWithBackoff.assertEquals(getCtrlMessageNum, 1, "1 controller message queued");
// Give Helix sometime to handle the message
assertWithBackoff.assertEquals(getCtrlMessageNum, 0, "all controller messages processed");
}
Aggregations