@Override public ObjectQuery createShadowSearchQuery(String resourceOid) throws SchemaException { if (getKind() == null) { return ObjectQueryUtil.createResourceAndObjectClassQuery(resourceOid, getTypeName(), getPrismContext()); } else { return ObjectQueryUtil.createResourceAndKindIntent(resourceOid, getKind(), getIntent(), getPrismContext()); } } //endregion
@Test public void test112SeachIterativeKindIntent() throws Exception { final String TEST_NAME = "test112SeachIterativeKindIntent"; displayTestTitle(TEST_NAME); // GIVEN OperationResult result = new OperationResult(TestDummy.class.getName() + "." + TEST_NAME); ObjectQuery query = ObjectQueryUtil.createResourceAndKindIntent(RESOURCE_DUMMY_OID, ShadowKindType.ACCOUNT, "default", prismContext); display("query", query); final List<PrismObject<ShadowType>> foundObjects = new ArrayList<>(); rememberCounter(InternalCounters.SHADOW_FETCH_OPERATION_COUNT); // WHEN provisioningService.searchObjectsIterative(ShadowType.class, query, null, (object, parentResult) -> { foundObjects.add(object); return true; }, null, result); // THEN result.computeStatus(); display("searchObjectsIterative result", result); TestUtil.assertSuccess(result); assertCounterIncrement(InternalCounters.SHADOW_FETCH_OPERATION_COUNT, 1); display("Found shadows", foundObjects); assertEquals(4, foundObjects.size()); checkUniqueness(foundObjects); assertProtected(foundObjects, 1); // MID-1640 assertSteadyResource(); }
@Test public void test452ListLdapGroupsKindIntent() throws Exception { final String TEST_NAME = "test452ListLdapGroupsKindIntent"; displayTestTitle(TEST_NAME); Task task = createTask(TEST_NAME); OperationResult result = task.getResult(); ObjectQuery query = ObjectQueryUtil.createResourceAndKindIntent(RESOURCE_OPENDJ_OID, ShadowKindType.ENTITLEMENT, "ldapGroup", prismContext); display("query", query); // WHEN displayWhen(TEST_NAME); SearchResultList<PrismObject<ShadowType>> objects = provisioningService.searchObjects(ShadowType.class, query, null, task, result); // THEN displayThen(TEST_NAME); display("found objects", objects); result.computeStatus(); TestUtil.assertSuccess(result); assertEquals("Wrong number of objects found", 5, objects.size()); assertShadows(21); }
@Test public void test457ListLdapGroupsKindIntent() throws Exception { final String TEST_NAME = "test457ListLdapGroupsKindIntent"; displayTestTitle(TEST_NAME); Task task = createTask(TEST_NAME); OperationResult result = task.getResult(); ObjectQuery query = ObjectQueryUtil.createResourceAndKindIntent(RESOURCE_OPENDJ_OID, ShadowKindType.ENTITLEMENT, "ldapGroup", prismContext); display("query", query); // WHEN displayWhen(TEST_NAME); SearchResultList<PrismObject<ShadowType>> objects = provisioningService.searchObjects(ShadowType.class, query, null, task, result); // THEN displayThen(TEST_NAME); display("found objects", objects); result.computeStatus(); TestUtil.assertSuccess(result); assertEquals("Wrong number of objects found", 5, objects.size()); assertShadows(23); }
@Test public void test458ListSpecialGroupsKindIntent() throws Exception { final String TEST_NAME = "test458ListSpecialGroupsKindIntent"; displayTestTitle(TEST_NAME); Task task = createTask(TEST_NAME); OperationResult result = task.getResult(); ObjectQuery query = ObjectQueryUtil.createResourceAndKindIntent(RESOURCE_OPENDJ_OID, ShadowKindType.ENTITLEMENT, "specialGroup", prismContext); display("query", query); // WHEN displayWhen(TEST_NAME); SearchResultList<PrismObject<ShadowType>> objects = provisioningService.searchObjects(ShadowType.class, query, null, task, result); // THEN displayThen(TEST_NAME); display("found objects", objects); result.computeStatus(); TestUtil.assertSuccess(result); // Check that none of the normal LDAP groups appear here ... even if they have the same objectclass assertEquals("Wrong number of objects found", 1, objects.size()); // Discovered base context for specialgroups assertShadows(23); }
@Test public void test454ListSpecialGroupsKindIntent() throws Exception { final String TEST_NAME = "test454ListSpecialGroupsKindIntent"; displayTestTitle(TEST_NAME); Task task = createTask(TEST_NAME); OperationResult result = task.getResult(); ObjectQuery query = ObjectQueryUtil.createResourceAndKindIntent(RESOURCE_OPENDJ_OID, ShadowKindType.ENTITLEMENT, "specialGroup", prismContext); display("query", query); // WHEN displayWhen(TEST_NAME); SearchResultList<PrismObject<ShadowType>> objects = provisioningService.searchObjects(ShadowType.class, query, null, task, result); // THEN displayThen(TEST_NAME); display("found objects", objects); result.computeStatus(); TestUtil.assertSuccess(result); // Check that none of the normal LDAP groups appear here ... even if they have the same objectclass assertEquals("Wrong number of objects found", 0, objects.size()); // Discovered base context for specialgroups assertShadows(22); }
/** * List organizationUnits with intent ou-people. There are no sub-ous in People. * But the definition has objectclass organizationalUnit and it has baseContext that * is also organizationalUnit. This test therefore makes sure this will not end up * in endless loop (stack overflow). */ @Test public void test460ListOrganizationalUnitPeopleKindIntent() throws Exception { final String TEST_NAME = "test460ListOrganizationalUnitPeopleKindIntent"; displayTestTitle(TEST_NAME); Task task = createTask(TEST_NAME); OperationResult result = task.getResult(); ObjectQuery query = ObjectQueryUtil.createResourceAndKindIntent(RESOURCE_OPENDJ_OID, ShadowKindType.GENERIC, "ou-people", prismContext); display("query", query); // WHEN displayWhen(TEST_NAME); SearchResultList<PrismObject<ShadowType>> objects = provisioningService.searchObjects(ShadowType.class, query, null, task, result); // THEN displayThen(TEST_NAME); display("found objects", objects); result.computeStatus(); TestUtil.assertSuccess(result); // Just the ou=People itself assertEquals("Wrong number of objects found", 1, objects.size()); assertShadows(24); }
OperationResult result = task.getResult(); ObjectQuery query = ObjectQueryUtil.createResourceAndKindIntent(getResourceOid(), ShadowKindType.ACCOUNT, null, prismContext);