@Test
public void testGetComponents() throws Exception {

  ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
  Set<String> components = clusterDefinition.getComponents("HDFS");
  Assert.assertTrue(components.contains("NAMENODE"));
  Assert.assertTrue(components.contains("SECONDARY_NAMENODE"));
  Assert.assertTrue(components.contains("DATANODE"));
  components = clusterDefinition.getComponents("MAPREDUCE");
  Assert.assertTrue(components.contains("JOBTRACKER"));
  Assert.assertTrue(components.contains("TASKTRACKER"));
  components = clusterDefinition.getComponents("FLUME");
  Assert.assertTrue(components.contains("FLUME_SERVER"));
  components = clusterDefinition.getComponents("OOZIE");
  Assert.assertTrue(components.contains("OOZIE_SERVER"));
  components = clusterDefinition.getComponents("HBASE");
  Assert.assertTrue(components.contains("HBASE_MASTER"));
  Assert.assertTrue(components.contains("HBASE_REGIONSERVER"));
  components = clusterDefinition.getComponents("ZOOKEEPER");
  Assert.assertTrue(components.contains("ZOOKEEPER_SERVER"));
  components = clusterDefinition.getComponents("HIVE");
  Assert.assertTrue(components.contains("HIVE_SERVER"));
  clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider("clusterproperties_HDP2_HA.txt", "myCluster", "HDP-2.0.6"), new TestHostInfoProvider());
  components = clusterDefinition.getComponents("HDFS");
  Assert.assertTrue(components.contains("NAMENODE"));
  Assert.assertTrue(components.contains("SECONDARY_NAMENODE"));
  Assert.assertTrue(components.contains("DATANODE"));
  Assert.assertTrue(components.contains("ZKFC"));
  Assert.assertTrue(components.contains("JOURNALNODE"));
  clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider("clusterproperties_HDP21_HA.txt", "myCluster", "HDP-2.1.2"), new TestHostInfoProvider());
  components = clusterDefinition.getComponents("HDFS");
  Assert.assertTrue(components.contains("NAMENODE"));
  Assert.assertTrue(components.contains("ZKFC"));
  Assert.assertTrue(components.contains("JOURNALNODE"));
  components = clusterDefinition.getComponents("YARN");
  Assert.assertTrue(components.contains("RESOURCEMANAGER"));
}