Package org.apache.ambari.server.state

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



  @Test
  public void testHooksDirInheritance() throws Exception {
    // Test hook dir determination in parent
    StackInfo stackInfo = metaInfo.getStackInfo(STACK_NAME_HDP, "2.0.6");
    Assert.assertEquals("HDP/2.0.6/hooks", stackInfo.getStackHooksFolder());
    // Test hook dir inheritance
    stackInfo = metaInfo.getStackInfo(STACK_NAME_HDP, "2.0.7");
    Assert.assertEquals("HDP/2.0.6/hooks", stackInfo.getStackHooksFolder());
    // Test hook dir override
    stackInfo = metaInfo.getStackInfo(STACK_NAME_HDP, "2.0.8");
    Assert.assertEquals("HDP/2.0.8/hooks", stackInfo.getStackHooksFolder());
  }
View Full Code Here


  }

  @Test
  public void testUpdateStacks() throws Exception {

    StackInfo stackInfo = ambariMetaInfo.getStackInfo(STACK_NAME, STACK_VERSION);

    for (RepositoryInfo repositoryInfo: stackInfo.getRepositories()) {
      assertFalse(INCORRECT_BASE_URL.equals(repositoryInfo.getBaseUrl()));
      repositoryInfo.setBaseUrl(INCORRECT_BASE_URL);
      assertTrue(INCORRECT_BASE_URL.equals(repositoryInfo.getBaseUrl()));
    }

    controller.updateStacks();

    stackInfo = ambariMetaInfo.getStackInfo(STACK_NAME, STACK_VERSION);

    for (RepositoryInfo repositoryInfo: stackInfo.getRepositories()) {
      assertFalse(INCORRECT_BASE_URL.equals(repositoryInfo.getBaseUrl()));
    }
  }
View Full Code Here

  }

  public Map<String, List<RepositoryInfo>> getRepository(String stackName,
                                                         String version) throws AmbariException {
    Map<String, List<RepositoryInfo>> reposResult = null;
    StackInfo stack = getStackInfo(stackName, version);
    if (stack != null) {
      List<RepositoryInfo> repository = stack.getRepositories();
      reposResult = new HashMap<String, List<RepositoryInfo>>();
      for (RepositoryInfo repo : repository) {
        if (!reposResult.containsKey(repo.getOsType())) {
          reposResult.put(repo.getOsType(),
              new ArrayList<RepositoryInfo>());
View Full Code Here

  }

  public List<RepositoryInfo> getRepositories(String stackName,
                                              String version, String osType) throws AmbariException {

    StackInfo stack = getStackInfo(stackName, version);
    List<RepositoryInfo> repositories = stack.getRepositories();

    List<RepositoryInfo> repositoriesResult = new ArrayList<RepositoryInfo>();
    for (RepositoryInfo repository : repositories) {
      if (repository.getOsType().equals(osType))
        repositoriesResult.add(repository);
View Full Code Here

   * function for given a stack name and version, is it a supported stack
   */
  public boolean isSupportedStack(String stackName, String version) throws AmbariException {
    boolean exist = false;
    try {
      StackInfo stackInfo = getStackInfo(stackName, version);
      if (stackInfo != null) {
        exist = true;
      }
    } catch (ObjectNotFoundException e) {
    }
View Full Code Here

  public Map<String, ServiceInfo> getServices(String stackName, String version) throws AmbariException {

    Map<String, ServiceInfo> servicesInfoResult = new HashMap<String, ServiceInfo>();

    List<ServiceInfo> services;
    StackInfo stack;
    try {
      stack = getStackInfo(stackName, version);
    } catch (StackAccessException e) {
      throw new ParentObjectNotFoundException("Parent Stack Version resource doesn't exist", e);
    }

    services = stack.getServices();
    if (services != null)
      for (ServiceInfo service : services) {
        servicesInfoResult.put(service.getName(), service);
      }
    return servicesInfoResult;
View Full Code Here

  public ServiceInfo getServiceInfo(String stackName, String version,
                                    String serviceName) throws AmbariException {
    ServiceInfo serviceInfoResult = null;
    List<ServiceInfo> services;
    StackInfo stack;
    try {
      stack = getStackInfo(stackName, version);
    } catch (StackAccessException e) {
      throw new ParentObjectNotFoundException("Parent Stack Version resource doesn't exist", e);
    }

    services = stack.getServices();
    if (services != null)
      for (ServiceInfo service : services) {
        if (serviceName.equals(service.getName())) {
          serviceInfoResult = service;
          break;
View Full Code Here

  }

  public List<ServiceInfo> getSupportedServices(String stackName, String version)
    throws AmbariException {
    List<ServiceInfo> servicesResult = null;
    StackInfo stack = getStackInfo(stackName, version);
    if (stack != null)
      servicesResult = stack.getServices();
    return servicesResult;
  }
View Full Code Here

    }
    return stackVersions;
  }

  public StackInfo getStackInfo(String stackName, String version) throws AmbariException {
    StackInfo stackInfoResult = null;

    for (StackInfo stack : stacksResult) {
      if (stackName.equals(stack.getName())
          && version.equals(stack.getVersion())) {
        stackInfoResult = stack;
View Full Code Here

   */
  public Set<OperatingSystemInfo> getOperatingSystems(String stackName, String version)
      throws AmbariException {

    Set<OperatingSystemInfo> operatingSystems = new HashSet<OperatingSystemInfo>();
    StackInfo stack = getStackInfo(stackName, version);
    List<RepositoryInfo> repositories = stack.getRepositories();
    for (RepositoryInfo repository : repositories) {
      operatingSystems.add(new OperatingSystemInfo(repository.getOsType()));
    }

    return operatingSystems;
View Full Code Here

TOP

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

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.