Examples of FakeGadgetToken


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

    backingStore.setDefaultKey(new BasicOAuthStoreConsumerKeyAndSecret("key", "secret",
        KeyType.RSA_PRIVATE, "keyname", null));
    backingStore.setDefaultCallbackUrl(DEFAULT_CALLBACK);
    store = new GadgetOAuthTokenStore(backingStore, new FakeGadgetSpecFactory());

    socialToken = new FakeGadgetToken();
    socialToken.setOwnerId("owner");
    socialToken.setViewerId("viewer");
    socialToken.setAppUrl(GADGET_URL);

    privateToken = new FakeGadgetToken();
    privateToken.setOwnerId("owner");
    privateToken.setViewerId("owner");
    privateToken.setAppUrl(GADGET_URL);

    stateCrypter = new BasicBlobCrypter("abcdefghijklmnop".getBytes());
View Full Code Here

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

    EasyMock.expect(mockPrefs.getAllFeatures()).andReturn(features).anyTimes();
  }

  @Before
  public void setUp() throws Exception {
    token = new FakeGadgetToken();
    token.setAppUrl("http://www.example.com/gadget.xml");

    Injector injector = Guice.createInjector();
    converter = new BeanJsonConverter(injector);
View Full Code Here

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

  @Test
  public void testChangeSecurityToken() throws Exception {
    // Doesn't actually sign since it returns the standard fetcher.
    // Signing tests are in SigningFetcherTest
    expectGetAndReturnBody(AuthType.SIGNED, RESPONSE_BODY);
    FakeGadgetToken authToken = new FakeGadgetToken()
      .setUpdatedToken("updated")
      .setAppUrl(DUMMY_TOKEN.getAppUrl())
      .setContainer(DUMMY_TOKEN.getContainer());
    expect(request.getAttribute(AuthInfoUtil.Attribute.SECURITY_TOKEN.getId()))
        .andReturn(authToken).atLeastOnce();
View Full Code Here

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

  @Test
  public void testDoOAuthRequest() throws Exception {
    // Doesn't actually do oauth dance since it returns the standard fetcher.
    // OAuth tests are in OAuthRequestTest
    expectGetAndReturnBody(AuthType.OAUTH, RESPONSE_BODY);
    FakeGadgetToken authToken = new FakeGadgetToken()
      .setUpdatedToken("updated")
      .setAppUrl(DUMMY_TOKEN.getAppUrl())
      .setContainer(DUMMY_TOKEN.getContainer());
    expect(request.getAttribute(AuthInfoUtil.Attribute.SECURITY_TOKEN.getId()))
        .andReturn(authToken).atLeastOnce();
View Full Code Here

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

  @Test
  public void testGetExpectedActivities() throws Exception {
    RestfulCollection<Activity> responseItem = db.getActivities(
        ImmutableSet.of(CANON_USER), 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 testGetExpectedActivitiesForPlural() throws Exception {
    RestfulCollection<Activity> responseItem = db.getActivities(
        ImmutableSet.of(CANON_USER, JOHN_DOE), SELF_GROUP, APP_ID, Collections.<String>emptySet(), null,
        new FakeGadgetToken()).get();
    assertSame(3, responseItem.getTotalResults());
  }
View Full Code Here

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

  @Test
  public void testGetExpectedActivity() throws Exception {
    Activity activity = db.getActivity(
        CANON_USER, SELF_GROUP, APP_ID,
        ImmutableSet.of("appId", "body", "mediaItems"), APP_ID, new FakeGadgetToken()).get();
    assertNotNull(activity);
    // Check that some fields are fetched and others are not
    assertNotNull(activity.getBody());
    assertNull(activity.getBodyId());
  }
View Full Code Here

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

  }

  @Test
  public void testDeleteExpectedActivity() throws Exception {
    db.deleteActivities(CANON_USER, SELF_GROUP, APP_ID, ImmutableSet.of(APP_ID),
        new FakeGadgetToken());

    // Try to fetch the activity
    try {
      db.getActivity(
          CANON_USER, SELF_GROUP, APP_ID,
          ImmutableSet.of("appId", "body", "mediaItems"), 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

  @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"));
View Full Code Here

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

  @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"));
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.