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();
TreeNode<Resource> tree = result.getResultTree();
Assert.assertEquals(1, tree.getChildren().size());
TreeNode<Resource> stackVersionNode = tree.getChild("StackVersion:1");
Assert.assertEquals("StackVersion:1", stackVersionNode.getName());
Assert.assertEquals(Resource.Type.StackVersion, stackVersionNode.getObject().getType());
Assert.assertEquals("1.2.1", stackVersionNode.getObject().getPropertyValue("Versions/stack_version"));
QueryImpl instance2 = new TestQuery(mapIds, resourceDefinition);
instance2.addProperty("operatingSystems/*", null);
instance2.setUserPredicate(predicate);
instance2.setPageRequest(new PageRequestImpl(PageRequest.StartingPoint.OffsetStart, 1, 1, null, null));
Result result2 = instance2.execute();
TreeNode<Resource> tree2 = result2.getResultTree();
Assert.assertEquals(1, tree2.getChildren().size());
TreeNode<Resource> stackVersionNode2 = tree2.getChild("StackVersion:1");
Assert.assertEquals("StackVersion:1", stackVersionNode2.getName());
Assert.assertEquals(Resource.Type.StackVersion, stackVersionNode2.getObject().getType());
Assert.assertEquals("1.2.2", stackVersionNode2.getObject().getPropertyValue("Versions/stack_version"));
QueryImpl instance3 = new TestQuery(mapIds, resourceDefinition);
instance3.addProperty("operatingSystems/*", null);
instance3.setUserPredicate(predicate);
//page_size = 2, offset = 1
instance3.setPageRequest(new PageRequestImpl(PageRequest.StartingPoint.OffsetStart, 2, 1, null, null));
Result result3 = instance3.execute();
TreeNode<Resource> tree3 = result3.getResultTree();
Assert.assertEquals(2, tree3.getChildren().size());