Package org.apache.ambari.server.state

Examples of org.apache.ambari.server.state.ComponentInfo


    AmbariManagementController managementController = createMock(AmbariManagementController.class);
    Clusters clusters = createNiceMock(Clusters.class);
    Cluster cluster = createNiceMock(Cluster.class);
    AmbariMetaInfo ambariMetaInfo = createNiceMock(AmbariMetaInfo.class);
    StackId stackId = createNiceMock(StackId.class);
    ComponentInfo componentInfo = createNiceMock(ComponentInfo.class);

    ServiceComponentHostResponse shr1 = new ServiceComponentHostResponse("C1", "HBASE", "HBASE_MASTER", "Host100""INSTALLED", "", null, null, null);
    ServiceComponentHostResponse shr2 = new ServiceComponentHostResponse("C1", "HBASE", "HBASE_REGIONSERVER", "Host100", "STARTED", "", null, null, null);

    Set<ServiceComponentHostResponse> responses = new LinkedHashSet<ServiceComponentHostResponse>();
    responses.add(shr1);
    responses.add(shr2);

    // set expectations
    expect(managementController.getAmbariMetaInfo()).andReturn(ambariMetaInfo).anyTimes();
    expect(managementController.getClusters()).andReturn(clusters).anyTimes();
    expect(clusters.getCluster("C1")).andReturn(cluster).anyTimes();
    expect(managementController.getHostComponents((Set<ServiceComponentHostRequest>) anyObject())).andReturn(responses).anyTimes();
    expect(cluster.getDesiredStackVersion()).andReturn(stackId);

    expect(stackId.getStackName()).andReturn("S1").anyTimes();
    expect(stackId.getStackVersion()).andReturn("V1").anyTimes();


    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
        (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();

    expect(componentInfo.isMaster()).andReturn(true);
    expect(componentInfo.isMaster()).andReturn(false);

    // replay
    replay(managementController, clusters, cluster, ambariMetaInfo, stackId, componentInfo);

    ServiceResourceProvider.ServiceState serviceState = new ServiceResourceProvider.HBaseServiceState();
View Full Code Here


    AmbariManagementController managementController = createMock(AmbariManagementController.class);
    Clusters clusters = createNiceMock(Clusters.class);
    Cluster cluster = createNiceMock(Cluster.class);
    AmbariMetaInfo ambariMetaInfo = createNiceMock(AmbariMetaInfo.class);
    StackId stackId = createNiceMock(StackId.class);
    ComponentInfo componentInfo = createNiceMock(ComponentInfo.class);

    ServiceComponentHostResponse shr1 = new ServiceComponentHostResponse("C1", "HBASE", "HBASE_REGIONSERVER", "Host100", "STARTED", "", null, null, null);

    Set<ServiceComponentHostResponse> responses = new LinkedHashSet<ServiceComponentHostResponse>();
    responses.add(shr1);

    // set expectations
    expect(managementController.getAmbariMetaInfo()).andReturn(ambariMetaInfo).anyTimes();
    expect(managementController.getClusters()).andReturn(clusters).anyTimes();
    expect(clusters.getCluster("C1")).andReturn(cluster).anyTimes();
    expect(managementController.getHostComponents((Set<ServiceComponentHostRequest>) anyObject())).andReturn(responses).anyTimes();
    expect(cluster.getDesiredStackVersion()).andReturn(stackId);

    expect(stackId.getStackName()).andReturn("S1").anyTimes();
    expect(stackId.getStackVersion()).andReturn("V1").anyTimes();


    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
        (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();

    expect(componentInfo.isMaster()).andReturn(false);

    // replay
    replay(managementController, clusters, cluster, ambariMetaInfo, stackId, componentInfo);

    ServiceResourceProvider.ServiceState serviceState = new ServiceResourceProvider.HBaseServiceState();
View Full Code Here

    AmbariManagementController managementController = createMock(AmbariManagementController.class);
    Clusters clusters = createNiceMock(Clusters.class);
    Cluster cluster = createNiceMock(Cluster.class);
    AmbariMetaInfo ambariMetaInfo = createNiceMock(AmbariMetaInfo.class);
    StackId stackId = createNiceMock(StackId.class);
    ComponentInfo componentInfo = createNiceMock(ComponentInfo.class);

    ServiceComponentHostResponse shr1 = new ServiceComponentHostResponse("C1", "GANGLIA", "GANGLIA_MONITOR", "Host100", "STARTED", "", null, null, null);
    ServiceComponentHostResponse shr2 = new ServiceComponentHostResponse("C1", "GANGLIA", "GANGLIA_MONITOR", "Host199", "UNKNOWN", "", null, null, null);
    ServiceComponentHostResponse shr3 = new ServiceComponentHostResponse("C1", "GANGLIA", "GANGLIA_SERVER", "Host100", "STARTED", "", null, null, null);

    Set<ServiceComponentHostResponse> responses = new LinkedHashSet<ServiceComponentHostResponse>();
    responses.add(shr1);
    responses.add(shr2);
    responses.add(shr3);

    // set expectations
    expect(managementController.getAmbariMetaInfo()).andReturn(ambariMetaInfo).anyTimes();
    expect(managementController.getClusters()).andReturn(clusters).anyTimes();
    expect(clusters.getCluster("C1")).andReturn(cluster).anyTimes();
    expect(componentInfo.isMaster()).andReturn(false).once();
    expect(componentInfo.isMaster()).andReturn(false).once();
    expect(componentInfo.isMaster()).andReturn(true).once();
    expect(componentInfo.isClient()).andReturn(false).anyTimes();
    expect(managementController.getHostComponents((Set<ServiceComponentHostRequest>) anyObject())).andReturn(responses).anyTimes();
    expect(cluster.getDesiredStackVersion()).andReturn(stackId);

    expect(stackId.getStackName()).andReturn("S1").anyTimes();
    expect(stackId.getStackVersion()).andReturn("V1").anyTimes();
View Full Code Here

    AmbariManagementController managementController = createMock(AmbariManagementController.class);
    Clusters clusters = createNiceMock(Clusters.class);
    Cluster cluster = createNiceMock(Cluster.class);
    AmbariMetaInfo ambariMetaInfo = createNiceMock(AmbariMetaInfo.class);
    StackId stackId = createNiceMock(StackId.class);
    ComponentInfo componentInfo = createNiceMock(ComponentInfo.class);

    ServiceComponentHostResponse shr1 = new ServiceComponentHostResponse("C1", "PIG", "PIG", "Host100", "INSTALLED", "", null, null, null);

    Set<ServiceComponentHostResponse> responses = new LinkedHashSet<ServiceComponentHostResponse>();
    responses.add(shr1);

    // set expectations
    expect(managementController.getAmbariMetaInfo()).andReturn(ambariMetaInfo).anyTimes();
    expect(managementController.getClusters()).andReturn(clusters).anyTimes();
    expect(clusters.getCluster("C1")).andReturn(cluster).anyTimes();
    expect(managementController.getHostComponents((Set<ServiceComponentHostRequest>) anyObject())).andReturn(responses).anyTimes();
    expect(cluster.getDesiredStackVersion()).andReturn(stackId);

    expect(stackId.getStackName()).andReturn("S1").anyTimes();
    expect(stackId.getStackVersion()).andReturn("V1").anyTimes();


    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
        (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();

    expect(componentInfo.isClient()).andReturn(true);

    // replay
    replay(managementController, clusters, cluster, ambariMetaInfo, stackId, componentInfo);

    ServiceResourceProvider.ServiceState serviceState = new ServiceResourceProvider.DefaultServiceState();
View Full Code Here

    AmbariManagementController managementController = createMock(AmbariManagementController.class);
    Clusters clusters = createNiceMock(Clusters.class);
    Cluster cluster = createNiceMock(Cluster.class);
    AmbariMetaInfo ambariMetaInfo = createNiceMock(AmbariMetaInfo.class);
    StackId stackId = createNiceMock(StackId.class);
    ComponentInfo componentInfo = createNiceMock(ComponentInfo.class);

    ServiceComponentHostResponse shr1 = new ServiceComponentHostResponse("C1", "PIG", "PIG", "Host100", "INSTALL_FAILED", "", null, null, null);

    Set<ServiceComponentHostResponse> responses = new LinkedHashSet<ServiceComponentHostResponse>();
    responses.add(shr1);

    // set expectations
    expect(managementController.getAmbariMetaInfo()).andReturn(ambariMetaInfo).anyTimes();
    expect(managementController.getClusters()).andReturn(clusters).anyTimes();
    expect(clusters.getCluster("C1")).andReturn(cluster).anyTimes();
    expect(managementController.getHostComponents((Set<ServiceComponentHostRequest>) anyObject())).andReturn(responses).anyTimes();
    expect(cluster.getDesiredStackVersion()).andReturn(stackId);

    expect(stackId.getStackName()).andReturn("S1").anyTimes();
    expect(stackId.getStackVersion()).andReturn("V1").anyTimes();


    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
        (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();

    expect(componentInfo.isClient()).andReturn(true);

    // replay
    replay(managementController, clusters, cluster, ambariMetaInfo, stackId, componentInfo);

    ServiceResourceProvider.ServiceState serviceState = new ServiceResourceProvider.DefaultServiceState();
View Full Code Here

            boolean hasMaster    = false;
            boolean hasOther     = false;
            boolean hasClient    = false;

            for (ServiceComponentHostResponse hostComponentResponse : hostComponentResponses ) {
              ComponentInfo componentInfo = ambariMetaInfo.getComponentCategory(stackId.getStackName(),
                  stackId.getStackVersion(), hostComponentResponse.getServiceName(),
                  hostComponentResponse.getComponentName());

              if (componentInfo != null) {
                State state = getHostComponentState(hostComponentResponse);

                if (state.equals(State.DISABLED)) {
                  hasDisabled = true;
                } else {
                  if (componentInfo.isMaster()) {
                    hasMaster = true;
                    if(!state.equals(State.STARTED) &&
                        ( masterState == null || state.ordinal() > masterState.ordinal())) {
                      masterState = state;
                    }
                  } else if (componentInfo.isClient()) {
                    hasClient = true;
                    if (!state.equals(State.INSTALLED) &&
                        (clientState == null || state.ordinal() > clientState.ordinal())) {
                      clientState = state;
                    }
View Full Code Here

            boolean hasSecondary        = false;
            boolean hasJournal          = false;
            State   nonStartedState     = null;

            for (ServiceComponentHostResponse hostComponentResponse : hostComponentResponses ) {
              ComponentInfo componentInfo = ambariMetaInfo.getComponentCategory(stackId.getStackName(),
                  stackId.getStackVersion(), hostComponentResponse.getServiceName(),
                  hostComponentResponse.getComponentName());

              if (componentInfo != null) {
                if (componentInfo.isMaster()) {

                  String componentName = hostComponentResponse.getComponentName();
                  boolean isNameNode = false;

                  if (componentName.equals("NAMENODE")) {
View Full Code Here

    }
  }

  @Test
  public void getComponentCategory() {
    ComponentInfo componentInfo = metaInfo.getComponentCategory(STACK_NAME_HDP,
        STACK_VERSION_HDP, SERVICE_NAME_HDFS, SERVICE_COMPONENT_NAME);
    assertNotNull(componentInfo);
    componentInfo = metaInfo.getComponentCategory(STACK_NAME_HDP,
        STACK_VERSION_HDP, SERVICE_NAME_HDFS, "DATANODE1");
    Assert.assertNotNull(componentInfo);
    assertTrue(!componentInfo.isClient());
  }
View Full Code Here

      Service s = cluster.getService(request.getServiceName());
      ServiceComponent sc = s.getServiceComponent(
          request.getComponentName());

      StackId stackId = sc.getDesiredStackVersion();
      ComponentInfo compInfo = ambariMetaInfo.getComponentCategory(
          stackId.getStackName(), stackId.getStackVersion(),
          s.getName(), sc.getName());
      boolean isClient = compInfo.isClient();

      ServiceComponentHost sch =
          serviceComponentHostFactory.createNew(sc, request.getHostname(),
              isClient);
View Full Code Here

                + service.getName() " on host "
                + componentHost.getHostName() + " is not stopped.");
            throw new AmbariException(sb.toString());
          }
          if(componentHost.getState() == State.STARTED) {
            ComponentInfo compInfo = ambariMetaInfo.getComponent(stackName, stackVersion,
                componentHost.getServiceName(), componentHost.getServiceComponentName());
            if(compInfo.isMaster()) {
              sb.append("Component " + component.getName() + " of service "
                  + service.getName() " on host "
                  + componentHost.getHostName() + " is not yet stopped.");
              throw new AmbariException(sb.toString());
            }
View Full Code Here

TOP

Related Classes of org.apache.ambari.server.state.ComponentInfo

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.