Skip to content

Commit

Permalink
removing remaining references to 'verification', changing to 'authori…
Browse files Browse the repository at this point in the history
…zation' to conform to convention per SECOAUTH-51
  • Loading branch information
stoicflame committed Sep 6, 2011
1 parent 9e9c67a commit 28965a4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@

public abstract class TestAuthorizationCodeServicesBase {

abstract AuthorizationCodeServices getVerificationCodeServices();
abstract AuthorizationCodeServices getAuthorizationCodeServices();

@Test
public void testCreateVerificationCode() {
public void testCreateAuthorizationCode() {
UnconfirmedAuthorizationCodeAuthenticationTokenHolder expectedAuthentication = new UnconfirmedAuthorizationCodeAuthenticationTokenHolder(
new UnconfirmedAuthorizationCodeAuthenticationToken("id", null, null, null), new TestAuthentication(
"test2", false));
String code = getVerificationCodeServices().createAuthorizationCode(expectedAuthentication);
String code = getAuthorizationCodeServices().createAuthorizationCode(expectedAuthentication);
assertNotNull(code);

UnconfirmedAuthorizationCodeAuthenticationTokenHolder actualAuthentication = getVerificationCodeServices()
UnconfirmedAuthorizationCodeAuthenticationTokenHolder actualAuthentication = getAuthorizationCodeServices()
.consumeAuthorizationCode(code);
assertEquals(expectedAuthentication, actualAuthentication);
}
Expand All @@ -34,15 +34,15 @@ public void testConsumeRemovesCode() {
UnconfirmedAuthorizationCodeAuthenticationTokenHolder expectedAuthentication = new UnconfirmedAuthorizationCodeAuthenticationTokenHolder(
new UnconfirmedAuthorizationCodeAuthenticationToken("id", null, null, null), new TestAuthentication(
"test2", false));
String code = getVerificationCodeServices().createAuthorizationCode(expectedAuthentication);
String code = getAuthorizationCodeServices().createAuthorizationCode(expectedAuthentication);
assertNotNull(code);

UnconfirmedAuthorizationCodeAuthenticationTokenHolder actualAuthentication = getVerificationCodeServices()
UnconfirmedAuthorizationCodeAuthenticationTokenHolder actualAuthentication = getAuthorizationCodeServices()
.consumeAuthorizationCode(code);
assertEquals(expectedAuthentication, actualAuthentication);

try {
getVerificationCodeServices().consumeAuthorizationCode(code);
getAuthorizationCodeServices().consumeAuthorizationCode(code);
fail("Should have thrown exception");
} catch (InvalidGrantException e) {
// good we expected this
Expand All @@ -52,7 +52,7 @@ public void testConsumeRemovesCode() {
@Test
public void testConsumeNonExistingCode() {
try {
getVerificationCodeServices().consumeAuthorizationCode("doesnt exist");
getAuthorizationCodeServices().consumeAuthorizationCode("doesnt exist");
fail("Should have thrown exception");
} catch (InvalidGrantException e) {
// good we expected this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
package org.springframework.security.oauth2.provider.code;

import org.junit.Before;
import org.springframework.security.oauth2.provider.code.AuthorizationCodeServices;
import org.springframework.security.oauth2.provider.code.InMemoryAuthorizationCodeServices;

public class TestInMemoryAuthorizationCodeServices extends TestAuthorizationCodeServicesBase {

private InMemoryAuthorizationCodeServices verificationCodeServices;
private InMemoryAuthorizationCodeServices authorizationCodeServices;

@Before
public void setUp() throws Exception {
verificationCodeServices = new InMemoryAuthorizationCodeServices();
verificationCodeServices.afterPropertiesSet();
authorizationCodeServices = new InMemoryAuthorizationCodeServices();
authorizationCodeServices.afterPropertiesSet();
}

@Override
AuthorizationCodeServices getVerificationCodeServices() {
return verificationCodeServices;
AuthorizationCodeServices getAuthorizationCodeServices() {
return authorizationCodeServices;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@
import org.junit.Before;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
import org.springframework.security.oauth2.provider.code.AuthorizationCodeServices;
import org.springframework.security.oauth2.provider.code.JdbcAuthorizationCodeServices;

public class TestJdbcAuthorizationCodeServices extends TestAuthorizationCodeServicesBase {
private JdbcAuthorizationCodeServices verificationCodeServices;
private JdbcAuthorizationCodeServices authorizationCodeServices;
private EmbeddedDatabase db;

@Before
public void setUp() throws Exception {
// creates a HSQL in-memory db populated from default scripts classpath:schema.sql and classpath:data.sql
db = new EmbeddedDatabaseBuilder().addDefaultScripts().build();
verificationCodeServices = new JdbcAuthorizationCodeServices(db);
verificationCodeServices.afterPropertiesSet();
authorizationCodeServices = new JdbcAuthorizationCodeServices(db);
authorizationCodeServices.afterPropertiesSet();
}

@After
Expand All @@ -25,7 +23,7 @@ public void tearDown() throws Exception {
}

@Override
AuthorizationCodeServices getVerificationCodeServices() {
return verificationCodeServices;
AuthorizationCodeServices getAuthorizationCodeServices() {
return authorizationCodeServices;
}
}

0 comments on commit 28965a4

Please sign in to comment.