Skip to content

Commit

Permalink
Merge branch 'master' into json-serialization-ldapmapper
Browse files Browse the repository at this point in the history
Conflicts:
	cas-server-core/src/test/java/org/jasig/cas/services/JsonServiceRegistryDaoTests.java
  • Loading branch information
SavvasMisaghMoayyed committed Dec 1, 2014
2 parents 411c3e9 + d9b46f1 commit 6a647c6
Show file tree
Hide file tree
Showing 264 changed files with 1,344 additions and 1,243 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
* Unit test to verify Spring context wiring.
*
* @author Middleware Services
* @since 3.0.0
*/
public class WiringTests {
private XmlWebApplicationContext applicationContext;
Expand All @@ -58,7 +59,7 @@ public ClassLoader getClassLoader() {
}

@Test
public void testWiring() throws Exception {
public void verifyWiring() throws Exception {
assertTrue(applicationContext.getBeanDefinitionCount() > 0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

import org.jasig.cas.authentication.principal.Service;

/**
* @author Marvin S. Addison
* @since 3.4.0
*/
public class MockRegisteredService extends AbstractRegisteredService {
private static final long serialVersionUID = 4036877894594884813L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void setUp() throws Exception {
}

@Test
public void testDeleteService() {
public void verifyDeleteService() {
final RegisteredServiceImpl r = new RegisteredServiceImpl();
r.setId(1200);
r.setName("name");
Expand All @@ -67,7 +67,7 @@ public void testDeleteService() {
assertEquals("name", modelAndView.getModelMap().get("serviceName"));
}

public void testDeleteServiceNoService() {
public void verifyDeleteServiceNoService() {

final ModelAndView modelAndView = this.controller.deleteRegisteredService(1200);
assertNotNull(modelAndView);
Expand All @@ -76,7 +76,7 @@ public void testDeleteServiceNoService() {
assertEquals("", modelAndView.getModelMap().get("serviceName"));
}

public void testManage() {
public void verifyManage() {
final RegisteredServiceImpl r = new RegisteredServiceImpl();
r.setId(1200);
r.setName("name");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.jasig.cas.services.AbstractRegisteredService;
import org.jasig.cas.services.DefaultServicesManagerImpl;
import org.jasig.cas.services.InMemoryServiceRegistryDaoImpl;
Expand Down Expand Up @@ -76,7 +77,7 @@ public void setUp() throws Exception {
}

@Test
public void testAddRegisteredServiceNoValues() throws Exception {
public void verifyAddRegisteredServiceNoValues() throws Exception {
final BindingResult result = mock(BindingResult.class);
when(result.getModel()).thenReturn(new HashMap<String, Object>());
when(result.hasErrors()).thenReturn(true);
Expand All @@ -88,7 +89,7 @@ public void testAddRegisteredServiceNoValues() throws Exception {
}

@Test
public void testAddRegisteredServiceWithValues() throws Exception {
public void verifyAddRegisteredServiceWithValues() throws Exception {
final RegisteredServiceImpl svc = new RegisteredServiceImpl();
svc.setDescription("description");
svc.setServiceId("serviceId");
Expand All @@ -106,7 +107,7 @@ public void testAddRegisteredServiceWithValues() throws Exception {
}

@Test
public void testEditRegisteredServiceWithValues() throws Exception {
public void verifyEditRegisteredServiceWithValues() throws Exception {
final RegisteredServiceImpl r = new RegisteredServiceImpl();
r.setId(1000);
r.setName("Test Service");
Expand All @@ -131,7 +132,7 @@ public void testEditRegisteredServiceWithValues() throws Exception {
}

@Test
public void testAddRegexRegisteredService() throws Exception {
public void verifyAddRegexRegisteredService() throws Exception {
final RegexRegisteredService svc = new RegexRegisteredService();
svc.setDescription("description");
svc.setServiceId("^serviceId");
Expand All @@ -149,7 +150,7 @@ public void testAddRegexRegisteredService() throws Exception {
}

@Test
public void testChangingServicePatternAndType() throws Exception {
public void verifyChangingServicePatternAndType() throws Exception {
final AbstractRegisteredService svc = new RegexRegisteredService();
svc.setDescription("description");
svc.setServiceId("serviceId");
Expand Down Expand Up @@ -181,7 +182,7 @@ public void testChangingServicePatternAndType() throws Exception {


@Test
public void testAddMultipleRegisteredServiceTypes() throws Exception {
public void verifyAddMultipleRegisteredServiceTypes() throws Exception {
AbstractRegisteredService svc = new RegexRegisteredService();
svc.setDescription("description");
svc.setServiceId("^serviceId");
Expand All @@ -203,16 +204,16 @@ public void testAddMultipleRegisteredServiceTypes() throws Exception {
final Collection<RegisteredService> services = this.manager.getAllServices();
assertEquals(2, services.size());
for(RegisteredService rs : this.manager.getAllServices()) {
if(rs.getName().equals("ant")) {
if(StringUtils.equals(rs.getName(), "ant")) {
assertTrue(rs instanceof RegisteredServiceImpl);
}else if (rs.getName().equals("regex")) {
}else if (StringUtils.equals(rs.getName(), "regex")) {
assertTrue(rs instanceof RegexRegisteredService);
}
}
}

@Test
public void testAddMockRegisteredService() throws Exception {
public void verifyAddMockRegisteredService() throws Exception {
final MockRegisteredService svc = new MockRegisteredService();
svc.setDescription("description");
svc.setServiceId("^serviceId");
Expand All @@ -230,7 +231,7 @@ public void testAddMockRegisteredService() throws Exception {
}

@Test
public void testEmptyServiceWithModelAttributesRestored() throws Exception {
public void verifyEmptyServiceWithModelAttributesRestored() throws Exception {
final BindingResult result = mock(BindingResult.class);
when(result.getModel()).thenReturn(new HashMap<String, Object>());
when(result.hasErrors()).thenReturn(true);
Expand All @@ -250,7 +251,7 @@ public void testEmptyServiceWithModelAttributesRestored() throws Exception {


@Test
public void testEditMockRegisteredService() throws Exception {
public void verifyEditMockRegisteredService() throws Exception {
final MockRegisteredService r = new MockRegisteredService();
r.setId(1000);
r.setName("Test Service");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
/**
* Integration tests for the management webapp.
* @author Misagh Moayyed
* @since 4.0.0
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:*Context.xml")
Expand All @@ -60,7 +61,7 @@ public void setup() {
}

@Test
public void testUpdateServiceSuccessfully() throws Exception {
public void verifyUpdateServiceSuccessfully() throws Exception {
final ModelAndView mv = this.mvc.perform(get("/updateRegisteredServiceEvaluationOrder.html")
.param("id", "0").param("evaluationOrder", "200"))
.andExpect(status().isOk())
Expand All @@ -70,14 +71,14 @@ public void testUpdateServiceSuccessfully() throws Exception {
}

@Test(expected = NestedServletException.class)
public void testUpdateNonExistingService() throws Exception {
public void verifyUpdateNonExistingService() throws Exception {
this.mvc.perform(get("/updateRegisteredServiceEvaluationOrder.html")
.param("id", "100").param("evaluationOrder", "200"))
.andExpect(status().isBadRequest());
}

@Test
public void testDeleteServiceSuccessfully() throws Exception {
public void verifyDeleteServiceSuccessfully() throws Exception {
final ModelAndView mv = this.mvc.perform(get("/deleteRegisteredService.html").param("id", "0"))
.andExpect(status().isFound())
.andReturn().getModelAndView();
Expand All @@ -87,7 +88,7 @@ public void testDeleteServiceSuccessfully() throws Exception {
}

@Test
public void testDeleteNonExistingService() throws Exception {
public void verifyDeleteNonExistingService() throws Exception {
final ModelAndView mv = this.mvc.perform(get("/deleteRegisteredService.html").param("id", "100"))
.andExpect(status().isFound())
.andReturn().getModelAndView();
Expand All @@ -97,13 +98,13 @@ public void testDeleteNonExistingService() throws Exception {
}

@Test
public void testDeleteServiceByInvalidId() throws Exception {
public void verifyDeleteServiceByInvalidId() throws Exception {
this.mvc.perform(get("/deleteRegisteredService.html").param("id", "invalid"))
.andExpect(status().isBadRequest());
}

@Test
public void testDeleteServiceByLargeId() throws Exception {
public void verifyDeleteServiceByLargeId() throws Exception {
this.mvc.perform(get("/deleteRegisteredService.html").param("id", String.valueOf(Double.MAX_VALUE)))
.andExpect(status().isBadRequest());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,34 +61,34 @@ private RegisteredServiceValidator getValidator(final boolean returnValue) {
}

@Test
public void testIdExists() {
public void verifyIdExists() {
checkId(true, 1, "test");
}

@Test
public void testIdDoesNotExist() {
public void verifyIdDoesNotExist() {
checkId(false, 0, "test");
}

@Test
public void testIdDoesNotExist2() {
public void verifyIdDoesNotExist2() {
checkId(true, 0, "test2");
}

@Test
public void testIdDoesNotExist3() {
public void verifyIdDoesNotExist3() {
checkId(true, 1, "test");
}

@Test
public void testSupports() {
public void verifySupports() {
final Validator validator = getValidator(false);
assertTrue(validator.supports(RegisteredServiceImpl.class));
assertFalse(validator.supports(Object.class));
}

@Test
public void testMaxLength() {
public void verifyMaxLength() {
final RegisteredServiceImpl impl = new RegisteredServiceImpl();
impl.setServiceId("test");
impl.setDescription("fasdfdsafsafsafdsa");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ protected final String getProxyCallbackUrl() {
return getProperties().getProperty(PROXY_RECEPTOR_URL_PROPERTY);
}

public void testNoParameters() {
public void verifyNoParameters() {
beginAt(getValidationPath());
assertTextPresent("cas:authenticationFailure");

// TODO actually test the validation response XML.
}

public void testBadServiceTicket() throws UnsupportedEncodingException {
public void verifyBadServiceTicket() throws UnsupportedEncodingException {
final String service = getServiceUrl();
beginAt(getValidationPath() + "?service=" + URLEncoder.encode(service, "UTF-8") + "&ticket=test");

Expand All @@ -80,7 +80,7 @@ public void testBadServiceTicket() throws UnsupportedEncodingException {
* not multiply validatable.
* @throws IOException
*/
public void testProperCredentialsAndServiceTicket() throws IOException {
public void verifyProperCredentialsAndServiceTicket() throws IOException {
final String service = getServiceUrl();
final String encodedService = URLEncoder.encode(service, "UTF-8");
beginAt("/login?service=" + encodedService);
Expand Down Expand Up @@ -120,7 +120,7 @@ public void testProperCredentialsAndServiceTicket() throws IOException {
* validation succeeds.
* @throws IOException
*/
public void testRenew() throws IOException {
public void verifyRenew() throws IOException {
final String service = getServiceUrl();
final String encodedService = URLEncoder.encode(service, "UTF-8");
beginAt("/login?renew=true&service=" + encodedService);
Expand All @@ -145,7 +145,7 @@ public void testRenew() throws IOException {
* Test a couple renew=true logins...
* @throws IOException
*/
public void testMultipleRenew() throws IOException {
public void verifyMultipleRenew() throws IOException {
final String service = getServiceUrl();
final String encodedService = URLEncoder.encode(service, "UTF-8");

Expand Down Expand Up @@ -193,7 +193,7 @@ public void testMultipleRenew() throws IOException {
* though renew wasn't set then.
* @throws IOException
*/
public void testAccidentalRenew() throws IOException {
public void verifyAccidentalRenew() throws IOException {
final String service = getServiceUrl();
final String encodedService = URLEncoder.encode(service, "UTF-8");
beginAt("/login?service=" + encodedService);
Expand All @@ -220,7 +220,7 @@ public void testAccidentalRenew() throws IOException {
* vended via SSO.
* @throws IOException
*/
public void testRenewBlocksSsoValidation() throws IOException {
public void verifyRenewBlocksSsoValidation() throws IOException {

// initial authentication
final String firstService = getServiceUrl();
Expand Down Expand Up @@ -268,7 +268,7 @@ public void testRenewBlocksSsoValidation() throws IOException {
* doesn't really exist.
* @throws IOException
*/
public void testBrokenProxyCallbackUrl() throws IOException {
public void verifyBrokenProxyCallbackUrl() throws IOException {

final String service = getServiceUrl();
final String encodedService = URLEncoder.encode(service, "UTF-8");
Expand Down Expand Up @@ -298,7 +298,7 @@ public void testBrokenProxyCallbackUrl() throws IOException {

}

public void testPgtAcquisition() throws IOException {
public void verifyPgtAcquisition() throws IOException {

final String service = getServiceUrl();
final String encodedService = URLEncoder.encode(service, "UTF-8");
Expand Down Expand Up @@ -339,7 +339,7 @@ public void testPgtAcquisition() throws IOException {
* to cover this issue.
* @throws IOException
*/
public void test224() throws IOException {
public void verify224() throws IOException {

final String service = getServiceUrl();
final String encodedService = URLEncoder.encode(service, "UTF-8");
Expand Down
Loading

0 comments on commit 6a647c6

Please sign in to comment.