geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hiteshkhame...@apache.org
Subject [05/29] geode git commit: GEODE-2294: revert to avoid rest protocol change
Date Mon, 19 Jun 2017 22:17:49 GMT
GEODE-2294: revert to avoid rest protocol change


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

Branch: refs/heads/feature/GEODE-2804
Commit: c3756ff6518ce9c9ae04333d0d1985510b490fb3
Parents: 2205cf3
Author: Jinmei Liao <jiliao@pivotal.io>
Authored: Tue Jun 13 10:28:08 2017 -0700
Committer: Hitesh Khamesra <hkhamesra@pivotal.io>
Committed: Mon Jun 19 13:47:55 2017 -0700

----------------------------------------------------------------------
 .../web/controllers/AbstractBaseController.java | 62 ++++++++++----------
 .../AbstractBaseControllerJUnitTest.java        | 24 +++++---
 2 files changed, 45 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/c3756ff6/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/AbstractBaseController.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/AbstractBaseController.java
b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/AbstractBaseController.java
index d8eb572..00623c3 100644
--- a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/AbstractBaseController.java
+++ b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/AbstractBaseController.java
@@ -14,41 +14,10 @@
  */
 package org.apache.geode.rest.internal.web.controllers;
 
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URLDecoder;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicLong;
-
-import javax.annotation.PostConstruct;
-
 import com.fasterxml.jackson.core.JsonParseException;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.JsonMappingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.logging.log4j.Logger;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.json.JSONTokener;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.util.Assert;
-import org.springframework.util.ClassUtils;
-import org.springframework.util.CollectionUtils;
-import org.springframework.util.StringUtils;
-import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
-
 import org.apache.geode.SerializationException;
 import org.apache.geode.cache.CacheLoaderException;
 import org.apache.geode.cache.CacheWriterException;
@@ -81,6 +50,35 @@ import org.apache.geode.rest.internal.web.util.IdentifiableUtils;
 import org.apache.geode.rest.internal.web.util.JSONUtils;
 import org.apache.geode.rest.internal.web.util.NumberUtils;
 import org.apache.geode.rest.internal.web.util.ValidationUtils;
+import org.apache.logging.log4j.Logger;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.json.JSONTokener;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.util.Assert;
+import org.springframework.util.ClassUtils;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicLong;
+import javax.annotation.PostConstruct;
 
 /**
  * AbstractBaseController class contains common functionalities required for other controllers.
@@ -722,7 +720,7 @@ public abstract class AbstractBaseController {
   }
 
   String convertErrorAsJson(String errorMessage) {
-    return ("{" + "\"message\"" + ":" + "\"" + errorMessage + "\"" + "}");
+    return ("{" + "\"cause\"" + ":" + "\"" + errorMessage + "\"" + "}");
   }
 
   String convertErrorAsJson(Throwable t) {

http://git-wip-us.apache.org/repos/asf/geode/blob/c3756ff6/geode-web-api/src/test/java/org/apache/geode/rest/internal/web/controllers/AbstractBaseControllerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/test/java/org/apache/geode/rest/internal/web/controllers/AbstractBaseControllerJUnitTest.java
b/geode-web-api/src/test/java/org/apache/geode/rest/internal/web/controllers/AbstractBaseControllerJUnitTest.java
index 7ebfbcf..7206ed3 100644
--- a/geode-web-api/src/test/java/org/apache/geode/rest/internal/web/controllers/AbstractBaseControllerJUnitTest.java
+++ b/geode-web-api/src/test/java/org/apache/geode/rest/internal/web/controllers/AbstractBaseControllerJUnitTest.java
@@ -40,11 +40,11 @@ public class AbstractBaseControllerJUnitTest {
    * Method: convertErrorAsJson(String errorMessage)
    */
   @Test
-  public void testConvertErrorAsJsonErrorMessage() throws Exception {
+  public void testConvertErrorAsJsonErrorCause() throws Exception {
     String message = "This is an error message";
     String json = abstractBaseController.convertErrorAsJson(message);
-    ErrorMessage errorMessage = mapper.readValue(json, ErrorMessage.class);
-    assertEquals(message, errorMessage.message);
+    ErrorCause errorCause = mapper.readValue(json, ErrorCause.class);
+    assertEquals(message, errorCause.cause);
   }
 
   /**
@@ -62,12 +62,6 @@ public class AbstractBaseControllerJUnitTest {
   public static class ErrorMessage {
     private String message;
 
-    public ErrorMessage() {}
-
-    public ErrorMessage(String message) {
-      this.message = message;
-    }
-
     public String getMessage() {
       return message;
     }
@@ -77,4 +71,16 @@ public class AbstractBaseControllerJUnitTest {
     }
   }
 
+  public static class ErrorCause {
+    private String cause;
+
+    public String getCause() {
+      return cause;
+    }
+
+    public void setCause(final String cause) {
+      this.cause = cause;
+    }
+  }
+
 }


Mime
View raw message