You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by ie...@apache.org on 2008/11/05 00:02:17 UTC

svn commit: r711459 - in /incubator/shindig/trunk/java/social-api/src: main/java/org/apache/shindig/social/core/util/ main/java/org/apache/shindig/social/core/util/xstream/ test/java/org/apache/shindig/social/dataservice/integration/ test/java/org/apac...

Author: ieb
Date: Tue Nov  4 15:02:16 2008
New Revision: 711459

URL: http://svn.apache.org/viewvc?rev=711459&view=rev
Log:
SHINDIG-562

     Created a special hander for DataCollections to ensure correct serialization in both use cases.
     Made all the ResfulXmlData tests work so activated it in the maven build
     Updated the BeanXStreamConverter test in the light of the corrections to the DataCollection conversion.
     No working on the person test.

Added:
    incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/xstream/DataCollectionConverter.java
    incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulXmlDataTest.java
      - copied, changed from r711285, incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulXmlDataDisabled.java
Removed:
    incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulXmlDataDisabled.java
Modified:
    incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanXStreamConverter.java
    incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/xstream/XStream081Configuration.java
    incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/AbstractLargeRestfulTests.java
    incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulXmlActivityTest.java
    incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanXStreamConverterTest.java
    incubator/shindig/trunk/java/social-api/src/test/resources/org/apache/shindig/social/opensocial/util/opensocial.xsd

Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanXStreamConverter.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanXStreamConverter.java?rev=711459&r1=711458&r2=711459&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanXStreamConverter.java (original)
+++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanXStreamConverter.java Tue Nov  4 15:02:16 2008
@@ -33,6 +33,7 @@
 import org.apache.shindig.social.core.util.xstream.WriterStack;
 import org.apache.shindig.social.core.util.xstream.XStreamConfiguration;
 import org.apache.shindig.social.opensocial.service.BeanConverter;
+import org.apache.shindig.social.opensocial.spi.DataCollection;
 import org.apache.shindig.social.opensocial.spi.RestfulCollection;
 
 import org.apache.commons.logging.Log;
@@ -126,6 +127,13 @@
       String result = cc.xstream.toXML(obj);
       log.debug("Result is " + result);
       return result;
+    } else if (obj instanceof DataCollection) {
+      ConverterConfig cc = converterMap
+          .get(XStreamConfiguration.ConverterSet.MAP);
+      cc.mapper.setBaseObject(obj); // thread safe method
+      String result = cc.xstream.toXML(obj);
+      log.debug("Result is " + result);
+      return result;
     }
     ConverterConfig cc = converterMap
         .get(XStreamConfiguration.ConverterSet.DEFAULT);

Added: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/xstream/DataCollectionConverter.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/xstream/DataCollectionConverter.java?rev=711459&view=auto
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/xstream/DataCollectionConverter.java (added)
+++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/xstream/DataCollectionConverter.java Tue Nov  4 15:02:16 2008
@@ -0,0 +1,186 @@
+/*
+ * 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 org.apache.shindig.social.core.util.xstream;
+
+import com.thoughtworks.xstream.converters.MarshallingContext;
+import com.thoughtworks.xstream.converters.UnmarshallingContext;
+import com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter;
+import com.thoughtworks.xstream.io.HierarchicalStreamReader;
+import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
+import com.thoughtworks.xstream.mapper.Mapper;
+
+import org.apache.shindig.social.opensocial.spi.DataCollection;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ * This converter changes the way in which a collection is serialized
+ * 
+ */
+public class DataCollectionConverter extends AbstractCollectionConverter {
+
+  /**
+   * @param mapper
+   */
+  public DataCollectionConverter(Mapper mapper) {
+    super(mapper);
+  }
+
+  /**
+   * {@inheritDoc}
+   * 
+   * @see com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter#canConvert(java.lang.Class)
+   */
+  @Override
+  public boolean canConvert(Class clazz) {
+    boolean convert = (DataCollection.class.isAssignableFrom(clazz));
+    return convert;
+  }
+
+  /**
+   * {@inheritDoc}
+   * 
+   * @see com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter#marshal(java.lang.Object,
+   *      com.thoughtworks.xstream.io.HierarchicalStreamWriter,
+   *      com.thoughtworks.xstream.converters.MarshallingContext)
+   */
+  @Override
+  public void marshal(Object source, HierarchicalStreamWriter writer,
+      MarshallingContext context) {
+
+    DataCollection collection = (DataCollection) source;
+    Map<String, Map<String, String>> internalMap = collection.getEntry();
+
+    if (false) {
+      Map<String, String> m = internalMap.values().iterator().next();
+      for (Entry<String, String> e : m.entrySet()) {
+        writer.startNode("entry");
+        writer.startNode("key");
+        writer.setValue(e.getKey());
+        writer.endNode();
+        writer.startNode("value");
+        writer.setValue(e.getValue());
+        writer.endNode();
+        writer.endNode();
+      }
+    } else {
+      for (Entry<String, Map<String, String>> eo : internalMap.entrySet()) {
+        writer.startNode("entry");
+        writer.startNode("key");
+        writer.setValue(eo.getKey());
+        writer.endNode();
+        writer.startNode("value");
+        for (Entry<String, String> ei : eo.getValue().entrySet()) {
+          writer.startNode("entry");
+          writer.startNode("key");
+          writer.setValue(ei.getKey());
+          writer.endNode();
+          writer.startNode("value");
+          writer.setValue(ei.getValue());
+          writer.endNode();
+          writer.endNode();
+        }
+
+        writer.endNode();
+        writer.endNode();
+      }
+    }
+  }
+
+  /**
+   * {@inheritDoc}
+   * 
+   * @see com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter#unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader,
+   *      com.thoughtworks.xstream.converters.UnmarshallingContext)
+   */
+  @SuppressWarnings("unchecked")
+  @Override
+  public Object unmarshal(HierarchicalStreamReader reader,
+      UnmarshallingContext context) {
+    reader.moveDown();
+    Map<String, Object> m = new HashMap<String, Object>();
+    while (reader.hasMoreChildren()) {
+      reader.moveDown(); // entry
+      String ok = null;
+      Object ov = null;
+      while (reader.hasMoreChildren()) {
+        reader.moveDown(); // key or value
+        String elname = reader.getNodeName();
+        if ("key".equals(elname)) {
+          ok = reader.getValue();
+        } else if ("value".equals(elname)) {
+          ov = reader.getValue();
+          if (reader.hasMoreChildren()) {
+            Map<String, String> innerMap = new HashMap<String, String>();
+            while (reader.hasMoreChildren()) {
+              reader.moveDown();// entry
+              String k = null;
+              String v = null;
+              while (reader.hasMoreChildren()) {
+                reader.moveDown(); // key or value
+                if ("key".equals(elname)) {
+                  k = reader.getValue();
+                } else if ("value".equals(elname)) {
+                  v = reader.getValue();
+                }
+                reader.moveUp();
+              }
+              innerMap.put(k, v);
+              reader.moveUp();
+            }
+            ov = innerMap;
+          } else {
+          }
+        }
+        reader.moveUp();
+      }
+      reader.moveUp();
+      m.put(ok, ov);
+    }
+    reader.moveUp();
+    // scan the map, if there are any maps, then everything should be in maps.
+    boolean nonmap = false;
+    for (Entry<String, Object> e : m.entrySet()) {
+      if (e.getValue() instanceof String) {
+        nonmap = true;
+      }
+    }
+    Map<String, Map<String, String>> fm = new HashMap<String, Map<String, String>>();
+    if (nonmap) {
+      for (Entry<String, Object> e : m.entrySet()) {
+        if (e.getValue() instanceof Map) {
+          fm.put(e.getKey(), (Map<String, String>) e.getValue());
+        } else {
+          // not certain that this makes sense, but can't see how else.
+          Map<String, String> mv = new HashMap<String, String>();
+          mv.put(e.getKey(), (String) e.getValue());
+          fm.put(e.getKey(), mv);
+        }
+      }
+
+    } else {
+      for (Entry<String, Object> e : m.entrySet()) {
+        fm.put(e.getKey(), (Map<String, String>) e.getValue());
+      }
+    }
+    return new DataCollection(fm);
+  }
+
+}

Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/xstream/XStream081Configuration.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/xstream/XStream081Configuration.java?rev=711459&r1=711458&r2=711459&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/xstream/XStream081Configuration.java (original)
+++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/xstream/XStream081Configuration.java Tue Nov  4 15:02:16 2008
@@ -34,6 +34,7 @@
 import org.apache.shindig.social.opensocial.model.Organization;
 import org.apache.shindig.social.opensocial.model.Person;
 import org.apache.shindig.social.opensocial.model.Url;
+import org.apache.shindig.social.opensocial.spi.DataCollection;
 import org.apache.shindig.social.opensocial.spi.RestfulCollection;
 
 import java.util.ArrayList;
@@ -105,6 +106,8 @@
 
     defaultElementMappingList.add(new ClassFieldMapping("response",
         RestfulCollection.class));
+    defaultElementMappingList.add(new ClassFieldMapping("appdata",
+        DataCollection.class));
     defaultElementMappingList.add(new ClassFieldMapping("list", List.class));
     defaultElementMappingList.add(new ClassFieldMapping("map", Map.class));
 
@@ -171,7 +174,7 @@
     defaultElementClassMap.put("phone", ListField.class);
     defaultElementClassMap.put("list", ArrayList.class);
     defaultElementClassMap.put("map", ConcurrentHashMap.class);
-    defaultElementClassMap.put("appdata", ConcurrentHashMap.class);
+    defaultElementClassMap.put("appdata", DataCollection.class);
     defaultElementClassMap.put("activity", Activity.class);
     defaultElementClassMap.put("account", Account.class);
     defaultElementClassMap.put("address", Address.class);
@@ -281,7 +284,8 @@
 
   private Converter[] getConverters(Mapper mapper, ConverterSet c) {
     return new Converter[] { new MapConverter(mapper),
-        new RestfullCollectionConverter(mapper) };
+        new RestfullCollectionConverter(mapper),
+        new DataCollectionConverter(mapper)};
   }
 
   /**

Modified: incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/AbstractLargeRestfulTests.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/AbstractLargeRestfulTests.java?rev=711459&r1=711458&r2=711459&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/AbstractLargeRestfulTests.java (original)
+++ incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/AbstractLargeRestfulTests.java Tue Nov  4 15:02:16 2008
@@ -70,50 +70,59 @@
   @Override
   protected void setUp() throws Exception {
     Injector injector = Guice.createInjector(new SocialApiTestsGuiceModule());
-    
+
     servlet = new DataServiceServlet();
 
     servlet.setHandlerDispatcher(injector.getInstance(HandlerDispatcher.class));
-    servlet.setBeanConverters(new BeanJsonConverter(injector), new BeanXStreamConverter(new XStream081Configuration()),
+    servlet.setBeanConverters(new BeanJsonConverter(injector),
+        new BeanXStreamConverter(new XStream081Configuration()),
         new BeanXStreamAtomConverter(new XStream081Configuration()));
 
     req = EasyMock.createMock(HttpServletRequest.class);
     res = EasyMock.createMock(HttpServletResponse.class);
   }
 
-  protected String getResponse(String path, String method, String format, String contentType) throws Exception {
-    return getResponse(path, method, Maps.<String, String>newHashMap(), "", format, contentType);
+  protected String getResponse(String path, String method, String format,
+      String contentType) throws Exception {
+    return getResponse(path, method, Maps.<String, String> newHashMap(), "",
+        format, contentType);
   }
 
   protected String getResponse(String path, String method,
-      Map<String, String> extraParams, String format, String contentType) throws Exception {
+      Map<String, String> extraParams, String format, String contentType)
+      throws Exception {
     return getResponse(path, method, extraParams, "", format, contentType);
   }
 
-  protected String getResponse(String path, String method, String postData, String format, String contentType) throws Exception {
-    return getResponse(path, method, Maps.<String, String>newHashMap(), postData, format, contentType);
+  protected String getResponse(String path, String method, String postData,
+      String format, String contentType) throws Exception {
+    return getResponse(path, method, Maps.<String, String> newHashMap(),
+        postData, format, contentType);
   }
 
-  protected String getResponse(String path, String method, Map<String, String> extraParams,
-      String postData, String format, String contentType) throws Exception {
+  protected String getResponse(String path, String method,
+      Map<String, String> extraParams, String postData, String format,
+      String contentType) throws Exception {
     EasyMock.expect(req.getCharacterEncoding()).andStubReturn("UTF-8");
     EasyMock.expect(req.getPathInfo()).andStubReturn(path);
     EasyMock.expect(req.getMethod()).andStubReturn(method);
     EasyMock.expect(req.getParameter("format")).andStubReturn(format);
-    EasyMock.expect(req.getParameter("X-HTTP-Method-Override")).andStubReturn(method);
+    EasyMock.expect(req.getParameter("X-HTTP-Method-Override")).andStubReturn(
+        method);
 
-    EasyMock.expect(req.getAttribute(EasyMock.isA(String.class))).andReturn(FAKE_GADGET_TOKEN);
+    EasyMock.expect(req.getAttribute(EasyMock.isA(String.class))).andReturn(
+        FAKE_GADGET_TOKEN);
 
     Vector<String> vector = new Vector<String>(extraParams.keySet());
     EasyMock.expect(req.getParameterNames()).andStubReturn(vector.elements());
 
     for (Map.Entry<String, String> entry : extraParams.entrySet()) {
       if (entry.getValue() != null) {
-        EasyMock.expect(req.getParameterValues(entry.getKey()))
-            .andStubReturn(new String[]{entry.getValue()});
+        EasyMock.expect(req.getParameterValues(entry.getKey())).andStubReturn(
+            new String[] { entry.getValue() });
       } else {
-        EasyMock.expect(req.getParameterValues(entry.getKey()))
-            .andStubReturn(new String[]{});
+        EasyMock.expect(req.getParameterValues(entry.getKey())).andStubReturn(
+            new String[] {});
       }
     }
 
@@ -123,7 +132,8 @@
 
     final InputStream stream = new ByteArrayInputStream(postData.getBytes());
     ServletInputStream servletStream = new ServletInputStream() {
-      @Override public int read() throws IOException {
+      @Override
+      public int read() throws IOException {
         return stream.read();
       }
     };
@@ -150,11 +160,12 @@
 
   /**
    * parse entry.content xml into a Map<> struct
-   *
-   * @param str input content string
+   * 
+   * @param str
+   *          input content string
    * @return the map<> of <name, value> pairs from the content xml
    * @throws javax.xml.stream.XMLStreamException
-   *          If the str is not valid xml
+   *           If the str is not valid xml
    */
   protected Map<String, String> parseXmlContent(String str)
       throws XMLStreamException {
@@ -175,17 +186,19 @@
           String value = parser.getText();
           columns.put(name, value);
         }
-      } 
+      }
     }
     return columns;
   }
-  
+
   /**
    * Converts a node which child nodes into a map keyed on element names
    * containing the text inside each child node.
-   *
-   * @param n the node to convert.
-   * @return a map keyed on element name, containing the contents of each element.
+   * 
+   * @param n
+   *          the node to convert.
+   * @return a map keyed on element name, containing the contents of each
+   *         element.
    */
   protected Map<String, List<String>> childNodesToMap(Node n) {
     Map<String, List<String>> v = new HashMap<String, List<String>>();
@@ -194,60 +207,57 @@
       Node nv = result.item(i);
       if (nv.getNodeType() == Node.ELEMENT_NODE) {
         List<String> l = v.get(nv.getLocalName());
-        if ( l == null ) {
+        if (l == null) {
           l = new ArrayList<String>();
-          v.put(nv.getLocalName(),l);
+          v.put(nv.getLocalName(), l);
         }
         l.add(nv.getTextContent());
       }
     }
     return v;
   }
-  
-  
+
   /**
-   * Converts 
-   * <entry>
-   *    <key>k</key>
-   *    <value>
-   *       <entry>
-   *         <key>count</key>
-   *         <value>val</value>
-   *       </entry>
-   *       <entry>
-   *         <key>lastUpdate</key>
-   *         <value>val</value>
-   *       </entry>
-   *    </value>
-   * </entry>
+   * Converts <entry> <key>k</key> <value> <entry> <key>count</key>
+   * <value>val</value> </entry> <entry> <key>lastUpdate</key>
+   * <value>val</value> </entry> </value> </entry>
+   * 
+   * To map.get("k").get("count")
    * 
-   * To map.get("k").get("count") 
    * @param result
    * @return
    */
-  protected Map<String, Map<String, List<String>>> childNodesToMapofMap(NodeList result) {
+  protected Map<String, Map<String, List<String>>> childNodesToMapofMap(
+      NodeList result) {
     Map<String, Map<String, List<String>>> v = new HashMap<String, Map<String, List<String>>>();
-    for ( int i = 0; i < 3; i++ ) {
-      Node entry = result.item(i);
-      NodeList keyValue = entry.getChildNodes();
-      assertEquals(2, keyValue.getLength());
-      Node key = keyValue.item(0);
-      Node value = keyValue.item(1);
-      if ( "key".equals(keyValue.item(1).getNodeName()) ) {
-        key = value;
-        value = keyValue.item(0);
-      }      
-      NodeList entries = value.getChildNodes();
-      for ( int j = 0; j < entries.getLength(); j++) {
-        Map<String, List<String>> ve = childNodesToMap(entries.item(j));
-        assertTrue(ve.containsKey("key"));
-        v.put(key.getTextContent(), ve);
+    for (int i = 0; i < result.getLength(); i++) {
+      Map<String, List<Node>> keyValue = childNodesToNodeMap(result.item(i));
+
+      assertEquals(2, keyValue.size());
+      assertTrue(keyValue.containsKey("key"));
+      assertTrue(keyValue.containsKey("value"));
+      Node valueNode = keyValue.get("value").get(0);
+      Node key = keyValue.get("key").get(0);
+      NodeList entryList = valueNode.getChildNodes();
+      Map<String, List<String>> pv = new HashMap<String, List<String>>();
+      v.put(key.getTextContent(), pv);
+      for (int j = 0; j < entryList.getLength(); j++) {
+        Node n = entryList.item(j);
+        if ("entry".equals(n.getNodeName())) {
+          Map<String, List<String>> ve = childNodesToMap(entryList.item(j));
+          assertTrue(ve.containsKey("key"));
+          List<String> l = pv.get(ve.get("key").get(0));
+          if ( l == null ) {
+            l = new ArrayList<String>();
+            pv.put(ve.get("key").get(0), l);
+          }
+          l.add(ve.get("value").get(0));
+        }
       }
     }
     return v;
   }
-  
-  
+
   /**
    * @param personNode
    * @return
@@ -259,9 +269,9 @@
       Node nv = result.item(i);
       if (nv.getNodeType() == Node.ELEMENT_NODE) {
         List<Node> l = v.get(nv.getLocalName());
-        if ( l == null ) {
+        if (l == null) {
           l = new ArrayList<Node>();
-          v.put(nv.getLocalName(),l);
+          v.put(nv.getLocalName(), l);
         }
         l.add(nv);
       }
@@ -269,5 +279,4 @@
     return v;
   }
 
-
 }

Modified: incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulXmlActivityTest.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulXmlActivityTest.java?rev=711459&r1=711458&r2=711459&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulXmlActivityTest.java (original)
+++ incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulXmlActivityTest.java Tue Nov  4 15:02:16 2008
@@ -70,7 +70,6 @@
   public void testGetActivityJson() throws Exception {
     String resp = getResponse("/activities/john.doe/@self/@app/1", "GET",
         "xml", "application/xml");
-    System.err.println("Got:\n" + resp);
 
     InputSource source = new InputSource(new StringReader(resp));
     XPath xp = xpathFactory.newXPath();
@@ -129,7 +128,6 @@
   public void testGetActivitiesJson() throws Exception {
     String resp = getResponse("/activities/john.doe/@self", "GET", "xml",
         "application/xml");
-    System.err.println("Got testGetActivitiesJson:\n" + resp);
     XPath xp = xpathFactory.newXPath();
     assertEquals("0", xp.evaluate("/response/startIndex", new InputSource(
         new StringReader(resp))));
@@ -189,8 +187,7 @@
   public void testGetFriendsActivitiesJson() throws Exception {
     String resp = getResponse("/activities/john.doe/@friends", "GET", "xml",
         "application/xml");
-    System.err.println("Got:\n" + resp);
-
+ 
     XPath xp = xpathFactory.newXPath();
     assertEquals("0", xp.evaluate("/response/startIndex", new InputSource(
         new StringReader(resp))));
@@ -215,11 +212,9 @@
     String postData = XSDValidator.XMLDEC+"<activity><body>and dad.</body><title>hi mom!</title></activity>";
     String createResponse = getResponse("/activities/john.doe/@self", "POST",
         postData, "xml", "application/xml");
-    System.err.println("Got testCreateActivity1 " + createResponse);
 
     String resp = getResponse("/activities/john.doe/@self", "GET", "xml",
         "application/xml");
-    System.err.println("Got testCreateActivity2 " + resp);
 
     XPath xp = xpathFactory.newXPath();
     assertEquals("0", xp.evaluate("/response/startIndex", new InputSource(

Copied: incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulXmlDataTest.java (from r711285, incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulXmlDataDisabled.java)
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulXmlDataTest.java?p2=incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulXmlDataTest.java&p1=incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulXmlDataDisabled.java&r1=711285&r2=711459&rev=711459&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulXmlDataDisabled.java (original)
+++ incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulXmlDataTest.java Tue Nov  4 15:02:16 2008
@@ -19,6 +19,8 @@
 
 import com.google.common.collect.Maps;
 
+import org.apache.shindig.social.opensocial.util.XSDValidator;
+
 import org.junit.Test;
 import org.w3c.dom.NodeList;
 import org.xml.sax.InputSource;
@@ -31,7 +33,7 @@
 import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathFactory;
 
-public class RestfulXmlDataDisabled extends AbstractLargeRestfulTests {
+public class RestfulXmlDataTest extends AbstractLargeRestfulTests {
 
   private XPathFactory xpathFactory;
 
@@ -63,8 +65,6 @@
     String resp = getResponse("/appdata/john.doe/@friends/app", "GET",
         extraParams, "xml", "application/xml");
     
-    System.err.println("Got Response \n"+resp);
-
     XPath xp = xpathFactory.newXPath();
     NodeList result = (NodeList) xp.evaluate("/appdata/entry", new InputSource(
         new StringReader(resp)), XPathConstants.NODESET);
@@ -76,7 +76,7 @@
     assertTrue(v.containsKey("jane.doe"));
     assertTrue(v.containsKey("george.doe"));
     assertTrue(v.containsKey("maija.m"));
-
+    
     assertEquals(1, v.get("jane.doe").size());
     assertEquals(1, v.get("george.doe").size());
     assertEquals(0, v.get("maija.m").size());
@@ -102,8 +102,6 @@
     String resp = getResponse("/appdata/john.doe/@self/app", "GET",
         extraParams, "xml", "application/xml");
 
-    System.err.println("Got Response \n"+resp);
-
     XPath xp = xpathFactory.newXPath();
     NodeList result = (NodeList) xp.evaluate("/appdata/entry", new InputSource(
         new StringReader(resp)), XPathConstants.NODESET);
@@ -135,7 +133,6 @@
     String resp = getResponse("/appdata/john.doe/@self/app", "GET",
         extraParams, "xml", "application/xml");
 
-    System.err.println("Got Response \n"+resp);
 
     XPath xp = xpathFactory.newXPath();
     NodeList result = (NodeList) xp.evaluate("/appdata/entry", new InputSource(
@@ -168,7 +165,6 @@
     String resp = getResponse("/appdata/john.doe/@self/app", "GET",
         extraParams, "xml", "application/xml");
 
-    System.err.println("Got Response \n"+resp);
 
     XPath xp = xpathFactory.newXPath();
     NodeList result = (NodeList) xp.evaluate("/appdata/entry", new InputSource(
@@ -192,8 +188,6 @@
     String resp = getResponse("/appdata/john.doe/@self/app", "DELETE", extraParams, "xml",
         "application/xml");
 
-    System.err.println("Got Response \n"+resp);
-
     assertCount("0");
 
     // should be xml ?
@@ -211,11 +205,10 @@
     Map<String, String> extraParams = Maps.newHashMap();
     extraParams.put("fields", "count");
     // should be xml ?
-    String postData = "{count : 5}";
+    String postData = XSDValidator.XMLDEC+"<map><entry><key>count</key><value>5</value></entry></map>";
     String resp = getResponse("/appdata/john.doe/@self/app", "POST", extraParams, postData,
         "xml", "application/xml");
     
-    System.err.println("Got Response \n"+resp);
 
     assertCount("5");
   }
@@ -224,7 +217,6 @@
     String resp = getResponse("/appdata/john.doe/@self/app", "GET", "xml",
         "application/xml");
     
-    System.err.println("Got Response \n"+resp);
 
 
     XPath xp = xpathFactory.newXPath();

Modified: incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanXStreamConverterTest.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanXStreamConverterTest.java?rev=711459&r1=711458&r2=711459&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanXStreamConverterTest.java (original)
+++ incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanXStreamConverterTest.java Tue Nov  4 15:02:16 2008
@@ -32,6 +32,7 @@
 import org.apache.shindig.social.opensocial.model.ListField;
 import org.apache.shindig.social.opensocial.model.MediaItem;
 import org.apache.shindig.social.opensocial.model.Person;
+import org.apache.shindig.social.opensocial.spi.DataCollection;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;

Modified: incubator/shindig/trunk/java/social-api/src/test/resources/org/apache/shindig/social/opensocial/util/opensocial.xsd
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/resources/org/apache/shindig/social/opensocial/util/opensocial.xsd?rev=711459&r1=711458&r2=711459&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/test/resources/org/apache/shindig/social/opensocial/util/opensocial.xsd (original)
+++ incubator/shindig/trunk/java/social-api/src/test/resources/org/apache/shindig/social/opensocial/util/opensocial.xsd Tue Nov  4 15:02:16 2008
@@ -16,9 +16,9 @@
   
   <xs:complexType name="Response">
     <xs:choice>
+      <xs:element name="group" type="tns:GroupCollection" />
       <xs:element name="activity" type="tns:ActivityCollection" />
       <xs:element name="person" type="tns:PersonCollection" />
-      <xs:element name="group" type="tns:GroupCollection" />
     </xs:choice>
   </xs:complexType>