@Test public void testGetTokenInfo() throws Exception { context.checking(new Expectations() { { oneOf(serviceActionControllerMock).execute(with(any(ServiceActionContext.class)), with(any(ServiceAction.class))); will(returnValue(new TokenInfoResponse(new TokenInfo(null, null, null, 0)))); } }); sut.getTokenInfo(securityToken, consumerInfo, "serviceName", "tokenName"); context.assertIsSatisfied(); }
public TokenInfo getTokenInfo(final SecurityToken securityToken, final ConsumerInfo consumerInfo, final String serviceName, final String tokenName) throws GadgetException { TokenInfo tokenInfo = null; try { GetConsumerTokenInfoRequest request = new GetConsumerTokenInfoRequest(securityToken, consumerInfo, serviceName, tokenName); ServiceActionContext currentContext = new ServiceActionContext(request, null); TokenInfoResponse response = (TokenInfoResponse) actionController.execute(currentContext, getConsumerTokenInfoAction); if (response != null) { tokenInfo = response.getTokenInfo(); } } catch (Exception ex) { logger.error("Error occurred getting consumer token info.", ex); throw new GadgetException(GadgetException.Code.INTERNAL_SERVER_ERROR, ex.getMessage()); } return tokenInfo; }
OAuthStoreImpl implements OAuthStore { public TokenInfo getTokenInfo(final SecurityToken securityToken, final ConsumerInfo consumerInfo, final String serviceName, final String tokenName) throws GadgetException { TokenInfo tokenInfo = null; try { GetConsumerTokenInfoRequest request = new GetConsumerTokenInfoRequest(securityToken, consumerInfo, serviceName, tokenName); ServiceActionContext currentContext = new ServiceActionContext(request, null); TokenInfoResponse response = (TokenInfoResponse) actionController.execute(currentContext, getConsumerTokenInfoAction); if (response != null) { tokenInfo = response.getTokenInfo(); } } catch (Exception ex) { logger.error("Error occurred getting consumer token info.", ex); throw new GadgetException(GadgetException.Code.INTERNAL_SERVER_ERROR, ex.getMessage()); } return tokenInfo; } }
OAuthStoreImpl implements OAuthStore { public TokenInfo getTokenInfo(final SecurityToken securityToken, final ConsumerInfo consumerInfo, final String serviceName, final String tokenName) throws GadgetException { TokenInfo tokenInfo = null; try { GetConsumerTokenInfoRequest request = new GetConsumerTokenInfoRequest(securityToken, consumerInfo, serviceName, tokenName); ServiceActionContext currentContext = new ServiceActionContext(request, null); TokenInfoResponse response = (TokenInfoResponse) actionController.execute(currentContext, getConsumerTokenInfoAction); if (response != null) { tokenInfo = response.getTokenInfo(); } } catch (Exception ex) { logger.error("Error occurred getting consumer token info.", ex); throw new GadgetException(GadgetException.Code.INTERNAL_SERVER_ERROR, ex.getMessage()); } return tokenInfo; } @Inject  OAuthStoreImpl(@Named("getConsumerInfo") final ServiceAction inGetConsumerInfoAction,
            @Named("setConsumerTokenInfo") final ServiceAction inSetConsumerTokenInfoAction,
            @Named("getConsumerTokenInfo") final ServiceAction inGetConsumerTokenInfoAction,
            @Named("removeConsumerToken") final ServiceAction inRemoveConsumerTokenAction); }
OAuthStoreImpl implements OAuthStore { public TokenInfo getTokenInfo(final SecurityToken securityToken, final ConsumerInfo consumerInfo, final String serviceName, final String tokenName) throws GadgetException { TokenInfo tokenInfo = null; try { GetConsumerTokenInfoRequest request = new GetConsumerTokenInfoRequest(securityToken, consumerInfo, serviceName, tokenName); ServiceActionContext currentContext = new ServiceActionContext(request, null); TokenInfoResponse response = (TokenInfoResponse) actionController.execute(currentContext, getConsumerTokenInfoAction); if (response != null) { tokenInfo = response.getTokenInfo(); } } catch (Exception ex) { logger.error("Error occurred getting consumer token info.", ex); throw new GadgetException(GadgetException.Code.INTERNAL_SERVER_ERROR, ex.getMessage()); } return tokenInfo; } @Inject  OAuthStoreImpl(@Named("getConsumerInfo") final ServiceAction inGetConsumerInfoAction,
            @Named("setConsumerTokenInfo") final ServiceAction inSetConsumerTokenInfoAction,
            @Named("getConsumerTokenInfo") final ServiceAction inGetConsumerTokenInfoAction,
            @Named("removeConsumerToken") final ServiceAction inRemoveConsumerTokenAction); void setServiceActionController(final ActionController inServiceActionController); ConsumerInfo getConsumerKeyAndSecret(final SecurityToken securityToken, final String serviceName,
            final OAuthServiceProvider provider); void setTokenInfo(final SecurityToken securityToken, final ConsumerInfo consumerInfo,
            final String serviceName, final String tokenName, final TokenInfo tokenInfo); TokenInfo getTokenInfo(final SecurityToken securityToken, final ConsumerInfo consumerInfo,
            final String serviceName, final String tokenName); void removeToken(final SecurityToken securityToken, final ConsumerInfo consumerInfo,
            final String serviceName, final String tokenName); }
OAuthStoreImpl implements OAuthStore { public TokenInfo getTokenInfo(final SecurityToken securityToken, final ConsumerInfo consumerInfo, final String serviceName, final String tokenName) throws GadgetException { TokenInfo tokenInfo = null; try { GetConsumerTokenInfoRequest request = new GetConsumerTokenInfoRequest(securityToken, consumerInfo, serviceName, tokenName); ServiceActionContext currentContext = new ServiceActionContext(request, null); TokenInfoResponse response = (TokenInfoResponse) actionController.execute(currentContext, getConsumerTokenInfoAction); if (response != null) { tokenInfo = response.getTokenInfo(); } } catch (Exception ex) { logger.error("Error occurred getting consumer token info.", ex); throw new GadgetException(GadgetException.Code.INTERNAL_SERVER_ERROR, ex.getMessage()); } return tokenInfo; } @Inject  OAuthStoreImpl(@Named("getConsumerInfo") final ServiceAction inGetConsumerInfoAction,
            @Named("setConsumerTokenInfo") final ServiceAction inSetConsumerTokenInfoAction,
            @Named("getConsumerTokenInfo") final ServiceAction inGetConsumerTokenInfoAction,
            @Named("removeConsumerToken") final ServiceAction inRemoveConsumerTokenAction); void setServiceActionController(final ActionController inServiceActionController); ConsumerInfo getConsumerKeyAndSecret(final SecurityToken securityToken, final String serviceName,
            final OAuthServiceProvider provider); void setTokenInfo(final SecurityToken securityToken, final ConsumerInfo consumerInfo,
            final String serviceName, final String tokenName, final TokenInfo tokenInfo); TokenInfo getTokenInfo(final SecurityToken securityToken, final ConsumerInfo consumerInfo,
            final String serviceName, final String tokenName); void removeToken(final SecurityToken securityToken, final ConsumerInfo consumerInfo,
            final String serviceName, final String tokenName);  }