Package org.apache.ambari.server

Examples of org.apache.ambari.server.HostNotFoundException


    Map<String, Host> hostMap = new HashMap<String, Host>();
    r.lock();
    try {
      for (String host : hostSet) {
        if (!hosts.containsKey(host))
          throw new HostNotFoundException(host);
        else
          hostMap.put(host, hosts.get(host));
      }
    } finally {
      r.unlock();
View Full Code Here


          } else {
            cSet.add(getClusterById(clusterEntity.getClusterId()));
          }
        }
      } else {
        throw new HostNotFoundException(hostname);
      }
    }
    return hosts.get(hostname);
  }
View Full Code Here

      String clusterName) throws AmbariException {
    Cluster cluster = getCluster(clusterName);
    HostImpl host = (HostImpl) getHost(hostname);

    if (!hostClusterMap.containsKey(hostname)) {
      throw new HostNotFoundException(hostname);
    }

    for (Cluster c : hostClusterMap.get(hostname)) {
      if (c.getClusterName().equals(clusterName)) {
        throw new DuplicateResourceException("Attempted to create a host which already exists: clusterName=" +
View Full Code Here

          } else {
            cSet.add(getClusterById(clusterEntity.getClusterId()));
          }
        }
      } else {
        throw new HostNotFoundException(hostname);
      }
    }
    return hosts.get(hostname);
  }
View Full Code Here

      String clusterName) throws AmbariException {
    Cluster cluster = getCluster(clusterName);
    HostImpl host = (HostImpl) getHost(hostname);

    if (!hostClusterMap.containsKey(hostname)) {
      throw new HostNotFoundException(hostname);
    }

    for (Cluster c : hostClusterMap.get(hostname)) {
      if (c.getClusterName().equals(clusterName)) {
        throw new DuplicateResourceException("Attempted to create a host which already exists: clusterName=" +
View Full Code Here

          invalidHostsStr.append(hostname);
        }
      }
    }
    if (foundInvalidHosts) {
      throw new HostNotFoundException(invalidHostsStr.toString());
    }

    clusters.addCluster(request.getClusterName());
    Cluster c = clusters.getCluster(request.getClusterName());
    if (request.getStackVersion() != null) {
View Full Code Here

    if (request.getHostname() != null) {
      try {
        if (! clusters.getClustersForHost(request.getHostname()).contains(cluster)) {
          // case where host exists but not associated with given cluster
          throw new ParentObjectNotFoundException("Parent Host resource doesn't exist",
              new HostNotFoundException(request.getClusterName(), request.getHostname()));
        }
      } catch (HostNotFoundException e) {
        // creating new HostNotFoundException to add cluster name
        throw new ParentObjectNotFoundException("Parent Host resource doesn't exist",
            new HostNotFoundException(request.getClusterName(), request.getHostname()));
      }
    }

    if (request.getComponentName() != null) {
      if (request.getServiceName() == null
View Full Code Here

    injector.injectMembers(capture(controllerCapture));
    expect(injector.getInstance(Gson.class)).andReturn(null);

    // getHosts
    expect(clusters.getCluster("cluster1")).andReturn(cluster);
    expect(clusters.getHost("host1")).andThrow(new HostNotFoundException("host1"));

    // replay mocks
    replay(injector, clusters, cluster);

    //test
View Full Code Here

    expect(host2.getHostName()).andReturn("host2").anyTimes();
    expect(clusters.getClustersForHost("host2")).andReturn(Collections.singleton(cluster));
    expect(host2.convertToResponse()).andReturn(response2);
    response2.setClusterName("cluster1");

    expect(clusters.getHost("host3")).andThrow(new HostNotFoundException("host3"));
    expect(clusters.getHost("host4")).andThrow(new HostNotFoundException("host4"));

    // replay mocks
    replay(injector, clusters, cluster, host1, host2, response, response2);

    //test
View Full Code Here

      loadClustersAndHosts();
    }
    r.lock();
    try {
      if (!hosts.containsKey(hostname)) {
        throw new HostNotFoundException(hostname);
      }
      return hosts.get(hostname);
    } finally {
      r.unlock();
    }
View Full Code Here

TOP

Related Classes of org.apache.ambari.server.HostNotFoundException

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.