Search in sources :

Example 26 with ResourceObjectTypeDefinition

use of com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition in project midpoint by Evolveum.

the class TestDummySchemaless method assertStaticSchemaSanity.

private void assertStaticSchemaSanity(ResourceSchema resourceSchema) {
    ResourceType resourceType = resourceStaticSchema.asObjectable();
    assertNotNull("No resource schema in " + resourceType, resourceSchema);
    QName objectClassQname = new QName(MidPointConstants.NS_RI, "AccountObjectClass");
    ResourceObjectClassDefinition accountDefinition = resourceSchema.findObjectClassDefinition(objectClassQname);
    assertNotNull("No object class definition for " + objectClassQname + " in resource schema", accountDefinition);
    ResourceObjectClassDefinition accountDef1 = resourceSchema.findObjectClassDefinition(ACCOUNT_OBJECT_CLASS_NAME);
    assertSame("Mismatched account definition: " + accountDefinition + " <-> " + accountDef1, accountDefinition, accountDef1);
    assertNotNull("No object class definition " + objectClassQname, accountDefinition);
    assertTrue("Object class " + objectClassQname + " is not default account", accountDefinition.isDefaultAccountDefinition());
    assertFalse("Object class " + objectClassQname + " is empty", accountDefinition.isEmpty());
    assertFalse("Object class " + objectClassQname + " is empty", accountDefinition.isIgnored());
    Collection<? extends ResourceAttributeDefinition> identifiers = accountDefinition.getPrimaryIdentifiers();
    assertNotNull("Null identifiers for " + objectClassQname, identifiers);
    assertFalse("Empty identifiers for " + objectClassQname, identifiers.isEmpty());
    ResourceAttributeDefinition uidAttributeDefinition = accountDefinition.findAttributeDefinition(SchemaTestConstants.ICFS_UID);
    assertNotNull("No definition for attribute " + SchemaTestConstants.ICFS_UID, uidAttributeDefinition);
    assertTrue("Attribute " + SchemaTestConstants.ICFS_UID + " in not an identifier", accountDefinition.isPrimaryIdentifier(uidAttributeDefinition.getItemName()));
    assertTrue("Attribute " + SchemaTestConstants.ICFS_UID + " in not in identifiers list", identifiers.contains(uidAttributeDefinition));
    assertEquals("Wrong displayName for attribute " + SchemaTestConstants.ICFS_UID, "Modified ConnId UID", uidAttributeDefinition.getDisplayName());
    assertEquals("Wrong displayOrder for attribute " + SchemaTestConstants.ICFS_UID, (Integer) 100, uidAttributeDefinition.getDisplayOrder());
    Collection<? extends ResourceAttributeDefinition> secondaryIdentifiers = accountDefinition.getSecondaryIdentifiers();
    assertNotNull("Null secondary identifiers for " + objectClassQname, secondaryIdentifiers);
    assertFalse("Empty secondary identifiers for " + objectClassQname, secondaryIdentifiers.isEmpty());
    ResourceAttributeDefinition nameAttributeDefinition = accountDefinition.findAttributeDefinition(SchemaTestConstants.ICFS_NAME);
    assertNotNull("No definition for attribute " + SchemaTestConstants.ICFS_NAME, nameAttributeDefinition);
    assertTrue("Attribute " + SchemaTestConstants.ICFS_NAME + " in not an identifier", accountDefinition.isSecondaryIdentifier(nameAttributeDefinition.getItemName()));
    assertTrue("Attribute " + SchemaTestConstants.ICFS_NAME + " in not in identifiers list", secondaryIdentifiers.contains(nameAttributeDefinition));
    assertEquals("Wrong displayName for attribute " + SchemaTestConstants.ICFS_NAME, "Modified ConnId Name", nameAttributeDefinition.getDisplayName());
    assertEquals("Wrong displayOrder for attribute " + SchemaTestConstants.ICFS_NAME, (Integer) 110, nameAttributeDefinition.getDisplayOrder());
    assertNotNull("Null identifiers in account", accountDef1.getPrimaryIdentifiers());
    assertFalse("Empty identifiers in account", accountDef1.getPrimaryIdentifiers().isEmpty());
    assertNotNull("Null secondary identifiers in account", accountDef1.getSecondaryIdentifiers());
    assertFalse("Empty secondary identifiers in account", accountDef1.getSecondaryIdentifiers().isEmpty());
    assertNotNull("No naming attribute in account", accountDef1.getNamingAttribute());
    assertFalse("No nativeObjectClass in account", StringUtils.isEmpty(accountDef1.getNativeObjectClass()));
    ResourceAttributeDefinition uidDef = accountDef1.findAttributeDefinition(SchemaTestConstants.ICFS_UID);
    assertEquals(1, uidDef.getMaxOccurs());
    assertEquals(0, uidDef.getMinOccurs());
    assertFalse("No UID display name", StringUtils.isBlank(uidDef.getDisplayName()));
    assertFalse("UID has create", uidDef.canAdd());
    assertFalse("UID has update", uidDef.canModify());
    assertTrue("No UID read", uidDef.canRead());
    assertTrue("UID definition not in identifiers", accountDef1.getPrimaryIdentifiers().contains(uidDef));
    assertEquals("Wrong refined displayName for attribute " + SchemaTestConstants.ICFS_UID, "Modified ConnId UID", uidDef.getDisplayName());
    assertEquals("Wrong refined displayOrder for attribute " + SchemaTestConstants.ICFS_UID, (Integer) 100, uidDef.getDisplayOrder());
    ResourceAttributeDefinition nameDef = accountDef1.findAttributeDefinition(SchemaTestConstants.ICFS_NAME);
    assertEquals(1, nameDef.getMaxOccurs());
    assertEquals(1, nameDef.getMinOccurs());
    assertFalse("No NAME displayName", StringUtils.isBlank(nameDef.getDisplayName()));
    assertTrue("No NAME create", nameDef.canAdd());
    assertTrue("No NAME update", nameDef.canModify());
    assertTrue("No NAME read", nameDef.canRead());
    assertTrue("NAME definition not in identifiers", accountDef1.getSecondaryIdentifiers().contains(nameDef));
    assertEquals("Wrong refined displayName for attribute " + SchemaTestConstants.ICFS_NAME, "Modified ConnId Name", nameDef.getDisplayName());
    assertEquals("Wrong refined displayOrder for attribute " + SchemaTestConstants.ICFS_NAME, (Integer) 110, nameDef.getDisplayOrder());
    assertNull("The _PASSSWORD_ attribute sneaked into schema", accountDef1.findAttributeDefinition(new QName(SchemaTestConstants.NS_ICFS, "password")));
    // ACCOUNT
    ResourceObjectClassDefinition accountDef = resourceSchema.findObjectClassDefinition(ACCOUNT_OBJECT_CLASS_NAME);
    assertNotNull("No ACCOUNT kind definition", accountDef);
    ResourceAttributeDefinition fullnameDef = accountDef.findAttributeDefinition("fullname");
    assertNotNull("No definition for fullname", fullnameDef);
    assertEquals(1, fullnameDef.getMaxOccurs());
    assertEquals(1, fullnameDef.getMinOccurs());
    assertTrue("No fullname create", fullnameDef.canAdd());
    assertTrue("No fullname update", fullnameDef.canModify());
    assertTrue("No fullname read", fullnameDef.canRead());
    assertTrue("Wrong displayOrder for attribute fullName: " + fullnameDef.getDisplayOrder(), fullnameDef.getDisplayOrder() == 200 || fullnameDef.getDisplayOrder() == 250 || fullnameDef.getDisplayOrder() == 260);
    // GROUP
    ResourceObjectClassDefinition groupObjectClass = resourceSchema.findObjectClassDefinition(SchemaTestConstants.GROUP_OBJECT_CLASS_NAME);
    assertNotNull("No group objectClass", groupObjectClass);
    ResourceAttributeDefinition membersDef = groupObjectClass.findAttributeDefinition(DummyResourceContoller.DUMMY_GROUP_MEMBERS_ATTRIBUTE_NAME);
    assertNotNull("No definition for members", membersDef);
    assertEquals("Wrong maxOccurs", -1, membersDef.getMaxOccurs());
    assertEquals("Wrong minOccurs", 0, membersDef.getMinOccurs());
    assertTrue("No members create", membersDef.canAdd());
    assertTrue("No members update", membersDef.canModify());
    assertTrue("No members read", membersDef.canRead());
    assertEquals("Unexpected number of schema definitions in " + dummyResourceSchemalessCtl.getName() + " dummy resource", dummyResourceStaticSchema.getNumberOfObjectclasses(), resourceSchema.getDefinitions().size());
    for (Definition def : resourceSchema.getDefinitions()) {
        if (def instanceof ResourceObjectTypeDefinition) {
            AssertJUnit.fail("Refined definition sneaked into resource schema of " + dummyResourceSchemalessCtl.getName() + " dummy resource: " + def);
        }
    }
}
Also used : QName(javax.xml.namespace.QName) ResourceObjectTypeDefinition(com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition) Definition(com.evolveum.midpoint.prism.Definition) ResourceObjectTypeDefinition(com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition)

Example 27 with ResourceObjectTypeDefinition

use of com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition in project midpoint by Evolveum.

the class DummyResourceContoller method assertRefinedSchemaSanity.

public void assertRefinedSchemaSanity(ResourceSchema refinedSchema) {
    ResourceObjectTypeDefinition accountDef = refinedSchema.findDefaultOrAnyObjectTypeDefinition(ShadowKindType.ACCOUNT);
    assertNotNull("Account definition is missing", accountDef);
    assertNotNull("Null identifiers in account", accountDef.getPrimaryIdentifiers());
    assertFalse("Empty identifiers in account", accountDef.getPrimaryIdentifiers().isEmpty());
    assertNotNull("Null secondary identifiers in account", accountDef.getSecondaryIdentifiers());
    assertFalse("Empty secondary identifiers in account", accountDef.getSecondaryIdentifiers().isEmpty());
    assertNotNull("No naming attribute in account", accountDef.getNamingAttribute());
    assertFalse("No nativeObjectClass in account", StringUtils.isEmpty(accountDef.getObjectClassDefinition().getNativeObjectClass()));
    ResourceAttributeDefinition<?> uidDef = accountDef.findAttributeDefinition(SchemaTestConstants.ICFS_UID);
    assertEquals(1, uidDef.getMaxOccurs());
    assertEquals(0, uidDef.getMinOccurs());
    assertFalse("No UID display name", StringUtils.isBlank(uidDef.getDisplayName()));
    assertFalse("UID has create", uidDef.canAdd());
    assertFalse("UID has update", uidDef.canModify());
    assertTrue("No UID read", uidDef.canRead());
    assertTrue("UID definition not in identifiers", accountDef.getPrimaryIdentifiers().contains(uidDef));
    ResourceAttributeDefinition<?> nameDef = accountDef.findAttributeDefinition(SchemaTestConstants.ICFS_NAME);
    assertEquals(1, nameDef.getMaxOccurs());
    assertEquals(1, nameDef.getMinOccurs());
    assertFalse("No NAME displayName", StringUtils.isBlank(nameDef.getDisplayName()));
    assertTrue("No NAME create", nameDef.canAdd());
    assertTrue("No NAME update", nameDef.canModify());
    assertTrue("No NAME read", nameDef.canRead());
    assertTrue("NAME definition not in identifiers", accountDef.getSecondaryIdentifiers().contains(nameDef));
    ResourceAttributeDefinition<?> fullnameDef = accountDef.findAttributeDefinition(DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME);
    assertNotNull("No definition for fullname", fullnameDef);
    assertEquals(1, fullnameDef.getMaxOccurs());
    assertEquals(1, fullnameDef.getMinOccurs());
    assertTrue("No fullname create", fullnameDef.canAdd());
    assertTrue("No fullname update", fullnameDef.canModify());
    assertTrue("No fullname read", fullnameDef.canRead());
    assertNull("The _PASSSWORD_ attribute sneaked into schema", accountDef.findAttributeDefinition(new QName(SchemaTestConstants.NS_ICFS, "password")));
}
Also used : ResourceObjectTypeDefinition(com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition) QName(javax.xml.namespace.QName)

Example 28 with ResourceObjectTypeDefinition

use of com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition in project midpoint by Evolveum.

the class DotModel method exportDot.

public String exportDot() {
    StringBuilder sb = new StringBuilder();
    sb.append("digraph G {\n");
    Set<DataItem> itemsShown = new HashSet<>();
    int clusterNumber = 1;
    int indent = 1;
    for (PrismObject<ResourceType> resource : dataModel.getResources().values()) {
        if (subgraphsForResources) {
            sb.append(indent(indent)).append("subgraph cluster_").append(clusterNumber++).append(" {\n");
            sb.append(indent(indent + 1)).append("label=\"").append(resource.getName()).append("\";\n");
            // TODO style for resource label
            indent++;
        }
        ResourceSchema schema = dataModel.getRefinedResourceSchema(resource.getOid());
        for (ResourceObjectTypeDefinition def : schema.getObjectTypeDefinitions()) {
            StringBuilder sb1 = new StringBuilder();
            sb1.append(indent(indent)).append("subgraph cluster_").append(clusterNumber++).append(" {\n");
            String typeName = "";
            if (!subgraphsForResources && dataModel.getResources().size() > 1) {
                typeName = PolyString.getOrig(resource.getName()) + LF;
            }
            typeName += getObjectTypeName(def, true);
            sb1.append(indent(indent + 1)).append("label=\"").append(typeName).append("\";\n");
            sb1.append(indent(indent + 1)).append("fontname=\"times-bold\";\n\n");
            String previousNodeName = null;
            indent++;
            for (ResourceAttributeDefinition attrDef : def.getAttributeDefinitions()) {
                if (attrDef.isIgnored()) {
                    continue;
                }
                ResourceDataItem item = dataModel.findResourceItem(resource.getOid(), def.getKind(), def.getIntent(), getObjectClassName(def), attrDef.getItemName());
                previousNodeName = addResourceItem(itemsShown, indent, sb1, previousNodeName, item);
            }
            for (ResourceAssociationDefinition assocDef : def.getAssociationDefinitions()) {
                if (assocDef.isIgnored()) {
                    continue;
                }
                ResourceDataItem item = dataModel.findResourceItem(resource.getOid(), def.getKind(), def.getIntent(), getObjectClassName(def), assocDef.getName());
                previousNodeName = addResourceItem(itemsShown, indent, sb1, previousNodeName, item);
            }
            previousNodeName = addResourceItem(itemsShown, indent, sb1, previousNodeName, dataModel.findResourceItem(resource.getOid(), def.getKind(), def.getIntent(), getObjectClassName(def), ItemPath.create(ShadowType.F_ACTIVATION, ActivationType.F_ADMINISTRATIVE_STATUS)));
            previousNodeName = addResourceItem(itemsShown, indent, sb1, previousNodeName, dataModel.findResourceItem(resource.getOid(), def.getKind(), def.getIntent(), getObjectClassName(def), ItemPath.create(ShadowType.F_ACTIVATION, DataModelVisualizerImpl.ACTIVATION_EXISTENCE)));
            previousNodeName = addResourceItem(itemsShown, indent, sb1, previousNodeName, dataModel.findResourceItem(resource.getOid(), def.getKind(), def.getIntent(), getObjectClassName(def), ItemPath.create(ShadowType.F_ACTIVATION, ActivationType.F_VALID_FROM)));
            previousNodeName = addResourceItem(itemsShown, indent, sb1, previousNodeName, dataModel.findResourceItem(resource.getOid(), def.getKind(), def.getIntent(), getObjectClassName(def), ItemPath.create(ShadowType.F_ACTIVATION, ActivationType.F_VALID_TO)));
            previousNodeName = addResourceItem(itemsShown, indent, sb1, previousNodeName, dataModel.findResourceItem(resource.getOid(), def.getKind(), def.getIntent(), getObjectClassName(def), ItemPath.create(ShadowType.F_ACTIVATION, ActivationType.F_LOCKOUT_STATUS)));
            previousNodeName = addResourceItem(itemsShown, indent, sb1, previousNodeName, dataModel.findResourceItem(resource.getOid(), def.getKind(), def.getIntent(), getObjectClassName(def), ItemPath.create(ShadowType.F_CREDENTIALS, CredentialsType.F_PASSWORD)));
            indent--;
            sb1.append(indent(indent)).append("}\n");
            if (previousNodeName != null) {
                sb.append(sb1.toString());
            }
        }
        if (subgraphsForResources) {
            sb.append(indent(indent)).append("}\n");
            indent--;
        }
    }
    sb.append("\n");
    int mappingNode = 1;
    for (Relation relation : dataModel.getRelations()) {
        showNodesIfNeeded(sb, indent, itemsShown, relation.getSources());
        showNodeIfNeeded(sb, indent, itemsShown, relation.getTarget());
        DotRelation dotRelation = getDotRelation(relation);
        if (relation.getSources().size() == 1 && relation.getTarget() != null) {
            DataItem sourceItem = relation.getSources().get(0);
            DataItem targetItem = relation.getTarget();
            DotDataItem dotSourceItem = getDotDataItem(sourceItem);
            DotDataItem dotTargetItem = getDotDataItem(targetItem);
            sb.append(indent(indent)).append(dotSourceItem.getNodeName());
            sb.append(" -> ").append(dotTargetItem.getNodeName());
            sb.append(" [label=\"").append(dotRelation.getEdgeLabel()).append("\"");
            sb.append(", style=").append(dotRelation.getEdgeStyle());
            sb.append(", tooltip=\"").append(dotRelation.getEdgeTooltip()).append("\"");
            sb.append(", labeltooltip=\"").append(dotRelation.getEdgeTooltip()).append("\"");
            sb.append("];").append("\n");
        } else {
            String mappingName = "m" + (mappingNode++);
            String nodeLabel = dotRelation.getNodeLabel(mappingName);
            if (nodeLabel != null) {
                sb.append(indent(indent)).append(mappingName).append(" [label=\"").append(nodeLabel).append("\"");
                String styles = dotRelation.getNodeStyleAttributes();
                if (StringUtils.isNotEmpty(styles)) {
                    sb.append(", ").append(styles);
                }
                sb.append(", tooltip=\"").append(dotRelation.getNodeTooltip()).append("\"");
                sb.append("];\n");
            }
            for (DataItem src : relation.getSources()) {
                DotDataItem dotSrc = getDotDataItem(src);
                sb.append(indent(indent)).append(dotSrc.getNodeName()).append(" -> ").append(mappingName).append(" [style=").append(dotRelation.getEdgeStyle()).append("]\n");
            }
            if (relation.getTarget() != null) {
                DotDataItem dotTarget = getDotDataItem(relation.getTarget());
                sb.append(indent(indent)).append(mappingName).append(" -> ").append(dotTarget.getNodeName()).append(" [style=").append(dotRelation.getEdgeStyle()).append("]\n");
            }
        }
    }
    sb.append("}");
    String dot = sb.toString();
    LOGGER.debug("Resulting DOT:\n{}", dot);
    return dot;
}
Also used : ResourceSchema(com.evolveum.midpoint.schema.processor.ResourceSchema) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) ResourceAssociationDefinition(com.evolveum.midpoint.schema.processor.ResourceAssociationDefinition) ResourceAttributeDefinition(com.evolveum.midpoint.schema.processor.ResourceAttributeDefinition) ResourceObjectTypeDefinition(com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition)

Example 29 with ResourceObjectTypeDefinition

use of com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition in project midpoint by Evolveum.

the class TestModelServiceContract method test191ModifyUserJackModifyAssignment.

/**
 * We try to modify an assignment of the account and see whether changes will be recorded in the account itself.
 *
 * We also check the metadata.channel migration for both the object and the assignment (MID-6547).
 */
@Test
public void test191ModifyUserJackModifyAssignment() throws Exception {
    given();
    Task task = getTestTask();
    OperationResult result = task.getResult();
    Collection<ObjectDelta<? extends ObjectType>> deltas = new ArrayList<>();
    PrismObject<ResourceType> dummyResource = repositoryService.getObject(ResourceType.class, RESOURCE_DUMMY_OID, null, result);
    ResourceSchema refinedSchema = ResourceSchemaFactory.getCompleteSchema(dummyResource);
    // This explicitly parses the schema, therefore ...
    assertCounterIncrement(InternalCounters.RESOURCE_SCHEMA_PARSE_COUNT, 1);
    ResourceObjectTypeDefinition accountDefinition = refinedSchema.findObjectTypeDefinitionRequired(ShadowKindType.ACCOUNT, null);
    PrismPropertyDefinition gossipDefinition = accountDefinition.findPropertyDefinition(new ItemName("http://midpoint.evolveum.com/xml/ns/public/resource/instance-3", DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME));
    assertNotNull("gossip attribute definition not found", gossipDefinition);
    ConstructionType accountConstruction = createAccountConstruction(RESOURCE_DUMMY_OID, null);
    ResourceAttributeDefinitionType radt = new ResourceAttributeDefinitionType();
    radt.setRef(new ItemPathType(gossipDefinition.getItemName()));
    MappingType outbound = new MappingType();
    radt.setOutbound(outbound);
    ExpressionType expression = new ExpressionType();
    outbound.setExpression(expression);
    MappingType value = new MappingType();
    // noinspection unchecked
    PrismProperty<String> property = gossipDefinition.instantiate();
    property.addRealValue("q");
    List evaluators = expression.getExpressionEvaluator();
    Collection<JAXBElement<RawType>> collection = StaticExpressionUtil.serializeValueElements(property);
    ObjectFactory of = new ObjectFactory();
    for (JAXBElement<RawType> obj : collection) {
        // noinspection unchecked
        evaluators.add(of.createValue(obj.getValue()));
    }
    value.setExpression(expression);
    radt.setOutbound(value);
    accountConstruction.getAttribute().add(radt);
    PrismObject<UserType> jackBefore = getUserFromRepo(USER_JACK_OID);
    assertEquals("Wrong # of assignments", 1, jackBefore.asObjectable().getAssignment().size());
    Long assignmentId = jackBefore.asObjectable().getAssignment().get(0).getId();
    ObjectDelta<UserType> accountAssignmentUserDelta = createReplaceAccountConstructionUserDelta(USER_JACK_OID, assignmentId, accountConstruction);
    deltas.add(accountAssignmentUserDelta);
    // Set user and assignment create channel to legacy value.
    repositoryService.modifyObject(UserType.class, jackBefore.getOid(), deltaFor(UserType.class).item(UserType.F_METADATA, MetadataType.F_CREATE_CHANNEL).replace(Channel.USER.getLegacyUri()).item(UserType.F_ASSIGNMENT, assignmentId, AssignmentType.F_METADATA, MetadataType.F_CREATE_CHANNEL).replace(Channel.USER.getLegacyUri()).asItemDeltas(), result);
    preTestCleanup(AssignmentPolicyEnforcementType.POSITIVE);
    PrismObject<UserType> userJackOld = getUser(USER_JACK_OID);
    display("User before change execution", userJackOld);
    display("Deltas to execute execution", deltas);
    when();
    modelService.executeChanges(deltas, null, task, result);
    then();
    result.computeStatus();
    TestUtil.assertSuccess("executeChanges result", result);
    // First fetch: initial account read
    // Second fetch: fetchback after modification to correctly process inbound
    assertCounterIncrement(InternalCounters.SHADOW_FETCH_OPERATION_COUNT, 2);
    PrismObject<UserType> userJack = getUser(USER_JACK_OID);
    display("User after change execution", userJack);
    assertUserJack(userJack, "Jack Sparrow");
    accountJackOid = getSingleLinkOid(userJack);
    // MID-6547 (channel URI migration)
    assertThat(userJack.asObjectable().getMetadata().getCreateChannel()).isEqualTo(Channel.USER.getUri());
    assertThat(userJack.asObjectable().getAssignment().get(0).getMetadata().getCreateChannel()).isEqualTo(Channel.USER.getUri());
    // Check shadow
    PrismObject<ShadowType> accountShadow = repositoryService.getObject(ShadowType.class, accountJackOid, SelectorOptions.createCollection(GetOperationOptions.createRaw()), result);
    assertDummyAccountShadowRepo(accountShadow, accountJackOid, USER_JACK_USERNAME);
    // Check account
    PrismObject<ShadowType> accountModel = modelService.getObject(ShadowType.class, accountJackOid, null, task, result);
    assertDummyAccountShadowModel(accountModel, accountJackOid, USER_JACK_USERNAME, "Cpt. Jack Sparrow");
    // Check account in dummy resource
    assertDefaultDummyAccount(USER_JACK_USERNAME, "Cpt. Jack Sparrow", true);
    DummyAccount dummyAccount = getDummyAccount(null, USER_JACK_USERNAME);
    display(dummyAccount.debugDump());
    assertDummyAccountAttribute(null, USER_JACK_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME, "q");
    assertDummyScriptsModify(userJack, true);
    // Check audit
    displayDumpable("Audit", dummyAuditService);
    dummyAuditService.assertRecords(2);
    dummyAuditService.assertSimpleRecordSanity();
    dummyAuditService.assertAnyRequestDeltas();
    Collection<ObjectDeltaOperation<? extends ObjectType>> auditExecutionDeltas = dummyAuditService.getExecutionDeltas();
    assertEquals("Wrong number of execution deltas", 2, auditExecutionDeltas.size());
    dummyAuditService.assertHasDelta(ChangeType.MODIFY, UserType.class);
    dummyAuditService.assertHasDelta(ChangeType.MODIFY, ShadowType.class);
    dummyAuditService.assertTarget(USER_JACK_OID);
    dummyAuditService.assertExecutionSuccess();
    assertCounterIncrement(InternalCounters.SCRIPT_COMPILE_COUNT, 0);
    assertSteadyResources();
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ItemPathType(com.evolveum.prism.xml.ns._public.types_3.ItemPathType) ArrayList(java.util.ArrayList) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) ObjectFactory(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectFactory) ResourceObjectTypeDefinition(com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition) ItemName(com.evolveum.midpoint.prism.path.ItemName) List(java.util.List) ArrayList(java.util.ArrayList) RawType(com.evolveum.prism.xml.ns._public.types_3.RawType) DummyAccount(com.evolveum.icf.dummy.resource.DummyAccount) JAXBElement(javax.xml.bind.JAXBElement) ObjectDeltaOperation(com.evolveum.midpoint.schema.ObjectDeltaOperation) Test(org.testng.annotations.Test)

Example 30 with ResourceObjectTypeDefinition

use of com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition in project midpoint by Evolveum.

the class RefinedResourceSchemaAsserter method defaultAccountDefinition.

public ResourceObjectDefinitionAsserter<RefinedResourceSchemaAsserter<RA>> defaultAccountDefinition() {
    ResourceObjectTypeDefinition objectClassDefinition = getSchema().findDefaultOrAnyObjectTypeDefinition(ShadowKindType.ACCOUNT);
    ResourceObjectDefinitionAsserter<RefinedResourceSchemaAsserter<RA>> asserter = new ResourceObjectDefinitionAsserter<>(objectClassDefinition, this, "default account definition in " + desc());
    copySetupTo(asserter);
    return asserter;
}
Also used : ResourceObjectTypeDefinition(com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition)

Aggregations

ResourceObjectTypeDefinition (com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition)32 ResourceSchema (com.evolveum.midpoint.schema.processor.ResourceSchema)14 QName (javax.xml.namespace.QName)8 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)6 ArrayList (java.util.ArrayList)5 Test (org.testng.annotations.Test)5 ResourceObjectDefinition (com.evolveum.midpoint.schema.processor.ResourceObjectDefinition)4 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)4 Task (com.evolveum.midpoint.task.api.Task)4 ShadowKindType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType)4 PrismObject (com.evolveum.midpoint.prism.PrismObject)3 ResourceAttributeDefinition (com.evolveum.midpoint.schema.processor.ResourceAttributeDefinition)3 List (java.util.List)3 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)2 Definition (com.evolveum.midpoint.prism.Definition)2 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)2 ResourceAssociationDefinition (com.evolveum.midpoint.schema.processor.ResourceAssociationDefinition)2 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 NotNull (org.jetbrains.annotations.NotNull)2 DummyAccount (com.evolveum.icf.dummy.resource.DummyAccount)1