Package org.apache.shindig.protocol

Examples of org.apache.shindig.protocol.DataCollection


          }
        }
        results.put(adm.getPersonId(), m);
      }
    }
    DataCollection dc = new DataCollection(results);
    return ImmediateFuture.newInstance(dc);
  }
View Full Code Here


  private void assertHandleGetForGroup(GroupId.Type group) throws Exception {
    String path = "/appdata/john.doe/@" + group.toString() + "/appId";
    RestHandler operation = registry.getRestHandler(path, "GET");

    DataCollection data = new DataCollection(null);
    org.easymock.EasyMock.expect(appDataService.getPersonData(eq(JOHN_DOE),
        eq(new GroupId(group, null)),
        eq("appId"), eq(ImmutableSet.<String>of()), eq(token)))
        .andReturn(ImmediateFuture.newInstance(data));
View Full Code Here

  @Test
  public void testHandleGetPlural() throws Exception {
    String path = "/appdata/john.doe,jane.doe/@self/appId";
    RestHandler operation = registry.getRestHandler(path, "GET");

    DataCollection data = new DataCollection(null);
    Set<UserId> userIdSet = Sets.newLinkedHashSet(JOHN_DOE);
    userIdSet.add(new UserId(UserId.Type.userId, "jane.doe"));
    org.easymock.EasyMock.expect(appDataService.getPersonData(eq(userIdSet),
        eq(new GroupId(GroupId.Type.self, null)),
        eq("appId"), eq(ImmutableSet.<String>of()), eq(token)))
View Full Code Here

    RestHandler operation = registry.getRestHandler(path, "GET");

    Map<String, String[]> params = Maps.newHashMap();
    params.put("fields", new String[]{"pandas"});

    DataCollection data = new DataCollection(null);
    org.easymock.EasyMock.expect(appDataService.getPersonData(eq(JOHN_DOE),
        eq(new GroupId(GroupId.Type.friends, null)),
        eq("appId"), eq(ImmutableSet.of("pandas")), eq(token)))
        .andReturn(ImmediateFuture.newInstance(data));
View Full Code Here

    }
  }

  @Test
  public void testGetExpectedAppData() throws Exception {
    DataCollection responseItem = db.getPersonData(
        ImmutableSet.of(CANON_USER), SELF_GROUP, APP_ID, Collections.<String>emptySet(),
        new FakeGadgetToken()).get();
    assertFalse(responseItem.getEntry().isEmpty());
    assertFalse(responseItem.getEntry().get(CANONICAL_USER_ID).isEmpty());

    assertSame(2, responseItem.getEntry().get(CANONICAL_USER_ID).size());
    assertTrue(responseItem.getEntry().get(CANONICAL_USER_ID).containsKey("count"));
    assertTrue(responseItem.getEntry().get(CANONICAL_USER_ID).containsKey("size"));
  }
View Full Code Here

    assertTrue(responseItem.getEntry().get(CANONICAL_USER_ID).containsKey("size"));
  }

  @Test
  public void testGetExpectedAppDataForPlural() throws Exception {
    DataCollection responseItem = db.getPersonData(
        ImmutableSet.of(CANON_USER, JOHN_DOE), SELF_GROUP, APP_ID, Collections.<String>emptySet(),
        new FakeGadgetToken()).get();
    assertFalse(responseItem.getEntry().isEmpty());
    assertFalse(responseItem.getEntry().get(CANONICAL_USER_ID).isEmpty());

    assertSame(2, responseItem.getEntry().get(CANONICAL_USER_ID).size());
    assertTrue(responseItem.getEntry().get(CANONICAL_USER_ID).containsKey("count"));
    assertTrue(responseItem.getEntry().get(CANONICAL_USER_ID).containsKey("size"));

    assertFalse(responseItem.getEntry().get(JOHN_DOE.getUserId()).isEmpty());
    assertSame(1, responseItem.getEntry().get(JOHN_DOE.getUserId()).size());
    assertTrue(responseItem.getEntry().get(JOHN_DOE.getUserId()).containsKey("count"));
  }
View Full Code Here

    // Delete the data
    db.deletePersonData(CANON_USER, SELF_GROUP, APP_ID,
        ImmutableSet.of("count"), new FakeGadgetToken());

    // Fetch the remaining and test
    DataCollection responseItem = db.getPersonData(
        ImmutableSet.of(CANON_USER), SELF_GROUP, APP_ID, Collections.<String>emptySet(),
        new FakeGadgetToken()).get();
    assertFalse(responseItem.getEntry().isEmpty());
    assertFalse(responseItem.getEntry().get(CANONICAL_USER_ID).isEmpty());

    assertSame(1, responseItem.getEntry().get(CANONICAL_USER_ID).size());
    assertFalse(responseItem.getEntry().get(CANONICAL_USER_ID).containsKey("count"));
    assertTrue(responseItem.getEntry().get(CANONICAL_USER_ID).containsKey("size"));
  }
View Full Code Here

    // Delete the data
    db.updatePersonData(CANON_USER, SELF_GROUP, APP_ID,
        null, ImmutableMap.of("count", (Object)"10", "newvalue", (Object)"20", "isValid", new Boolean(true)), new FakeGadgetToken());

    // Fetch the remaining and test
    DataCollection responseItem = db.getPersonData(
        ImmutableSet.of(CANON_USER), SELF_GROUP, APP_ID, Collections.<String>emptySet(),
        new FakeGadgetToken()).get();

    assertFalse(responseItem.getEntry().isEmpty());
    assertFalse(responseItem.getEntry().get(CANONICAL_USER_ID).isEmpty());

    assertSame(4, responseItem.getEntry().get(CANONICAL_USER_ID).size());
    assertTrue(responseItem.getEntry().get(CANONICAL_USER_ID).containsKey("count"));
    assertEquals("10", responseItem.getEntry().get(CANONICAL_USER_ID).get("count"));
    assertTrue(responseItem.getEntry().get(CANONICAL_USER_ID).containsKey("newvalue"));
    assertEquals("20", responseItem.getEntry().get(CANONICAL_USER_ID).get("newvalue"));
    assertTrue(responseItem.getEntry().get(CANONICAL_USER_ID).containsKey("isValid"));
    assertEquals(true, Boolean.valueOf(responseItem.getEntry().get(CANONICAL_USER_ID).get("isValid")));
  }
View Full Code Here

      totalResults = r.getTotalResults();
      itemsPerPage = r.getItemsPerPage();
      author = "?";
      link = new AtomLink("rel", "???");
    } else if ( obj instanceof DataCollection ) {
      DataCollection dc = (DataCollection) obj;
      entry = Lists.newArrayList();
      for ( Entry<String, Map<String,String>> o : dc.getEntry().entrySet()) {
        entry.add(new AtomEntry(o));
      }
      startIndex = 0;
      totalResults = entry.size();
      itemsPerPage = entry.size();
View Full Code Here

        //make sure the request conforms to the OpenSocial visibility rules
        List<String> personIds = validateReadRequest(userIds, groupId, appId, token);

        //fetch their appdata, convert it to a DataCollection and return it
        List<ApplicationData> applicationData = applicationDataRepository.getApplicationData(personIds, appId);
        DataCollection dataCollection = convertAppDataMapToDataCollection(personIds, applicationData, fields);
        return Futures.immediateFuture(dataCollection);
    }
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.