private JsonValue readJsonFile(String path) throws AuditException { try { InputStream is = AuditServiceProviderImpl.class.getResourceAsStream(path); String contents = IOUtils.readStream(is); return JsonValueBuilder.toJsonValue(contents.replaceAll("\\s", "")); } catch (IOException e) { debug.error("Unable to read configuration file {}", path, e); throw new AuditException("Unable to read configuration file " + path, e); } }
@BeforeClass public void setupScript() throws Exception { String rawScript = IOUtils.readStream( this.getClass().getClassLoader().getResourceAsStream("oidc-claims-extension.groovy")); SupportedScriptingLanguage scriptType = SupportedScriptingLanguage.GROOVY; this.script = new ScriptObject("oidc-claims-script", rawScript, scriptType, null); StandardScriptEngineManager scriptEngineManager = new StandardScriptEngineManager(); scriptEngineManager.registerEngineName( SupportedScriptingLanguage.GROOVY_ENGINE_NAME, new GroovyScriptEngineFactory()); scriptEvaluator = new StandardScriptEvaluator(scriptEngineManager); }