@Test public void testSuccessfulEntryToDto() { OAuthEntry entry = new OAuthEntry(); entry.setAppId("appid"); entry.setAuthorized(true); entry.setCallbackToken("callbacktoken"); entry.setCallbackTokenAttempts(0); entry.setCallbackUrl("callbackurl"); entry.setCallbackUrlSigned(true); entry.setConsumerKey("testkey"); entry.setContainer("container"); entry.setDomain("domain"); entry.setIssueTime(new Date()); entry.setOauthVersion("1.0"); entry.setToken("token"); entry.setTokenSecret("secret"); entry.setType(Type.ACCESS); entry.setUserId("userId"); context.checking(new Expectations() { { oneOf(mapper).execute("testkey"); will(returnValue(new OAuthConsumer(null, null, "testkey", null, null))); } }); OAuthDomainEntry dto = sut.convertToEntryDTO(entry); assertEquals(entry.getAppId(), dto.getAppId()); assertEquals(entry.isAuthorized(), dto.isAuthorized()); assertEquals(entry.getCallbackToken(), dto.getCallbackToken()); assertEquals(entry.getCallbackTokenAttempts(), dto.getCallbackTokenAttempts()); assertEquals(entry.getCallbackUrl(), dto.getCallbackUrl()); assertEquals(entry.isCallbackUrlSigned(), dto.isCallbackUrlSigned()); assertEquals(entry.getConsumerKey(), dto.getConsumer().getConsumerKey()); assertEquals(entry.getContainer(), dto.getContainer()); assertEquals(entry.getDomain(), dto.getDomain()); assertEquals(entry.getIssueTime(), dto.getIssueTime()); assertEquals(entry.getOauthVersion(), dto.getOauthVersion()); assertEquals(entry.getToken(), dto.getToken()); assertEquals(entry.getTokenSecret(), dto.getTokenSecret()); assertEquals(entry.getType(), Type.valueOf(dto.getType())); assertEquals(entry.getUserId(), dto.getUserId()); context.assertIsSatisfied(); }
public OAuthDomainEntry convertToEntryDTO(final OAuthEntry entry) { OAuthDomainEntry dto = new OAuthDomainEntry(); dto.setAppId(entry.getAppId()); dto.setAuthorized(entry.isAuthorized()); dto.setCallbackToken(entry.getCallbackToken()); dto.setCallbackTokenAttempts(entry.getCallbackTokenAttempts()); dto.setCallbackUrl(entry.getCallbackUrl()); dto.setCallbackUrlSigned(entry.isCallbackUrlSigned()); dto.setConsumer(mapper.execute(entry.getConsumerKey())); dto.setContainer(entry.getContainer()); dto.setDomain(entry.getDomain()); dto.setIssueTime(entry.getIssueTime()); dto.setOauthVersion(entry.getOauthVersion()); dto.setToken(entry.getToken()); dto.setTokenSecret(entry.getTokenSecret()); dto.setType(entry.getType().toString()); dto.setUserId(entry.getUserId()); return dto; }
OAuthEntryConversionStrategy { public OAuthDomainEntry convertToEntryDTO(final OAuthEntry entry) { OAuthDomainEntry dto = new OAuthDomainEntry(); dto.setAppId(entry.getAppId()); dto.setAuthorized(entry.isAuthorized()); dto.setCallbackToken(entry.getCallbackToken()); dto.setCallbackTokenAttempts(entry.getCallbackTokenAttempts()); dto.setCallbackUrl(entry.getCallbackUrl()); dto.setCallbackUrlSigned(entry.isCallbackUrlSigned()); dto.setConsumer(mapper.execute(entry.getConsumerKey())); dto.setContainer(entry.getContainer()); dto.setDomain(entry.getDomain()); dto.setIssueTime(entry.getIssueTime()); dto.setOauthVersion(entry.getOauthVersion()); dto.setToken(entry.getToken()); dto.setTokenSecret(entry.getTokenSecret()); dto.setType(entry.getType().toString()); dto.setUserId(entry.getUserId()); return dto; } }
OAuthEntryConversionStrategy { public OAuthDomainEntry convertToEntryDTO(final OAuthEntry entry) { OAuthDomainEntry dto = new OAuthDomainEntry(); dto.setAppId(entry.getAppId()); dto.setAuthorized(entry.isAuthorized()); dto.setCallbackToken(entry.getCallbackToken()); dto.setCallbackTokenAttempts(entry.getCallbackTokenAttempts()); dto.setCallbackUrl(entry.getCallbackUrl()); dto.setCallbackUrlSigned(entry.isCallbackUrlSigned()); dto.setConsumer(mapper.execute(entry.getConsumerKey())); dto.setContainer(entry.getContainer()); dto.setDomain(entry.getDomain()); dto.setIssueTime(entry.getIssueTime()); dto.setOauthVersion(entry.getOauthVersion()); dto.setToken(entry.getToken()); dto.setTokenSecret(entry.getTokenSecret()); dto.setType(entry.getType().toString()); dto.setUserId(entry.getUserId()); return dto; } OAuthEntryConversionStrategy(final DomainMapper<String, OAuthConsumer> inMapper); }
OAuthEntryConversionStrategy { public OAuthDomainEntry convertToEntryDTO(final OAuthEntry entry) { OAuthDomainEntry dto = new OAuthDomainEntry(); dto.setAppId(entry.getAppId()); dto.setAuthorized(entry.isAuthorized()); dto.setCallbackToken(entry.getCallbackToken()); dto.setCallbackTokenAttempts(entry.getCallbackTokenAttempts()); dto.setCallbackUrl(entry.getCallbackUrl()); dto.setCallbackUrlSigned(entry.isCallbackUrlSigned()); dto.setConsumer(mapper.execute(entry.getConsumerKey())); dto.setContainer(entry.getContainer()); dto.setDomain(entry.getDomain()); dto.setIssueTime(entry.getIssueTime()); dto.setOauthVersion(entry.getOauthVersion()); dto.setToken(entry.getToken()); dto.setTokenSecret(entry.getTokenSecret()); dto.setType(entry.getType().toString()); dto.setUserId(entry.getUserId()); return dto; } OAuthEntryConversionStrategy(final DomainMapper<String, OAuthConsumer> inMapper); OAuthDomainEntry convertToEntryDTO(final OAuthEntry entry); OAuthEntry convertToEntry(final OAuthDomainEntry dto); }
OAuthEntryConversionStrategy { public OAuthDomainEntry convertToEntryDTO(final OAuthEntry entry) { OAuthDomainEntry dto = new OAuthDomainEntry(); dto.setAppId(entry.getAppId()); dto.setAuthorized(entry.isAuthorized()); dto.setCallbackToken(entry.getCallbackToken()); dto.setCallbackTokenAttempts(entry.getCallbackTokenAttempts()); dto.setCallbackUrl(entry.getCallbackUrl()); dto.setCallbackUrlSigned(entry.isCallbackUrlSigned()); dto.setConsumer(mapper.execute(entry.getConsumerKey())); dto.setContainer(entry.getContainer()); dto.setDomain(entry.getDomain()); dto.setIssueTime(entry.getIssueTime()); dto.setOauthVersion(entry.getOauthVersion()); dto.setToken(entry.getToken()); dto.setTokenSecret(entry.getTokenSecret()); dto.setType(entry.getType().toString()); dto.setUserId(entry.getUserId()); return dto; } OAuthEntryConversionStrategy(final DomainMapper<String, OAuthConsumer> inMapper); OAuthDomainEntry convertToEntryDTO(final OAuthEntry entry); OAuthEntry convertToEntry(final OAuthDomainEntry dto);  }