/** * Looks for conflicting account on the resource (not just repository). We will get conflicting shadow. * But a side-effect of this search is that the shadow for the conflicting account is created in the repo. */ private List<PrismObject<ShadowType>> findConflictingShadowsOnResource(ObjectQuery query, Task task, OperationResult parentResult) throws ObjectNotFoundException, CommunicationException, ConfigurationException, SchemaException, SecurityViolationException, ExpressionEvaluationException { final List<PrismObject<ShadowType>> foundAccount = new ArrayList<>(); // noDiscovery option to avoid calling notifyChange from ShadowManager (in case that new resource object is discovered) Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(GetOperationOptions.createDoNotDiscovery()); provisioningService.searchObjectsIterative(ShadowType.class, query, options, (object,result) -> foundAccount.add(object), task, parentResult); return foundAccount; }
@Override public <O extends ObjectType> void searchIterative(Class<O> type, ObjectQuery query, Collection<SelectorOptions<GetOperationOptions>> options, ResultHandler<O> handler, Task task, OperationResult parentResult) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException { if (ObjectTypes.isClassManagedByProvisioning(type)) { provisioning.searchObjectsIterative(type, query, options, handler, task, parentResult); } else { cacheRepositoryService.searchObjectsIterative(type, query, handler, options, true, parentResult); // TODO pull up into resolver interface } }
@Test public void test522SearchAccountsIterative() throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException, Exception { final String TEST_NAME = "test522SearchAccountsIterative"; displayTestTitle(TEST_NAME); // GIVEN OperationResult result = new OperationResult(TestOpenDjNegative.class.getName() + "." + TEST_NAME); final String resourceNamespace = ResourceTypeUtil.getResourceNamespace(resource); QName objectClass = new QName(resourceNamespace, OBJECT_CLASS_INETORGPERSON_NAME); ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(resource.getOid(), objectClass, prismContext); ResultHandler handler = new ResultHandler<ObjectType>() { @Override public boolean handle(PrismObject<ObjectType> prismObject, OperationResult parentResult) { AssertJUnit.fail("handler called unexpectedly"); return false; } }; try { // WHEN provisioningService.searchObjectsIterative(ShadowType.class, query, null, handler, null, result); AssertJUnit.fail("searchObjectsIterative succeeded unexpectedly"); } catch (CommunicationException e) { // This is expected display("Expected exception", e); } assertFailure(result); }
ObjectQuery query = getQueryConverter().createObjectQuery(ShadowType.class, queryType); provisioningService.searchObjectsIterative(ShadowType.class, query, null, new ResultHandler<ShadowType>() {
@Test public void test122SearchAccountsIterative() throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException, Exception { final String TEST_NAME = "test122SearchAccountsIterative"; displayTestTitle(TEST_NAME); // GIVEN OperationResult result = new OperationResult(TestOpenDjNegative.class.getName() + "." + TEST_NAME); final String resourceNamespace = ResourceTypeUtil.getResourceNamespace(resource); QName objectClass = new QName(resourceNamespace, OBJECT_CLASS_INETORGPERSON_NAME); ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(resource.getOid(), objectClass, prismContext); ResultHandler handler = new ResultHandler<ObjectType>() { @Override public boolean handle(PrismObject<ObjectType> prismObject, OperationResult parentResult) { AssertJUnit.fail("handler called unexpectedly"); return false; } }; try { // WHEN provisioningService.searchObjectsIterative(ShadowType.class, query, null, handler, null, result); AssertJUnit.fail("searchObjectsIterative succeeded unexpectedly"); } catch (ConfigurationException e) { // This is expected display("Expected exception", e); } result.computeStatus(); TestUtil.assertFailure(result); }
provisioningService.searchObjectsIterative(ShadowType.class, q, null, handler, null, result);
/** * Search with query that queries both the repository and the resource. * NoFetch. This should go OK. * MID-2822 */ @Test public void test196SearchOnAndOffResourceNoFetch() throws Exception { final String TEST_NAME = "test196SearchOnAndOffResourceNoFetch"; displayTestTitle(TEST_NAME); // GIVEN Task task = taskManager.createTaskInstance(TestDummy.class.getName() + "." + TEST_NAME); OperationResult result = task.getResult(); ObjectQuery query = createOnOffQuery(); ResultHandler<ShadowType> handler = new ResultHandler<ShadowType>() { @Override public boolean handle(PrismObject<ShadowType> object, OperationResult parentResult) { AssertJUnit.fail("Handler called: "+object); return false; } }; // WHEN provisioningService.searchObjectsIterative(ShadowType.class, query, SelectorOptions.createCollection(GetOperationOptions.createNoFetch()), handler, task, result); // THEN result.computeStatus(); TestUtil.assertSuccess(result); }
provisioningService.searchObjectsIterative(ShadowType.class, query, null, handler, task, result);
@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(); }
SearchResultMetadata searchMetadata = provisioningService.searchObjectsIterative(ShadowType.class, query, null, handler, task, result);
switch (searchProvider) { case REPOSITORY: metadata = cacheRepositoryService.searchObjectsIterative(type, processedQuery, internalHandler, options, true, result); break; case PROVISIONING: metadata = provisioning.searchObjectsIterative(type, processedQuery, options, internalHandler, task, result); break; case TASK_MANAGER: metadata = taskManager.searchObjectsIterative(type, processedQuery, options, internalHandler, result); break; default: throw new AssertionError("Unexpected search provider: " + searchProvider);
SearchResultMetadata searchMetadata = provisioningService.searchObjectsIterative(ShadowType.class, query, null, handler, task, result);
SearchResultMetadata searchMetadata = provisioningService.searchObjectsIterative(ShadowType.class, query, null, handler, task, result);
provisioningService.searchObjectsIterative(ShadowType.class, query, options, handler, null, result);
SearchResultMetadata searchMetadata = provisioningService.searchObjectsIterative(ShadowType.class, query, options, handler, null, result);
searchMetadata = repositoryService.searchObjectsIterative(ShadowType.class, query, handler, null, true, result); } else { searchMetadata = provisioningService.searchObjectsIterative(ShadowType.class, query, options, handler, null, result);
provisioningService.searchObjectsIterative(ShadowType.class, query, null, handler, null, result); provisioningService.searchObjectsIterative(ShadowType.class, query, null, handler, null, result);
provisioningService.searchObjectsIterative(ShadowType.class, query, null, handler, localCoordinatorTask, searchResult); handler.completeProcessing(localCoordinatorTask, searchResult);