Package org.apache.ambari.server.controller.spi

Examples of org.apache.ambari.server.controller.spi.Predicate


    AbstractResourceProviderTest.TestObserver observer = new AbstractResourceProviderTest.TestObserver();

    ((ObservableResourceProvider)provider).addObserver(observer);

    Predicate predicate = new PredicateBuilder().property(HostResourceProvider.HOST_NAME_PROPERTY_ID).equals("Host100").
        toPredicate();
    provider.deleteResources(predicate);


    ResourceProviderEvent lastEvent = observer.getLastEvent();
View Full Code Here


    propertyIds.add(HostComponentResourceProvider.HOST_COMPONENT_STATE_PROPERTY_ID);
    propertyIds.add(HostComponentResourceProvider.HOST_COMPONENT_STACK_ID_PROPERTY_ID);
    propertyIds.add(HostComponentResourceProvider.HOST_COMPONENT_DESIRED_STATE_PROPERTY_ID);
    propertyIds.add(HostComponentResourceProvider.HOST_COMPONENT_DESIRED_STACK_ID_PROPERTY_ID);

    Predicate predicate = new PredicateBuilder().property(
        HostComponentResourceProvider.HOST_COMPONENT_CLUSTER_NAME_PROPERTY_ID).equals("Cluster100").toPredicate();
    Request request = PropertyHelper.getReadRequest(propertyIds);
    Set<Resource> resources = provider.getResources(request, predicate);

    Assert.assertEquals(3, resources.size());
View Full Code Here

    // create the request
    Request request = PropertyHelper.getUpdateRequest(properties, mapRequestProps);

    // update the cluster named Cluster102
    Predicate predicate = new PredicateBuilder().property(
        HostComponentResourceProvider.HOST_COMPONENT_CLUSTER_NAME_PROPERTY_ID).equals("Cluster102").toPredicate();
    provider.updateResources(request, predicate);

    // verify
    verify(managementController, response);
View Full Code Here

    AbstractResourceProviderTest.TestObserver observer = new AbstractResourceProviderTest.TestObserver();

    ((ObservableResourceProvider)provider).addObserver(observer);

    Predicate predicate = new PredicateBuilder().
        property(HostComponentResourceProvider.HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID).equals("Component100").and().
        property(HostComponentResourceProvider.HOST_COMPONENT_HOST_NAME_PROPERTY_ID).equals("Host100").toPredicate();
    provider.deleteResources(predicate);

View Full Code Here

    propertyIds.add(ComponentResourceProvider.COMPONENT_CLUSTER_NAME_PROPERTY_ID);
    propertyIds.add(ComponentResourceProvider.COMPONENT_COMPONENT_NAME_PROPERTY_ID);
    propertyIds.add(ComponentResourceProvider.COMPONENT_CATEGORY_PROPERTY_ID);

    Predicate predicate = new PredicateBuilder().property(ComponentResourceProvider.COMPONENT_CLUSTER_NAME_PROPERTY_ID).
        equals("Cluster100").toPredicate();
    Request request = PropertyHelper.getReadRequest(propertyIds);
    Set<Resource> resources = provider.getResources(request, predicate);

    Assert.assertEquals(3, resources.size());
View Full Code Here

    // create the request
    Request request = PropertyHelper.getUpdateRequest(properties, mapRequestProps);

    // update the cluster named Cluster102
    Predicate predicate = new PredicateBuilder().property(ComponentResourceProvider.COMPONENT_CLUSTER_NAME_PROPERTY_ID).
        equals("Cluster100").toPredicate();
    provider.updateResources(request, predicate);

    // verify
    verify(managementController, clusters, cluster, ambariMetaInfo, service,
View Full Code Here

    AbstractResourceProviderTest.TestObserver observer = new AbstractResourceProviderTest.TestObserver();

    ((ObservableResourceProvider)provider).addObserver(observer);

    Predicate  predicate = new PredicateBuilder().property(
        ComponentResourceProvider.COMPONENT_COMPONENT_NAME_PROPERTY_ID).equals("Component100").toPredicate();
    try {
      provider.deleteResources(predicate);
      Assert.fail("Expected exception.");
    } catch (Exception e) {
View Full Code Here

    DependencyInfo dependencyInfo = new DependencyInfo();
    dependencyInfo.setName("service_name/comp_name");
    dependencyInfo.setScope("cluster");

    Predicate namePredicate = new EqualsPredicate<String>(
        StackDependencyResourceProvider.COMPONENT_NAME_ID, "comp_name");
    Predicate depServicePredicate = new EqualsPredicate<String>(
        StackDependencyResourceProvider.DEPENDENT_SERVICE_NAME_ID, "dep_service_name");
    Predicate depCompPredicate = new EqualsPredicate<String>(
        StackDependencyResourceProvider.DEPENDENT_COMPONENT_NAME_ID, "dep_comp_name");
    Predicate stackNamePredicate = new EqualsPredicate<String>
        (StackDependencyResourceProvider.STACK_NAME_ID, "stack_name");
    Predicate stackVersionPredicate = new EqualsPredicate<String>(
        StackDependencyResourceProvider.STACK_VERSION_ID, "stack_version");

    Predicate andPredicate = new AndPredicate(namePredicate, depServicePredicate,
        depCompPredicate, stackNamePredicate, stackVersionPredicate);

    //mock expectations
    expect(metaInfo.getComponentDependency("stack_name", "stack_version", "dep_service_name",
        "dep_comp_name", "comp_name")).andReturn(dependencyInfo);
View Full Code Here

    DependencyInfo dependencyInfo = new DependencyInfo();
    dependencyInfo.setName("service_name/comp_name");
    dependencyInfo.setScope("cluster");

    Predicate namePredicate = new EqualsPredicate<String>(
        StackDependencyResourceProvider.COMPONENT_NAME_ID, "comp_name");
    Predicate name2Predicate = new EqualsPredicate<String>(
        StackDependencyResourceProvider.COMPONENT_NAME_ID, "comp_name2");
    Predicate depServicePredicate = new EqualsPredicate<String>(
        StackDependencyResourceProvider.DEPENDENT_SERVICE_NAME_ID, "dep_service_name");
    Predicate depCompPredicate = new EqualsPredicate<String>(
        StackDependencyResourceProvider.DEPENDENT_COMPONENT_NAME_ID, "dep_comp_name");
    Predicate stackNamePredicate = new EqualsPredicate<String>
        (StackDependencyResourceProvider.STACK_NAME_ID, "stack_name");
    Predicate stackVersionPredicate = new EqualsPredicate<String>(
        StackDependencyResourceProvider.STACK_VERSION_ID, "stack_version");

    Predicate andPredicate1 = new AndPredicate(namePredicate, depServicePredicate,
        depCompPredicate, stackNamePredicate, stackVersionPredicate);
    Predicate andPredicate2 = new AndPredicate(name2Predicate, depServicePredicate,
        depCompPredicate, stackNamePredicate, stackVersionPredicate);
    Predicate orPredicate = new OrPredicate(andPredicate1, andPredicate2);

    //mock expectations
    expect(metaInfo.getComponentDependency("stack_name", "stack_version", "dep_service_name",
        "dep_comp_name", "comp_name")).andReturn(dependencyInfo);
    expect(metaInfo.getComponentDependency("stack_name", "stack_version", "dep_service_name",
View Full Code Here

      String name = (String) resource.getPropertyValue(ClusterResourceProvider.CLUSTER_NAME_PROPERTY_ID);
      Assert.assertEquals(name, "Cluster" + id);
    }

    // get cluster named Cluster102
    Predicate predicate =
        new PredicateBuilder().property(ClusterResourceProvider.CLUSTER_NAME_PROPERTY_ID).equals("Cluster102").
            toPredicate();
    resources = provider.getResources(request, predicate);

    Assert.assertEquals(1, resources.size());
View Full Code Here

TOP

Related Classes of org.apache.ambari.server.controller.spi.Predicate

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.