Package org.apache.ambari.server.controller.utilities

Examples of org.apache.ambari.server.controller.utilities.PredicateBuilder


    properties.put(PropertyHelper.getPropertyId("Clusters.desired_config.properties", "x"), "y");

    // create the request
    Request request = PropertyHelper.getUpdateRequest(properties, mapRequestProps);
   
    Predicate  predicate = new PredicateBuilder().property(
        ClusterResourceProvider.CLUSTER_NAME_PROPERTY_ID).equals("Cluster100").toPredicate();
   
    ResourceProvider provider = AbstractControllerResourceProvider.getResourceProvider(
        Resource.Type.Cluster,
        PropertyHelper.getPropertyIds(Resource.Type.Cluster),
View Full Code Here


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

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

    // delete the cluster named Cluster102
    Predicate  predicate = new PredicateBuilder().property(
        ClusterResourceProvider.CLUSTER_NAME_PROPERTY_ID).equals("Cluster102").toPredicate();
    provider.deleteResources(predicate);

    // delete the cluster where id == 103
    predicate = new PredicateBuilder().property(
        ClusterResourceProvider.CLUSTER_ID_PROPERTY_ID).equals(103L).toPredicate();
    provider.deleteResources(predicate);

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

    propertyIds.add(PropertyHelper.getPropertyId("c1", "p3"));
    propertyIds.add(PropertyHelper.getPropertyId("c2", "p4"));

    Request request = PropertyHelper.getReadRequest(propertyIds);

    Predicate predicate = new PredicateBuilder().property("c1/p2").equals(1).toPredicate();

    Iterable<Resource> iterable = controller.getResources(Resource.Type.Host, request, predicate);

    int cnt = 0;
    for (Resource resource : iterable) {
View Full Code Here

    propertyIds.add(PropertyHelper.getPropertyId("c1", "p3"));
    propertyIds.add(PropertyHelper.getPropertyId("c2", "p4"));

    Request request = PropertyHelper.getReadRequest(propertyIds);

    Predicate predicate = new PredicateBuilder().property(UNSUPPORTED_PROPERTY).equals(1).toPredicate();

    try {
      controller.getResources(Resource.Type.Host, request, predicate);
      Assert.fail("Expected an UnsupportedPropertyException for the unsupported properties.");
    } catch (UnsupportedPropertyException e) {
View Full Code Here

    propertyIds.add(PropertyHelper.getPropertyId("c1", "p3"));
    propertyIds.add(UNSUPPORTED_PROPERTY);

    Request request = PropertyHelper.getReadRequest(propertyIds);

    Predicate predicate = new PredicateBuilder().property("c1/p2").equals(1).toPredicate();

    try {
      controller.getResources(Resource.Type.Host, request, predicate);
      Assert.fail("Expected an UnsupportedPropertyException for the unsupported properties.");
    } catch (UnsupportedPropertyException e) {
View Full Code Here

    propertyMap.put(PropertyHelper.getPropertyId("c1", "p1"), 99);
    propertyMap.put(PropertyHelper.getPropertyId("c1", "p2"), 2);

    Request request = PropertyHelper.getUpdateRequest(propertyMap, null);

    Predicate predicate = new PredicateBuilder().property("c1/p2").equals(1).toPredicate();

    controller.updateResources(Resource.Type.Host, request, predicate);

    Assert.assertEquals(TestResourceProvider.Action.Update, resourceProvider.getLastAction());
    Assert.assertSame(request, resourceProvider.getLastRequest());
View Full Code Here

    propertyMap.put(PropertyHelper.getPropertyId("c1", "p1"), 99);
    propertyMap.put(UNSUPPORTED_PROPERTY, 2);

    Request request = PropertyHelper.getUpdateRequest(propertyMap, null);

    Predicate predicate = new PredicateBuilder().property("c1/p2").equals(1).toPredicate();

    try {
      controller.updateResources(Resource.Type.Host, request, predicate);
      Assert.fail("Expected an UnsupportedPropertyException for the unsupported properties.");
    } catch (UnsupportedPropertyException e) {
View Full Code Here

    propertyMap.put(PropertyHelper.getPropertyId("c1", "p1"), 99);
    propertyMap.put(PropertyHelper.getPropertyId("c1", "p2"), 2);

    Request request = PropertyHelper.getUpdateRequest(propertyMap, null);

    Predicate predicate = new PredicateBuilder().property(UNSUPPORTED_PROPERTY).equals(1).toPredicate();

    try {
      controller.updateResources(Resource.Type.Host, request, predicate);
      Assert.fail("Expected an UnsupportedPropertyException for the unsupported properties.");
    } catch (UnsupportedPropertyException e) {
View Full Code Here

    propertyMap.put(PropertyHelper.getPropertyId("c1", "p1"), 99);
    propertyMap.put(PropertyHelper.getPropertyId("c1", "p2"), 2);

    Request request = PropertyHelper.getUpdateRequest(propertyMap, null);

    Predicate predicate = new PredicateBuilder().property("c3/p6").equals(1).toPredicate();

    controller.updateResources(Resource.Type.Host, request, predicate);

    Assert.assertEquals(TestResourceProvider.Action.Update, resourceProvider.getLastAction());
    Assert.assertSame(request, resourceProvider.getLastRequest());
View Full Code Here

  public void testDeleteResources() throws Exception{
    TestProviderModule providerModule = new TestProviderModule();
    TestResourceProvider resourceProvider = (TestResourceProvider) providerModule.getResourceProvider(Resource.Type.Host);
    ClusterController controller = new ClusterControllerImpl(providerModule);

    Predicate predicate = new PredicateBuilder().property("c1/p2").equals(1).toPredicate();

    controller.deleteResources(Resource.Type.Host, predicate);

    Assert.assertEquals(TestResourceProvider.Action.Delete, resourceProvider.getLastAction());
    Assert.assertNull(resourceProvider.getLastRequest());
View Full Code Here

TOP

Related Classes of org.apache.ambari.server.controller.utilities.PredicateBuilder

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.