@Test public void testClientCredentialsGrantTypeHandler_1() throws Exception { final ClientCredentialsGrantTypeHandler result = ClientCredentialsGrantTypeHandlerTest.ccgth; Assert.assertNotNull(result); Assert.assertEquals("client_credentials", result.getGrantType()); Assert.assertTrue(GrantRequestHandler.class.isInstance(result)); Assert.assertEquals(false, result.isAuthorizationEndpointResponse()); Assert.assertEquals(false, result.isRedirectRequired()); Assert.assertEquals(true, result.isTokenEndpointResponse()); }
@Before public void setUp() throws Exception { ClientCredentialsGrantTypeHandlerTest.ccgth = new ClientCredentialsGrantTypeHandler( MockUtils.getDummyClientAuthHandlers()); }
@Test(expected = OAuth2RequestException.class) public void testGetAuthorizationRequest_1() throws Exception { final ClientCredentialsGrantTypeHandler fixture = ClientCredentialsGrantTypeHandlerTest.ccgth; final OAuth2Accessor accessor = null; final String completeAuthorizationUrl = "xxx"; fixture.getAuthorizationRequest(accessor, completeAuthorizationUrl); }
private String getAuthorizationBody(final OAuth2Accessor accessor) throws OAuth2RequestException { String ret = ""; final Map<String, String> queryParams = Maps.newHashMap(); queryParams.put(OAuth2Message.GRANT_TYPE, this.getGrantType()); final String clientId = accessor.getClientId(); final byte[] secretBytes = accessor.getClientSecret(); String secret; try { secret = new String(secretBytes, "UTF-8"); } catch (final UnsupportedEncodingException e) { throw new OAuth2RequestException(OAuth2Error.CLIENT_CREDENTIALS_PROBLEM, "error getting authorization body", e); } queryParams.put(OAuth2Message.CLIENT_ID, clientId); queryParams.put(OAuth2Message.CLIENT_SECRET, secret); ret = OAuth2Utils.buildUrl(ret, queryParams, null); final char firstChar = ret.charAt(0); if (firstChar == '?' || firstChar == '&') { ret = ret.substring(1); } return ret; }
@Test(expected = OAuth2RequestException.class) public void testGetCompleteUrl_1() throws Exception { final ClientCredentialsGrantTypeHandler fixture = ClientCredentialsGrantTypeHandlerTest.ccgth; final OAuth2Accessor accessor = null; fixture.getCompleteUrl(accessor); }
@Test public void testIsRedirectRequired_1() throws Exception { final ClientCredentialsGrantTypeHandler fixture = ClientCredentialsGrantTypeHandlerTest.ccgth; final boolean result = fixture.isRedirectRequired(); Assert.assertEquals(false, result); }
@Test public void testIsAuthorizationEndpointResponse_1() throws Exception { final ClientCredentialsGrantTypeHandler fixture = ClientCredentialsGrantTypeHandlerTest.ccgth; final boolean result = fixture.isAuthorizationEndpointResponse(); Assert.assertEquals(false, result); }
@Test public void testIsTokenEndpointResponse_1() throws Exception { final ClientCredentialsGrantTypeHandler fixture = ClientCredentialsGrantTypeHandlerTest.ccgth; final boolean result = fixture.isTokenEndpointResponse(); Assert.assertEquals(true, result); } }
request.setPostBody(this.getAuthorizationBody(accessor).getBytes("UTF-8")); } catch (final UnsupportedEncodingException e) { throw new OAuth2RequestException(OAuth2Error.CLIENT_CREDENTIALS_PROBLEM,
@Test public void testGetGrantType_1() throws Exception { final ClientCredentialsGrantTypeHandler fixture = ClientCredentialsGrantTypeHandlerTest.ccgth; final String result = fixture.getGrantType(); Assert.assertEquals(OAuth2Message.CLIENT_CREDENTIALS, result); }
@Test(expected = OAuth2RequestException.class) public void testGetCompleteUrl_1() throws Exception { final ClientCredentialsGrantTypeHandler fixture = ClientCredentialsGrantTypeHandlerTest.ccgth; final OAuth2Accessor accessor = null; fixture.getCompleteUrl(accessor); }
@Test public void testIsRedirectRequired_1() throws Exception { final ClientCredentialsGrantTypeHandler fixture = ClientCredentialsGrantTypeHandlerTest.ccgth; final boolean result = fixture.isRedirectRequired(); Assert.assertEquals(false, result); }
@Test public void testIsAuthorizationEndpointResponse_1() throws Exception { final ClientCredentialsGrantTypeHandler fixture = ClientCredentialsGrantTypeHandlerTest.ccgth; final boolean result = fixture.isAuthorizationEndpointResponse(); Assert.assertEquals(false, result); }
@Test public void testIsTokenEndpointResponse_1() throws Exception { final ClientCredentialsGrantTypeHandler fixture = ClientCredentialsGrantTypeHandlerTest.ccgth; final boolean result = fixture.isTokenEndpointResponse(); Assert.assertEquals(true, result); } }
@Test public void testClientCredentialsGrantTypeHandler_1() throws Exception { final ClientCredentialsGrantTypeHandler result = ClientCredentialsGrantTypeHandlerTest.ccgth; Assert.assertNotNull(result); Assert.assertEquals("client_credentials", result.getGrantType()); Assert.assertTrue(GrantRequestHandler.class.isInstance(result)); Assert.assertEquals(false, result.isAuthorizationEndpointResponse()); Assert.assertEquals(false, result.isRedirectRequired()); Assert.assertEquals(true, result.isTokenEndpointResponse()); }
@Test(expected = OAuth2RequestException.class) public void testGetAuthorizationRequest_1() throws Exception { final ClientCredentialsGrantTypeHandler fixture = ClientCredentialsGrantTypeHandlerTest.ccgth; final OAuth2Accessor accessor = null; final String completeAuthorizationUrl = "xxx"; fixture.getAuthorizationRequest(accessor, completeAuthorizationUrl); }
@Test public void testGetGrantType_1() throws Exception { final ClientCredentialsGrantTypeHandler fixture = ClientCredentialsGrantTypeHandlerTest.ccgth; final String result = fixture.getGrantType(); Assert.assertEquals(OAuth2Message.CLIENT_CREDENTIALS, result); }
@Test(expected = OAuth2RequestException.class) public void testGetCompleteUrl_3() throws Exception { final ClientCredentialsGrantTypeHandler fixture = ClientCredentialsGrantTypeHandlerTest.ccgth; final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_Code(); fixture.getCompleteUrl(accessor); }
@Before public void setUp() throws Exception { ClientCredentialsGrantTypeHandlerTest.ccgth = new ClientCredentialsGrantTypeHandler( MockUtils.getDummyClientAuthHandlers()); }
@Test(expected = OAuth2RequestException.class) public void testGetAuthorizationRequest_2() throws Exception { final ClientCredentialsGrantTypeHandler fixture = ClientCredentialsGrantTypeHandlerTest.ccgth; final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_Code(); final String completeAuthorizationUrl = null; fixture.getAuthorizationRequest(accessor, completeAuthorizationUrl); }