protected static List<ClientAuthenticationHandler> getDummyClientAuthHandlers() throws Exception { final List<ClientAuthenticationHandler> ret = new ArrayList<ClientAuthenticationHandler>(2); ret.add(new BasicAuthenticationHandler()); ret.add(new StandardAuthenticationHandler()); return ret; }
protected static List<ClientAuthenticationHandler> getDummyClientAuthHandlers() throws Exception { final List<ClientAuthenticationHandler> ret = new ArrayList<ClientAuthenticationHandler>(2); ret.add(new BasicAuthenticationHandler()); ret.add(new StandardAuthenticationHandler()); return ret; }
@Test public void testGeClientAuthenticationType1() throws Exception { final BasicAuthenticationHandler fixture = new BasicAuthenticationHandler(); final String result = fixture.geClientAuthenticationType(); Assert.assertEquals(OAuth2Message.BASIC_AUTH_TYPE, result); } }
@Test public void testGeClientAuthenticationType1() throws Exception { final BasicAuthenticationHandler fixture = new BasicAuthenticationHandler(); final String result = fixture.geClientAuthenticationType(); Assert.assertEquals(OAuth2Message.BASIC_AUTH_TYPE, result); } }
@Test public void testBasicAuthenticationHandler1() throws Exception { final BasicAuthenticationHandler result = new BasicAuthenticationHandler(); Assert.assertNotNull(result); Assert.assertTrue(ClientAuthenticationHandler.class.isInstance(result)); Assert.assertEquals(OAuth2Message.BASIC_AUTH_TYPE, result.geClientAuthenticationType()); }
@Test public void testBasicAuthenticationHandler1() throws Exception { final BasicAuthenticationHandler result = new BasicAuthenticationHandler(); Assert.assertNotNull(result); Assert.assertTrue(ClientAuthenticationHandler.class.isInstance(result)); Assert.assertEquals(OAuth2Message.BASIC_AUTH_TYPE, result.geClientAuthenticationType()); }
@SuppressWarnings("unused") @Test public void testProvideClientAuthenticationHandlers_1() throws Exception { final OAuth2HandlerModule fixture = new OAuth2HandlerModule(); final BasicAuthenticationHandler basicAuthenticationHandler = new BasicAuthenticationHandler(); final StandardAuthenticationHandler standardAuthenticationHandler = new StandardAuthenticationHandler(); final List<ClientAuthenticationHandler> result = OAuth2HandlerModule .provideClientAuthenticationHandlers(basicAuthenticationHandler, standardAuthenticationHandler); Assert.assertNotNull(result); Assert.assertEquals(2, result.size()); }
@SuppressWarnings("unused") @Test public void testProvideClientAuthenticationHandlers_1() throws Exception { final OAuth2HandlerModule fixture = new OAuth2HandlerModule(); final BasicAuthenticationHandler basicAuthenticationHandler = new BasicAuthenticationHandler(); final StandardAuthenticationHandler standardAuthenticationHandler = new StandardAuthenticationHandler(); final List<ClientAuthenticationHandler> result = OAuth2HandlerModule .provideClientAuthenticationHandlers(basicAuthenticationHandler, standardAuthenticationHandler); Assert.assertNotNull(result); Assert.assertEquals(2, result.size()); }
@Test public void testAddOAuth2Authentication4() throws Exception { final BasicAuthenticationHandler fixture = new BasicAuthenticationHandler(); final HttpRequest request = new HttpRequest(Uri.fromJavaUri(new URI(""))); final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_Code(); final OAuth2HandlerError result = fixture.addOAuth2Authentication(request, accessor); Assert.assertNull(result); final String authHeader = request.getHeader("Authorization"); Assert.assertNotNull(authHeader); Assert.assertEquals("Basic: Y2xpZW50SWQxOmNsaWVudFNlY3JldDE=", authHeader); }
@Test public void testAddOAuth2Authentication4() throws Exception { final BasicAuthenticationHandler fixture = new BasicAuthenticationHandler(); final HttpRequest request = new HttpRequest(Uri.fromJavaUri(new URI(""))); final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_Code(); final OAuth2HandlerError result = fixture.addOAuth2Authentication(request, accessor); Assert.assertNull(result); final String authHeader = request.getHeader("Authorization"); Assert.assertNotNull(authHeader); Assert.assertEquals("Basic: Y2xpZW50SWQxOmNsaWVudFNlY3JldDE=", authHeader); }
@Test public void testAddOAuth2Authentication3() throws Exception { final BasicAuthenticationHandler fixture = new BasicAuthenticationHandler(); final HttpRequest request = new HttpRequest(Uri.fromJavaUri(new URI(""))); final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_Error(); final OAuth2HandlerError result = fixture.addOAuth2Authentication(request, accessor); Assert.assertNotNull(result); Assert.assertEquals(null, result.getCause()); Assert.assertEquals(OAuth2Error.AUTHENTICATION_PROBLEM, result.getError()); Assert.assertTrue(result.getContextMessage().startsWith("accessor is invalid")); }
@Test public void testAddOAuth2Authentication3() throws Exception { final BasicAuthenticationHandler fixture = new BasicAuthenticationHandler(); final HttpRequest request = new HttpRequest(Uri.fromJavaUri(new URI(""))); final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_Error(); final OAuth2HandlerError result = fixture.addOAuth2Authentication(request, accessor); Assert.assertNotNull(result); Assert.assertEquals(null, result.getCause()); Assert.assertEquals(OAuth2Error.AUTHENTICATION_PROBLEM, result.getError()); Assert.assertTrue(result.getContextMessage().startsWith("accessor is invalid")); }
@Test public void testAddOAuth2Authentication2() throws Exception { final BasicAuthenticationHandler fixture = new BasicAuthenticationHandler(); final HttpRequest request = new HttpRequest(Uri.fromJavaUri(new URI(""))); final OAuth2Accessor accessor = null; final OAuth2HandlerError result = fixture.addOAuth2Authentication(request, accessor); Assert.assertNotNull(result); Assert.assertEquals(null, result.getCause()); Assert.assertEquals("accessor is invalid null", result.getContextMessage()); Assert.assertEquals( "org.apache.shindig.gadgets.oauth2.handler.OAuth2HandlerError : AUTHENTICATION_PROBLEM : accessor is invalid null : : :null", result.toString()); }
@Test public void testAddOAuth2Authentication2() throws Exception { final BasicAuthenticationHandler fixture = new BasicAuthenticationHandler(); final HttpRequest request = new HttpRequest(Uri.fromJavaUri(new URI(""))); final OAuth2Accessor accessor = null; final OAuth2HandlerError result = fixture.addOAuth2Authentication(request, accessor); Assert.assertNotNull(result); Assert.assertEquals(null, result.getCause()); Assert.assertEquals("accessor is invalid null", result.getContextMessage()); Assert.assertEquals( "org.apache.shindig.gadgets.oauth2.handler.OAuth2HandlerError : AUTHENTICATION_PROBLEM : accessor is invalid null : : :null", result.toString()); }
@Test public void testAddOAuth2Authentication1() throws Exception { final BasicAuthenticationHandler fixture = new BasicAuthenticationHandler(); final HttpRequest request = null; final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_Code(); final OAuth2HandlerError result = fixture.addOAuth2Authentication(request, accessor); Assert.assertNotNull(result); Assert.assertEquals(null, result.getCause()); Assert.assertEquals("request is null", result.getContextMessage()); Assert.assertEquals( "org.apache.shindig.gadgets.oauth2.handler.OAuth2HandlerError : AUTHENTICATION_PROBLEM : request is null : : :null", result.toString()); }
@Test public void testAddOAuth2Authentication1() throws Exception { final BasicAuthenticationHandler fixture = new BasicAuthenticationHandler(); final HttpRequest request = null; final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_Code(); final OAuth2HandlerError result = fixture.addOAuth2Authentication(request, accessor); Assert.assertNotNull(result); Assert.assertEquals(null, result.getCause()); Assert.assertEquals("request is null", result.getContextMessage()); Assert.assertEquals( "org.apache.shindig.gadgets.oauth2.handler.OAuth2HandlerError : AUTHENTICATION_PROBLEM : request is null : : :null", result.toString()); }