Examples of AmbariMetaInfo


Examples of org.apache.ambari.server.api.services.AmbariMetaInfo

   
    if (null != repoUrlOs) {
      oses = repoUrlOs.split(",");
    }
   
    AmbariMetaInfo ami = injector.getInstance(AmbariMetaInfo.class);
   
    if (0 == oses.length) {
      // do them all
      for (OperatingSystemInfo osi : ami.getOperatingSystems(stackName, stackVersion)) {
        ami.updateRepoBaseURL(stackName, stackVersion, osi.getOsType(),
            stackName + "-" + stackVersion, server);
      }
     
    } else {
      for (String os : oses) {
        ami.updateRepoBaseURL(stackName, stackVersion, os,
            stackName + "-" + stackVersion, server);
      }
    }
  }
View Full Code Here

Examples of org.apache.ambari.server.api.services.AmbariMetaInfo

  public void setup() throws Exception {
    injector = Guice.createInjector(new InMemoryDefaultTestModule());
    injector.getInstance(GuiceJpaInitializer.class);
    clusters = injector.getInstance(Clusters.class);
    controller = injector.getInstance(AmbariManagementController.class);
    AmbariMetaInfo ambariMetaInfo = injector.getInstance(AmbariMetaInfo.class);
    ambariMetaInfo.init();
  }
View Full Code Here

Examples of org.apache.ambari.server.api.services.AmbariMetaInfo

    Clusters clusters = createNiceMock(Clusters.class);
    Cluster cluster = createNiceMock(Cluster.class);
    Service service = createNiceMock(Service.class);
    StackId stackId = createNiceMock(StackId.class);
    ServiceFactory serviceFactory = createNiceMock(ServiceFactory.class);
    AmbariMetaInfo ambariMetaInfo = createNiceMock(AmbariMetaInfo.class);

    expect(managementController.getClusters()).andReturn(clusters);
    expect(managementController.getAmbariMetaInfo()).andReturn(ambariMetaInfo);
    expect(managementController.getServiceFactory()).andReturn(serviceFactory);

    expect(serviceFactory.createNew(cluster, "Service100")).andReturn(service);

    expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();

    expect(cluster.getService("Service100")).andReturn(null);
    expect(cluster.getDesiredStackVersion()).andReturn(stackId);

    expect(ambariMetaInfo.isValidService( (String) anyObject(), (String) anyObject(), (String) anyObject())).andReturn(true);

    // replay
    replay(managementController, clusters, cluster, service, ambariMetaInfo, stackId, serviceFactory);

    ResourceProvider provider = getServiceProvider(managementController);
View Full Code Here

Examples of org.apache.ambari.server.api.services.AmbariMetaInfo

    ServiceResponse serviceResponse3 = createNiceMock(ServiceResponse.class);
    ServiceResponse serviceResponse4 = createNiceMock(ServiceResponse.class);

    StackId stackId = createNiceMock(StackId.class);
    ServiceFactory serviceFactory = createNiceMock(ServiceFactory.class);
    AmbariMetaInfo ambariMetaInfo = createNiceMock(AmbariMetaInfo.class);

    Map<String, Service> allResponseMap = new HashMap<String, Service>();
    allResponseMap.put("Service100", service0);
    allResponseMap.put("Service101", service1);
    allResponseMap.put("Service102", service2);
View Full Code Here

Examples of org.apache.ambari.server.api.services.AmbariMetaInfo

    AmbariManagementController managementController = createMock(AmbariManagementController.class);
    Clusters clusters = createNiceMock(Clusters.class);
    Cluster cluster = createNiceMock(Cluster.class);
    Service service0 = createNiceMock(Service.class);
    ServiceFactory serviceFactory = createNiceMock(ServiceFactory.class);
    AmbariMetaInfo ambariMetaInfo = createNiceMock(AmbariMetaInfo.class);
    RequestStageContainer requestStages = createNiceMock(RequestStageContainer.class);
    RequestStatusResponse requestStatusResponse = createNiceMock(RequestStatusResponse.class);

    Map<String, String> mapRequestProps = new HashMap<String, String>();
    mapRequestProps.put("context", "Called from a test");
View Full Code Here

Examples of org.apache.ambari.server.api.services.AmbariMetaInfo

    LOG.debug("Adding missing configs into Ambari DB.");
    ClusterDAO clusterDAO = injector.getInstance(ClusterDAO.class);
    ClusterServiceDAO clusterServiceDAO = injector.getInstance(ClusterServiceDAO.class);

    AmbariMetaInfo ambariMetaInfo = injector.getInstance(AmbariMetaInfo.class);
    Gson gson = injector.getInstance(Gson.class);

    List <ClusterEntity> clusterEntities = clusterDAO.findAll();
    for (final ClusterEntity clusterEntity : clusterEntities) {
      Long clusterId = clusterEntity.getClusterId();
      String desiredStackVersion = clusterEntity.getDesiredStackVersion();

      Map<String, String> clusterInfo =
        gson.<Map<String, String>>fromJson(desiredStackVersion, Map.class);

      String stackName = clusterInfo.get("stackName");
      String stackVersion = clusterInfo.get("stackVersion");

      List<ClusterServiceEntity> clusterServiceEntities = clusterServiceDAO.findAll();
      for (final ClusterServiceEntity clusterServiceEntity : clusterServiceEntities) {
        String serviceName = clusterServiceEntity.getServiceName();
        ServiceInfo serviceInfo = null;
        try {
          serviceInfo = ambariMetaInfo.getService(stackName, stackVersion, serviceName);
        } catch (AmbariException e) {
          LOG.error("Service " + serviceName + " not found for " + stackName + stackVersion);
          continue;
        }
        List<String> configTypes = serviceInfo.getConfigDependencies();
View Full Code Here

Examples of org.apache.ambari.server.api.services.AmbariMetaInfo

  }
 
  @Test
  public void testHostDesiredConfig() throws Exception {
    AmbariMetaInfo metaInfo = injector.getInstance(AmbariMetaInfo.class);
    metaInfo.init();
   
    clusters.addCluster("c1");
    Cluster c1 = clusters.getCluster("c1");
    Assert.assertEquals("c1", c1.getClusterName());
    Assert.assertEquals(1, c1.getClusterId());
View Full Code Here

Examples of org.apache.ambari.server.api.services.AmbariMetaInfo

   
  }
 
  @Test
  public void testHostMaintenance() throws Exception {
    AmbariMetaInfo metaInfo = injector.getInstance(AmbariMetaInfo.class);
    metaInfo.init();
   
    clusters.addCluster("c1");
    Cluster c1 = clusters.getCluster("c1");
    Assert.assertEquals("c1", c1.getClusterName());
    Assert.assertEquals(1, c1.getClusterId());
View Full Code Here

Examples of org.apache.ambari.server.api.services.AmbariMetaInfo

  public void teardown() throws Exception {
    injector.getInstance(PersistService.class).stop();
  }
 
  private void reset(String stackName, String stackVersion) throws Exception {
    AmbariMetaInfo ami = injector.getInstance(AmbariMetaInfo.class);
   
    for (Entry<String, List<RepositoryInfo>> entry : ami.getRepository(stackName, stackVersion).entrySet()) {
      for (RepositoryInfo ri : entry.getValue()) {
        if (-1 == ri.getRepoId().indexOf("epel")) {
          ami.updateRepoBaseURL(stackName, stackVersion,
              ri.getOsType(), ri.getRepoId(), ri.getDefaultBaseUrl());
        }
      }
    }
   
View Full Code Here

Examples of org.apache.ambari.server.api.services.AmbariMetaInfo

    String commandName = actionExecutionContext.getActionName();

    String clusterName = stage.getClusterName();
    Cluster cluster = clusters.getCluster(clusterName);
    StackId stackId = cluster.getDesiredStackVersion();
    AmbariMetaInfo ambariMetaInfo = managementController.getAmbariMetaInfo();
    ServiceInfo serviceInfo = ambariMetaInfo.getServiceInfo
      (stackId.getStackName(), stackId.getStackVersion(), serviceName);
    StackInfo stackInfo = ambariMetaInfo.getStackInfo
      (stackId.getStackName(), stackId.getStackVersion());

    long nowTimestamp = System.currentTimeMillis();

    for (String hostName : hosts) {

      Host host = clusters.getHost(hostName);

      stage.addHostRoleExecutionCommand(hostName, Role.valueOf(componentName),
          RoleCommand.CUSTOM_COMMAND,
          new ServiceComponentHostOpInProgressEvent(componentName,
              hostName, nowTimestamp), cluster.getClusterName(), serviceName);

      Map<String, Map<String, String>> configurations =
          new TreeMap<String, Map<String, String>>();
      Map<String, Map<String, String>> configTags =
          managementController.findConfigurationTagsWithOverrides(cluster, hostName);

      HostRoleCommand cmd = stage.getHostRoleCommand(hostName, componentName);
      if (cmd != null) {
        cmd.setCommandDetail(commandDetail);
        cmd.setCustomCommandName(commandName);
      }

      ExecutionCommand execCmd = stage.getExecutionCommandWrapper(hostName,
          componentName).getExecutionCommand();

      execCmd.setConfigurations(configurations);
      execCmd.setConfigurationTags(configTags);

      execCmd.setClusterHostInfo(
          StageUtils.getClusterHostInfo(clusters.getHostsForCluster(clusterName), cluster));

      hostLevelParams.put(CUSTOM_COMMAND, commandName);
      // Set parameters required for re-installing clients on restart
      hostLevelParams.put(REPO_INFO, getRepoInfo
        (cluster, host));
      execCmd.setHostLevelParams(hostLevelParams);

      Map<String, String> commandParams = new TreeMap<String, String>();
      commandParams.put(SCHEMA_VERSION, serviceInfo.getSchemaVersion());
      if (additionalCommandParams != null) {
        for (String key : additionalCommandParams.keySet()) {
          commandParams.put(key, additionalCommandParams.get(key));
        }
      }

      String commandTimeout = configs.getDefaultAgentTaskTimeout();

      ComponentInfo componentInfo = ambariMetaInfo.getComponent(
          stackId.getStackName(), stackId.getStackVersion(),
          serviceName, componentName);

      if (serviceInfo.getSchemaVersion().equals(AmbariMetaInfo.SCHEMA_VERSION_2)) {
        // Service check command is not custom command
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.