use of com.evolveum.midpoint.prism.path.ItemPath in project midpoint by Evolveum.
the class TestQueryBuilder method test150ExistsWithEquals.
@Test
public void test150ExistsWithEquals() throws Exception {
ObjectQuery actual = QueryBuilder.queryFor(UserType.class, getPrismContext()).exists(UserType.F_ASSIGNMENT).item(AssignmentType.F_DESCRIPTION).startsWith("desc1").build();
ComplexTypeDefinition assCtd = getPrismContext().getSchemaRegistry().findComplexTypeDefinitionByCompileTimeClass(AssignmentType.class);
PrismContainerDefinition userPcd = getPrismContext().getSchemaRegistry().findContainerDefinitionByCompileTimeClass(UserType.class);
ObjectQuery expected = ObjectQuery.createObjectQuery(ExistsFilter.createExists(new ItemPath(UserType.F_ASSIGNMENT), userPcd, SubstringFilter.createSubstring(new ItemPath(AssignmentType.F_DESCRIPTION), assCtd.findPropertyDefinition(AssignmentType.F_DESCRIPTION), getPrismContext(), null, "desc1", true, false)));
compare(actual, expected);
}
use of com.evolveum.midpoint.prism.path.ItemPath in project midpoint by Evolveum.
the class TestQueryBuilder method test151ExistsWithEquals2.
@Test
public void test151ExistsWithEquals2() throws Exception {
ObjectQuery actual = QueryBuilder.queryFor(UserType.class, getPrismContext()).exists(UserType.F_ASSIGNMENT).item(AssignmentType.F_NOTE).endsWith("DONE.").build();
ComplexTypeDefinition assCtd = getPrismContext().getSchemaRegistry().findComplexTypeDefinitionByCompileTimeClass(AssignmentType.class);
PrismContainerDefinition userPcd = getPrismContext().getSchemaRegistry().findContainerDefinitionByCompileTimeClass(UserType.class);
ObjectQuery expected = ObjectQuery.createObjectQuery(ExistsFilter.createExists(new ItemPath(UserType.F_ASSIGNMENT), userPcd, SubstringFilter.createSubstring(new ItemPath(AssignmentType.F_NOTE), assCtd.findPropertyDefinition(AssignmentType.F_NOTE), getPrismContext(), null, "DONE.", false, true)));
compare(actual, expected);
}
use of com.evolveum.midpoint.prism.path.ItemPath in project midpoint by Evolveum.
the class TestQueryBuilder method test156ExistsAndSomething.
@Test
public void test156ExistsAndSomething() throws Exception {
ObjectQuery actual = QueryBuilder.queryFor(UserType.class, getPrismContext()).exists(UserType.F_ASSIGNMENT).none().and().all().build();
ComplexTypeDefinition assCtd = getPrismContext().getSchemaRegistry().findComplexTypeDefinitionByCompileTimeClass(AssignmentType.class);
PrismContainerDefinition userPcd = getPrismContext().getSchemaRegistry().findContainerDefinitionByCompileTimeClass(UserType.class);
ObjectQuery expected = ObjectQuery.createObjectQuery(AndFilter.createAnd(ExistsFilter.createExists(new ItemPath(UserType.F_ASSIGNMENT), userPcd, NoneFilter.createNone()), AllFilter.createAll()));
compare(actual, expected);
}
use of com.evolveum.midpoint.prism.path.ItemPath in project midpoint by Evolveum.
the class TestPath method testPathRemainder.
@Test
public void testPathRemainder() throws Exception {
System.out.println("\n\n===[ testPathRemainder ]===\n");
// GIVEN
ItemPath pathFoo = new ItemPath(new QName(NS, "foo"));
ItemPath pathBar = new ItemPath(new QName(NS, "bar"));
ItemPath pathFooNull = new ItemPath(new NameItemPathSegment(new QName(NS, "foo")), new IdItemPathSegment());
ItemPath pathFoo123 = new ItemPath(new NameItemPathSegment(new QName(NS, "foo")), new IdItemPathSegment(123L));
ItemPath pathFooBar = new ItemPath(new QName(NS, "foo"), new QName(NS, "bar"));
ItemPath pathFooNullBar = new ItemPath(new NameItemPathSegment(new QName(NS, "foo")), new IdItemPathSegment(), new NameItemPathSegment(new QName(NS, "bar")));
// WHEN
ItemPath remainder1 = pathFooBar.remainder(pathFooNull);
// THEN
assertEquals("Remainder fooBar, fooNull", pathBar, remainder1);
}
use of com.evolveum.midpoint.prism.path.ItemPath in project midpoint by Evolveum.
the class TestFind method testFindAssignment1Description.
@Test
public void testFindAssignment1Description() throws SchemaException, SAXException, IOException {
final String TEST_NAME = "testFindAssignment1Description";
System.out.println("===[ " + TEST_NAME + " ]===");
// GIVEN
ItemPath path = new ItemPath(new NameItemPathSegment(UserType.F_ASSIGNMENT), new IdItemPathSegment(USER_ASSIGNMENT_1_ID), new NameItemPathSegment(AssignmentType.F_DESCRIPTION));
// WHEN
PrismProperty<String> property = findUserProperty(path);
// THEN
assertEquals("Wrong property value (path=" + path + ")", "Assignment 1", property.getRealValue());
}
Aggregations