Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for scriptable datasets via Java scripting api (JSR 233) #47

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

rmpestano
Copy link

refs #18

There is a limitation for the Javascript engine which is bundled with the jdk. It is working on some cases (Wildfly jdk 7) but failing on others (jboss as) with the following error:

ScriptEngineManager providers.next(): javax.script.ScriptEngineFactory: Provider 
com.sun.script.javascript.RhinoScriptEngineFactory not found

The error is thrown on a variety of cases like JDK version (on jdk8 engine was changed from rhino to Nashorn) and server version and is pretty uninstallable.

Groovy engine seems to be more stable and work on all cases I've tested. Its dependency (groovy-all) is being bundle within arquillian persistence extension.

The implementation is parsing the script engine from dataset and, in theory, any script engine can be used.

Also by default this feature is not enabled and needs to be settled in arquillian.xml.

What do you think?

@bartoszmajsak
Copy link
Member

Awesome stuff! Thanks a lot for your contribution. Let me just get back
from holidays (22.05) and I will jump into it.
On May 13, 2016 10:32 AM, "Rafael M. Pestano" [email protected]
wrote:

refs #18
#18

There is a limitation for the Javascript engine which is bundled with
the jdk. It is working on some cases (Wildfly jdk 7) but failing on others
(jboss as) with the following error:

ScriptEngineManager providers.next(): javax.script.ScriptEngineFactory: Provider
com.sun.script.javascript.RhinoScriptEngineFactory not found

The error is thrown on a variety of cases like JDK version (on jdk8 engine
was changed from rhino to Nashorn) and server version and is pretty
uninstallable.

Groovy engine seems to be more stable and work on all cases I've tested.
Its dependency (groovy-all) is being bundle within arquillian persistence
extension.

The implementation
https://github.com/rmpestano/arquillian-extension-persistence/blob/master/dbunit/src/main/java/org/jboss/arquillian/persistence/dbunit/dataset/scriptable/ScriptableTable.java#L91
is parsing the script engine from dataset and, in theory, any script engine
can be used.

Also by default this feature is not enabled
https://github.com/rmpestano/arquillian-extension-persistence/blob/master/dbunit/src/main/java/org/jboss/arquillian/persistence/dbunit/DBUnitDataHandler.java#L101
and needs to be settled in arquillian.xml.

What do you think?

You can view, comment on, or merge this pull request online at:

#47
Commit Summary

  • adds scriptable datasets
  • fix windows test
  • adds test files windows removed...
  • moved wildfly-remote to wildfly folder
  • adds wildfly-remote
  • jdk 1.6 as minimum version
  • adjusted wildfly-remote profile

File Changes

Patch Links:

https://github.com/arquillian/arquillian-extension-persistence/pull/47.patch

https://github.com/arquillian/arquillian-extension-persistence/pull/47.diff


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#47

INSERT INTO useraccount (id, firstname, lastname, username, password) VALUES (1, 'John', 'Smith', 'doovde', 'password');
INSERT INTO useraccount (id, firstname, lastname, username, password) VALUES (2, 'Clark', 'Kent', 'superman', 'kryptonite');
INSERT INTO useraccount (id, firstname, lastname, username, password) VALUES (1, 'John', 'Smith', 'doovde', 'password');
INSERT INTO useraccount (id, firstname, lastname, username, password) VALUES (2, 'Clark', 'Kent', 'superman', 'kryptonite');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it line-ending change b/c of windows? If so I would suggest to adjust your IDE and re-format to linux line ending :)

Copy link
Author

@rmpestano rmpestano May 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, can be because I commited from both envs, it shouldn't be on the PR.

- removes windows special characters;
@rmpestano
Copy link
Author

Hi @bartoszmajsak, I think the last commit fixes above issues.

<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.6</version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move the version to the property like for other artifacts?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

@bartoszmajsak
Copy link
Member

Great, thanks! I shared just few small things but we are close to bringing it to the upstream. Thanks a lot for your contribution. I will work on this tonight.

Could you also add some small note about this functionality in README.md - we can use it later on for the release announcement blog post.

- adds ScriptableDataSetEngineException and ScriptableDataSetEvalutationException.
@rmpestano
Copy link
Author

rmpestano commented Jun 4, 2016

Hi @bartoszmajsak,

added readme and fixed exception handling. Let me know if there is anything else to refactory.

@bartoszmajsak
Copy link
Member

Overall it's awesome contribution. And it's been very long on my list.

The only thing we have left is to make sure that we somehow support (or not) those containers which are currently causing the issues, as you highlighted in the initial comment. Before that we cannot really fully announce that we have such a functionality. I believe we have to investigate if it is fixable or not. In both cases we should it documented, but also make problematic tests not run in those environments.

I will take it over from now on. Once again, many thanks!

@bartoszmajsak bartoszmajsak self-assigned this Jun 7, 2016
@rmpestano
Copy link
Author

The only thing we have left is to make sure that we somehow support (or not) those containers which are currently causing the issues, as you highlighted in the initial comment.

Yea, fully agreed. Here is what I've tested:

On wildfly for example it works for 8.2.0/8.2.1(jdk7 and 8) but fails on 8.1.0 with message: ScriptEngineManager providers.next(): javax.script.ScriptEngineFactory: Provider jdk.nashorn.api.scripting.NashornScriptEngineFactory not found

On jboss 7.0.2 it didn't worked at all with error mentioned in first message here.

I was not able to test on other containers like glassfish and tomee, the maven profiles should work?

@bartoszmajsak
Copy link
Member

They should. Or at least used to :) But I will need to update those too, so I will check how does it behave in other envs we plan to support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants