// System.out.println(new String(bytes));
StaticFileHelixManager.verifyFileBasedClusterStates("localhost_8900",
configFile, configFile);
StaticFileHelixManager controller = new StaticFileHelixManager(clusterName, controllerName,
InstanceType.CONTROLLER, configFile);
controller.disconnect();
AssertJUnit.assertFalse(controller.isConnected());
controller.connect();
AssertJUnit.assertTrue(controller.isConnected());
String sessionId = controller.getSessionId();
// AssertJUnit.assertEquals(DynamicFileClusterManager._sessionId, sessionId);
AssertJUnit.assertEquals(clusterName, controller.getClusterName());
AssertJUnit.assertEquals(0, controller.getLastNotificationTime());
AssertJUnit.assertEquals(InstanceType.CONTROLLER, controller.getInstanceType());
AssertJUnit.assertNull(controller.getPropertyStore());
AssertJUnit.assertNull(controller.getHealthReportCollector());
AssertJUnit.assertEquals(controllerName, controller.getInstanceName());
AssertJUnit.assertNull(controller.getClusterManagmentTool());
AssertJUnit.assertNull(controller.getMessagingService());
MockListener controllerListener = new MockListener();
AssertJUnit.assertFalse(controller.removeListener(null, controllerListener));
controllerListener.reset();
controller.addIdealStateChangeListener(controllerListener);
AssertJUnit.assertTrue(controllerListener.isIdealStateChangeListenerInvoked);
controller.addMessageListener(controllerListener, "localhost_8900");
AssertJUnit.assertTrue(controllerListener.isMessageListenerInvoked);
exceptionCaught = false;
try
{
controller.addLiveInstanceChangeListener(controllerListener);
} catch (UnsupportedOperationException e)
{
exceptionCaught = true;
}
AssertJUnit.assertTrue(exceptionCaught);
exceptionCaught = false;
try
{
controller.addCurrentStateChangeListener(controllerListener, "localhost_8900", sessionId);
} catch (UnsupportedOperationException e)
{
exceptionCaught = true;
}
AssertJUnit.assertTrue(exceptionCaught);
exceptionCaught = false;
try
{
controller.addConfigChangeListener(controllerListener);
} catch (UnsupportedOperationException e)
{
exceptionCaught = true;
}
AssertJUnit.assertTrue(exceptionCaught);
exceptionCaught = false;
try
{
controller.addExternalViewChangeListener(controllerListener);
} catch (UnsupportedOperationException e)
{
exceptionCaught = true;
}
AssertJUnit.assertTrue(exceptionCaught);
exceptionCaught = false;
try
{
controller.addControllerListener(controllerListener);
} catch (UnsupportedOperationException e)
{
exceptionCaught = true;
}
AssertJUnit.assertTrue(exceptionCaught);