chukwa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asrab...@apache.org
Subject svn commit: r924560 - in /hadoop/chukwa/trunk: CHANGES.txt src/java/org/apache/hadoop/chukwa/datastore/UserStore.java src/java/org/apache/hadoop/chukwa/rest/bean/UserBean.java src/test/org/apache/hadoop/chukwa/rest/resource/TestUserResource.java
Date Wed, 17 Mar 2010 23:56:41 GMT
Author: asrabkin
Date: Wed Mar 17 23:56:41 2010
New Revision: 924560

URL: http://svn.apache.org/viewvc?rev=924560&view=rev
Log:
CHUKWA-457. Fix TestUserResource. Contributed by Eric Yang.

Modified:
    hadoop/chukwa/trunk/CHANGES.txt
    hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datastore/UserStore.java
    hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/rest/bean/UserBean.java
    hadoop/chukwa/trunk/src/test/org/apache/hadoop/chukwa/rest/resource/TestUserResource.java

Modified: hadoop/chukwa/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/CHANGES.txt?rev=924560&r1=924559&r2=924560&view=diff
==============================================================================
--- hadoop/chukwa/trunk/CHANGES.txt (original)
+++ hadoop/chukwa/trunk/CHANGES.txt Wed Mar 17 23:56:41 2010
@@ -64,6 +64,8 @@ Trunk (unreleased changes)
 
   BUG FIXES
 
+    CHUKWA-457. Fix TestUserResource. (Eric Yang via asrabkin)
+
     CHUKWA-463. Fix pattern match for tags. (Guillermo Perez via asrabkin)
     
     CHUKWA-464. Fix spelling of processClusterDirectory. (Guillermo Perez via asrabkin)

Modified: hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datastore/UserStore.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datastore/UserStore.java?rev=924560&r1=924559&r2=924560&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datastore/UserStore.java (original)
+++ hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datastore/UserStore.java Wed Mar
17 23:56:41 2010
@@ -66,7 +66,7 @@ public class UserStore {
         JSONArray ja = new JSONArray();
         profile.setViews(ja);
         JSONObject json = new JSONObject();
-        profile.setProperties(json);
+        profile.setProperties(json.toString());
       }
     } catch (IOException ex) {
       log.error(ExceptionUtil.getStackTrace(ex));

Modified: hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/rest/bean/UserBean.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/rest/bean/UserBean.java?rev=924560&r1=924559&r2=924560&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/rest/bean/UserBean.java (original)
+++ hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/rest/bean/UserBean.java Wed Mar
17 23:56:41 2010
@@ -31,7 +31,11 @@ public class UserBean {
     try {
       id = json.getString("id");
       views = json.getJSONArray("views");
-      properties = json.getJSONObject("properties");
+      if(json.has("properties")) {
+        properties = json.getJSONObject("properties");
+      } else {
+        properties = new JSONObject();
+      }
     } catch (Exception e) {
       log.error(ExceptionUtil.getStackTrace(e));
       throw new ParseException("Error parsing user object.",0);
@@ -72,10 +76,6 @@ public class UserBean {
   public void setViews(JSONArray ja) {
     this.views=ja;
   }
-  
-  public void setProperties(JSONObject properties) {
-    this.properties = properties;
-  }
 
   public void setProperty(String key, String value) throws ParseException {
     try {

Modified: hadoop/chukwa/trunk/src/test/org/apache/hadoop/chukwa/rest/resource/TestUserResource.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/test/org/apache/hadoop/chukwa/rest/resource/TestUserResource.java?rev=924560&r1=924559&r2=924560&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/test/org/apache/hadoop/chukwa/rest/resource/TestUserResource.java
(original)
+++ hadoop/chukwa/trunk/src/test/org/apache/hadoop/chukwa/rest/resource/TestUserResource.java
Wed Mar 17 23:56:41 2010
@@ -17,9 +17,10 @@
  */
 package org.apache.hadoop.chukwa.rest.resource;
 
+import org.json.JSONObject;
+
 import org.apache.hadoop.chukwa.rest.bean.ReturnCodeBean;
 import org.apache.hadoop.chukwa.rest.bean.UserBean;
-import org.apache.hadoop.chukwa.rest.bean.ViewBean;
 import org.apache.hadoop.chukwa.util.ExceptionUtil;
 import org.json.JSONArray;
 



Mime
View raw message