This is an automated email from the ASF dual-hosted git repository. jkevan pushed a commit to branch reduceIndicesItems2 in repository https://gitbox.apache.org/repos/asf/unomi.git
The following commit(s) were added to refs/heads/reduceIndicesItems2 by this push: new 7721d8f57 UNOMI-736: More fixes regarding groovy actions 7721d8f57 is described below commit 7721d8f570b198778de58786669e9affa9f54ff5 Author: Kevan <ke...@jahia.com> AuthorDate: Fri Feb 24 12:27:02 2023 +0100 UNOMI-736: More fixes regarding groovy actions --- .../groovy/actions/services/impl/GroovyActionsServiceImpl.java | 6 +----- .../test/java/org/apache/unomi/itests/GroovyActionsServiceIT.java | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/extensions/groovy-actions/services/src/main/java/org/apache/unomi/groovy/actions/services/impl/GroovyActionsServiceImpl.java b/extensions/groovy-actions/services/src/main/java/org/apache/unomi/groovy/actions/services/impl/GroovyActionsServiceImpl.java index 14816f46a..cc120e869 100644 --- a/extensions/groovy-actions/services/src/main/java/org/apache/unomi/groovy/actions/services/impl/GroovyActionsServiceImpl.java +++ b/extensions/groovy-actions/services/src/main/java/org/apache/unomi/groovy/actions/services/impl/GroovyActionsServiceImpl.java @@ -154,9 +154,7 @@ public class GroovyActionsServiceImpl implements GroovyActionsService { return; } logger.debug("Found Groovy base script at {}, loading... ", groovyBaseScriptURL.getPath()); - GroovyCodeSource groovyCodeSource = new GroovyCodeSource(IOUtils.toString(groovyBaseScriptURL.openStream()), BASE_SCRIPT_NAME, - "/groovy/script"); - groovyCodeSourceMap.put(BASE_SCRIPT_NAME, groovyCodeSource); + GroovyCodeSource groovyCodeSource = new GroovyCodeSource(IOUtils.toString(groovyBaseScriptURL.openStream()), BASE_SCRIPT_NAME, "/groovy/script"); groovyScriptEngine.getGroovyClassLoader().parseClass(groovyCodeSource, true); } @@ -259,8 +257,6 @@ public class GroovyActionsServiceImpl implements GroovyActionsService { private void refreshGroovyActions() { Map<String, GroovyCodeSource> refreshedGroovyCodeSourceMap = new HashMap<>(); - GroovyCodeSource baseScript = groovyCodeSourceMap.get(BASE_SCRIPT_NAME); - refreshedGroovyCodeSourceMap.put(BASE_SCRIPT_NAME, baseScript); persistenceService.getAllItems(GroovyAction.class).forEach(groovyAction -> refreshedGroovyCodeSourceMap .put(groovyAction.getName(), buildClassScript(groovyAction.getScript(), groovyAction.getName()))); groovyCodeSourceMap = refreshedGroovyCodeSourceMap; diff --git a/itests/src/test/java/org/apache/unomi/itests/GroovyActionsServiceIT.java b/itests/src/test/java/org/apache/unomi/itests/GroovyActionsServiceIT.java index 20c507f8d..18cd2c80f 100644 --- a/itests/src/test/java/org/apache/unomi/itests/GroovyActionsServiceIT.java +++ b/itests/src/test/java/org/apache/unomi/itests/GroovyActionsServiceIT.java @@ -120,7 +120,7 @@ public class GroovyActionsServiceIT extends BaseIT { ActionType actionType = keepTrying("Failed waiting for the creation of the GroovyAction for the save test", () -> definitionsService.getActionType(UPDATE_ADDRESS_GROOVY_ACTION), Objects::nonNull, 1000, 100); - Assert.assertEquals(UPDATE_ADDRESS_ACTION, groovyActionsService.getGroovyCodeSource(UPDATE_ADDRESS_ACTION).getName()); + Assert.assertEquals(UPDATE_ADDRESS_ACTION + "-groovySourceCode", groovyActionsService.getGroovyCodeSource(UPDATE_ADDRESS_ACTION).getName()); Assert.assertTrue(actionType.getMetadata().getId().contains(UPDATE_ADDRESS_GROOVY_ACTION)); Assert.assertEquals(2, actionType.getMetadata().getSystemTags().size());