test and rat fixes, and log message tidy

Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/a882a87b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/a882a87b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/a882a87b

Branch: refs/heads/master
Commit: a882a87b0055ec06fa66eaad749935399504d1d3
Parents: 2f4367e
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Authored: Fri Jul 18 00:38:46 2014 -0400
Committer: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Committed: Fri Jul 18 09:15:18 2014 -0400

----------------------------------------------------------------------
 .../resources/fixtures/api-error-no-details.json  |  3 +--
 .../rest/util/DefaultExceptionMapper.java         |  3 ++-
 .../rest/resources/UsageResourceTest.java         |  2 +-
 .../util/exceptions/UserFacingException.java      | 18 ++++++++++++++++++
 4 files changed, 22 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a882a87b/usage/rest-api/src/test/resources/fixtures/api-error-no-details.json
----------------------------------------------------------------------
diff --git 
a/usage/rest-api/src/test/resources/fixtures/api-error-no-details.json 
b/usage/rest-api/src/test/resources/fixtures/api-error-no-details.json
index 4cd16ca..5762f6f 100644
--- a/usage/rest-api/src/test/resources/fixtures/api-error-no-details.json
+++ b/usage/rest-api/src/test/resources/fixtures/api-error-no-details.json
@@ -1,4 +1,3 @@
 {
-    "message": "explanatory message",
-    "details": ""
+    "message": "explanatory message"
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a882a87b/usage/rest-server/src/main/java/brooklyn/rest/util/DefaultExceptionMapper.java
----------------------------------------------------------------------
diff --git 
a/usage/rest-server/src/main/java/brooklyn/rest/util/DefaultExceptionMapper.java
 
b/usage/rest-server/src/main/java/brooklyn/rest/util/DefaultExceptionMapper.java
index 4a458ce..71bc945 100644
--- 
a/usage/rest-server/src/main/java/brooklyn/rest/util/DefaultExceptionMapper.java
+++ 
b/usage/rest-server/src/main/java/brooklyn/rest/util/DefaultExceptionMapper.java
@@ -88,7 +88,8 @@ public class DefaultExceptionMapper implements 
ExceptionMapper<Throwable> {
 
         if (!Exceptions.isPrefixBoring(throwable)) {
             if ( warnedUnknownExceptions.add( throwable.getClass() )) {
-                LOG.info("No exception mapping for " + throwable.getClass() + 
"; consider adding to "+getClass()+" (future warnings logged at debug)");
+                throwable.printStackTrace();
+                LOG.warn("REST call generated exception type 
"+throwable.getClass()+" unrecognized in "+getClass()+" (subsequent occurrences 
will be logged debug only): " + throwable);
             }
         }
         

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a882a87b/usage/rest-server/src/test/java/brooklyn/rest/resources/UsageResourceTest.java
----------------------------------------------------------------------
diff --git 
a/usage/rest-server/src/test/java/brooklyn/rest/resources/UsageResourceTest.java
 
b/usage/rest-server/src/test/java/brooklyn/rest/resources/UsageResourceTest.java
index 82629da..1cadbcd 100644
--- 
a/usage/rest-server/src/test/java/brooklyn/rest/resources/UsageResourceTest.java
+++ 
b/usage/rest-server/src/test/java/brooklyn/rest/resources/UsageResourceTest.java
@@ -164,7 +164,7 @@ public class UsageResourceTest extends 
BrooklynRestResourceTest {
         assertAppUsage(usage, appId, ImmutableList.of(Status.STARTING, 
Status.RUNNING), roundDown(preStart), postStart);
         
         response = client().resource("/v1/usage/applications/" + appId + 
"?start=9999-01-01T00:00:00+0100").get(ClientResponse.class);
-        assertTrue(response.getStatus() >= 500, "end defaults to NOW, so 
future start should fail");
+        assertTrue(response.getStatus() >= 400, "end defaults to NOW, so 
future start should fail, instead got code "+response.getStatus());
         
         response = client().resource("/v1/usage/applications/" + appId + 
"?start=9999-01-01T00:00:00%2B0100&end=9999-01-02T00:00:00%2B0100").get(ClientResponse.class);
         usage = response.getEntity(new GenericType<UsageStatistics>() {});

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a882a87b/utils/common/src/main/java/brooklyn/util/exceptions/UserFacingException.java
----------------------------------------------------------------------
diff --git 
a/utils/common/src/main/java/brooklyn/util/exceptions/UserFacingException.java 
b/utils/common/src/main/java/brooklyn/util/exceptions/UserFacingException.java
index 1d53d11..b7237ac 100644
--- 
a/utils/common/src/main/java/brooklyn/util/exceptions/UserFacingException.java
+++ 
b/utils/common/src/main/java/brooklyn/util/exceptions/UserFacingException.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 brooklyn.util.exceptions;
 
 /** marker interface, to show that an exception is suitable for 
pretty-printing to an end-user,

Reply via email to