@Test(expected = ExecutionException.class) public void testGetConsumerWithNullConsumerKey() throws Exception { context.checking(new Expectations() { { oneOf(actionContext).getParams(); will(returnValue(new GetConsumerInfoRequest(securityToken, "serviceName", provider))); oneOf(securityToken).getAppUrl(); will(returnValue("http: oneOf(consumerMapper).execute(with(any(OAuthConsumerRequest.class))); will(returnValue(null)); } }); sut.execute(actionContext); context.assertIsSatisfied(); }
@Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { GetConsumerInfoRequest request = (GetConsumerInfoRequest) inActionContext.getParams(); OAuthConsumer oauthConsumer = consumerMapper.execute(new OAuthConsumerRequest(request.getServiceName(), request .getSecurityToken().getAppUrl())); if (oauthConsumer == null) { throw new ExecutionException("OAuth Consumer was not found"); } net.oauth.OAuthConsumer consumer = new net.oauth.OAuthConsumer(oauthConsumer.getCallbackURL(), oauthConsumer .getConsumerKey(), oauthConsumer.getConsumerSecret(), request.getProvider()); consumer.setProperty(OAuth.OAUTH_SIGNATURE_METHOD, oauthConsumer.getSignatureMethod()); ConsumerInfo consumerInfo = new ConsumerInfo(consumer, null, oauthConsumer.getCallbackURL()); return new ConsumerInfoResponse(consumerInfo); }
GetConsumerInfoExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { GetConsumerInfoRequest request = (GetConsumerInfoRequest) inActionContext.getParams(); OAuthConsumer oauthConsumer = consumerMapper.execute(new OAuthConsumerRequest(request.getServiceName(), request .getSecurityToken().getAppUrl())); if (oauthConsumer == null) { throw new ExecutionException("OAuth Consumer was not found"); } net.oauth.OAuthConsumer consumer = new net.oauth.OAuthConsumer(oauthConsumer.getCallbackURL(), oauthConsumer .getConsumerKey(), oauthConsumer.getConsumerSecret(), request.getProvider()); consumer.setProperty(OAuth.OAUTH_SIGNATURE_METHOD, oauthConsumer.getSignatureMethod()); ConsumerInfo consumerInfo = new ConsumerInfo(consumer, null, oauthConsumer.getCallbackURL()); return new ConsumerInfoResponse(consumerInfo); } }
GetConsumerInfoExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { GetConsumerInfoRequest request = (GetConsumerInfoRequest) inActionContext.getParams(); OAuthConsumer oauthConsumer = consumerMapper.execute(new OAuthConsumerRequest(request.getServiceName(), request .getSecurityToken().getAppUrl())); if (oauthConsumer == null) { throw new ExecutionException("OAuth Consumer was not found"); } net.oauth.OAuthConsumer consumer = new net.oauth.OAuthConsumer(oauthConsumer.getCallbackURL(), oauthConsumer .getConsumerKey(), oauthConsumer.getConsumerSecret(), request.getProvider()); consumer.setProperty(OAuth.OAUTH_SIGNATURE_METHOD, oauthConsumer.getSignatureMethod()); ConsumerInfo consumerInfo = new ConsumerInfo(consumer, null, oauthConsumer.getCallbackURL()); return new ConsumerInfoResponse(consumerInfo); } GetConsumerInfoExecution(final DomainMapper<OAuthConsumerRequest, OAuthConsumer> inConsumerMapper); }
GetConsumerInfoExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { GetConsumerInfoRequest request = (GetConsumerInfoRequest) inActionContext.getParams(); OAuthConsumer oauthConsumer = consumerMapper.execute(new OAuthConsumerRequest(request.getServiceName(), request .getSecurityToken().getAppUrl())); if (oauthConsumer == null) { throw new ExecutionException("OAuth Consumer was not found"); } net.oauth.OAuthConsumer consumer = new net.oauth.OAuthConsumer(oauthConsumer.getCallbackURL(), oauthConsumer .getConsumerKey(), oauthConsumer.getConsumerSecret(), request.getProvider()); consumer.setProperty(OAuth.OAUTH_SIGNATURE_METHOD, oauthConsumer.getSignatureMethod()); ConsumerInfo consumerInfo = new ConsumerInfo(consumer, null, oauthConsumer.getCallbackURL()); return new ConsumerInfoResponse(consumerInfo); } GetConsumerInfoExecution(final DomainMapper<OAuthConsumerRequest, OAuthConsumer> inConsumerMapper); @Override Serializable execute(final PrincipalActionContext inActionContext); }
GetConsumerInfoExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { GetConsumerInfoRequest request = (GetConsumerInfoRequest) inActionContext.getParams(); OAuthConsumer oauthConsumer = consumerMapper.execute(new OAuthConsumerRequest(request.getServiceName(), request .getSecurityToken().getAppUrl())); if (oauthConsumer == null) { throw new ExecutionException("OAuth Consumer was not found"); } net.oauth.OAuthConsumer consumer = new net.oauth.OAuthConsumer(oauthConsumer.getCallbackURL(), oauthConsumer .getConsumerKey(), oauthConsumer.getConsumerSecret(), request.getProvider()); consumer.setProperty(OAuth.OAUTH_SIGNATURE_METHOD, oauthConsumer.getSignatureMethod()); ConsumerInfo consumerInfo = new ConsumerInfo(consumer, null, oauthConsumer.getCallbackURL()); return new ConsumerInfoResponse(consumerInfo); } GetConsumerInfoExecution(final DomainMapper<OAuthConsumerRequest, OAuthConsumer> inConsumerMapper); @Override Serializable execute(final PrincipalActionContext inActionContext);  }