Search in sources :

Example 6 with PrismContext

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

the class TestFilterSimplifier method test200AndLevel2.

@Test
public void test200AndLevel2() throws Exception {
    System.out.println("===[ test200AndLevel2 ]===");
    // GIVEN
    PrismContext prismContext = PrismTestUtil.getPrismContext();
    // WHEN
    ObjectFilter filter = QueryBuilder.queryFor(UserType.class, prismContext).all().and().undefined().and().block().none().or().none().endBlock().and().block().none().or().none().endBlock().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 7 with PrismContext

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

the class TestFilterSimplifier method test010All.

@Test
public void test010All() throws Exception {
    System.out.println("===[ test010All ]===");
    // GIVEN
    PrismContext prismContext = PrismTestUtil.getPrismContext();
    // WHEN
    ObjectFilter filter = QueryBuilder.queryFor(UserType.class, prismContext).all().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 8 with PrismContext

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

the class TestFilterSimplifier method test120AndEmpty.

@Test
public void test120AndEmpty() throws Exception {
    System.out.println("===[ test120AndEmpty ]===");
    // GIVEN
    PrismContext prismContext = PrismTestUtil.getPrismContext();
    // WHEN
    ObjectFilter filter = AndFilter.createAnd();
    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 9 with PrismContext

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

the class TestFilterSimplifier method test180OrEmpty.

@Test
public void test180OrEmpty() throws Exception {
    System.out.println("===[ test180OrEmpty ]===");
    // GIVEN
    PrismContext prismContext = PrismTestUtil.getPrismContext();
    // WHEN
    ObjectFilter filter = OrFilter.createOr();
    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 10 with PrismContext

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

the class TestFilterSimplifier method test400TypeAll.

@Test
public void test400TypeAll() throws Exception {
    System.out.println("===[ test400TypeAll ]===");
    // GIVEN
    PrismContext prismContext = PrismTestUtil.getPrismContext();
    // WHEN
    ObjectFilter filter = QueryBuilder.queryFor(UserType.class, prismContext).type(UserType.class).all().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 TypeFilter);
    TypeFilter typeSimplified = (TypeFilter) simplified;
    assertEquals("Wrong simplified filter type", UserType.COMPLEX_TYPE, typeSimplified.getType());
    assertTrue("Wrong simplified filter subfilter: " + typeSimplified.getFilter(), ObjectQueryUtil.isAll(typeSimplified.getFilter()));
}
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