Search in sources :

Example 11 with ItemPath

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);
}
Also used : ItemPath(com.evolveum.midpoint.prism.path.ItemPath) Test(org.testng.annotations.Test)

Example 12 with ItemPath

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);
}
Also used : ItemPath(com.evolveum.midpoint.prism.path.ItemPath) Test(org.testng.annotations.Test)

Example 13 with ItemPath

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);
}
Also used : UserType(com.evolveum.midpoint.prism.foo.UserType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) Test(org.testng.annotations.Test)

Example 14 with ItemPath

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);
}
Also used : QName(javax.xml.namespace.QName) IdItemPathSegment(com.evolveum.midpoint.prism.path.IdItemPathSegment) NameItemPathSegment(com.evolveum.midpoint.prism.path.NameItemPathSegment) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) Test(org.testng.annotations.Test)

Example 15 with ItemPath

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());
}
Also used : IdItemPathSegment(com.evolveum.midpoint.prism.path.IdItemPathSegment) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) NameItemPathSegment(com.evolveum.midpoint.prism.path.NameItemPathSegment) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) Test(org.testng.annotations.Test)

Aggregations

ItemPath (com.evolveum.midpoint.prism.path.ItemPath)693 Test (org.testng.annotations.Test)184 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)143 QName (javax.xml.namespace.QName)137 Task (com.evolveum.midpoint.task.api.Task)104 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)84 ArrayList (java.util.ArrayList)79 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)71 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)68 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)61 ItemPathType (com.evolveum.prism.xml.ns._public.types_3.ItemPathType)48 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)46 PrismPropertyValue (com.evolveum.midpoint.prism.PrismPropertyValue)41 NameItemPathSegment (com.evolveum.midpoint.prism.path.NameItemPathSegment)41 PrismObject (com.evolveum.midpoint.prism.PrismObject)38 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)38 PropertyDelta (com.evolveum.midpoint.prism.delta.PropertyDelta)38 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)33 IdItemPathSegment (com.evolveum.midpoint.prism.path.IdItemPathSegment)31 NotNull (org.jetbrains.annotations.NotNull)30