Examples of FakeGadgetToken


Examples of org.apache.shindig.common.testing.FakeGadgetToken

  @Test
  public void testDeleteExpectedAppData() throws Exception {
    // 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"));
View Full Code Here

Examples of org.apache.shindig.common.testing.FakeGadgetToken

  @Test
  public void testUpdateExpectedAppData() throws Exception {
    // Delete the data
    db.updatePersonData(CANON_USER, SELF_GROUP, APP_ID,
        null, ImmutableMap.of("count", "10", "newvalue", "20"), 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(3, responseItem.getEntry().get(CANONICAL_USER_ID).size());
View Full Code Here

Examples of org.apache.shindig.common.testing.FakeGadgetToken

  @Test
  public void testGetExpectedActivityEntries() throws Exception {
    RestfulCollection<ActivityEntry> responseItem = db.getActivityEntries(
        ImmutableSet.of(JOHN_DOE), SELF_GROUP, APP_ID, Collections.<String>emptySet(), null,
        new FakeGadgetToken()).get();
    assertSame(2, responseItem.getTotalResults());
  }
View Full Code Here

Examples of org.apache.shindig.common.testing.FakeGadgetToken

  @Test
  public void testGetExpectedActivityEntriesForPlural() throws Exception {
    RestfulCollection<ActivityEntry> responseItem = db.getActivityEntries(
        ImmutableSet.of(CANON_USER, JOHN_DOE), SELF_GROUP, APP_ID, Collections.<String>emptySet(), null,
        new FakeGadgetToken()).get();
    assertSame(2, responseItem.getTotalResults());
  }
View Full Code Here

Examples of org.apache.shindig.common.testing.FakeGadgetToken

  }

  @Test
  public void testGetExpectedActivityEntry() throws Exception {
    ActivityEntry entry = db.getActivityEntry(JOHN_DOE, SELF_GROUP, APP_ID,
        ImmutableSet.of("title"), "activity2", new FakeGadgetToken()).get();
    assertNotNull(entry);
    // Check that some fields are fetched and others are not
    assertNotNull(entry.getTitle());
    assertNull(entry.getPublished());
  }
View Full Code Here

Examples of org.apache.shindig.common.testing.FakeGadgetToken

  }

  @Test
  public void testDeleteExpectedActivityEntry() throws Exception {
    db.deleteActivityEntries(JOHN_DOE, SELF_GROUP, APP_ID, ImmutableSet.of(APP_ID),
        new FakeGadgetToken());

    // Try to fetch the activity
    try {
      db.getActivityEntry(
          JOHN_DOE, SELF_GROUP, APP_ID,
          ImmutableSet.of("body"), APP_ID, new FakeGadgetToken()).get();
      fail();
    } catch (ProtocolException sse) {
      assertEquals(HttpServletResponse.SC_BAD_REQUEST, sse.getCode());
    }
  }
View Full Code Here

Examples of org.apache.shindig.common.testing.FakeGadgetToken

    JSONArray people = db.getDb().getJSONArray("people");
    JSONObject jsonPerson = new JSONObject();
    jsonPerson.put("id", "updatePerson");
    people.put(people.length(),jsonPerson);

    SecurityToken updateToken = new FakeGadgetToken("appId", "appUrl", "domain", "updatePerson", "trustedJson", "updatePerson", "20");

    // Get user
    UserId userId = new UserId(UserId.Type.userId, "updatePerson");
    Person person = db
        .getPerson(userId, Person.Field.ALL_FIELDS, token).get();
View Full Code Here

Examples of org.apache.shindig.common.testing.FakeGadgetToken

    JSONArray people = db.getDb().getJSONArray("people");
    JSONObject jsonPerson = new JSONObject();
    jsonPerson.put("id", "updatePerson");
    people.put(people.length(),jsonPerson);

    SecurityToken updateToken = new FakeGadgetToken("appId", "appUrl", "domain", "viewer", "trustedJson", "viewer", "20");

    // Get user
    UserId userId = new UserId(UserId.Type.userId, "updatePerson");
    Person person = db
        .getPerson(userId, Person.Field.ALL_FIELDS, token).get();
View Full Code Here

Examples of org.apache.shindig.common.testing.FakeGadgetToken

    DEFAULT_OPTIONS.setMax(20);
  }

  @Before
  public void setUp() throws Exception {
    token = new FakeGadgetToken();
    converter = mock(BeanJsonConverter.class);
    personService = mock(PersonService.class);
    JSONObject config = new JSONObject('{' + ContainerConfig.DEFAULT_CONTAINER + ':' +
        "{'gadgets.container': ['default']," +
         "'gadgets.features':{opensocial:" +
View Full Code Here

Examples of org.apache.shindig.common.testing.FakeGadgetToken

  @Override
  public void setUp() {
    cacheProvider = new LruCacheProvider(100);
    cache = new DefaultHttpCache(cacheProvider);
    service = new DefaultInvalidationService(cache, cacheProvider, new AtomicLong());
    appxToken = new FakeGadgetToken();
    appxToken.setAppId("AppX");
    appxToken.setOwnerId("OwnerX");
    appxToken.setViewerId("ViewerX");
    appyToken = new FakeGadgetToken();
    appyToken.setAppId("AppY");
    appyToken.setOwnerId("OwnerY");
    appyToken.setViewerId("ViewerY");

    control = EasyMock.createNiceControl();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.