Package org.apache.shindig.gadgets.oauth2

Examples of org.apache.shindig.gadgets.oauth2.OAuth2Accessor


  }

  @Test
  public void testHandlesRequest_1() throws Exception {
    final CodeAuthorizationResponseHandler fixture = CodeAuthorizationResponseHandlerTest.carh;
    final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_Code();
    final HttpServletRequest request = null;

    final boolean result = fixture.handlesRequest(accessor, request);

    Assert.assertEquals(false, result);
View Full Code Here


  }

  @Test
  public void testHandlesRequest_2() throws Exception {
    final CodeAuthorizationResponseHandler fixture = CodeAuthorizationResponseHandlerTest.carh;
    final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_Redirecting();
    final HttpServletRequest request = new DummyHttpServletRequest();

    final boolean result = fixture.handlesRequest(accessor, request);

    Assert.assertTrue(result);
View Full Code Here

  }

  @Test
  public void testHandlesRequest_3() throws Exception {
    final CodeAuthorizationResponseHandler fixture = CodeAuthorizationResponseHandlerTest.carh;
    final OAuth2Accessor accessor = null;
    final HttpServletRequest request = new DummyHttpServletRequest();

    final boolean result = fixture.handlesRequest(accessor, request);

    Assert.assertEquals(false, result);
View Full Code Here

  }

  @Test
  public void testHandlesRequest_4() throws Exception {
    final CodeAuthorizationResponseHandler fixture = CodeAuthorizationResponseHandlerTest.carh;
    final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_Code();
    final HttpServletRequest request = new DummyHttpServletRequest();

    final boolean result = fixture.handlesRequest(accessor, request);

    Assert.assertEquals(false, result);
View Full Code Here

  }

  @Test
  public void testHandlesResponse_1() throws Exception {
    final CodeAuthorizationResponseHandler fixture = CodeAuthorizationResponseHandlerTest.carh;
    final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_Code();
    final HttpResponse response = new HttpResponse();

    final boolean result = fixture.handlesResponse(accessor, response);

    Assert.assertEquals(false, result);
View Full Code Here

    Assert.assertEquals(MockUtils.CLIENT_INDEX1, result);
  }

  @Test
  public void testGetOAuth2Accessor_1() throws Exception {
    final OAuth2Accessor result = this.cache.getOAuth2Accessor(MockUtils.ACCESSOR_INDEX1);

    Assert.assertNotNull(result);
    Assert.assertEquals(MockUtils.CLIENT_ID1, result.getClientId());
  }
View Full Code Here

    Assert.assertEquals(MockUtils.CLIENT_ID1, result.getClientId());
  }

  @Test
  public void testGetOAuth2Accessor_2() throws Exception {
    final OAuth2Accessor result = this.cache.getOAuth2Accessor(null);

    Assert.assertNull(result);
  }
View Full Code Here

    Assert.assertNull(result);
  }

  @Test
  public void testGetOAuth2Accessor_3() throws Exception {
    final OAuth2Accessor result = this.cache.getOAuth2Accessor(MockUtils.BAD_INDEX);

    Assert.assertNull(result);
  }
View Full Code Here

  }

  @Test
  public void testRemoveOAuth2Accessor_1() throws Exception {

    final OAuth2Accessor result = this.cache.removeOAuth2Accessor(MockUtils.BAD_INDEX);

    Assert.assertNull(result);
  }
View Full Code Here

  }

  @Test
  public void testStoreOAuth2Accessor_1() throws Exception {
    final OAuth2Store store = MockUtils.getDummyStore(this.cache, null, null);
    OAuth2Accessor accessor = new BasicOAuth2Accessor("XXX", "YYY", "ZZZ", "", false, store, "AAA");

    final Integer result = this.cache.storeOAuth2Accessor(accessor);

    Assert.assertEquals(-1664180105, result.intValue());

    accessor = this.cache.getOAuth2Accessor(result);

    Assert.assertNotNull(accessor);
    Assert.assertEquals("XXX", accessor.getGadgetUri());
    Assert.assertEquals("YYY", accessor.getServiceName());
    Assert.assertEquals("ZZZ", accessor.getUser());
    Assert.assertEquals("", accessor.getScope());
    Assert.assertEquals(false, accessor.isAllowModuleOverrides());
    Assert.assertEquals("AAA", accessor.getRedirectUri());
    Assert.assertEquals("-1664180105", accessor.getState());
  }
View Full Code Here

TOP

Related Classes of org.apache.shindig.gadgets.oauth2.OAuth2Accessor

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.