// test message service
ClusterMessagingService msgService = controller.getMessagingService();
// test file management tool
HelixAdmin tool = controller.getClusterManagmentTool();
exceptionCaught = false;
try
{
tool.getClusters();
} catch (UnsupportedOperationException e)
{
exceptionCaught = true;
}
AssertJUnit.assertTrue(exceptionCaught);
exceptionCaught = false;
try
{
tool.getResourcesInCluster(clusterName);
} catch (UnsupportedOperationException e)
{
exceptionCaught = true;
}
AssertJUnit.assertTrue(exceptionCaught);
exceptionCaught = false;
try
{
tool.addResource(clusterName, "resource", 10, "MasterSlave",
IdealStateModeProperty.AUTO.toString());
} catch (UnsupportedOperationException e)
{
exceptionCaught = true;
}
AssertJUnit.assertTrue(exceptionCaught);
exceptionCaught = false;
try
{
tool.getStateModelDefs(clusterName);
} catch (UnsupportedOperationException e)
{
exceptionCaught = true;
}
AssertJUnit.assertTrue(exceptionCaught);
exceptionCaught = false;
try
{
tool.getInstanceConfig(clusterName, instanceName);
} catch (UnsupportedOperationException e)
{
exceptionCaught = true;
}
AssertJUnit.assertTrue(exceptionCaught);
exceptionCaught = false;
try
{
tool.getStateModelDef(clusterName, "MasterSlave");
} catch (UnsupportedOperationException e)
{
exceptionCaught = true;
}
AssertJUnit.assertTrue(exceptionCaught);
exceptionCaught = false;
try
{
tool.getResourceExternalView(clusterName, "resource");
} catch (UnsupportedOperationException e)
{
exceptionCaught = true;
}
AssertJUnit.assertTrue(exceptionCaught);
exceptionCaught = false;
try
{
tool.enableInstance(clusterName, "resource", false);
} catch (UnsupportedOperationException e)
{
exceptionCaught = true;
}
AssertJUnit.assertTrue(exceptionCaught);
tool.addCluster(clusterName, true);
tool.addResource(clusterName, "resource", 10, "MasterSlave");
InstanceConfig config = new InstanceConfig("nodeConfig");
tool.addInstance(clusterName, config);
List<String> instances = tool.getInstancesInCluster(clusterName);
AssertJUnit.assertEquals(1, instances.size());
tool.dropInstance(clusterName, config);
IdealState idealState = new IdealState("idealState");
tool.setResourceIdealState(clusterName, "resource", idealState);
idealState = tool.getResourceIdealState(clusterName, "resource");
AssertJUnit.assertEquals(idealState.getId(), "idealState");
tool.dropResource(clusterName, "resource");
_store.stop();
}