Package org.apache.shindig.protocol

Examples of org.apache.shindig.protocol.DataCollection


  }

  @Test
  public void getJohnDoeApplicationData() throws Exception {
    Future<DataCollection> results = this.appDataServiceDb.getPersonData(SpiTestUtil.buildUserIds("john.doe"), new GroupId(GroupId.Type.self, "@self"), DEFAULT_APPLICATION_ID, null, SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
    DataCollection data = results.get();
    assertEquals(1, data.getEntry().size());
    assertEquals("0", data.getEntry().get("john.doe").get("count"));
  }
View Full Code Here


  }

  @Test
  public void getJohnDoeApplicationDataWithCountField() throws Exception {
    Future<DataCollection> results = this.appDataServiceDb.getPersonData(SpiTestUtil.buildUserIds("john.doe"), new GroupId(GroupId.Type.self, "@self"), DEFAULT_APPLICATION_ID, SpiTestUtil.asSet("count"), SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
    DataCollection data = results.get();
    assertEquals(1, data.getEntry().size());
    assertEquals("0", data.getEntry().get("john.doe").get("count"));
  }
View Full Code Here

  }

  @Test
  public void getJohnDoeApplicationDataWithInvalidField() throws Exception {
    Future<DataCollection> results = this.appDataServiceDb.getPersonData(SpiTestUtil.buildUserIds("john.doe"), new GroupId(GroupId.Type.self, "@self"), DEFAULT_APPLICATION_ID, SpiTestUtil.asSet("peabody"), SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
    DataCollection data = results.get();
    assertEquals(1, data.getEntry().size());
    assertEquals(null, data.getEntry().get("john.doe").get("count"));
  }
View Full Code Here

  }

  @Test
  public void getJohnDoeFriendsApplicationDataWithCountField() throws Exception {
    Future<DataCollection> results = this.appDataServiceDb.getPersonData(SpiTestUtil.buildUserIds("john.doe"), new GroupId(GroupId.Type.friends, "@friends"), DEFAULT_APPLICATION_ID, SpiTestUtil.asSet("count"), SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
    DataCollection data = results.get();
    assertEquals(3, data.getEntry().size());
    assertEquals("7", data.getEntry().get("jane.doe").get("count"));
    assertEquals("2", data.getEntry().get("george.doe").get("count"));
  }
View Full Code Here

    values.put("count", "5");
    this.appDataServiceDb.updatePersonData(new UserId(Type.userId, "john.doe"), new GroupId(GroupId.Type.self, "@self"), DEFAULT_APPLICATION_ID, SpiTestUtil.asSet("count"), values, SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);

    // Verify that update succeeded
    Future<DataCollection> results = this.appDataServiceDb.getPersonData(SpiTestUtil.buildUserIds("john.doe"), new GroupId(GroupId.Type.self, "@self"), DEFAULT_APPLICATION_ID, null, SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
    DataCollection data = results.get();
    assertEquals(1, data.getEntry().size());
    assertEquals("5", data.getEntry().get("john.doe").get("count"));
  }
View Full Code Here

  public void deleteJohnDoeApplicationDataWithCountField() throws Exception {
    // Do delete
    this.appDataServiceDb.deletePersonData(new UserId(Type.userId, "john.doe"), new GroupId(GroupId.Type.self, "@self"), DEFAULT_APPLICATION_ID, SpiTestUtil.asSet("count"), SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
    // Verify that delete succeeded
    Future<DataCollection> results = this.appDataServiceDb.getPersonData(SpiTestUtil.buildUserIds("john.doe"), new GroupId(GroupId.Type.self, "@self"), DEFAULT_APPLICATION_ID, SpiTestUtil.asSet("count"), SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
    DataCollection data = results.get();
    assertEquals(1, data.getEntry().size());
    assertEquals(null, data.getEntry().get("john.doe").get("count"));
  }
View Full Code Here

  public void deleteJohnDoeApplicationDataWithInvalidField() throws Exception {
    // Do delete with invalid field
    this.appDataServiceDb.deletePersonData(new UserId(Type.userId, "john.doe"), new GroupId(GroupId.Type.self, "@self"), DEFAULT_APPLICATION_ID, SpiTestUtil.asSet("peabody"), SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
    // Verify that delete did not occur
    Future<DataCollection> results = this.appDataServiceDb.getPersonData(SpiTestUtil.buildUserIds("john.doe"), new GroupId(GroupId.Type.self, "@self"), DEFAULT_APPLICATION_ID, SpiTestUtil.asSet("count"), SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
    DataCollection data = results.get();
    assertEquals(1, data.getEntry().size());
    assertEquals("0", data.getEntry().get("john.doe").get("count"));
  }
View Full Code Here

   *      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();

    for (Entry<String, Map<String, String>> eo : internalMap.entrySet()) {
      writer.startNode("entry");
      writer.startNode("key");
      writer.setValue(eo.getKey());
View Full Code Here

    } else {
      for (Entry<String, Object> e : m.entrySet()) {
        fm.put(e.getKey(), (Map<String, String>) e.getValue());
      }
    }
    return new DataCollection(fm);
  }
View Full Code Here

          String key = keys.next();
          data.put(key, personData.getString(key));
        }
        idToData.put(id, data);
      }
      return ImmediateFuture.newInstance(new DataCollection(idToData));
    } catch (JSONException je) {
      throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
          je);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.shindig.protocol.DataCollection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.