Search in sources :

Example 11 with ResourceObjectClassDefinition

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

the class TestEntitlements method getGroupShadow.

private PrismObject<ShadowType> getGroupShadow(DummyResourceContoller dummyResourceCtl, QName objectClass, String name, Task task, OperationResult result) throws Exception {
    PrismObject<ResourceType> resource = dummyResourceCtl.getResource();
    ResourceObjectClassDefinition groupDef = ResourceSchemaFactory.getCompleteSchema(resource).findObjectClassDefinition(dummyResourceCtl.getGroupObjectClass());
    ResourceAttributeDefinition<?> nameDef = groupDef.findAttributeDefinition(SchemaConstants.ICFS_NAME);
    assertNotNull("No icfs:name definition", nameDef);
    ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassFilterPrefix(resource.getOid(), objectClass, prismContext).and().item(ItemPath.create(ShadowType.F_ATTRIBUTES, SchemaConstants.ICFS_NAME), nameDef).eq(name).build();
    SearchResultList<PrismObject<ShadowType>> shadows = modelService.searchObjects(ShadowType.class, query, null, task, result);
    assertEquals("Wrong # of results for " + name + " of " + objectClass + " at " + resource, 1, shadows.size());
    return shadows.get(0);
}
Also used : ResourceObjectClassDefinition(com.evolveum.midpoint.schema.processor.ResourceObjectClassDefinition) PrismObject(com.evolveum.midpoint.prism.PrismObject) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery)

Aggregations

ResourceObjectClassDefinition (com.evolveum.midpoint.schema.processor.ResourceObjectClassDefinition)11 Test (org.testng.annotations.Test)6 DummyAccount (com.evolveum.icf.dummy.resource.DummyAccount)4 PrismObject (com.evolveum.midpoint.prism.PrismObject)4 ResourceAttributeContainer (com.evolveum.midpoint.schema.processor.ResourceAttributeContainer)4 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)4 PrismContainerDefinition (com.evolveum.midpoint.prism.PrismContainerDefinition)3 PrismContainerValue (com.evolveum.midpoint.prism.PrismContainerValue)3 PrismSchema (com.evolveum.midpoint.prism.schema.PrismSchema)3 SchemaRegistry (com.evolveum.midpoint.prism.schema.SchemaRegistry)3 PrismTestUtil (com.evolveum.midpoint.prism.util.PrismTestUtil)3 GenericFrameworkException (com.evolveum.midpoint.provisioning.ucf.api.GenericFrameworkException)3 ObjectHandler (com.evolveum.midpoint.provisioning.ucf.api.ObjectHandler)3 UcfExecutionContext (com.evolveum.midpoint.provisioning.ucf.api.UcfExecutionContext)3 SchemaConstants (com.evolveum.midpoint.schema.constants.SchemaConstants)3 ResourceAttribute (com.evolveum.midpoint.schema.processor.ResourceAttribute)3 ConnectorOperationalStatus (com.evolveum.midpoint.schema.statistics.ConnectorOperationalStatus)3 ResourceTypeUtil (com.evolveum.midpoint.schema.util.ResourceTypeUtil)3 ACCOUNT_OBJECT_CLASS_NAME (com.evolveum.midpoint.schema.util.SchemaTestConstants.ACCOUNT_OBJECT_CLASS_NAME)3 ShadowUtil (com.evolveum.midpoint.schema.util.ShadowUtil)3