use of com.evolveum.midpoint.repo.common.ObjectResolver in project midpoint by Evolveum.
the class AbstractScriptTest method setupFactory.
@BeforeClass
public void setupFactory() {
prismContext = PrismTestUtil.getPrismContext();
ObjectResolver resolver = new DirectoryFileObjectResolver(OBJECTS_DIR);
Protector protector = KeyStoreBasedProtectorBuilder.create(prismContext).buildOnly();
Clock clock = new Clock();
Collection<FunctionLibrary> functions = new ArrayList<>();
functions.add(FunctionLibraryUtil.createBasicFunctionLibrary(prismContext, protector, clock));
scriptExpressionfactory = new ScriptExpressionFactory(prismContext, null);
scriptExpressionfactory.setObjectResolver(resolver);
scriptExpressionfactory.setFunctions(functions);
localizationService = LocalizationTestUtil.getLocalizationService();
evaluator = createEvaluator(prismContext, protector);
if (!evaluator.isInitialized()) {
display("Script engine for " + evaluator.getLanguageName() + " missing, skipping the tests.");
throw new SkipException("Script engine not available");
}
String languageUrl = evaluator.getLanguageUrl();
display("Expression test for " + evaluator.getLanguageName() + ": registering " + evaluator + " with URL " + languageUrl);
scriptExpressionfactory.registerEvaluator(languageUrl, evaluator);
}
use of com.evolveum.midpoint.repo.common.ObjectResolver in project midpoint by Evolveum.
the class TestExpression method setup.
@BeforeClass
public void setup() throws SchemaException, SAXException, IOException {
PrettyPrinter.setDefaultNamespacePrefix(MidPointConstants.NS_MIDPOINT_PUBLIC_PREFIX);
PrismTestUtil.resetPrismContext(MidPointPrismContextFactory.FACTORY);
prismContext = PrismTestUtil.createInitializedPrismContext();
ObjectResolver resolver = new DirectoryFileObjectResolver(MidPointTestConstants.OBJECTS_DIR);
Protector protector = ExpressionTestUtil.createInitializedProtector(prismContext);
Clock clock = new Clock();
constantsManager = new ConstantsManager();
expressionFactory = ExpressionTestUtil.createInitializedExpressionFactory(resolver, protector, prismContext, clock, null, null);
expressionProfile = compileExpressionProfile(getExpressionProfileName());
System.out.println("Using expression profile: " + expressionProfile);
logger.info("EXPRESSION PROFILE: {}", expressionProfile);
}
use of com.evolveum.midpoint.repo.common.ObjectResolver in project midpoint by Evolveum.
the class TestScriptCaching method setupFactory.
@BeforeClass
public void setupFactory() {
display("Setting up expression factory and evaluator");
PrismContext prismContext = getPrismContext();
ObjectResolver resolver = new DirectoryFileObjectResolver(OBJECTS_DIR);
Protector protector = KeyStoreBasedProtectorBuilder.create(prismContext).buildOnly();
Clock clock = new Clock();
Collection<FunctionLibrary> functions = new ArrayList<>();
functions.add(FunctionLibraryUtil.createBasicFunctionLibrary(prismContext, protector, clock));
scriptExpressionfactory = new ScriptExpressionFactory(prismContext, null);
scriptExpressionfactory.setObjectResolver(resolver);
scriptExpressionfactory.setFunctions(functions);
evaluator = new Jsr223ScriptEvaluator("groovy", prismContext, protector, LocalizationTestUtil.getLocalizationService());
String languageUrl = evaluator.getLanguageUrl();
scriptExpressionfactory.registerEvaluator(languageUrl, evaluator);
}
Aggregations