[daemon] jsvc integration into to maven-based integration/unit tests?
Hi, during our maven-based build, we have some integration tests, which runs our own server and binds it on low ports (e.g. 443 and 80). We start our server during those integration tests, by using a Maven-Plugin which invokes the API of the server (I guess in a similar way how the Jetty container is started by its maven-plugin). On Windows this all is fine. On Linux you are not able to bind those lower ports, but there is a work-around (authbind): http://en.wikipedia.org/wiki/Authbind However, on Mac there is no authbind port (and it does not compile) :-( After some research, I found the jsvc from the Commons Daemon projects. I am now wondering if folks have integrated the jsvc in a similar case? (E.g. binding servers to low ports during integration/unit testing, without being root) Ideally we do not have to change the Start / Stop API of our server in order to that. Any pointers are appreciated! Greetings, Matthias -- Matthias Wessendorf blog: http://matthiaswessendorf.wordpress.com/ sessions: http://www.slideshare.net/mwessendorf twitter: http://twitter.com/mwessendorf - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [dbcp] Min connection pool
I believe you're looking for minIdle configuration property. Find more configuration details @ http://commons.apache.org/dbcp/configuration.html Regards, Stevo. On May 9, 2011 8:23 PM, Fernando O. fot...@gmail.com wrote: Hi all I'm trying to migrate from C3p0 to dbcp and it looks like some (a lot of?) things are different. one of the more important problems im facing is that it looks like I can't specify a minimum amount of connections in the pool. so if I run a kill test, after initializing the pool with say 10 connections I see only 1 connection, no other connection gets created is there a way to get my 10 connections back without specifying autoreconnect in the jdbc url?
[scxml] Creating ad-hoc arrays in JEXL expressions
Hello, I am trying to create an ad-hoc array in my workflow and provide it to a custom action: state id=fetchCustomerData onentry log expr='Customer - Fetching data'/ al:fetchTableData select=['col1', 'col2'] / /onentry /state In the custom action, I am evaluating this string through JEXL Evaluator: public void execute(EventDispatcher eventDispatcher, ErrorReporter errorReporter, SCInstance scInstance, Log log, Collection collection) throws ModelException, SCXMLExpressionException { log.info(scInstance.getEvaluator().eval(scInstance.getRootContext(), this.getSelect())); } This throws an error: WARNING: EXPRESSION_ERROR (eval('['col1', 'col2']'):Encountered [ at line 1, column 1. Was expecting one of: EOF INTEGER_LITERAL ... FLOAT_LITERAL ... { ... empty ... ( ... size ... - ... ~ ... ! ... not ... null ... true ... false ... ; ... if ... while ... foreach ... IDENTIFIER ... STRING_LITERAL ... ): Is creating arrays (or HashMaps, for that matter) even possible like this in SCXML? I was following the guide at: http://commons.apache.org/jexl/reference/syntax.html The executor was created like this: SCXMLExecutor exec = null; exec = new SCXMLExecutor(new JexlEvaluator(), new SimpleDispatcher(), new SimpleErrorReporter()); Context ctx = new JexlContext(); exec.setRootContext(ctx); exec.setStateMachine(scxml); exec.setSuperStep(true); Thank you!
[Jexl] Problem using BigDecimal divide and compare
*** Re-sending it ** Hello Jexl Users, First, thanks for developing this, its very useful and simple to use. I was planning to use it for one of my projects, but I am running into few issues. I am using the latest build (2.0.2-Snapshot) - the version in which JexlArithmetic takes MathContext to solve the divide problem. I see couple of issues: 1. MathContext allows one to control the precision and rounding mode, but not the scale. Without that comparison using the result any operation (multiply/divide) would fail. 2. There seems to be bug in JexlArithmetic equals method. The intend seems to be to use compareTo when BigDecimal, but the code handling the case when only one of them is BigDecimal. Here is the snippet } else if (left.getClass().equals(right.getClass())) { return left.equals(right); } else if (left instanceof BigDecimal || right instanceof BigDecimal) { return toBigDecimal(left).compareTo(toBigDecimal(right)) == 0; } So, when both the operands are BigDecimal, it does equals, which is trouble. The instanceOfBigDecimal check should go above the class equals check. I feel the bigger problem is any comparison without applying scale would fail. Here is the example String expStr1 = result == salary/month * work.percent/100.00; Expression exp1 = engine.createExpression(expStr1); JexlContext ctx = new MapContext(); ctx.set(result, new BigDecimal(9958.33)); ctx.set(salary, new BigDecimal(119500.00)); ctx.set(month, new BigDecimal(12.00)); ctx.set(percent, new BigDecimal(100.00)); This always returns 'false', as the right operand computes to 9958.33, which is not equals to or compares to 9958.33. I think the JexlArithmetic should take the scale and the equals method should apply the scale on both the left and right operands and then perform the check. Let me know, if this doesn't make any sense, and missing something obvious. -- ~Naren -- ~Naren
Re: [scxml] Creating ad-hoc arrays in JEXL expressions
On Mon, May 9, 2011 at 4:19 PM, Dario D darac1...@gmail.com wrote: Hello, I am trying to create an ad-hoc array in my workflow and provide it to a custom action: state id=fetchCustomerData onentry log expr='Customer - Fetching data'/ al:fetchTableData select=['col1', 'col2'] / /onentry /state In the custom action, I am evaluating this string through JEXL Evaluator: public void execute(EventDispatcher eventDispatcher, ErrorReporter errorReporter, SCInstance scInstance, Log log, Collection collection) throws ModelException, SCXMLExpressionException { log.info(scInstance.getEvaluator().eval(scInstance.getRootContext(), this.getSelect())); } This throws an error: WARNING: EXPRESSION_ERROR (eval('['col1', 'col2']'):Encountered [ at line 1, column 1. Was expecting one of: EOF INTEGER_LITERAL ... FLOAT_LITERAL ... { ... empty ... ( ... size ... - ... ~ ... ! ... not ... null ... true ... false ... ; ... if ... while ... foreach ... IDENTIFIER ... STRING_LITERAL ... ): Is creating arrays (or HashMaps, for that matter) even possible like this in SCXML? I was following the guide at: http://commons.apache.org/jexl/reference/syntax.html The executor was created like this: SCXMLExecutor exec = null; exec = new SCXMLExecutor(new JexlEvaluator(), new SimpleDispatcher(), new SimpleErrorReporter()); Context ctx = new JexlContext(); exec.setRootContext(ctx); exec.setStateMachine(scxml); exec.setSuperStep(true); Thank you! snip/ JEXL 2.x syntax will require a suitable Evaluator/Context implementation (the default in v0.9 supports JEXL 1.x). You can either provide one yourself or try the one attached to this ticket [1]. -Rahul [1] https://issues.apache.org/jira/browse/SCXML-114 - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [scxml] Creating ad-hoc arrays in JEXL expressions
Thanks a lot Rahul. 2011/5/10 Rahul Akolkar rahul.akol...@gmail.com On Mon, May 9, 2011 at 4:19 PM, Dario D darac1...@gmail.com wrote: Hello, I am trying to create an ad-hoc array in my workflow and provide it to a custom action: state id=fetchCustomerData onentry log expr='Customer - Fetching data'/ al:fetchTableData select=['col1', 'col2'] / /onentry /state In the custom action, I am evaluating this string through JEXL Evaluator: public void execute(EventDispatcher eventDispatcher, ErrorReporter errorReporter, SCInstance scInstance, Log log, Collection collection) throws ModelException, SCXMLExpressionException { log.info (scInstance.getEvaluator().eval(scInstance.getRootContext(), this.getSelect())); } This throws an error: WARNING: EXPRESSION_ERROR (eval('['col1', 'col2']'):Encountered [ at line 1, column 1. Was expecting one of: EOF INTEGER_LITERAL ... FLOAT_LITERAL ... { ... empty ... ( ... size ... - ... ~ ... ! ... not ... null ... true ... false ... ; ... if ... while ... foreach ... IDENTIFIER ... STRING_LITERAL ... ): Is creating arrays (or HashMaps, for that matter) even possible like this in SCXML? I was following the guide at: http://commons.apache.org/jexl/reference/syntax.html The executor was created like this: SCXMLExecutor exec = null; exec = new SCXMLExecutor(new JexlEvaluator(), new SimpleDispatcher(), new SimpleErrorReporter()); Context ctx = new JexlContext(); exec.setRootContext(ctx); exec.setStateMachine(scxml); exec.setSuperStep(true); Thank you! snip/ JEXL 2.x syntax will require a suitable Evaluator/Context implementation (the default in v0.9 supports JEXL 1.x). You can either provide one yourself or try the one attached to this ticket [1]. -Rahul [1] https://issues.apache.org/jira/browse/SCXML-114 - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org