[jira] [Commented] (OFBIZ-10805) OFBiz shell

2019-01-28 Thread Mathieu Lirzin (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10805?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16754015#comment-16754015
 ] 

Mathieu Lirzin commented on OFBIZ-10805:


The issue was that the classloader used by the main thread which is augmented 
with the classpath directories found in {{ofbiz-component.xml}} files was not 
shared with the the admin server thread.  I fixed the issue locally with an 
inelegant solution (meaning a thread unsafe global variable).

I will update the patch when I found a better solution.

> OFBiz shell
> ---
>
> Key: OFBIZ-10805
> URL: https://issues.apache.org/jira/browse/OFBIZ-10805
> Project: OFBiz
>  Issue Type: Improvement
>  Components: framework
>Affects Versions: Trunk
>Reporter: Mathieu Lirzin
>Priority: Major
> Fix For: Upcoming Branch
>
> Attachments: OFBIZ-10805_OFBiz-shell.patch
>
>
> One issue with the current way of writing Groovy tests is that the feedback 
> between writing an instruction and checking its result is slow because one 
> has to rerun the corresponding test case.
> Providing a Groovy shell access with a delegator and dispatcher allows 
> developers to interactively execute commands and check their results 
> instantly.
> The shell access has been done via Remote Procedure Call (RPC) which was 
> already implemented by the {{AdminClient}} and {{AdminServer}} classes.
> In order to test, you must start the server first:
> {code}
> $ ./gradlew ofbiz
> {code}
> then you can run the following command in another terminal:
> {code}
> $ java -jar build/libs/ofbiz.jar --shell
> {code}
> or this equivalent one which uses the corresponding short option:
> {code}
> $ java -jar build/libs/ofbiz.jar -i
> {code}
> *Limitation*: It is currently not possible to connect multiple shells at
>  the same time.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (OFBIZ-10805) OFBiz shell

2019-01-13 Thread Mathieu Lirzin (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10805?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16741577#comment-16741577
 ] 

Mathieu Lirzin commented on OFBIZ-10805:


One issue that I discover is that currently the shell doesn't play well with 
services implemented using the Groovy engine since it relies on the Groovy DSL. 
The issue looks like a shared instance problem. If the Groovy engine is loaded 
before the first shell session things works fine, however if that's not the 
case then services implemented in Groovy can not be invoked anymore. Here is an 
example showing the issue at hand with the {{createQuote}} service which is 
implemented in Groovy.

Here is the failing scenario: I launch the OFBiz server, then invoke 
{{createQuote}} directly via the shell and obtains the following error:
{code:java}
groovy:000> dispatcher.runSync('createQuote', [userLogin: admin, partyId: 
'Company'])
ERROR org.apache.ofbiz.service.GenericServiceException:
Error running Groovy method [createQuote] in Groovy file 
[component://order/groovyScripts/quote/QuoteServices.groovy]:  
(groovy.lang.MissingMethodException: No signature of method: 
QuoteServices.makeValue() is applicable for argument types: (java.lang.String, 
java.util.HashMap) values: [Quote, [userLogin:[lastUpdatedStamp:2019-01-08 
09:30:37.047, ...], ...]])
at org.apache.ofbiz.service.engine.GroovyEngine.serviceInvoker 
(GroovyEngine.java:129)
at org.apache.ofbiz.service.engine.GroovyEngine.runSync 
(GroovyEngine.java:83)
at org.apache.ofbiz.service.ServiceDispatcher.runSync 
(ServiceDispatcher.java:415)
at org.apache.ofbiz.service.ServiceDispatcher.runSync 
(ServiceDispatcher.java:240)
at 
org.apache.ofbiz.service.GenericDispatcherFactory$GenericDispatcher.runSync 
(GenericDispatcherFactory.java:88)
at org.apache.ofbiz.service.LocalDispatcher$runSync.call (Unknown 
Source)
{code}
Afterwards invoking the {{createQuote}} service via the the web interface fails 
with the same error.

Here is the successful scenario: I launch the OFBiz server, then invoke 
{{createQuote}} via the web interface 
{{[https://localhost:8443/webtools/control/runService]}} which loads the Groovy 
Engine with the DSL features., and finally I reinvoke {{createQuote}} via the 
shell:
{code:java}
groovy:000> dispatcher.runSync('createQuote', [userLogin: admin, partyId: 
'Company'])
===> [successMessage:Quote Created Successfully, quoteId:10051]
{code}

Does anyone know a proper way to embed multiple Groovy runtimes inside a single 
Java application?


> OFBiz shell
> ---
>
> Key: OFBIZ-10805
> URL: https://issues.apache.org/jira/browse/OFBIZ-10805
> Project: OFBiz
>  Issue Type: Improvement
>  Components: framework
>Affects Versions: Trunk
>Reporter: Mathieu Lirzin
>Priority: Major
> Fix For: Upcoming Branch
>
> Attachments: OFBIZ-10805_OFBiz-shell.patch
>
>
> One issue with the current way of writing Groovy tests is that the feedback 
> between writing an instruction and checking its result is slow because one 
> has to rerun the corresponding test case.
> Providing a Groovy shell access with a delegator and dispatcher allows 
> developers to interactively execute commands and check their results 
> instantly.
> The shell access has been done via Remote Procedure Call (RPC) which was 
> already implemented by the {{AdminClient}} and {{AdminServer}} classes.
> In order to test, you must start the server first:
> {code}
> $ ./gradlew ofbiz
> {code}
> then you can run the following command in another terminal:
> {code}
> $ java -jar build/libs/ofbiz.jar --shell
> {code}
> or this equivalent one which uses the corresponding short option:
> {code}
> $ java -jar build/libs/ofbiz.jar -i
> {code}
> *Limitation*: It is currently not possible to connect multiple shells at
>  the same time.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (OFBIZ-10805) OFBiz shell

2019-01-12 Thread Michael Brohl (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10805?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16741364#comment-16741364
 ] 

Michael Brohl commented on OFBIZ-10805:
---

Hi Mathieu,

that sounds great!

How would I use the feature? Can you give an example?

Do we have to deal with security issues?

> OFBiz shell
> ---
>
> Key: OFBIZ-10805
> URL: https://issues.apache.org/jira/browse/OFBIZ-10805
> Project: OFBiz
>  Issue Type: Improvement
>  Components: framework
>Affects Versions: Trunk
>Reporter: Mathieu Lirzin
>Priority: Major
> Fix For: Upcoming Branch
>
> Attachments: OFBIZ-10805_OFBiz-shell.patch
>
>
> One issue with the current way of writing Groovy tests is that the feedback 
> between writing an instruction and checking its result is slow because one 
> has to rerun the corresponding test case.
> Providing a Groovy shell access with a delegator and dispatcher allows 
> developers to interactively execute commands and check their results 
> instantly.
> The shell access has been done via Remote Procedure Call (RPC) which was 
> already implemented by the {{AdminClient}} and {{AdminServer}} classes.
> In order to test, you must start the server first:
> {code}
> $ ./gradlew ofbiz
> {code}
> then you can run the following command in another terminal:
> {code}
> $ java -jar build/libs/ofbiz.jar --shell
> {code}
> or this equivalent one which uses the corresponding short option:
> {code}
> $ java -jar build/libs/ofbiz.jar -i
> {code}
> *Limitation*: It is currently not possible to connect multiple shells at
>  the same time.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)