@Test public void testConversion() { final OAuthEntry requestEntry = new OAuthEntry(); context.checking(new Expectations() { { oneOf(actionContext).getParams(); will(returnValue(requestEntry)); oneOf(deleteMapper).execute(with(any(String.class))); oneOf(conversionStrat).convertToEntryDTO(with(any(OAuthEntry.class))); oneOf(insertMapper).execute(with(any(PersistenceRequest.class))); } }); sut.execute(actionContext); context.assertIsSatisfied(); }
@Override public OAuthEntry execute(final PrincipalActionContext inActionContext) throws ExecutionException { OAuthEntry requestEntry = (OAuthEntry) inActionContext.getParams(); OAuthEntry accessEntry = new OAuthEntry(requestEntry); accessEntry.setToken(UUID.randomUUID().toString()); accessEntry.setTokenSecret(UUID.randomUUID().toString()); accessEntry.setType(OAuthEntry.Type.ACCESS); accessEntry.setIssueTime(new Date()); deleteMapper.execute(requestEntry.getToken()); insertMapper.execute(new PersistenceRequest<OAuthDomainEntry>(conversionStrat.convertToEntryDTO(accessEntry))); return accessEntry; }
UpdateRequestToAccessTokenExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public OAuthEntry execute(final PrincipalActionContext inActionContext) throws ExecutionException { OAuthEntry requestEntry = (OAuthEntry) inActionContext.getParams(); OAuthEntry accessEntry = new OAuthEntry(requestEntry); accessEntry.setToken(UUID.randomUUID().toString()); accessEntry.setTokenSecret(UUID.randomUUID().toString()); accessEntry.setType(OAuthEntry.Type.ACCESS); accessEntry.setIssueTime(new Date()); deleteMapper.execute(requestEntry.getToken()); insertMapper.execute(new PersistenceRequest<OAuthDomainEntry>(conversionStrat.convertToEntryDTO(accessEntry))); return accessEntry; } }
UpdateRequestToAccessTokenExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public OAuthEntry execute(final PrincipalActionContext inActionContext) throws ExecutionException { OAuthEntry requestEntry = (OAuthEntry) inActionContext.getParams(); OAuthEntry accessEntry = new OAuthEntry(requestEntry); accessEntry.setToken(UUID.randomUUID().toString()); accessEntry.setTokenSecret(UUID.randomUUID().toString()); accessEntry.setType(OAuthEntry.Type.ACCESS); accessEntry.setIssueTime(new Date()); deleteMapper.execute(requestEntry.getToken()); insertMapper.execute(new PersistenceRequest<OAuthDomainEntry>(conversionStrat.convertToEntryDTO(accessEntry))); return accessEntry; } UpdateRequestToAccessTokenExecution(final DomainMapper<String, Boolean> inDomainMapper,
            final InsertMapper<OAuthDomainEntry> inInsertMapper, final OAuthEntryConversionStrategy inConversionStrat); }
UpdateRequestToAccessTokenExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public OAuthEntry execute(final PrincipalActionContext inActionContext) throws ExecutionException { OAuthEntry requestEntry = (OAuthEntry) inActionContext.getParams(); OAuthEntry accessEntry = new OAuthEntry(requestEntry); accessEntry.setToken(UUID.randomUUID().toString()); accessEntry.setTokenSecret(UUID.randomUUID().toString()); accessEntry.setType(OAuthEntry.Type.ACCESS); accessEntry.setIssueTime(new Date()); deleteMapper.execute(requestEntry.getToken()); insertMapper.execute(new PersistenceRequest<OAuthDomainEntry>(conversionStrat.convertToEntryDTO(accessEntry))); return accessEntry; } UpdateRequestToAccessTokenExecution(final DomainMapper<String, Boolean> inDomainMapper,
            final InsertMapper<OAuthDomainEntry> inInsertMapper, final OAuthEntryConversionStrategy inConversionStrat); @Override OAuthEntry execute(final PrincipalActionContext inActionContext); }
UpdateRequestToAccessTokenExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public OAuthEntry execute(final PrincipalActionContext inActionContext) throws ExecutionException { OAuthEntry requestEntry = (OAuthEntry) inActionContext.getParams(); OAuthEntry accessEntry = new OAuthEntry(requestEntry); accessEntry.setToken(UUID.randomUUID().toString()); accessEntry.setTokenSecret(UUID.randomUUID().toString()); accessEntry.setType(OAuthEntry.Type.ACCESS); accessEntry.setIssueTime(new Date()); deleteMapper.execute(requestEntry.getToken()); insertMapper.execute(new PersistenceRequest<OAuthDomainEntry>(conversionStrat.convertToEntryDTO(accessEntry))); return accessEntry; } UpdateRequestToAccessTokenExecution(final DomainMapper<String, Boolean> inDomainMapper,
            final InsertMapper<OAuthDomainEntry> inInsertMapper, final OAuthEntryConversionStrategy inConversionStrat); @Override OAuthEntry execute(final PrincipalActionContext inActionContext);  }