[jira] [Commented] (TAP5-1949) Alerts component does not show alerts added from a component that occurs later in the template

2012-06-12 Thread Jochen Kemnade (JIRA)

[ 
https://issues.apache.org/jira/browse/TAP5-1949?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13293395#comment-13293395
 ] 

Jochen Kemnade commented on TAP5-1949:
--

The term during the render of the page is somewhat misleasing. The alerts are 
generated during the setup-render phase of an embedded component. The exact use 
case is a component whose rendering is effected by users's settings. There can 
be misconfigurations (related to conflicts between session state and persisted 
settings) that lead to a message being displayed to the user. As the component 
detects that error itself, it registers an alert with the alert manager. But if 
the alerts component is contained in the layout component, its begin-render 
phase (which generated the client-side JS for the alerts to be shown) is 
executed before the component's setup-render, so the messages are not added.

 Alerts component does not show alerts added from a component that occurs 
 later in the template
 --

 Key: TAP5-1949
 URL: https://issues.apache.org/jira/browse/TAP5-1949
 Project: Tapestry 5
  Issue Type: Bug
  Components: tapestry-core
Affects Versions: 5.3.3, 5.4
Reporter: Jochen Kemnade
Priority: Minor
  Labels: patch
 Attachments: 
 0001-defer-the-alerts-JS-initialization-to-allow-for-aler.patch


 Consider the following snippet:
 t:alerts /
 t:componentthataddsanalert /
 The alert will not be shown as the JS for the alerts is generated in the 
 beginRender phase of the alerts component. and alerts that are added later 
 are ignored until its next rendering.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (TAP5-1949) Alerts component does not show alerts added from a component that occurs later in the template

2012-06-12 Thread Massimo Lusetti (JIRA)

[ 
https://issues.apache.org/jira/browse/TAP5-1949?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13293433#comment-13293433
 ] 

Massimo Lusetti commented on TAP5-1949:
---

I like the proposed behavior. Did anyone see a draw back in this changes?

 Alerts component does not show alerts added from a component that occurs 
 later in the template
 --

 Key: TAP5-1949
 URL: https://issues.apache.org/jira/browse/TAP5-1949
 Project: Tapestry 5
  Issue Type: Bug
  Components: tapestry-core
Affects Versions: 5.3.3, 5.4
Reporter: Jochen Kemnade
Priority: Minor
  Labels: patch
 Attachments: 
 0001-defer-the-alerts-JS-initialization-to-allow-for-aler.patch


 Consider the following snippet:
 t:alerts /
 t:componentthataddsanalert /
 The alert will not be shown as the JS for the alerts is generated in the 
 beginRender phase of the alerts component. and alerts that are added later 
 are ignored until its next rendering.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Updated] (TAP5-1948) NullFieldStrategy interface should have a reference to client\server provided value

2012-06-12 Thread Muhammad Gelbana (JIRA)

 [ 
https://issues.apache.org/jira/browse/TAP5-1948?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Muhammad Gelbana updated TAP5-1948:
---

Affects Version/s: 5.4
   5.3.4

 NullFieldStrategy interface should have a reference to client\server provided 
 value
 ---

 Key: TAP5-1948
 URL: https://issues.apache.org/jira/browse/TAP5-1948
 Project: Tapestry 5
  Issue Type: Improvement
  Components: tapestry-core
Affects Versions: 5.3.3, 5.3.4, 5.4
Reporter: Muhammad Gelbana
  Labels: NullFieldStrategy, blank, input

 And it affects all previous version. My case is that I should accept blank 
 inputs from the client through text fields. By blank inputs I mean nothing 
 and one or more spaces.
 Now the NullFieldStrategy interface doesn't provide a clue about the value 
 considered by tapestry to be blank. Like in my case, I actually need to know 
 if the user provided a space or more or even nothing at all ? I just need the 
 value as it is.
 Thank you.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Updated] (TAP5-1951) Allow multiple different service interface implementations to be registered using identical service identifier strings

2012-06-12 Thread Carsten Klein (JIRA)

 [ 
https://issues.apache.org/jira/browse/TAP5-1951?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Carsten Klein updated TAP5-1951:


Description: 
As of now, tapestry-ioc maintains a global namespace for all of the registered 
service ids.
This makes it impossible to bind different service interfaces and their 
implementations 
thereof using the same service identifiers, e.g.

binder.bind(IFirstService.class, 
FirstServiceDefaultImpl.class).withId(default);
binder.bind(ISecondService.class, 
SecondServiceDefaultImpl.class).withId(default);

This will result in an exception on container and application startup.

I think that, having played around with Plexus for a while, it would be nice to 
allow duplicate 
service ids for different service interfaces, as it makes documentation and 
using one's APIs 
a lot easier, when one can refer to default instead of for example 
secondservice.default 
and so on.

As for the performance impact, one could always use the fully qualified name of 
the service 
interface class and append to it the service identifier. This is very similar 
to the user 
disambiguating the service identifiers by herself, except that tapestry-ioc 
would use the 
namespaces provided by the application instead, e.g.

when doing 

binder.bind(...).withId(default);

the service binder would then

this.registry.registerServiceById(serviceInterfaceClass.getName() + . + 
serviceId, serviceInterfaceClass, implClass); 

or something like that.


  was:
As of now, tapestry-ioc maintains a global namespace for all of the registered 
service ids.
This makes it impossible to bind different service interfaces and their 
implementations 
thereof using the same service identifiers, e.g.

binder.bind(IFirstService.class, 
FirstServiceDefaultImpl.class).withId(default);
binder.bind(ISecondService.class, 
SecondServiceDefaultImpl.class).withId(default);

This will result in an exception on container and application startup.

I think that, having played around with Plexus for a while, it would be nice to 
allow duplicate 
service ids for different service interfaces, as it makes documentation and 
using one's APIs 
a lot easier, when one can refer to default instead of for example 
secondservice.default 
and so on.

As for the performance impact, one could always use the fully qualified name of 
the service 
interface class and prepend to it the service identifier. This is very similar 
to the user 
disambiguating the service identifiers by herself, except that tapestry-ioc 
would use the 
namespaces provided by the application instead, e.g.

when doing 

binder.bind(...).withId(default);

the service binder would then

this.registry.registerServiceById(serviceInterfaceClass.getName() + . + 
serviceId, serviceInterfaceClass, implClass); 

or something like that.



 Allow multiple different service interface implementations to be registered 
 using identical service identifier strings
 --

 Key: TAP5-1951
 URL: https://issues.apache.org/jira/browse/TAP5-1951
 Project: Tapestry 5
  Issue Type: Improvement
  Components: tapestry-ioc
Affects Versions: 5.3.3
Reporter: Carsten Klein
Priority: Minor

 As of now, tapestry-ioc maintains a global namespace for all of the 
 registered service ids.
 This makes it impossible to bind different service interfaces and their 
 implementations 
 thereof using the same service identifiers, e.g.
 binder.bind(IFirstService.class, 
 FirstServiceDefaultImpl.class).withId(default);
 binder.bind(ISecondService.class, 
 SecondServiceDefaultImpl.class).withId(default);
 This will result in an exception on container and application startup.
 I think that, having played around with Plexus for a while, it would be nice 
 to allow duplicate 
 service ids for different service interfaces, as it makes documentation and 
 using one's APIs 
 a lot easier, when one can refer to default instead of for example 
 secondservice.default 
 and so on.
 As for the performance impact, one could always use the fully qualified name 
 of the service 
 interface class and append to it the service identifier. This is very similar 
 to the user 
 disambiguating the service identifiers by herself, except that tapestry-ioc 
 would use the 
 namespaces provided by the application instead, e.g.
 when doing 
 binder.bind(...).withId(default);
 the service binder would then
 this.registry.registerServiceById(serviceInterfaceClass.getName() + . + 
 serviceId, serviceInterfaceClass, implClass); 
 or something like that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, 

[jira] [Assigned] (TAP5-1873) JavaScript execution exception is not logged

2012-06-12 Thread Howard M. Lewis Ship (JIRA)

 [ 
https://issues.apache.org/jira/browse/TAP5-1873?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Howard M. Lewis Ship reassigned TAP5-1873:
--

Assignee: Howard M. Lewis Ship

 JavaScript execution exception is not logged
 

 Key: TAP5-1873
 URL: https://issues.apache.org/jira/browse/TAP5-1873
 Project: Tapestry 5
  Issue Type: Bug
  Components: tapestry-core
Affects Versions: 5.3
Reporter: Denis Stepanov
Assignee: Howard M. Lewis Ship

 If there is an error durring the ajax javascript execution, exception is not 
 logged, that is a critical issue when you are developing and tracking errors.
 Tapestry.js ajaxRequest @453:
 finalOptions.get('onException').call(this, response);
 Should be:
 finalOptions.get('onException').call(this, response, e);
 Exception's stacktrace should be also logged otherwise there is no way to 
 tell were did it came from.
 Tapestry.js ajaxExceptionHandler @371:
 Tapestry.debug(Tapestry.Messages.ajaxFailure + exception, response);
 if(exception.stack) {
  Tapestry.debug(exception.stack);
 }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[1/2] git commit: Remove file accidentally leaked from the 5.4 master branch

2012-06-12 Thread hlship
Updated Branches:
  refs/heads/5.3 781da0b88 - 2f490ecb4


Remove file accidentally leaked from the 5.4 master branch


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/2f490ecb
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/2f490ecb
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/2f490ecb

Branch: refs/heads/5.3
Commit: 2f490ecb46d9906ee0caa7983fd7271792fd7261
Parents: 464160f
Author: Howard M. Lewis Ship hls...@apache.org
Authored: Tue Jun 12 14:36:52 2012 -0700
Committer: Howard M. Lewis Ship hls...@apache.org
Committed: Tue Jun 12 14:36:52 2012 -0700

--
 .../apache/tapestry5/ioc/util/OrdererSpec.groovy   |  171 ---
 1 files changed, 0 insertions(+), 171 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/2f490ecb/tapestry-ioc/src/test/groovy/org/apache/tapestry5/ioc/util/OrdererSpec.groovy
--
diff --git 
a/tapestry-ioc/src/test/groovy/org/apache/tapestry5/ioc/util/OrdererSpec.groovy 
b/tapestry-ioc/src/test/groovy/org/apache/tapestry5/ioc/util/OrdererSpec.groovy
deleted file mode 100644
index 49e5095..000
--- 
a/tapestry-ioc/src/test/groovy/org/apache/tapestry5/ioc/util/OrdererSpec.groovy
+++ /dev/null
@@ -1,171 +0,0 @@
-package org.apache.tapestry5.ioc.util
-
-import org.apache.tapestry5.ioc.internal.util.Orderer
-import org.apache.tapestry5.ioc.internal.util.UtilMessages
-import org.slf4j.Logger
-import spock.lang.Specification
-
-class OrdererSpec extends Specification {
-
-  Logger logger = Mock()
-
-  def the order of the values is unchanged when there are no dependencies() {
-
-def orderer = new Orderer(logger)
-
-when:
-
-orderer.with {
-  add fred, FRED
-  add barney, BARNEY
-  add wilma, WILMA
-  add betty, BETTY
-}
-
-then:
-
-orderer.ordered == [FRED, BARNEY, WILMA, BETTY]
-  }
-
-  def an override can change order and value() {
-def orderer = new Orderer(logger)
-
-when:
-
-orderer.with {
-  add fred, FRED
-  add barney, BARNEY
-  add wilma, WILMA
-  add betty, BETTY
-
-  override barney, Mr. Rubble, before:*
-}
-
-then:
-
-orderer.ordered == [Mr. Rubble, FRED, WILMA, BETTY]
-  }
-
-  def an override must match a previously added id() {
-def orderer = new Orderer(logger)
-
-when:
-
-orderer.with {
-  add fred, FRED
-  add barney, BARNEY
-  add wilma, WILMA
-  add betty, BETTY
-
-  override bambam, Mr. Rubble JR., before:*
-}
-
-then:
-
-IllegalArgumentException e = thrown()
-
-e.message == Override for object 'bambam' is invalid as it does not match 
an existing object.
-  }
-
-  def a missing constraint type is logged as a warning() {
-
-def orderer = new Orderer(logger)
-
-when:
-
-orderer.with {
-  add fred, FRED
-  add barney, BARNEY, fred
-  add wilma, WILMA
-  add betty, BETTY
-}
-
-then:
-
-logger.warn(UtilMessages.constraintFormat(fred, barney))
-
-orderer.ordered == [FRED, BARNEY, WILMA, BETTY]
-  }
-
-  def an unknown constraint type is logged as a warning() {
-def orderer = new Orderer(logger)
-
-when:
-
-orderer.with {
-  add fred, FRED
-  add barney, BARNEY, nearby:fred
-  add wilma, WILMA
-  add betty, BETTY
-}
-
-then:
-
-logger.warn(UtilMessages.constraintFormat(nearby:fred, barney))
-
-orderer.ordered == [FRED, BARNEY, WILMA, BETTY]
-  }
-
-  def null values are not included in the result() {
-def orderer = new Orderer(logger)
-
-when:
-
-orderer.with {
-  add fred, FRED
-  add barney, BARNEY
-  add zippo, null
-  add wilma, WILMA
-  add groucho, null
-  add betty, BETTY
-}
-
-then:
-
-orderer.ordered == [FRED, BARNEY, WILMA, BETTY]
-  }
-
-  def duplicate ids are ignored() {
-def orderer = new Orderer(logger)
-
-orderer.with {
-  add fred, FRED
-  add barney, BARNEY
-  add wilma, WILMA
-}
-
-when:
-
-orderer.add(Fred, Fred 2)
-
-then:
-
-// Notice it uses the previously added id, whose case is considered 
canonical
-logger.warn(UtilMessages.duplicateOrderer(fred))
-
-when:
-
-orderer.add betty, BETTY
-
-then:
-
-orderer.ordered == [FRED, BARNEY, WILMA, BETTY]
-  }
-
-  def the special before:* moves the value to the front of the list() {
-def orderer = new Orderer(logger)
-
-when:
-
-orderer.with {
-  add fred, FRED
-  add barney, BARNEY, before:*
-  add wilma, WILMA
-  add betty, BETTY
-}
-
-then:
-
-orderer.ordered == [BARNEY, FRED, WILMA, BETTY]
-  }
-}



[1/5] git commit: TAP5-1873: JavaScript execution exception is not logged

2012-06-12 Thread hlship
Updated Branches:
  refs/heads/master bd1da989c - 3e255abe8


TAP5-1873: JavaScript execution exception is not logged


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/3e255abe
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/3e255abe
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/3e255abe

Branch: refs/heads/master
Commit: 3e255abe8050dc8cb5d610eb3de6fa6141341d70
Parents: 22d05b1
Author: Howard M. Lewis Ship hls...@apache.org
Authored: Tue Jun 12 14:34:59 2012 -0700
Committer: Howard M. Lewis Ship hls...@apache.org
Committed: Tue Jun 12 14:34:59 2012 -0700

--
 .../resources/org/apache/tapestry5/tapestry.js |6 +-
 .../apache/tapestry5/ioc/util/OrdererSpec.groovy   |  171 +++
 2 files changed, 176 insertions(+), 1 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3e255abe/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
--
diff --git a/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js 
b/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
index f97fb03..f23a1e2 100644
--- a/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
+++ b/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
@@ -373,6 +373,10 @@ var Tapestry = {
 
 Tapestry.debug(Tapestry.Messages.ajaxFailure + exception, response);
 
+// This covers just FireFox and Opera:
+var trace = exception.stack || exception.stacktrace;
+if (exception.stack) { Tapestry.debug(exception.stack); }
+
 throw exception;
 },
 
@@ -450,7 +454,7 @@ var Tapestry = {
 /* Re-invoke the success handler, capturing any 
exceptions. */
 successHandler.call(this, response, jsonResponse);
 } catch (e) {
-finalOptions.get('onException').call(this, response);
+finalOptions.get('onException').call(this, response, 
e);
 }
 }
 });

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3e255abe/tapestry-ioc/src/test/groovy/org/apache/tapestry5/ioc/util/OrdererSpec.groovy
--
diff --git 
a/tapestry-ioc/src/test/groovy/org/apache/tapestry5/ioc/util/OrdererSpec.groovy 
b/tapestry-ioc/src/test/groovy/org/apache/tapestry5/ioc/util/OrdererSpec.groovy
new file mode 100644
index 000..49e5095
--- /dev/null
+++ 
b/tapestry-ioc/src/test/groovy/org/apache/tapestry5/ioc/util/OrdererSpec.groovy
@@ -0,0 +1,171 @@
+package org.apache.tapestry5.ioc.util
+
+import org.apache.tapestry5.ioc.internal.util.Orderer
+import org.apache.tapestry5.ioc.internal.util.UtilMessages
+import org.slf4j.Logger
+import spock.lang.Specification
+
+class OrdererSpec extends Specification {
+
+  Logger logger = Mock()
+
+  def the order of the values is unchanged when there are no dependencies() {
+
+def orderer = new Orderer(logger)
+
+when:
+
+orderer.with {
+  add fred, FRED
+  add barney, BARNEY
+  add wilma, WILMA
+  add betty, BETTY
+}
+
+then:
+
+orderer.ordered == [FRED, BARNEY, WILMA, BETTY]
+  }
+
+  def an override can change order and value() {
+def orderer = new Orderer(logger)
+
+when:
+
+orderer.with {
+  add fred, FRED
+  add barney, BARNEY
+  add wilma, WILMA
+  add betty, BETTY
+
+  override barney, Mr. Rubble, before:*
+}
+
+then:
+
+orderer.ordered == [Mr. Rubble, FRED, WILMA, BETTY]
+  }
+
+  def an override must match a previously added id() {
+def orderer = new Orderer(logger)
+
+when:
+
+orderer.with {
+  add fred, FRED
+  add barney, BARNEY
+  add wilma, WILMA
+  add betty, BETTY
+
+  override bambam, Mr. Rubble JR., before:*
+}
+
+then:
+
+IllegalArgumentException e = thrown()
+
+e.message == Override for object 'bambam' is invalid as it does not match 
an existing object.
+  }
+
+  def a missing constraint type is logged as a warning() {
+
+def orderer = new Orderer(logger)
+
+when:
+
+orderer.with {
+  add fred, FRED
+  add barney, BARNEY, fred
+  add wilma, WILMA
+  add betty, BETTY
+}
+
+then:
+
+logger.warn(UtilMessages.constraintFormat(fred, barney))
+
+orderer.ordered == [FRED, BARNEY, WILMA, BETTY]
+  }
+
+  def an unknown constraint type is logged as a warning() {
+def orderer = new Orderer(logger)
+
+when:
+
+orderer.with {
+  add fred, FRED
+  add barney, BARNEY, nearby:fred
+  add wilma, WILMA
+  add betty, BETTY
+}
+
+then:
+
+

[3/5] git commit: Convert TestNG to Spock

2012-06-12 Thread hlship
Convert TestNG to Spock


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/cb55d1c3
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/cb55d1c3
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/cb55d1c3

Branch: refs/heads/master
Commit: cb55d1c3ced4fb0803ac829b532a2b94d471c6cb
Parents: a663703
Author: Howard M. Lewis Ship hls...@apache.org
Authored: Tue Jun 12 11:04:27 2012 -0700
Committer: Howard M. Lewis Ship hls...@apache.org
Committed: Tue Jun 12 11:04:27 2012 -0700

--
 .../ioc/internal/services/RegistryStartup.java |   11 +-
 .../ioc/internal/services/ServiceMessages.java |5 -
 .../internal/services/ServiceStrings.properties|1 -
 .../internal/services/RegistryStartupSpec.groovy   |   95 ++
 .../ioc/internal/services/RegistryStartupTest.java |  135 ---
 5 files changed, 102 insertions(+), 145 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/cb55d1c3/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/RegistryStartup.java
--
diff --git 
a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/RegistryStartup.java
 
b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/RegistryStartup.java
index a6b3d0c..35e3a34 100644
--- 
a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/RegistryStartup.java
+++ 
b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/RegistryStartup.java
@@ -1,4 +1,4 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2012 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the License);
 // you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
 package org.apache.tapestry5.ioc.internal.services;
 
 import org.apache.tapestry5.ioc.Registry;
+import org.apache.tapestry5.ioc.internal.util.InternalUtils;
 import org.apache.tapestry5.ioc.internal.util.OneShotLock;
 import org.slf4j.Logger;
 
@@ -53,10 +54,12 @@ public class RegistryStartup implements Runnable
 try
 {
 r.run();
-}
-catch (RuntimeException ex)
+} catch (RuntimeException ex)
 {
-logger.error(ServiceMessages.startupFailure(ex));
+// startup-failure=An exception occurred during startup: %s
+
+logger.error(String.format(An exception occurred during 
startup: %s,
+InternalUtils.toMessage(ex)), ex);
 }
 }
 

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/cb55d1c3/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/ServiceMessages.java
--
diff --git 
a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/ServiceMessages.java
 
b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/ServiceMessages.java
index ad4c5b5..93899bf 100644
--- 
a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/ServiceMessages.java
+++ 
b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/ServiceMessages.java
@@ -90,9 +90,4 @@ public class ServiceMessages
 {
 return MESSAGES.format(service-build-failure, serviceId, cause);
 }
-
-public static String startupFailure(Throwable cause)
-{
-return MESSAGES.format(startup-failure, cause);
-}
 }

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/cb55d1c3/tapestry-ioc/src/main/resources/org/apache/tapestry5/ioc/internal/services/ServiceStrings.properties
--
diff --git 
a/tapestry-ioc/src/main/resources/org/apache/tapestry5/ioc/internal/services/ServiceStrings.properties
 
b/tapestry-ioc/src/main/resources/org/apache/tapestry5/ioc/internal/services/ServiceStrings.properties
index b16ae75..721a2d8 100644
--- 
a/tapestry-ioc/src/main/resources/org/apache/tapestry5/ioc/internal/services/ServiceStrings.properties
+++ 
b/tapestry-ioc/src/main/resources/org/apache/tapestry5/ioc/internal/services/ServiceStrings.properties
@@ -24,4 +24,3 @@ missing-symbol-close-brace-in-path=Input string '%s' is 
missing a symbol closing
 failed-coercion=Coercion of %s to type %s (via %s) failed: %s
 registry-shutdown=Proxy for service %s is no longer active because the IOC 
Registry has been shut down.
 service-build-failure=Exception constructing service '%s': %s
-startup-failure=An exception occurred during startup: %s


[5/5] git commit: Convert TestNG to Spock

2012-06-12 Thread hlship
Convert TestNG to Spock


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/b34f1112
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/b34f1112
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/b34f1112

Branch: refs/heads/master
Commit: b34f11121c9b55bb8617857c36a9d87d9fa3a1a5
Parents: bd1da98
Author: Howard M. Lewis Ship hls...@apache.org
Authored: Mon Jun 11 16:47:20 2012 -0700
Committer: Howard M. Lewis Ship hls...@apache.org
Committed: Mon Jun 11 16:47:20 2012 -0700

--
 .../ValidatingConfigurationWrapperSpec.groovy  |   78 
 .../ValidatingConfigurationWrapperTest.java|  137 ---
 2 files changed, 78 insertions(+), 137 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/b34f1112/tapestry-ioc/src/test/groovy/org/apache/tapestry5/ioc/internal/ValidatingConfigurationWrapperSpec.groovy
--
diff --git 
a/tapestry-ioc/src/test/groovy/org/apache/tapestry5/ioc/internal/ValidatingConfigurationWrapperSpec.groovy
 
b/tapestry-ioc/src/test/groovy/org/apache/tapestry5/ioc/internal/ValidatingConfigurationWrapperSpec.groovy
new file mode 100644
index 000..fdc1363
--- /dev/null
+++ 
b/tapestry-ioc/src/test/groovy/org/apache/tapestry5/ioc/internal/ValidatingConfigurationWrapperSpec.groovy
@@ -0,0 +1,78 @@
+package org.apache.tapestry5.ioc.internal
+
+import org.apache.tapestry5.ioc.Configuration
+import org.apache.tapestry5.ioc.ObjectLocator
+import spock.lang.Specification
+
+class ValidatingConfigurationWrapperSpec extends Specification {
+
+  TypeCoercerProxy tc = Mock()
+  ObjectLocator locator = Mock()
+
+  def collection = []
+
+  def valid contribution() {
+Runnable value = Mock()
+
+Configuration config = new ValidatingConfigurationWrapper(Runnable, null, 
tc, collection, Baz)
+
+when:
+
+config.add(value)
+
+then:
+
+tc.coerce(value, Runnable)  value
+
+collection == [value]
+  }
+
+  def contributed value may be coerced() {
+Runnable value = Mock()
+Runnable coerced = Mock()
+
+Configuration config = new ValidatingConfigurationWrapper(Runnable, null, 
tc, collection, Baz)
+
+when:
+
+config.add(value)
+
+then:
+
+tc.coerce(value, Runnable)  coerced
+
+collection == [coerced]
+  }
+
+  def an instance of a class may be contributed() {
+HashMap contributed = new HashMap()
+Map coerced = Mock()
+
+Configuration config = new ValidatingConfigurationWrapper(Map, locator, 
tc, collection, Baz)
+
+when:
+
+config.addInstance(HashMap)
+
+then:
+
+locator.autobuild(HashMap)  contributed
+tc.coerce(contributed, Map)  coerced
+
+collection == [coerced]
+  }
+
+  def null may not be contributed() {
+Configuration config = new ValidatingConfigurationWrapper(Runnable, null, 
tc, collection, Baz)
+
+when:
+
+config.add(null)
+
+then:
+
+NullPointerException e = thrown()
+
+e.message == Service contribution (to service 'Baz') was null.
+  }
+}

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/b34f1112/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ValidatingConfigurationWrapperTest.java
--
diff --git 
a/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ValidatingConfigurationWrapperTest.java
 
b/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ValidatingConfigurationWrapperTest.java
deleted file mode 100644
index e7a2d6e..000
--- 
a/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ValidatingConfigurationWrapperTest.java
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright 2006, 2007, 2008, 2009, 2011 The Apache Software Foundation
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package org.apache.tapestry5.ioc.internal;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tapestry5.ioc.Configuration;
-import org.apache.tapestry5.ioc.ObjectLocator;
-import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
-import org.testng.annotations.Test;
-
-@SuppressWarnings(
-{ rawtypes, unchecked })
-public class ValidatingConfigurationWrapperTest extends IOCInternalTestCase
-{
-@Test

[2/2] git commit: TAP5-1873: JavaScript execution exception is not logged

2012-06-12 Thread hlship
TAP5-1873: JavaScript execution exception is not logged


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/464160fd
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/464160fd
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/464160fd

Branch: refs/heads/5.3
Commit: 464160fdd9044b9e61b2ba9187e13106ebde1244
Parents: 781da0b
Author: Howard M. Lewis Ship hls...@apache.org
Authored: Tue Jun 12 14:34:59 2012 -0700
Committer: Howard M. Lewis Ship hls...@apache.org
Committed: Tue Jun 12 14:35:57 2012 -0700

--
 .../resources/org/apache/tapestry5/tapestry.js |6 +-
 .../apache/tapestry5/ioc/util/OrdererSpec.groovy   |  171 +++
 2 files changed, 176 insertions(+), 1 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/464160fd/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
--
diff --git a/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js 
b/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
index f97fb03..f23a1e2 100644
--- a/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
+++ b/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
@@ -373,6 +373,10 @@ var Tapestry = {
 
 Tapestry.debug(Tapestry.Messages.ajaxFailure + exception, response);
 
+// This covers just FireFox and Opera:
+var trace = exception.stack || exception.stacktrace;
+if (exception.stack) { Tapestry.debug(exception.stack); }
+
 throw exception;
 },
 
@@ -450,7 +454,7 @@ var Tapestry = {
 /* Re-invoke the success handler, capturing any 
exceptions. */
 successHandler.call(this, response, jsonResponse);
 } catch (e) {
-finalOptions.get('onException').call(this, response);
+finalOptions.get('onException').call(this, response, 
e);
 }
 }
 });

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/464160fd/tapestry-ioc/src/test/groovy/org/apache/tapestry5/ioc/util/OrdererSpec.groovy
--
diff --git 
a/tapestry-ioc/src/test/groovy/org/apache/tapestry5/ioc/util/OrdererSpec.groovy 
b/tapestry-ioc/src/test/groovy/org/apache/tapestry5/ioc/util/OrdererSpec.groovy
new file mode 100644
index 000..49e5095
--- /dev/null
+++ 
b/tapestry-ioc/src/test/groovy/org/apache/tapestry5/ioc/util/OrdererSpec.groovy
@@ -0,0 +1,171 @@
+package org.apache.tapestry5.ioc.util
+
+import org.apache.tapestry5.ioc.internal.util.Orderer
+import org.apache.tapestry5.ioc.internal.util.UtilMessages
+import org.slf4j.Logger
+import spock.lang.Specification
+
+class OrdererSpec extends Specification {
+
+  Logger logger = Mock()
+
+  def the order of the values is unchanged when there are no dependencies() {
+
+def orderer = new Orderer(logger)
+
+when:
+
+orderer.with {
+  add fred, FRED
+  add barney, BARNEY
+  add wilma, WILMA
+  add betty, BETTY
+}
+
+then:
+
+orderer.ordered == [FRED, BARNEY, WILMA, BETTY]
+  }
+
+  def an override can change order and value() {
+def orderer = new Orderer(logger)
+
+when:
+
+orderer.with {
+  add fred, FRED
+  add barney, BARNEY
+  add wilma, WILMA
+  add betty, BETTY
+
+  override barney, Mr. Rubble, before:*
+}
+
+then:
+
+orderer.ordered == [Mr. Rubble, FRED, WILMA, BETTY]
+  }
+
+  def an override must match a previously added id() {
+def orderer = new Orderer(logger)
+
+when:
+
+orderer.with {
+  add fred, FRED
+  add barney, BARNEY
+  add wilma, WILMA
+  add betty, BETTY
+
+  override bambam, Mr. Rubble JR., before:*
+}
+
+then:
+
+IllegalArgumentException e = thrown()
+
+e.message == Override for object 'bambam' is invalid as it does not match 
an existing object.
+  }
+
+  def a missing constraint type is logged as a warning() {
+
+def orderer = new Orderer(logger)
+
+when:
+
+orderer.with {
+  add fred, FRED
+  add barney, BARNEY, fred
+  add wilma, WILMA
+  add betty, BETTY
+}
+
+then:
+
+logger.warn(UtilMessages.constraintFormat(fred, barney))
+
+orderer.ordered == [FRED, BARNEY, WILMA, BETTY]
+  }
+
+  def an unknown constraint type is logged as a warning() {
+def orderer = new Orderer(logger)
+
+when:
+
+orderer.with {
+  add fred, FRED
+  add barney, BARNEY, nearby:fred
+  add wilma, WILMA
+  add betty, BETTY
+}
+
+then:
+
+logger.warn(UtilMessages.constraintFormat(nearby:fred, barney))
+
+orderer.ordered == [FRED, BARNEY, WILMA, 

[jira] [Closed] (TAP5-1873) JavaScript execution exception is not logged

2012-06-12 Thread Howard M. Lewis Ship (JIRA)

 [ 
https://issues.apache.org/jira/browse/TAP5-1873?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Howard M. Lewis Ship closed TAP5-1873.
--

   Resolution: Fixed
Fix Version/s: 5.4
   5.3.4

 JavaScript execution exception is not logged
 

 Key: TAP5-1873
 URL: https://issues.apache.org/jira/browse/TAP5-1873
 Project: Tapestry 5
  Issue Type: Bug
  Components: tapestry-core
Affects Versions: 5.3
Reporter: Denis Stepanov
Assignee: Howard M. Lewis Ship
 Fix For: 5.3.4, 5.4


 If there is an error durring the ajax javascript execution, exception is not 
 logged, that is a critical issue when you are developing and tracking errors.
 Tapestry.js ajaxRequest @453:
 finalOptions.get('onException').call(this, response);
 Should be:
 finalOptions.get('onException').call(this, response, e);
 Exception's stacktrace should be also logged otherwise there is no way to 
 tell were did it came from.
 Tapestry.js ajaxExceptionHandler @371:
 Tapestry.debug(Tapestry.Messages.ajaxFailure + exception, response);
 if(exception.stack) {
  Tapestry.debug(exception.stack);
 }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira