use of com.evolveum.midpoint.schema.processor.ObjectClassComplexTypeDefinition in project midpoint by Evolveum.
the class TestRefinedSchema method test122DetermineObjectClassKindIntentModel.
@Test
public void test122DetermineObjectClassKindIntentModel() throws Exception {
final String TEST_NAME = "test122DetermineObjectClassKindIntentModel";
TestUtil.displayTestTile(this, TEST_NAME);
OperationResult result = new OperationResult(TestRefinedSchema.class.getName() + "." + TEST_NAME);
importObjectFromFile(TASK_RECONCILE_DUMMY_KIND_INTENT_FILE);
Task task = taskManager.getTask(TASK_RECONCILE_DUMMY_KIND_INTENT_OID, result);
display("Task", task);
// WHEN
ObjectClassComplexTypeDefinition objectClass = Utils.determineObjectClass(refinedSchemaModel, task);
// THEN
display("Object class", objectClass);
display("Object class (toString)", objectClass.toString());
deleteObject(TaskType.class, TASK_RECONCILE_DUMMY_KIND_INTENT_OID);
assertLayerRefinedObjectClass(objectClass, RESOURCE_DUMMY_PRIVILEGE_OBJECTCLASS_QNAME, ShadowKindType.ENTITLEMENT, "privilege", LayerType.MODEL);
}
use of com.evolveum.midpoint.schema.processor.ObjectClassComplexTypeDefinition in project midpoint by Evolveum.
the class TestRefinedSchema method test110DetermineObjectClassObjectClass.
@Test
public void test110DetermineObjectClassObjectClass() throws Exception {
final String TEST_NAME = "test110DetermineObjectClassObjectClass";
TestUtil.displayTestTile(this, TEST_NAME);
OperationResult result = new OperationResult(TestRefinedSchema.class.getName() + "." + TEST_NAME);
importObjectFromFile(TASK_RECONCILE_DUMMY_OBJECTCLASS_FILE);
Task task = taskManager.getTask(TASK_RECONCILE_DUMMY_OBJECTCLASS_OID, result);
display("Task", task);
// WHEN
ObjectClassComplexTypeDefinition objectClass = Utils.determineObjectClass(refinedSchema, task);
// THEN
display("Object class", objectClass);
deleteObject(TaskType.class, TASK_RECONCILE_DUMMY_OBJECTCLASS_OID);
assertObjectClass(objectClass, RESOURCE_DUMMY_ACCOUNT_OBJECTCLASS_QNAME);
}
use of com.evolveum.midpoint.schema.processor.ObjectClassComplexTypeDefinition in project midpoint by Evolveum.
the class TestRefinedSchema method test120DetermineObjectClassObjectClassModel.
@Test
public void test120DetermineObjectClassObjectClassModel() throws Exception {
final String TEST_NAME = "test120DetermineObjectClassObjectClassModel";
TestUtil.displayTestTile(this, TEST_NAME);
OperationResult result = new OperationResult(TestRefinedSchema.class.getName() + "." + TEST_NAME);
importObjectFromFile(TASK_RECONCILE_DUMMY_OBJECTCLASS_FILE);
Task task = taskManager.getTask(TASK_RECONCILE_DUMMY_OBJECTCLASS_OID, result);
display("Task", task);
// WHEN
ObjectClassComplexTypeDefinition objectClass = Utils.determineObjectClass(refinedSchemaModel, task);
// THEN
display("Object class", objectClass);
display("Object class (toString)", objectClass.toString());
deleteObject(TaskType.class, TASK_RECONCILE_DUMMY_OBJECTCLASS_OID);
assertObjectClass(objectClass, RESOURCE_DUMMY_ACCOUNT_OBJECTCLASS_QNAME);
}
use of com.evolveum.midpoint.schema.processor.ObjectClassComplexTypeDefinition in project midpoint by Evolveum.
the class ResourceDetailsTabPanel method getTaskFor.
private List<TaskType> getTaskFor(List<PrismObject<TaskType>> tasks, ObjectSynchronizationType synchronizationPolicy, PrismObject<ResourceType> resource) throws SchemaException {
List<TaskType> syncTasks = new ArrayList<TaskType>();
for (PrismObject<TaskType> task : tasks) {
PrismProperty<ShadowKindType> taskKind = task.findProperty(new ItemPath(TaskType.F_EXTENSION, SchemaConstants.MODEL_EXTENSION_KIND));
ShadowKindType taskKindValue = null;
if (taskKind != null) {
taskKindValue = taskKind.getRealValue();
}
PrismProperty<String> taskIntent = task.findProperty(new ItemPath(TaskType.F_EXTENSION, SchemaConstants.MODEL_EXTENSION_INTENT));
String taskIntentValue = null;
if (taskIntent != null) {
taskIntentValue = taskIntent.getRealValue();
}
PrismProperty<QName> taskObjectClass = task.findProperty(new ItemPath(TaskType.F_EXTENSION, SchemaConstants.OBJECTCLASS_PROPERTY_NAME));
QName taskObjectClassValue = null;
if (taskObjectClass != null) {
taskObjectClassValue = taskObjectClass.getRealValue();
}
// is not accessible in admin-gui)
if (taskObjectClassValue == null) {
ObjectClassComplexTypeDefinition taskObjectClassDef = null;
RefinedResourceSchema schema = RefinedResourceSchemaImpl.getRefinedSchema(resource);
if (schema == null) {
throw new SchemaException("No schema defined in resource. Possible configuration problem?");
}
if (taskKindValue == null && taskIntentValue == null) {
taskObjectClassDef = schema.findDefaultObjectClassDefinition(ShadowKindType.ACCOUNT);
}
if (taskKindValue != null) {
if (StringUtils.isEmpty(taskIntentValue)) {
taskObjectClassDef = schema.findDefaultObjectClassDefinition(taskKindValue);
} else {
taskObjectClassDef = schema.findObjectClassDefinition(taskKindValue, taskIntentValue);
}
}
if (taskObjectClassDef != null) {
taskObjectClassValue = taskObjectClassDef.getTypeName();
}
}
if (SynchronizationUtils.isPolicyApplicable(taskObjectClassValue, taskKindValue, taskIntentValue, synchronizationPolicy, resource)) {
syncTasks.add(task.asObjectable());
}
}
return syncTasks;
}
use of com.evolveum.midpoint.schema.processor.ObjectClassComplexTypeDefinition in project midpoint by Evolveum.
the class AbstractCsvTest method test005ParsedSchema.
@Test
public void test005ParsedSchema() throws Exception {
final String TEST_NAME = "test005ParsedSchema";
TestUtil.displayTestTile(TEST_NAME);
// THEN
// The returned type should have the schema pre-parsed
assertNotNull(RefinedResourceSchemaImpl.hasParsedSchema(resourceType));
// Also test if the utility method returns the same thing
ResourceSchema resourceSchema = RefinedResourceSchemaImpl.getResourceSchema(resourceType, prismContext);
display("Parsed resource schema", resourceSchema);
assertNotNull("No resource schema", resourceSchema);
ObjectClassComplexTypeDefinition accountDef = resourceSchema.findObjectClassDefinition(RESOURCE_CSV_ACCOUNT_OBJECTCLASS);
assertNotNull("Account definition is missing", accountDef);
assertNotNull("Null identifiers in account", accountDef.getPrimaryIdentifiers());
assertFalse("Empty identifiers in account", accountDef.getPrimaryIdentifiers().isEmpty());
assertNotNull("No naming attribute in account", accountDef.getNamingAttribute());
assertFalse("No nativeObjectClass in account", StringUtils.isEmpty(accountDef.getNativeObjectClass()));
assertAccountDefinition(accountDef);
ResourceAttributeDefinition<String> icfsNameDef = accountDef.findAttributeDefinition(SchemaConstants.ICFS_NAME);
assertNull("ICFS NAME definition sneaked in", icfsNameDef);
ResourceAttributeDefinition<String> icfsUidDef = accountDef.findAttributeDefinition(SchemaConstants.ICFS_UID);
assertNull("ICFS UID definition sneaked in", icfsUidDef);
// Check whether it is reusing the existing schema and not parsing it all over again
// Not equals() but == ... we want to really know if exactly the same
// object instance is returned
assertTrue("Broken caching", resourceSchema == RefinedResourceSchemaImpl.getResourceSchema(resourceType, prismContext));
}
Aggregations