Search in sources :

Example 71 with PrismContext

use of com.evolveum.midpoint.prism.PrismContext in project midpoint by Evolveum.

the class TestFilterSimplifier method test100AndLevel1.

@Test
public void test100AndLevel1() throws Exception {
    System.out.println("===[ test100AndLevel1 ]===");
    // GIVEN
    PrismContext prismContext = PrismTestUtil.getPrismContext();
    // WHEN
    ObjectFilter filter = QueryBuilder.queryFor(UserType.class, prismContext).all().and().none().and().undefined().buildFilter();
    System.out.println("Original filter:\n" + filter.debugDump());
    // THEN
    ObjectFilter simplified = ObjectQueryUtil.simplify(filter);
    System.out.println("Simplified filter:\n" + DebugUtil.debugDump(simplified));
    assertTrue("Wrong simplified filter: " + simplified, simplified instanceof NoneFilter);
}
Also used : PrismContext(com.evolveum.midpoint.prism.PrismContext) Test(org.testng.annotations.Test)

Example 72 with PrismContext

use of com.evolveum.midpoint.prism.PrismContext in project midpoint by Evolveum.

the class TestFilterSimplifier method test510ExistsNone.

@Test
public void test510ExistsNone() throws Exception {
    System.out.println("===[ test510ExistsNone ]===");
    // GIVEN
    PrismContext prismContext = PrismTestUtil.getPrismContext();
    // WHEN
    ObjectFilter filter = QueryBuilder.queryFor(UserType.class, prismContext).exists(UserType.F_ASSIGNMENT).none().buildFilter();
    System.out.println("Original filter:\n" + filter.debugDump());
    // THEN
    ObjectFilter simplified = ObjectQueryUtil.simplify(filter);
    System.out.println("Simplified filter:\n" + DebugUtil.debugDump(simplified));
    assertTrue("Wrong simplified filter: " + simplified, simplified instanceof NoneFilter);
}
Also used : PrismContext(com.evolveum.midpoint.prism.PrismContext) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Example 73 with PrismContext

use of com.evolveum.midpoint.prism.PrismContext in project midpoint by Evolveum.

the class TestFilterSimplifier method test030Undefined.

@Test
public void test030Undefined() throws Exception {
    System.out.println("===[ test030Undefined ]===");
    // GIVEN
    PrismContext prismContext = PrismTestUtil.getPrismContext();
    // WHEN
    ObjectFilter filter = QueryBuilder.queryFor(UserType.class, prismContext).undefined().buildFilter();
    System.out.println("Original filter:\n" + filter.debugDump());
    // THEN
    ObjectFilter simplified = ObjectQueryUtil.simplify(filter);
    System.out.println("Simplified filter:\n" + DebugUtil.debugDump(simplified));
    assertTrue("Wrong simplified filter: " + simplified, simplified == null || simplified instanceof AllFilter);
}
Also used : PrismContext(com.evolveum.midpoint.prism.PrismContext) Test(org.testng.annotations.Test)

Example 74 with PrismContext

use of com.evolveum.midpoint.prism.PrismContext in project midpoint by Evolveum.

the class TestFilterSimplifier method test150OrLevel1.

@Test
public void test150OrLevel1() throws Exception {
    System.out.println("===[ test150OrLevel1 ]===");
    // GIVEN
    PrismContext prismContext = PrismTestUtil.getPrismContext();
    // WHEN
    ObjectFilter filter = QueryBuilder.queryFor(UserType.class, prismContext).all().or().none().or().undefined().buildFilter();
    System.out.println("Original filter:\n" + filter.debugDump());
    // THEN
    ObjectFilter simplified = ObjectQueryUtil.simplify(filter);
    System.out.println("Simplified filter:\n" + DebugUtil.debugDump(simplified));
    assertTrue("Wrong simplified filter: " + simplified, simplified == null || simplified instanceof AllFilter);
}
Also used : PrismContext(com.evolveum.midpoint.prism.PrismContext) Test(org.testng.annotations.Test)

Example 75 with PrismContext

use of com.evolveum.midpoint.prism.PrismContext in project midpoint by Evolveum.

the class TestFilterSimplifier method test310NotNone.

@Test
public void test310NotNone() throws Exception {
    System.out.println("===[ test310NotNone ]===");
    // GIVEN
    PrismContext prismContext = PrismTestUtil.getPrismContext();
    // WHEN
    ObjectFilter filter = QueryBuilder.queryFor(UserType.class, prismContext).not().none().buildFilter();
    System.out.println("Original filter:\n" + filter.debugDump());
    // THEN
    ObjectFilter simplified = ObjectQueryUtil.simplify(filter);
    System.out.println("Simplified filter:\n" + DebugUtil.debugDump(simplified));
    assertTrue("Wrong simplified filter: " + simplified, simplified == null || simplified instanceof AllFilter);
}
Also used : PrismContext(com.evolveum.midpoint.prism.PrismContext) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Aggregations

PrismContext (com.evolveum.midpoint.prism.PrismContext)104 Test (org.testng.annotations.Test)59 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)15 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)15 QName (javax.xml.namespace.QName)15 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)13 Task (com.evolveum.midpoint.task.api.Task)11 SchemaRegistry (com.evolveum.midpoint.prism.schema.SchemaRegistry)10 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)10 PrismObject (com.evolveum.midpoint.prism.PrismObject)9 SystemException (com.evolveum.midpoint.util.exception.SystemException)9 File (java.io.File)8 PrismPropertyDefinition (com.evolveum.midpoint.prism.PrismPropertyDefinition)7 ArrayList (java.util.ArrayList)7 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)6 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)6 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)6 Protector (com.evolveum.midpoint.prism.crypto.Protector)5 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)5 MidPointApplication (com.evolveum.midpoint.web.security.MidPointApplication)5