Package org.apache.ambari.server.controller

Examples of org.apache.ambari.server.controller.RootServiceHostComponentResponse


    Resource.Type type = Resource.Type.RootServiceHostComponent;

    AmbariManagementController managementController = createMock(AmbariManagementController.class);

    Set<RootServiceHostComponentResponse> allResponse = new HashSet<RootServiceHostComponentResponse>();
    allResponse.add(new RootServiceHostComponentResponse("host1", "component1", "HEALTHY", "1.1.1", Collections.<String,String>emptyMap()));
    allResponse.add(new RootServiceHostComponentResponse("host2", "component2", "HEALTHY", "1.1.1", Collections.<String,String>emptyMap()));
    allResponse.add(new RootServiceHostComponentResponse("host3", "component3", "HEARBEAT_LOST", "1.1.1", Collections.<String,String>emptyMap()));

    Set<RootServiceHostComponentResponse> nameResponse = new HashSet<RootServiceHostComponentResponse>();
    nameResponse.add(new RootServiceHostComponentResponse("host4", "component4", "HEALTHY", "1.1.1", Collections.<String,String>emptyMap()));


    // set expectations
    expect(managementController.getRootServiceHostComponents(EasyMock.<Set<RootServiceHostComponentRequest>>anyObject())).andReturn(allResponse).once();
    expect(managementController.getRootServiceHostComponents(EasyMock.<Set<RootServiceHostComponentRequest>>anyObject())).andReturn(nameResponse).once();
    // replay
    replay(managementController);

    ResourceProvider provider = AbstractControllerResourceProvider.getResourceProvider(
        type,
        PropertyHelper.getPropertyIds(type),
        PropertyHelper.getKeyPropertyIds(type),
        managementController);

    Set<String> propertyIds = new HashSet<String>();

    propertyIds.add(RootServiceHostComponentResourceProvider.SERVICE_NAME_PROPERTY_ID);
    propertyIds.add(RootServiceHostComponentResourceProvider.HOST_NAME_PROPERTY_ID);
    propertyIds.add(RootServiceHostComponentResourceProvider.COMPONENT_NAME_PROPERTY_ID);
    propertyIds.add(RootServiceHostComponentResourceProvider.COMPONENT_STATE_PROPERTY_ID);
    propertyIds.add(RootServiceHostComponentResourceProvider.PROPERTIES_PROPERTY_ID);
    propertyIds.add(RootServiceHostComponentResourceProvider.COMPONENT_VERSION_PROPERTY_ID);
   
   
    // create the request
    Request request = PropertyHelper.getReadRequest(propertyIds);

    // get all ... no predicate
    Set<Resource> resources = provider.getResources(request, null);

    Assert.assertEquals(allResponse.size(), resources.size());
    for (Resource resource : resources) {
      String hostName = (String) resource.getPropertyValue(RootServiceHostComponentResourceProvider.HOST_NAME_PROPERTY_ID);
      String componentName = (String) resource.getPropertyValue(RootServiceHostComponentResourceProvider.COMPONENT_NAME_PROPERTY_ID);
      String componentState = (String) resource.getPropertyValue(RootServiceHostComponentResourceProvider.COMPONENT_STATE_PROPERTY_ID);
      String componentVersion = (String) resource.getPropertyValue(RootServiceHostComponentResourceProvider.COMPONENT_VERSION_PROPERTY_ID);
      Assert.assertTrue(allResponse.contains(new RootServiceHostComponentResponse(hostName, componentName, componentState, componentVersion,
          Collections.<String, String>emptyMap())));
    }

    // get service named service4
    Predicate predicate =
View Full Code Here


    Host host1 = createNiceMock(Host.class);
    HostHealthStatus healthStatus = createNiceMock(HostHealthStatus.class);

    HostResponse hostResponse1 = createNiceMock(HostResponse.class);

    RootServiceHostComponentResponse response = createNiceMock(RootServiceHostComponentResponse.class);

    AbstractRootServiceResponseFactory factory = createNiceMock(AbstractRootServiceResponseFactory.class);

    List<Host> hosts = new LinkedList<Host>();
    hosts.add(host1);
View Full Code Here

TOP

Related Classes of org.apache.ambari.server.controller.RootServiceHostComponentResponse

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.