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

Examples of org.apache.ambari.server.controller.utilities.PredicateBuilder.property()


    updatePropertyMap.put("SomeOtherProperty", 99);

    // get the property map to update resource
    // where ClusterName=c1 and ResourceName=r1
    PredicateBuilder pb = new PredicateBuilder();
    Predicate predicate = pb.property("ClusterName").equals("c1").and().property("ResourceName").equals("r1").toPredicate();

    Set<Map<String, Object>> propertyMaps = provider.getPropertyMaps(updatePropertyMap, predicate);

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


    Assert.assertEquals(99, map.get("SomeOtherProperty"));

    // get the property maps to update resources
    // where ClusterName=c1 and (ResourceName=r1 or ResourceName=r2)
    pb = new PredicateBuilder();
    predicate = pb.property("ClusterName").equals("c1").and().
        begin().
          property("ResourceName").equals("r1").or().property("ResourceName").equals("r2").
        end().toPredicate();

    propertyMaps = provider.getPropertyMaps(updatePropertyMap, predicate);
View Full Code Here

      for (String keyPropertyId : keyPropertyIds) {
        if (pbWithPredicate != null) {
          pb = pbWithPredicate.and();
        }
        pbWithPredicate =
            pb.property(keyPropertyId).equals((Comparable) resource.getPropertyValue(keyPropertyId));
      }
      if (pbWithPredicate != null) {
        pbWithPredicate = pbWithPredicate.end();
      }
    }
View Full Code Here

      for (String keyPropertyId : keyPropertyIds) {
        if (pbWithPredicate != null) {
          pb = pbWithPredicate.and();
        }
        pbWithPredicate =
            pb.property(keyPropertyId).equals((Comparable) resource.getPropertyValue(keyPropertyId));
      }
      if (pbWithPredicate != null) {
        pbWithPredicate = pbWithPredicate.end();
      }
    }
View Full Code Here

  }

  @Test
  public void testGetPredicate() throws Exception {
    PredicateBuilder pb = new PredicateBuilder();
    Predicate predicate = pb.property("id").equals(20).toPredicate();

    PageRequest pageRequest = new PageRequestImpl(PageRequest.StartingPoint.Beginning, 20, 99, predicate, null);
    Assert.assertEquals(predicate, pageRequest.getPredicate());
  }
View Full Code Here

    //test
    QueryImpl instance = new TestQuery(mapIds, resourceDefinition);

    PredicateBuilder pb = new PredicateBuilder();
    Predicate predicate = pb.property("versions/operatingSystems/OperatingSystems/os_type").equals("centos5").toPredicate();

    instance.setUserPredicate(predicate);

    Result result = instance.execute();
View Full Code Here

    //test
    QueryImpl instance = new TestQuery(mapIds, resourceDefinition);

    PredicateBuilder pb = new PredicateBuilder();
    Predicate predicate = pb.property("Hosts/host_name").equals("host:2").toPredicate();

    instance.setUserPredicate(predicate);

    Result result = instance.execute();
View Full Code Here

    //test
    QueryImpl instance = new TestQuery(mapIds, resourceDefinition);

    PredicateBuilder pb = new PredicateBuilder();
    Predicate predicate = pb.property("Hosts/host_name").equals("host:2").toPredicate();

    instance.setUserPredicate(predicate);

    Result result = instance.execute();
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.