@Test public void testRemoveToken() throws Exception { context.checking(new Expectations() { { oneOf(actionContext).getParams(); will(returnValue(new RemoveConsumerTokenRequest(securityToken, consumerInfo, "serviceName", "tokenName"))); OAuthConsumer consumer = new OAuthConsumer("", "", "", "", ""); OAuthToken token = new OAuthToken(consumer, "", "", "", ""); token.setTokenExpireMillis(0L); oneOf(securityToken).getAppUrl(); will(returnValue("http: oneOf(securityToken).getViewerId(); will(returnValue("123")); oneOf(securityToken).getOwnerId(); will(returnValue("456")); oneOf(consumerMapper).execute(with(any(OAuthConsumerRequest.class))); will(returnValue(new OAuthConsumer("", "", "", "", ""))); oneOf(tokenDeleteMapper).execute(with(any(OAuthTokenRequest.class))); } }); sut.execute(actionContext); context.assertIsSatisfied(); }
@Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { RemoveConsumerTokenRequest request = (RemoveConsumerTokenRequest) inActionContext.getParams(); SecurityToken securityToken = request.getSecurityToken(); OAuthConsumer consumer = consumerMapper.execute(new OAuthConsumerRequest(request.getServiceName(), securityToken.getAppUrl())); if (consumer != null) { tokenDeleteMapper.execute(new OAuthTokenRequest(consumer, securityToken.getViewerId(), securityToken .getOwnerId())); } else { throw new ExecutionException("OAuth Consumer was not found."); } return null; }
RemoveConsumerTokenExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { RemoveConsumerTokenRequest request = (RemoveConsumerTokenRequest) inActionContext.getParams(); SecurityToken securityToken = request.getSecurityToken(); OAuthConsumer consumer = consumerMapper.execute(new OAuthConsumerRequest(request.getServiceName(), securityToken.getAppUrl())); if (consumer != null) { tokenDeleteMapper.execute(new OAuthTokenRequest(consumer, securityToken.getViewerId(), securityToken .getOwnerId())); } else { throw new ExecutionException("OAuth Consumer was not found."); } return null; } }
RemoveConsumerTokenExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { RemoveConsumerTokenRequest request = (RemoveConsumerTokenRequest) inActionContext.getParams(); SecurityToken securityToken = request.getSecurityToken(); OAuthConsumer consumer = consumerMapper.execute(new OAuthConsumerRequest(request.getServiceName(), securityToken.getAppUrl())); if (consumer != null) { tokenDeleteMapper.execute(new OAuthTokenRequest(consumer, securityToken.getViewerId(), securityToken .getOwnerId())); } else { throw new ExecutionException("OAuth Consumer was not found."); } return null; } RemoveConsumerTokenExecution(final DomainMapper<OAuthConsumerRequest, OAuthConsumer> inConsumerMapper, // \n
            final DomainMapper<OAuthTokenRequest, Boolean> inTokenDeleteMapper); }
RemoveConsumerTokenExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { RemoveConsumerTokenRequest request = (RemoveConsumerTokenRequest) inActionContext.getParams(); SecurityToken securityToken = request.getSecurityToken(); OAuthConsumer consumer = consumerMapper.execute(new OAuthConsumerRequest(request.getServiceName(), securityToken.getAppUrl())); if (consumer != null) { tokenDeleteMapper.execute(new OAuthTokenRequest(consumer, securityToken.getViewerId(), securityToken .getOwnerId())); } else { throw new ExecutionException("OAuth Consumer was not found."); } return null; } RemoveConsumerTokenExecution(final DomainMapper<OAuthConsumerRequest, OAuthConsumer> inConsumerMapper, // \n
            final DomainMapper<OAuthTokenRequest, Boolean> inTokenDeleteMapper); @Override Serializable execute(final PrincipalActionContext inActionContext); }
RemoveConsumerTokenExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { RemoveConsumerTokenRequest request = (RemoveConsumerTokenRequest) inActionContext.getParams(); SecurityToken securityToken = request.getSecurityToken(); OAuthConsumer consumer = consumerMapper.execute(new OAuthConsumerRequest(request.getServiceName(), securityToken.getAppUrl())); if (consumer != null) { tokenDeleteMapper.execute(new OAuthTokenRequest(consumer, securityToken.getViewerId(), securityToken .getOwnerId())); } else { throw new ExecutionException("OAuth Consumer was not found."); } return null; } RemoveConsumerTokenExecution(final DomainMapper<OAuthConsumerRequest, OAuthConsumer> inConsumerMapper, // \n
            final DomainMapper<OAuthTokenRequest, Boolean> inTokenDeleteMapper); @Override Serializable execute(final PrincipalActionContext inActionContext);  }