use of com.evolveum.midpoint.prism.schema.SchemaRegistryImpl in project midpoint by Evolveum.
the class TestExtraSchema method testTypeOverride.
/**
* Test if a schema directory can be loaded to the schema registry. This contains definition of
* user extension, therefore check if it is applied to the user definition.
*/
@Test
public void testTypeOverride() throws SAXException, IOException, SchemaException {
System.out.println("===[ testTypeOverride ]===");
PrismContext context = constructPrismContext();
SchemaRegistryImpl reg = (SchemaRegistryImpl) context.getSchemaRegistry();
reg.registerPrismSchemasFromDirectory(EXTRA_SCHEMA_DIR);
context.initialize();
PrismSchema schema = reg.getSchema(NS_ROOT);
System.out.println("Parsed root schema:");
System.out.println(schema.debugDump());
PrismContainerDefinition rootContDef = schema.findContainerDefinitionByElementName(new QName(NS_ROOT, "root"));
assertNotNull("Not <root> definition", rootContDef);
PrismContainerDefinition extensionContDef = rootContDef.findContainerDefinition(new QName(NS_FOO, "extension"));
assertNotNull("Not <extension> definition", extensionContDef);
assertEquals("Wrong <extension> type", new QName(NS_ROOT, "MyExtensionType"), extensionContDef.getTypeName());
}
use of com.evolveum.midpoint.prism.schema.SchemaRegistryImpl in project midpoint by Evolveum.
the class MidPointPrismContextFactory method createPrismContext.
@Override
public PrismContext createPrismContext() throws SchemaException, FileNotFoundException {
SchemaRegistryImpl schemaRegistry = createSchemaRegistry();
PrismContextImpl context = PrismContextImpl.create(schemaRegistry);
context.setDefinitionFactory(createDefinitionFactory());
context.setDefaultRelation(SchemaConstants.ORG_DEFAULT);
if (InternalsConfig.isPrismMonitoring()) {
context.setMonitor(new InternalMonitor());
}
return context;
}
Aggregations