public void checkConsistence() { if (resource == null) { throw new IllegalArgumentException("No resource in "+this.getClass().getSimpleName()); } resource.checkConsistence(); if (sourceChannel == null) { throw new IllegalArgumentException("No sourceChannel in "+this.getClass().getSimpleName()); } if (objectDelta == null && currentShadow == null) { throw new IllegalArgumentException("Either objectDelta or currentShadow must be set in "+this.getClass().getSimpleName()); } if (objectDelta != null && objectDelta.getOid() == null) { throw new IllegalArgumentException("Delta OID not set in "+this.getClass().getSimpleName()); } if (objectDelta != null) { objectDelta.checkConsistence(); } if (currentShadow != null && currentShadow.getOid() == null) { throw new IllegalArgumentException("Current shadow OID not set in "+this.getClass().getSimpleName()); } if (currentShadow != null) { ShadowUtil.checkConsistence(currentShadow,"current shadow in change notification"); } if (oldShadow != null) { ShadowUtil.checkConsistence(oldShadow,"old shadow in change notification"); } }
protected void checkConsistence(PrismObject<O> object, String elementDesc, String contextDesc) { String desc = elementDesc+" in "+this + (contextDesc == null ? "" : " in " +contextDesc); try { object.checkConsistence(true, ConsistencyCheckScope.THOROUGH); } catch (IllegalArgumentException e) { throw new IllegalArgumentException(e.getMessage()+"; in "+desc, e); } catch (IllegalStateException e) { throw new IllegalStateException(e.getMessage()+"; in "+desc, e); } if (object.getDefinition() == null) { throw new IllegalStateException("No "+getElementDesc()+" definition "+desc); } O objectType = object.asObjectable(); if (objectType instanceof ShadowType) { ShadowUtil.checkConsistence((PrismObject<? extends ShadowType>) object, desc); } }
private void validate(ResourceObjectShadowChangeDescription change) { Validate.notNull(change, "Resource object shadow change description must not be null."); Validate.isTrue(change.getCurrentShadow() != null || change.getObjectDelta() != null, "Object delta and current shadow are null. At least one must be provided."); Validate.notNull(change.getResource(), "Resource in change must not be null."); if (consistencyChecks) { if (change.getCurrentShadow() != null) { change.getCurrentShadow().checkConsistence(); ShadowUtil.checkConsistence(change.getCurrentShadow(), "current shadow in change description"); } if (change.getObjectDelta() != null) { change.getObjectDelta().checkConsistence(); } } }
private void checkEntitlementShadow(PrismObject<ShadowType> shadow, OperationResult parentResult, String objectClassLocalName, boolean fullShadow) throws SchemaException { ObjectChecker<ShadowType> checker = createShadowChecker(fullShadow); ShadowUtil.checkConsistence(shadow, parentResult.getOperation()); IntegrationTestTools.checkEntitlementShadow(shadow.asObjectable(), resourceType, repositoryService, checker, objectClassLocalName, getUidMatchingRule(), prismContext, parentResult); }
protected void checkAccountShadow(PrismObject<ShadowType> shadowType, OperationResult parentResult, boolean fullShadow, XMLGregorianCalendar startTs, XMLGregorianCalendar endTs) throws SchemaException { ObjectChecker<ShadowType> checker = createShadowChecker(fullShadow); ShadowUtil.checkConsistence(shadowType, parentResult.getOperation()); IntegrationTestTools.checkAccountShadow(shadowType.asObjectable(), resourceType, repositoryService, checker, getUidMatchingRule(), prismContext, parentResult); }
@Test public void test040ApplyDefinitionShadow() throws Exception { final String TEST_NAME = "test040ApplyDefinitionShadow"; displayTestTitle(TEST_NAME); // GIVEN Task task = createTask(TEST_NAME); OperationResult result = task.getResult(); PrismObject<ShadowType> account = PrismTestUtil.parseObject(getAccountWillFile()); // WHEN provisioningService.applyDefinition(account, task, result); // THEN result.computeStatus(); display("applyDefinition result", result); TestUtil.assertSuccess(result); account.checkConsistence(true, true); ShadowUtil.checkConsistence(account, TEST_NAME); TestUtil.assertSuccess("applyDefinition(account) result", result); assertSteadyResource(); }
if (consistencyChecks) ShadowUtil.checkConsistence(shadow, "account from "+linkRefDelta);