Package org.apache.ambari.scom

Examples of org.apache.ambari.scom.TestHostInfoProvider


    types.add(Resource.Type.Task);
  }

  @Test
  public void testGetResourceProvider() throws Exception {
    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
    clusterDefinition.setServiceState("HDFS", "INSTALLED");

    for (Resource.Type type : types) {
      ResourceProvider provider = AbstractResourceProvider.getResourceProvider(type, clusterDefinition);
      Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), null);
View Full Code Here


*/
public class ClusterDefinitionTest {
  @Test
  public void testGetServices() throws Exception {

    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());

    Set<String> services = clusterDefinition.getServices();

    Assert.assertTrue(services.contains("HDFS"));
    Assert.assertTrue(services.contains("FLUME"));
View Full Code Here

    Assert.assertTrue(services.contains("WEBHCAT"));
  }

  @Test
  public void testGetHosts() throws Exception {
    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());

    Set<String> hosts = clusterDefinition.getHosts();

    Assert.assertTrue(hosts.contains("NAMENODE_MASTER.acme.com"));
    Assert.assertTrue(hosts.contains("SECONDARY_NAMENODE_MASTER.acme.com"));
View Full Code Here

    Assert.assertTrue(hosts.contains("WEBHCAT_MASTER.acme.com"));
  }

  @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"));
View Full Code Here

    Assert.assertTrue(components.contains("HIVE_SERVER"));
  }

  @Test
  public void testGetHostComponents() throws Exception {
    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());

    Set<String> hostComponents = clusterDefinition.getHostComponents("HDFS", "NAMENODE_MASTER.acme.com");

    Assert.assertTrue(hostComponents.contains("NAMENODE"));
View Full Code Here

    types.add(Resource.Type.Configuration);
  }

  @Test
  public void testGetResourceProvider() throws Exception {
    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
    clusterDefinition.setServiceState("HDFS", "INSTALLED");

    for (Resource.Type type : types) {
      ResourceProvider provider = AbstractResourceProvider.getResourceProvider(type, clusterDefinition);
      Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), null);
View Full Code Here

*/
public class HostComponentProviderTest {

  @Test
  public void testGetResources() throws Exception {
    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
    HostComponentProvider provider = new HostComponentProvider(clusterDefinition);
    Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), null);
    Assert.assertEquals(25, resources.size());
  }
View Full Code Here

    Assert.assertEquals(25, resources.size());
  }

  @Test
  public void testGetResourcesWithPredicate() throws Exception {
    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
    HostComponentProvider provider = new HostComponentProvider(clusterDefinition);
    Predicate predicate = new PredicateBuilder().property(HostComponentProvider.HOST_COMPONENT_SERVICE_NAME_PROPERTY_ID).equals("MAPREDUCE").toPredicate();
    Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
    Assert.assertEquals(5, resources.size());
View Full Code Here

  }

  @Test
  public void testGetResourcesCheckState() throws Exception {
    TestStateProvider stateProvider = new TestStateProvider();
    ClusterDefinition clusterDefinition = new ClusterDefinition(stateProvider, new TestClusterDefinitionProvider(), new TestHostInfoProvider());
    HostComponentProvider provider = new HostComponentProvider(clusterDefinition);
    Predicate predicate = new PredicateBuilder().property(HostComponentProvider.HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID).equals("HBASE_REGIONSERVER").toPredicate();
    Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
    Assert.assertEquals(3, resources.size());
View Full Code Here

  }

  @Test
  public void testGetResourcesCheckStateFromCategory() throws Exception {
    TestStateProvider stateProvider = new TestStateProvider();
    ClusterDefinition clusterDefinition = new ClusterDefinition(stateProvider, new TestClusterDefinitionProvider(), new TestHostInfoProvider());
    HostComponentProvider provider = new HostComponentProvider(clusterDefinition);
    Predicate predicate = new PredicateBuilder().property(HostComponentProvider.HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID).equals("HBASE_REGIONSERVER").toPredicate();
    Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest("HostRoles"), predicate);
    Assert.assertEquals(3, resources.size());
View Full Code Here

TOP

Related Classes of org.apache.ambari.scom.TestHostInfoProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.