Examples of IvoryService


Examples of org.apache.ambari.server.controller.ivory.IvoryService

  @Override
  public RequestStatus deleteResources(Predicate predicate)
      throws SystemException, UnsupportedPropertyException,
             NoSuchResourceException, NoSuchParentResourceException {
    IvoryService service = getService();

    // get all the feeds that pass the predicate check
    Set<Resource> resources = getResources(PropertyHelper.getReadRequest(), predicate);

    for (Resource resource : resources) {
      // delete all the matching feeds with the property values from the request
      service.deleteFeed((String) resource.getPropertyValue(FEED_NAME_PROPERTY_ID));
    }
    return new RequestStatusImpl(null);
  }
View Full Code Here

Examples of org.apache.ambari.server.controller.ivory.IvoryService

* Tests for InstanceResourceProvider.
*/
public class InstanceResourceProviderTest {
  @Test
  public void testCreateResources() throws Exception {
    IvoryService service = createMock(IvoryService.class);

    Set<Map<String, Object>> propertySet = new HashSet<Map<String, Object>>();

    Map<String, Object> properties = new HashMap<String, Object>();

View Full Code Here

Examples of org.apache.ambari.server.controller.ivory.IvoryService

    verify(service);
  }

  @Test
  public void testGetResources() throws Exception {
    IvoryService service = createMock(IvoryService.class);

    Set<Map<String, Object>> propertySet = new HashSet<Map<String, Object>>();

    Map<String, Object> properties = new HashMap<String, Object>();

    List<Instance> instances = new LinkedList<Instance>();

    Instance instance1 = new Instance("Feed1", "Instance1", "s", "st", "et", "d", "l");
    Instance instance2 = new Instance("Feed1", "Instance2", "s", "st", "et", "d", "l");
    Instance instance3 = new Instance("Feed1", "Instance3", "s", "st", "et", "d", "l");

    instances.add(instance1);
    instances.add(instance2);
    instances.add(instance3);

    // set expectations
    expect(service.getFeedNames()).andReturn(Collections.singletonList("Feed1"));
    expect(service.getInstances("Feed1")).andReturn(instances);

    // replay
    replay(service);

    propertySet.add(properties);
View Full Code Here

Examples of org.apache.ambari.server.controller.ivory.IvoryService

    verify(service);
  }

  @Test
  public void testUpdateResources() throws Exception {
    IvoryService service = createMock(IvoryService.class);

    Set<Map<String, Object>> propertySet = new HashSet<Map<String, Object>>();

    Map<String, Object> properties = new HashMap<String, Object>();

    properties.put(InstanceResourceProvider.INSTANCE_FEED_NAME_PROPERTY_ID, "Feed1");
    properties.put(InstanceResourceProvider.INSTANCE_ID_PROPERTY_ID, "Instance1");
    properties.put(InstanceResourceProvider.INSTANCE_STATUS_PROPERTY_ID, "SUSPEND");
    properties.put(InstanceResourceProvider.INSTANCE_START_TIME_PROPERTY_ID, "ST");
    properties.put(InstanceResourceProvider.INSTANCE_END_TIME_PROPERTY_ID, "ET");
    properties.put(InstanceResourceProvider.INSTANCE_DETAILS_PROPERTY_ID, "DETAILS");
    properties.put(InstanceResourceProvider.INSTANCE_LOG_PROPERTY_ID, "log");

    List<Instance> instances = new LinkedList<Instance>();

    // set expectations
    expect(service.getFeedNames()).andReturn(Collections.singletonList("Feed1"));
    expect(service.getInstances("Feed1")).andReturn(instances);

    // replay
    replay(service);

    propertySet.add(properties);
View Full Code Here

Examples of org.apache.ambari.server.controller.ivory.IvoryService

    verify(service);
  }

  @Test
  public void testDeleteResources() throws Exception {
    IvoryService service = createMock(IvoryService.class);

    Instance instance1 = new Instance("Feed1", "Instance1", "SUBMITTED", "start", "end", "details", "log");

    // set expectations
    expect(service.getFeedNames()).andReturn(Collections.singletonList("Feed1"));
    expect(service.getInstances("Feed1")).andReturn(Collections.singletonList(instance1));
    service.killInstance("Feed1", "Instance1");

    // replay
    replay(service);

    InstanceResourceProvider provider = new InstanceResourceProvider(service,
View Full Code Here

Examples of org.apache.ambari.server.controller.ivory.IvoryService

    verify(service);
  }

  @Test
  public void testGetKeyPropertyIds() throws Exception {
    IvoryService service = createMock(IvoryService.class);

    Map<Resource.Type, String> keyPropertyIds = PropertyHelper.getKeyPropertyIds(Resource.Type.DRInstance);

    InstanceResourceProvider provider = new InstanceResourceProvider(service,
        PropertyHelper.getPropertyIds(Resource.Type.DRInstance),
View Full Code Here

Examples of org.apache.ambari.server.controller.ivory.IvoryService

    locations.put("path", location1.getPath());
  }

  @Test
  public void testCreateResources() throws Exception {
    IvoryService service = createMock(IvoryService.class);

    Set<Map<String, Object>> propertySet = new HashSet<Map<String, Object>>();

    Map<String, Object> properties = new HashMap<String, Object>();

    properties.put(TargetClusterResourceProvider.CLUSTER_NAME_PROPERTY_ID, "Cluster1");
    properties.put(TargetClusterResourceProvider.CLUSTER_COLO_PROPERTY_ID, "Colo");
    properties.put(TargetClusterResourceProvider.CLUSTER_INTERFACES_PROPERTY_ID, Collections.singleton(interfaces));
    properties.put(TargetClusterResourceProvider.CLUSTER_LOCATIONS_PROPERTY_ID, Collections.singleton(locations));
    properties.put(TargetClusterResourceProvider.CLUSTER_PROPERTIES_PROPERTY_ID, Collections.singletonMap("P1", "V1"));

    // set expectations
    service.submitCluster(TargetClusterResourceProvider.getCluster("Cluster1", properties));

    // replay
    replay(service);

    propertySet.add(properties);
View Full Code Here

Examples of org.apache.ambari.server.controller.ivory.IvoryService

    verify(service);
  }

  @Test
  public void testGetResources() throws Exception {
    IvoryService service = createMock(IvoryService.class);

    Set<Map<String, Object>> propertySet = new HashSet<Map<String, Object>>();

    Map<String, Object> properties = new HashMap<String, Object>();

    List<String> targetClusterNames = new LinkedList<String>();
    targetClusterNames.add("Cluster1");
    targetClusterNames.add("Cluster2");
    targetClusterNames.add("Cluster3");

    Cluster.Interface interface1 = new Cluster.Interface("type", "endpoint", "version");
    Cluster.Location  location1  = new Cluster.Location("name", "path");

    Cluster targetCluster1 = new Cluster("Cluster1", "Colo", Collections.singleton(interface1),
        Collections.singleton(location1), Collections.singletonMap("P1", "V1"));
    Cluster targetCluster2 = new Cluster("Cluster2", "Colo", Collections.singleton(interface1),
        Collections.singleton(location1), Collections.singletonMap("P1", "V1"));
    Cluster targetCluster3 = new Cluster("Cluster3", "Colo", Collections.singleton(interface1),
        Collections.singleton(location1), Collections.singletonMap("P1", "V1"));

    // set expectations
    expect(service.getClusterNames()).andReturn(targetClusterNames);

    expect(service.getCluster("Cluster1")).andReturn(targetCluster1);
    expect(service.getCluster("Cluster2")).andReturn(targetCluster2);
    expect(service.getCluster("Cluster3")).andReturn(targetCluster3);

    // replay
    replay(service);

    propertySet.add(properties);
View Full Code Here

Examples of org.apache.ambari.server.controller.ivory.IvoryService

    verify(service);
  }

  @Test
  public void testUpdateResources() throws Exception {
    IvoryService service = createMock(IvoryService.class);

    Set<Map<String, Object>> propertySet = new HashSet<Map<String, Object>>();

    Map<String, Object> properties = new HashMap<String, Object>();

    properties.put(TargetClusterResourceProvider.CLUSTER_NAME_PROPERTY_ID, "Cluster1");
    properties.put(TargetClusterResourceProvider.CLUSTER_COLO_PROPERTY_ID, "Colo");
    properties.put(TargetClusterResourceProvider.CLUSTER_INTERFACES_PROPERTY_ID, Collections.singleton(interfaces));
    properties.put(TargetClusterResourceProvider.CLUSTER_LOCATIONS_PROPERTY_ID, Collections.singleton(locations));
    properties.put(TargetClusterResourceProvider.CLUSTER_PROPERTIES_PROPERTY_ID + "/P1", "V1");

    List<String> targetClusterNames = new LinkedList<String>();
    targetClusterNames.add("Cluster1");

    Set<Cluster.Interface> interfaceSet = Collections.singleton(interface1);
    Set<Cluster.Location>  locationSet  = Collections.singleton(location1);

    Cluster targetCluster1 = new Cluster("Cluster1", "Colo", interfaceSet,
        locationSet, Collections.singletonMap("P1", "V1"));

    // set expectations
    expect(service.getClusterNames()).andReturn(targetClusterNames);

    expect(service.getCluster("Cluster1")).andReturn(targetCluster1);

    service.updateCluster(targetCluster1);

    // replay
    replay(service);

    propertySet.add(properties);
View Full Code Here

Examples of org.apache.ambari.server.controller.ivory.IvoryService

    verify(service);
  }

  @Test
  public void testDeleteResources() throws Exception {
    IvoryService service = createMock(IvoryService.class);

    List<String> targetClusterNames = new LinkedList<String>();
    targetClusterNames.add("Cluster1");

    Cluster.Interface interface1 = new Cluster.Interface("type", "endpoint", "version");
    Cluster.Location  location1  = new Cluster.Location("name", "path");

    Cluster targetCluster1 = new Cluster("Cluster1", "Colo", Collections.singleton(interface1),
        Collections.singleton(location1), Collections.singletonMap("P1", "V1"));

    // set expectations
    expect(service.getClusterNames()).andReturn(targetClusterNames);

    expect(service.getCluster("Cluster1")).andReturn(targetCluster1);

    service.deleteCluster("Cluster1");

    // replay
    replay(service);

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.