use of com.evolveum.midpoint.prism.PrismContext in project midpoint by Evolveum.
the class TestFilterSimplifier method test020None.
@Test
public void test020None() throws Exception {
System.out.println("===[ test020None ]===");
// GIVEN
PrismContext prismContext = PrismTestUtil.getPrismContext();
// WHEN
ObjectFilter filter = QueryBuilder.queryFor(UserType.class, prismContext).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);
}
use of com.evolveum.midpoint.prism.PrismContext in project midpoint by Evolveum.
the class TestFilterSimplifier method test110AndLevel1WithoutNone.
@Test
public void test110AndLevel1WithoutNone() throws Exception {
System.out.println("===[ test110AndLevel1WithoutNone ]===");
// GIVEN
PrismContext prismContext = PrismTestUtil.getPrismContext();
// WHEN
ObjectFilter filter = QueryBuilder.queryFor(UserType.class, prismContext).all().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 == null || simplified instanceof AllFilter);
}
use of com.evolveum.midpoint.prism.PrismContext in project midpoint by Evolveum.
the class TestFilterSimplifier method test300NotAll.
@Test
public void test300NotAll() throws Exception {
System.out.println("===[ test300NotAll ]===");
// GIVEN
PrismContext prismContext = PrismTestUtil.getPrismContext();
// WHEN
ObjectFilter filter = QueryBuilder.queryFor(UserType.class, prismContext).not().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 NoneFilter);
}
use of com.evolveum.midpoint.prism.PrismContext in project midpoint by Evolveum.
the class TestFilterSimplifier method test500ExistsAll.
@Test
public void test500ExistsAll() throws Exception {
System.out.println("===[ test500ExistsAll ]===");
// GIVEN
PrismContext prismContext = PrismTestUtil.getPrismContext();
// WHEN
ObjectFilter filter = QueryBuilder.queryFor(UserType.class, prismContext).exists(UserType.F_ASSIGNMENT).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 ExistsFilter);
ExistsFilter existsSimplified = (ExistsFilter) simplified;
assertEquals("Wrong simplified filter path", new ItemPath(UserType.F_ASSIGNMENT), existsSimplified.getFullPath());
assertTrue("Wrong simplified filter subfilter: " + existsSimplified.getFilter(), ObjectQueryUtil.isAll(existsSimplified.getFilter()));
}
use of com.evolveum.midpoint.prism.PrismContext in project midpoint by Evolveum.
the class TestAdHocCertification method test020ModifyIndigo.
@Test
public void test020ModifyIndigo() throws Exception {
final String TEST_NAME = "test020ModifyIndigo";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestAdHocCertification.class.getName() + "." + TEST_NAME);
task.setOwner(userAdministrator.asPrismObject());
OperationResult result = task.getResult();
// WHEN
TestUtil.displayWhen(TEST_NAME);
@SuppressWarnings({ "unchecked", "raw" }) ObjectDelta<UserType> delta = (ObjectDelta<UserType>) DeltaBuilder.deltaFor(UserType.class, prismContext).item(UserType.F_DESCRIPTION).replace("new description").item(UserType.F_ACTIVATION, ActivationType.F_ADMINISTRATIVE_STATUS).replace(ActivationStatusType.DISABLED).asObjectDelta(USER_INDIGO_OID);
executeChanges(delta, null, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
SearchResultList<PrismObject<AccessCertificationCampaignType>> campaigns = repositoryService.searchObjects(AccessCertificationCampaignType.class, null, null, result);
assertEquals("Wrong # of campaigns", 2, campaigns.size());
AccessCertificationCampaignType campaign = campaigns.stream().filter(c -> MODIFICATION_CERT_DEF_OID.equals(c.asObjectable().getDefinitionRef().getOid())).findFirst().orElseThrow(() -> new AssertionError("No modification-triggered campaign")).asObjectable();
campaign = getCampaignWithCases(campaign.getOid());
display("campaign", campaign);
// beware, maybe not all details would match (in the future) - then adapt this test
assertAfterCampaignStart(campaign, modificationCertificationDefinition, 1);
// no cases, no problems
assertPercentComplete(campaign, 0, 0, 0);
}
Aggregations