Search in sources :

Example 6 with ProtectorImpl

use of com.evolveum.midpoint.prism.crypto.ProtectorImpl in project midpoint by Evolveum.

the class TestScriptCaching method setupFactory.

@BeforeClass
public void setupFactory() {
    System.out.println("Setting up expression factory and evaluator");
    PrismContext prismContext = PrismTestUtil.getPrismContext();
    ObjectResolver resolver = new DirectoryFileObjectResolver(OBJECTS_DIR);
    Protector protector = new ProtectorImpl();
    Collection<FunctionLibrary> functions = new ArrayList<FunctionLibrary>();
    functions.add(FunctionLibraryUtil.createBasicFunctionLibrary(prismContext, protector));
    scriptExpressionfactory = new ScriptExpressionFactory(resolver, prismContext, protector);
    scriptExpressionfactory.setFunctions(functions);
    evaluator = new Jsr223ScriptEvaluator("groovy", prismContext, protector);
    String languageUrl = evaluator.getLanguageUrl();
    scriptExpressionfactory.registerEvaluator(languageUrl, evaluator);
}
Also used : Jsr223ScriptEvaluator(com.evolveum.midpoint.model.common.expression.script.jsr223.Jsr223ScriptEvaluator) ObjectResolver(com.evolveum.midpoint.schema.util.ObjectResolver) DirectoryFileObjectResolver(com.evolveum.midpoint.test.util.DirectoryFileObjectResolver) DirectoryFileObjectResolver(com.evolveum.midpoint.test.util.DirectoryFileObjectResolver) ArrayList(java.util.ArrayList) FunctionLibrary(com.evolveum.midpoint.model.common.expression.functions.FunctionLibrary) ProtectorImpl(com.evolveum.midpoint.prism.crypto.ProtectorImpl) Protector(com.evolveum.midpoint.prism.crypto.Protector) BeforeClass(org.testng.annotations.BeforeClass)

Example 7 with ProtectorImpl

use of com.evolveum.midpoint.prism.crypto.ProtectorImpl in project midpoint by Evolveum.

the class TestExpression method setup.

@BeforeSuite
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);
    ProtectorImpl protector = ExpressionTestUtil.createInitializedProtector(prismContext);
    expressionFactory = ExpressionTestUtil.createInitializedExpressionFactory(resolver, protector, prismContext, null);
}
Also used : ObjectResolver(com.evolveum.midpoint.schema.util.ObjectResolver) DirectoryFileObjectResolver(com.evolveum.midpoint.test.util.DirectoryFileObjectResolver) DirectoryFileObjectResolver(com.evolveum.midpoint.test.util.DirectoryFileObjectResolver) ProtectorImpl(com.evolveum.midpoint.prism.crypto.ProtectorImpl) BeforeSuite(org.testng.annotations.BeforeSuite)

Example 8 with ProtectorImpl

use of com.evolveum.midpoint.prism.crypto.ProtectorImpl in project midpoint by Evolveum.

the class TestExpressionFunctions method createBasicFunctions.

private BasicExpressionFunctions createBasicFunctions() throws SchemaException, SAXException, IOException {
    PrismContext prismContext = PrismTestUtil.createInitializedPrismContext();
    Protector protector = new ProtectorImpl();
    return new BasicExpressionFunctions(prismContext, protector);
}
Also used : BasicExpressionFunctions(com.evolveum.midpoint.model.common.expression.functions.BasicExpressionFunctions) PrismContext(com.evolveum.midpoint.prism.PrismContext) ProtectorImpl(com.evolveum.midpoint.prism.crypto.ProtectorImpl) Protector(com.evolveum.midpoint.prism.crypto.Protector)

Aggregations

ProtectorImpl (com.evolveum.midpoint.prism.crypto.ProtectorImpl)8 Protector (com.evolveum.midpoint.prism.crypto.Protector)4 ObjectResolver (com.evolveum.midpoint.schema.util.ObjectResolver)3 DirectoryFileObjectResolver (com.evolveum.midpoint.test.util.DirectoryFileObjectResolver)3 FunctionLibrary (com.evolveum.midpoint.model.common.expression.functions.FunctionLibrary)2 PrismContext (com.evolveum.midpoint.prism.PrismContext)2 ArrayList (java.util.ArrayList)2 BeforeClass (org.testng.annotations.BeforeClass)2 BasicExpressionFunctions (com.evolveum.midpoint.model.common.expression.functions.BasicExpressionFunctions)1 Jsr223ScriptEvaluator (com.evolveum.midpoint.model.common.expression.script.jsr223.Jsr223ScriptEvaluator)1 EncryptionException (com.evolveum.midpoint.prism.crypto.EncryptionException)1 KeyStore (java.security.KeyStore)1 Entry (java.security.KeyStore.Entry)1 ProtectionParameter (java.security.KeyStore.ProtectionParameter)1 SecretKeyEntry (java.security.KeyStore.SecretKeyEntry)1 KeyStoreException (java.security.KeyStoreException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 Provider (java.security.Provider)1 UnrecoverableEntryException (java.security.UnrecoverableEntryException)1 SecretKey (javax.crypto.SecretKey)1