Hi guys,
I’m working on this APE issue and need an advice on how to add groovy-all to enable groovy script in datasets.
To make it work I had to add groovy all to test deployment:
@Deployment
public static Archive<?> createDeploymentPackage() {
WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war")
.addPackage(UserAccount.class.getPackage())
.addClass(Query.class)
.addPackages(true, "org.assertj.core")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsResource("test-persistence.xml", "META-INF/persistence.xml");
MavenResolverSystem resolver = Maven.resolver();
war.addAsLibraries(resolver.loadPomFromFile("pom.xml").resolve("org.codehaus.groovy:groovy-all").withoutTransitivity().asSingleFile());
return war;
}
But what I would like is to add it automatically when scriptableDatasets property is enabled in arq.xml.
The it-test can be found here. I’ve commented the lines which adds groovy to micro deployment so you can reproduce the issue. When the test is run, the following warnning is logged on server:
07:39:49,385 WARNING [org.jboss.arquillian.persistence.dbunit.data.replacement.DataSetScriptReplacer] (default task-24) Could not find script engine with name groovy in classpath
It happens when we try to get groovy script engine here.
I’ve tried to work on DBUnitArchiveAppender but without success, here is how I’m trying to add it:
if(dbunitConfigurationInstance.get().isScriptableDataSets()){
dbUnitExtensionArchive.addPackages(true, new String[]{
"groovy",
"org.codehaus.groovy",
"groovyjarjarcommonscli",
"groovyjarjarasm",
"groovyjarjarantlr"
});
dbUnitExtensionArchive.addAsResource("META-INF/services/javax.script.ScriptEngineFactory", ArchivePaths.create("META-INF/services/javax.script.ScriptEngineFactory"));
dbUnitExtensionArchive.addAsResource("META-INF/services/org.codehaus.groovy.runtime.ExtensionModule", ArchivePaths.create("META-INF/services/org.codehaus.groovy.runtime.ExtensionModule"));
dbUnitExtensionArchive.addAsResource("META-INF/services/org.codehaus.groovy.plugins.Runners", ArchivePaths.create("META-INF/services/org.codehaus.groovy.plugins.Runners"));
dbUnitExtensionArchive.addAsResource("META-INF/services/org.codehaus.groovy.transform.ASTTransformation", ArchivePaths.create("META-INF/services/org.codehaus.groovy.transform.ASTTransformation"));
dbUnitExtensionArchive.addAsResource("META-INF/services/org.codehaus.groovy.source.Extensions", ArchivePaths.create("META-INF/services/org.codehaus.groovy.source.Extensions"));
}
You can download generated arquilian-persistence-dbunit.jar here.
Any idea on how to solve that?