@Test public void test500FetchObject() throws Exception { final String TEST_NAME = "test500FetchObject"; TestUtil.displayTestTitle(this, TEST_NAME); // GIVEN ResourceAttributeContainer resourceObject = createResourceObject( "uid=Teell,ou=People,dc=example,dc=com", "Teell William", "Teell"); OperationResult addResult = new OperationResult(this.getClass().getName() + "." + TEST_NAME); PrismObject<ShadowType> shadow = wrapInShadow(ShadowType.class, resourceObject); // Add a testing object cc.addObject(shadow, null, null, addResult); ObjectClassComplexTypeDefinition accountDefinition = resourceObject.getDefinition().getComplexTypeDefinition(); Collection<ResourceAttribute<?>> identifiers = resourceObject.getPrimaryIdentifiers(); // Determine object class from the schema ResourceObjectIdentification identification = new ResourceObjectIdentification(accountDefinition, identifiers, null); OperationResult result = new OperationResult(this.getClass().getName() + "." + TEST_NAME); // WHEN PrismObject<ShadowType> ro = cc.fetchObject(identification, null, null, result); // THEN AssertJUnit.assertNotNull(ro); System.out.println("Fetched object " + ro); System.out.println("Result:"); System.out.println(result.debugDump()); }
PrismObject<ShadowType> shadow = cc.fetchObject(identification, null, null, result); ResourceAttributeContainer resObj = ShadowUtil.getAttributesContainer(shadow);
@Test public void test100AddDeleteObject() throws Exception { final String TEST_NAME = "test100AddDeleteObject"; TestUtil.displayTestTitle(this, TEST_NAME); OperationResult result = new OperationResult(this.getClass().getName() + "." + TEST_NAME); Collection<ResourceAttribute<?>> identifiers = addSampleResourceObject("john", "John", "Smith"); String uid = null; for (ResourceAttribute<?> resourceAttribute : identifiers) { if (SchemaConstants.ICFS_UID.equals(resourceAttribute.getElementName())) { uid = resourceAttribute.getValue(String.class).getValue(); System.out.println("uuuuid:" + uid); assertNotNull(uid); } } ObjectClassComplexTypeDefinition accountDefinition = resourceSchema.findObjectClassDefinition(OpenDJController.OBJECT_CLASS_INETORGPERSON_NAME); cc.deleteObject(accountDefinition, null, null, identifiers, null, result); ResourceObjectIdentification identification = ResourceObjectIdentification.createFromAttributes( accountDefinition, identifiers); PrismObject<ShadowType> resObj = null; try { resObj = cc.fetchObject(identification, null, null, result); Assert.fail(); } catch (ObjectNotFoundException ex) { AssertJUnit.assertNull(resObj); } }
identification.validatePrimaryIdenfiers(); LOGGER.trace("Re-fetching object {} because of attrsToReturn", identification); currentShadow = connector.fetchObject(identification, shadowAttrsToReturn, ctx, parentResult);
identification = resolvePrimaryIdentifiers(ctx, identification, parentResult); identification.validatePrimaryIdenfiers(); return connector.fetchObject(identification, attributesToReturn, ctx, parentResult); } catch (ObjectNotFoundException e) {
existingObject = readConnector.fetchObject(identification, null, ctx, result); } catch (ObjectNotFoundException e) {