Skip to content

Commit

Permalink
fixed test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
SavvasMisaghMoayyed committed Nov 29, 2015
1 parent 0f0f8ce commit 76b1949
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,11 @@ protected final Event doExecute(final RequestContext context) {
}

try {
WebUtils.putTicketGrantingTicketInScopes(
context,
this.centralAuthenticationService
.createTicketGrantingTicket(credential));
WebUtils.putTicketGrantingTicketInScopes(context, this.centralAuthenticationService.createTicketGrantingTicket(credential));
onSuccess(context, credential);
return success();
} catch (final Exception e) {
logger.warn(e.getMessage(), e);
onError(context, credential);
return error();
}
Expand Down
9 changes: 9 additions & 0 deletions cas-server-support-trusted/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@ dependencies {
exclude(module: 'spring-expression')
exclude(module: 'spring-webmvc')
}
testCompile(group: 'org.hibernate', name: 'hibernate-validator', version:hibernateValidatorVersion) {
exclude(module: 'slf4j-api')
exclude(module: 'jboss-logging')
exclude(module: 'xml-apis')
}
testCompile project(':cas-server-core')
testCompile project(':cas-server-core-tickets')
testCompile project(':cas-server-core-logout')
testCompile project(':cas-server-core-monitor')
testCompile project(path: ":cas-server-core-authentication", configuration: "tests")
testCompile project(path: ":cas-server-core", configuration: "tests")
}



Empty file.
Binary file not shown.
3 changes: 3 additions & 0 deletions cas-server-support-x509/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,7 @@ dependencies {
testCompile project(':cas-server-core-logout')
testCompile project(':cas-server-core-services')
testCompile project(':cas-server-core')
testCompile project(':cas-server-core-monitor')
testCompile project(path: ":cas-server-core-authentication", configuration: "tests")
testCompile project(path: ":cas-server-core", configuration: "tests")
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.jasig.cas.adaptors.x509.authentication.principal;

import org.jasig.cas.AbstractCentralAuthenticationServiceTests;

import java.math.BigInteger;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
Expand All @@ -19,13 +21,11 @@
* @author Marvin S. Addison
* @since 3.0.0
*/
public abstract class AbstractX509CertificateTests {
public abstract class AbstractX509CertificateTests extends AbstractCentralAuthenticationServiceTests {

public static final X509Certificate VALID_CERTIFICATE = new CasX509Certificate(
true);
public static final X509Certificate VALID_CERTIFICATE = new CasX509Certificate(true);

public static final X509Certificate INVALID_CERTIFICATE = new CasX509Certificate(
false);
public static final X509Certificate INVALID_CERTIFICATE = new CasX509Certificate(false);

protected static class CasX509Certificate extends X509Certificate {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
package org.jasig.cas.adaptors.x509.web.flow;

import org.jasig.cas.CentralAuthenticationServiceImpl;
import org.jasig.cas.AbstractCentralAuthenticationService;
import org.jasig.cas.adaptors.x509.authentication.handler.support.X509CredentialsAuthenticationHandler;
import org.jasig.cas.adaptors.x509.authentication.principal.AbstractX509CertificateTests;
import org.jasig.cas.adaptors.x509.authentication.principal.X509SerialNumberPrincipalResolver;
import org.jasig.cas.authentication.AuthenticationHandler;
import org.jasig.cas.authentication.AuthenticationManager;
import org.jasig.cas.authentication.PolicyBasedAuthenticationManager;
import org.jasig.cas.authentication.principal.PrincipalResolver;
import org.jasig.cas.logout.LogoutManager;
import org.jasig.cas.services.ServicesManager;
import org.jasig.cas.ticket.DefaultTicketFactory;
import org.jasig.cas.ticket.registry.DefaultTicketRegistry;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletContext;
Expand All @@ -25,7 +20,6 @@
import java.util.Collections;

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;

/**
* @author Marvin S. Addison
Expand All @@ -46,12 +40,10 @@ public void setUp() throws Exception {
Collections.<AuthenticationHandler, PrincipalResolver>singletonMap(
handler, new X509SerialNumberPrincipalResolver()));

final CentralAuthenticationServiceImpl centralAuthenticationService = new CentralAuthenticationServiceImpl(
new DefaultTicketRegistry(), authenticationManager, new DefaultTicketFactory(),
mock(ServicesManager.class), mock(LogoutManager.class));
centralAuthenticationService.setApplicationEventPublisher(mock(ApplicationEventPublisher.class));
final AbstractCentralAuthenticationService centralAuthenticationService = (AbstractCentralAuthenticationService)
getCentralAuthenticationService();
centralAuthenticationService.setAuthenticationManager(authenticationManager);
this.action.setCentralAuthenticationService(centralAuthenticationService);
this.action.afterPropertiesSet();
}

@Test
Expand Down

0 comments on commit 76b1949

Please sign in to comment.