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

    //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("Versions/stack_version").equals("1.2.1").or()
        .property("Versions/stack_version").equals("1.2.2").toPredicate();

    instance.setUserPredicate(predicate);
    //First page
    instance.setPageRequest(new PageRequestImpl(PageRequest.StartingPoint.Beginning, 1, 0, null, null));
View Full Code Here

    QueryImpl instance = new TestQuery(mapIds, resourceDefinition);
    instance.addProperty("operatingSystems/*", null);

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

    instance.setUserPredicate(predicate);
    instance.setPageRequest(new PageRequestImpl(PageRequest.StartingPoint.Beginning, 1, 0, null, null));

    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

    Map<String, ResourceInstance> mapChildren = new HashMap<String, ResourceInstance>();
    mapChildren.put("host_components", hostResourceInstance);

    PredicateBuilder pb = new PredicateBuilder();
    Predicate predicate = pb.property("clusterId").equals("clusterName").and().
        property("serviceId").equals("serviceName").and().
        property("componentId").equals("componentName").toPredicate();

    // expectations
    expect(componentResourceInstance.getResourceDefinition()).andReturn(componentResourceDefinition).anyTimes();
View Full Code Here

    mapResourceIds.put(Resource.Type.Cluster, "clusterName");
    mapResourceIds.put(Resource.Type.Service, "serviceName");
    mapResourceIds.put(Resource.Type.Component, null);

    PredicateBuilder pb = new PredicateBuilder();
    Predicate predicate = pb.property("clusterId").equals("clusterName").and().
        property("serviceId").equals("serviceName").toPredicate();

    // expectations
    expect(componentResource.getType()).andReturn(Resource.Type.Component).anyTimes();
View Full Code Here

    mapResourceIds.put(Resource.Type.Cluster, "clusterName");
    mapResourceIds.put(Resource.Type.Service, "serviceName");
    mapResourceIds.put(Resource.Type.Component, null);

    PredicateBuilder pb = new PredicateBuilder();
    Predicate internalPredicate = pb.property("clusterId").equals("clusterName").and().
        property("serviceId").equals("serviceName").toPredicate();

    pb = new PredicateBuilder();
    Predicate userPredicate = pb.property("foo").equals("bar").toPredicate();
    // combine internal predicate and user predicate
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.