You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2012/06/12 23:37:22 UTC
[1/5] git commit: TAP5-1873: JavaScript execution exception is not
logged
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 <hl...@apache.org>
Authored: Tue Jun 12 14:34:59 2012 -0700
Committer: Howard M. Lewis Ship <hl...@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 0000000..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", "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"]
+ }
+}