use of com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition in project midpoint by Evolveum.
the class TestRefinedSchema method test100EntitlementRefinedObjectClasses.
@Test
public void test100EntitlementRefinedObjectClasses() {
// WHEN
Collection<? extends ResourceObjectTypeDefinition> entitlementROcDefs = refinedSchema.getObjectTypeDefinitions(ShadowKindType.ENTITLEMENT);
display("entitlement rOcDefs", entitlementROcDefs);
// THEN
for (ResourceObjectTypeDefinition entitlementROcDef : entitlementROcDefs) {
assertEquals("Wrong kind in " + entitlementROcDef, ShadowKindType.ENTITLEMENT, entitlementROcDef.getKind());
}
assertEquals("Wrong number of entitlement rOcDefs", 6, entitlementROcDefs.size());
}
use of com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition in project midpoint by Evolveum.
the class TestRefinedSchema method test101EntitlementRefinedObjectClassesModel.
@Test
public void test101EntitlementRefinedObjectClassesModel() {
// WHEN
Collection<? extends ResourceObjectTypeDefinition> entitlementROcDefs = refinedSchemaModel.getObjectTypeDefinitions(ShadowKindType.ENTITLEMENT);
display("entitlement rOcDefs", entitlementROcDefs);
// THEN
for (ResourceObjectTypeDefinition entitlementROcDef : entitlementROcDefs) {
assertEquals("Wrong kind in " + entitlementROcDef, ShadowKindType.ENTITLEMENT, entitlementROcDef.getKind());
}
assertEquals("Wrong number of entitlement rOcDefs", 6, entitlementROcDefs.size());
}
use of com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition in project midpoint by Evolveum.
the class CorrelationServiceImpl method getFullCorrelationContext.
@NotNull
private FullCorrelationContext getFullCorrelationContext(ShadowType shadow, Task task, OperationResult result) throws SchemaException, ExpressionEvaluationException, CommunicationException, SecurityViolationException, ConfigurationException, ObjectNotFoundException {
String resourceOid = ShadowUtil.getResourceOidRequired(shadow);
ResourceType resource = beans.provisioningService.getObject(ResourceType.class, resourceOid, null, task, result).asObjectable();
// We expect that the shadow is classified + reasonably fresh (= not legacy), so it has kind+intent present.
ShadowKindType kind = MiscUtil.requireNonNull(shadow.getKind(), () -> new IllegalStateException("No kind in " + shadow));
String intent = MiscUtil.requireNonNull(shadow.getIntent(), () -> new IllegalStateException("No intent in " + shadow));
// TODO check for "unknown" ?
// We'll look for type definition in the future (after synchronization is integrated into it).
ResourceSchema schema = ResourceSchemaFactory.getCompleteSchema(resource);
ResourceObjectTypeDefinition typeDefinition = schema.findObjectTypeDefinitionRequired(kind, intent);
for (ObjectSynchronizationType config : resource.getSynchronization().getObjectSynchronization()) {
if (config.getKind() == kind && intent.equals(config.getIntent())) {
return new FullCorrelationContext(shadow, resource, typeDefinition, config, MiscUtil.requireNonNull(config.getCorrelationDefinition().getCorrelators(), () -> new IllegalStateException("No correlators in " + config)));
}
}
throw new IllegalStateException("No " + kind + "/" + intent + " (kind/intent) definition in " + resource + " (for " + shadow + ")");
}
use of com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition in project midpoint by Evolveum.
the class AbstractSecurityTest method assertGlobalStateUntouched.
protected void assertGlobalStateUntouched() throws SchemaException {
ResourceSchema refinedSchema = ResourceSchemaFactory.getCompleteSchema(getDummyResourceObject());
ResourceObjectTypeDefinition rOcDef = refinedSchema.findDefaultOrAnyObjectTypeDefinition(ShadowKindType.ACCOUNT);
assertAttributeFlags(rOcDef, SchemaConstants.ICFS_UID, true, false, false);
assertAttributeFlags(rOcDef, SchemaConstants.ICFS_NAME, true, true, true);
assertAttributeFlags(rOcDef, new QName("location"), true, true, true);
assertAttributeFlags(rOcDef, new QName("weapon"), true, true, true);
}
use of com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition in project midpoint by Evolveum.
the class RefinedResourceSchemaAsserter method defaultDefinition.
public ResourceObjectDefinitionAsserter<RefinedResourceSchemaAsserter<RA>> defaultDefinition(ShadowKindType kind) {
ResourceObjectTypeDefinition objectClassDefinition = getSchema().findDefaultOrAnyObjectTypeDefinition(kind);
ResourceObjectDefinitionAsserter<RefinedResourceSchemaAsserter<RA>> asserter = new ResourceObjectDefinitionAsserter<>(objectClassDefinition, this, "default definition for kind " + kind + " in " + desc());
copySetupTo(asserter);
return asserter;
}
Aggregations