@Test(expected = GadgetException.class) public void testGetConsumerInfoWithRollback() throws Exception { context.checking(new Expectations() { { oneOf(serviceActionControllerMock).execute(with(any(ServiceActionContext.class)), with(any(ServiceAction.class))); will(throwException(new ExecutionException())); } }); sut.getConsumerKeyAndSecret(securityToken, "serviceName", provider); context.assertIsSatisfied(); }
public ConsumerInfo getConsumerKeyAndSecret(final SecurityToken securityToken, final String serviceName, final OAuthServiceProvider provider) throws GadgetException { ConsumerInfo consumerInfo = null; try { GetConsumerInfoRequest request = new GetConsumerInfoRequest(securityToken, serviceName, provider); ServiceActionContext currentContext = new ServiceActionContext(request, null); ConsumerInfoResponse response = (ConsumerInfoResponse) actionController.execute(currentContext, getConsumerInfoAction); consumerInfo = response.getConsumerInfo(); } catch (Exception ex) { logger.error("Error occurred getting consumer info.", ex); throw new GadgetException(GadgetException.Code.INTERNAL_SERVER_ERROR, ex.getMessage()); } return consumerInfo; }
OAuthStoreImpl implements OAuthStore { public ConsumerInfo getConsumerKeyAndSecret(final SecurityToken securityToken, final String serviceName, final OAuthServiceProvider provider) throws GadgetException { ConsumerInfo consumerInfo = null; try { GetConsumerInfoRequest request = new GetConsumerInfoRequest(securityToken, serviceName, provider); ServiceActionContext currentContext = new ServiceActionContext(request, null); ConsumerInfoResponse response = (ConsumerInfoResponse) actionController.execute(currentContext, getConsumerInfoAction); consumerInfo = response.getConsumerInfo(); } catch (Exception ex) { logger.error("Error occurred getting consumer info.", ex); throw new GadgetException(GadgetException.Code.INTERNAL_SERVER_ERROR, ex.getMessage()); } return consumerInfo; } }
OAuthStoreImpl implements OAuthStore { public ConsumerInfo getConsumerKeyAndSecret(final SecurityToken securityToken, final String serviceName, final OAuthServiceProvider provider) throws GadgetException { ConsumerInfo consumerInfo = null; try { GetConsumerInfoRequest request = new GetConsumerInfoRequest(securityToken, serviceName, provider); ServiceActionContext currentContext = new ServiceActionContext(request, null); ConsumerInfoResponse response = (ConsumerInfoResponse) actionController.execute(currentContext, getConsumerInfoAction); consumerInfo = response.getConsumerInfo(); } catch (Exception ex) { logger.error("Error occurred getting consumer info.", ex); throw new GadgetException(GadgetException.Code.INTERNAL_SERVER_ERROR, ex.getMessage()); } return consumerInfo; } @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 ConsumerInfo getConsumerKeyAndSecret(final SecurityToken securityToken, final String serviceName, final OAuthServiceProvider provider) throws GadgetException { ConsumerInfo consumerInfo = null; try { GetConsumerInfoRequest request = new GetConsumerInfoRequest(securityToken, serviceName, provider); ServiceActionContext currentContext = new ServiceActionContext(request, null); ConsumerInfoResponse response = (ConsumerInfoResponse) actionController.execute(currentContext, getConsumerInfoAction); consumerInfo = response.getConsumerInfo(); } catch (Exception ex) { logger.error("Error occurred getting consumer info.", ex); throw new GadgetException(GadgetException.Code.INTERNAL_SERVER_ERROR, ex.getMessage()); } return consumerInfo; } @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 ConsumerInfo getConsumerKeyAndSecret(final SecurityToken securityToken, final String serviceName, final OAuthServiceProvider provider) throws GadgetException { ConsumerInfo consumerInfo = null; try { GetConsumerInfoRequest request = new GetConsumerInfoRequest(securityToken, serviceName, provider); ServiceActionContext currentContext = new ServiceActionContext(request, null); ConsumerInfoResponse response = (ConsumerInfoResponse) actionController.execute(currentContext, getConsumerInfoAction); consumerInfo = response.getConsumerInfo(); } catch (Exception ex) { logger.error("Error occurred getting consumer info.", ex); throw new GadgetException(GadgetException.Code.INTERNAL_SERVER_ERROR, ex.getMessage()); } return consumerInfo; } @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);  }