private void assertUserDrakeContent(PrismObject<UserType> user, boolean assertDefinitions) { // fullName PrismProperty fullNameProperty = user.findProperty(USER_FULLNAME_QNAME); if (assertDefinitions) PrismAsserts.assertDefinition(fullNameProperty, DOMUtil.XSD_STRING, 1, 1); assertEquals("Wrong fullname", "Sir Fancis Drake", fullNameProperty.getValue().getValue()); // activation PrismContainer activationContainer = user.findContainer(USER_ACTIVATION_QNAME); assertEquals(USER_ACTIVATION_QNAME, activationContainer.getElementName()); if (assertDefinitions) PrismAsserts.assertDefinition(activationContainer, ACTIVATION_TYPE_QNAME, 0, 1); // activation/enabled PrismProperty enabledProperty = user.findProperty(USER_ENABLED_PATH); assertEquals(USER_ENABLED_QNAME, enabledProperty.getElementName()); if (assertDefinitions) PrismAsserts.assertDefinition(enabledProperty, DOMUtil.XSD_BOOLEAN, 0, 1); assertEquals("Wrong enabled", true, enabledProperty.getValue().getValue()); // assignment PrismContainer assignmentContainer = user.findContainer(USER_ASSIGNMENT_QNAME); assertEquals(USER_ASSIGNMENT_QNAME, assignmentContainer.getElementName()); if (assertDefinitions) PrismAsserts.assertDefinition(assignmentContainer, ASSIGNMENT_TYPE_QNAME, 0, -1); // assignment values List<PrismContainerValue> assValues = assignmentContainer.getValues(); assertEquals("Wrong number of assignment values", 3, assValues.size()); // assignment values: blue PrismContainerValue assBlueValue = assValues.get(0); PrismProperty assBlueDescriptionProperty = assBlueValue.findProperty(USER_DESCRIPTION_QNAME); if (assertDefinitions) PrismAsserts.assertDefinition(assBlueDescriptionProperty, DOMUtil.XSD_STRING, 0, 1); assertEquals( "Wrong blue assignment description", "Assignment created out of the blue", assBlueDescriptionProperty.getValue().getValue()); // assignment values: cyan PrismContainerValue assCyanValue = assValues.get(1); PrismProperty assCyanDescriptionProperty = assCyanValue.findProperty(USER_DESCRIPTION_QNAME); if (assertDefinitions) PrismAsserts.assertDefinition(assCyanDescriptionProperty, DOMUtil.XSD_STRING, 0, 1); assertEquals( "Wrong cyan assignment description", "Assignment created out of the cyan", assCyanDescriptionProperty.getValue().getValue()); // assignment values: red PrismContainerValue assRedValue = assValues.get(2); PrismProperty assRedDescriptionProperty = assRedValue.findProperty(USER_DESCRIPTION_QNAME); if (assertDefinitions) PrismAsserts.assertDefinition(assRedDescriptionProperty, DOMUtil.XSD_STRING, 0, 1); assertEquals( "Wrong red assignment description", "Assignment created out of the red", assRedDescriptionProperty.getValue().getValue()); // accountRef PrismReference accountRef = user.findReference(USER_ACCOUNTREF_QNAME); if (assertDefinitions) PrismAsserts.assertDefinition(accountRef, OBJECT_REFERENCE_TYPE_QNAME, 0, -1); PrismAsserts.assertReferenceValue(accountRef, ACCOUNT1_OID); PrismAsserts.assertReferenceValue(accountRef, ACCOUNT2_OID); assertEquals("accountRef size", 2, accountRef.getValues().size()); PrismAsserts.assertParentConsistency(user); }