use of com.evolveum.midpoint.model.common.mapping.metadata.MetadataMappingEvaluator in project midpoint by Evolveum.
the class MappingTestEvaluator method init.
private void init(boolean withMetadata) throws SchemaException, SAXException, IOException {
this.withMetadata = withMetadata;
PrettyPrinter.setDefaultNamespacePrefix(MidPointConstants.NS_MIDPOINT_PUBLIC_PREFIX);
PrismTestUtil.resetPrismContext(MidPointPrismContextFactory.FACTORY);
prismContext = PrismTestUtil.createInitializedPrismContext();
ObjectResolver resolver = new DirectoryFileObjectResolver(MidPointTestConstants.OBJECTS_DIR);
protector = ExpressionTestUtil.createInitializedProtector(prismContext);
Clock clock = new Clock();
ExpressionFactory expressionFactory = ExpressionTestUtil.createInitializedExpressionFactory(resolver, protector, prismContext, clock, null, null);
// We need only selected beans for the mapping factory
ModelCommonBeans beans = new ModelCommonBeans();
beans.expressionFactory = expressionFactory;
beans.objectResolver = resolver;
beans.prismContext = prismContext;
beans.protector = protector;
if (withMetadata) {
BuiltinMetadataMappingsRegistry builtinMetadataMappingsRegistry = new BuiltinMetadataMappingsRegistry();
ProvenanceBuiltinMapping provenanceBuiltinMapping = new ProvenanceBuiltinMapping(prismContext, builtinMetadataMappingsRegistry);
provenanceBuiltinMapping.register();
beans.metadataMappingEvaluator = new MetadataMappingEvaluator(mappingFactory, prismContext, builtinMetadataMappingsRegistry);
}
mappingFactory = new MappingFactory();
mappingFactory.setBeans(beans);
mappingFactory.setProfiling(true);
}
Aggregations