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 6a5bb0a commit e4d9a44
Show file tree
Hide file tree
Showing 16 changed files with 73 additions and 70 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.jasig.cas.audit.spi;

import org.aspectj.lang.JoinPoint;
import org.jasig.cas.AbstractCentralAuthenticationServiceTest;
import org.jasig.cas.AbstractCentralAuthenticationServiceTests;
import org.jasig.cas.authentication.Credential;
import org.jasig.cas.authentication.TestUtils;
import org.jasig.cas.ticket.ServiceTicket;
Expand All @@ -21,7 +21,7 @@
* @author Misagh Moayyed
* @since 4.0.0
*/
public class TicketOrCredentialPrincipalResolverTests extends AbstractCentralAuthenticationServiceTest {
public class TicketOrCredentialPrincipalResolverTests extends AbstractCentralAuthenticationServiceTests {

@Test
public void verifyResolverByUnknownUser() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,4 +319,20 @@ protected final void evaluateProxiedServiceIfNeeded(final Service service, final
public void setApplicationEventPublisher(final ApplicationEventPublisher applicationEventPublisher) {
this.eventPublisher = applicationEventPublisher;
}

public void setTicketRegistry(final TicketRegistry ticketRegistry) {
this.ticketRegistry = ticketRegistry;
}

public void setAuthenticationManager(final AuthenticationManager authenticationManager) {
this.authenticationManager = authenticationManager;
}

public void setServicesManager(final ServicesManager servicesManager) {
this.servicesManager = servicesManager;
}

public void setLogoutManager(final LogoutManager logoutManager) {
this.logoutManager = logoutManager;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -435,4 +435,5 @@ public TicketGrantingTicket createTicketGrantingTicket(final Credential... crede
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"classpath:/core-context.xml"
})
@RunWith(SpringJUnit4ClassRunner.class)
public abstract class AbstractCentralAuthenticationServiceTest {
public abstract class AbstractCentralAuthenticationServiceTests {

protected final Logger logger = LoggerFactory.getLogger(this.getClass());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* @author Scott Battaglia
* @since 3.0.0
*/
public class CentralAuthenticationServiceImplTests extends AbstractCentralAuthenticationServiceTest {
public class CentralAuthenticationServiceImplTests extends AbstractCentralAuthenticationServiceTests {

@Test(expected = AuthenticationException.class)
public void verifyBadCredentialsOnTicketGrantingTicketCreation() throws Exception {
Expand Down
12 changes: 6 additions & 6 deletions cas-server-support-rest/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

description = 'Apereo CAS REST Implementation'
dependencies {
compile project(':cas-server-core-services')
compile project(':cas-server-core-authentication')
testCompile project(':cas-server-core-util')
testCompile project(path: ":cas-server-core-authentication", configuration: "tests")
testCompile project(path: ":cas-server-core-services", configuration: "tests")

compile project(':cas-server-core-services')
compile project(':cas-server-core-authentication')
testCompile project(':cas-server-core-util')
testCompile project(path: ":cas-server-core-authentication", configuration: "tests")
testCompile project(path: ":cas-server-core-services", configuration: "tests")
}


29 changes: 15 additions & 14 deletions cas-server-support-trusted/build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@

description = 'Apereo CAS Trusted User Support'
dependencies {

compile project(':cas-server-core-web')
compile project(':cas-server-core-authentication')
compile(group: 'org.springframework.webflow', name: 'spring-webflow', version:springWebflowVersion) {
exclude(module: 'commons-logging')
exclude(module: 'spring-context')
exclude(module: 'spring-web')
exclude(module: 'spring-beans')
exclude(module: 'spring-core')
exclude(module: 'spring-expression')
exclude(module: 'spring-webmvc')
}
testCompile project(':cas-server-core')
testCompile project(':cas-server-core-tickets')

compile project(':cas-server-core-web')
compile project(':cas-server-core-authentication')
compile(group: 'org.springframework.webflow', name: 'spring-webflow', version:springWebflowVersion) {
exclude(module: 'commons-logging')
exclude(module: 'spring-context')
exclude(module: 'spring-web')
exclude(module: 'spring-beans')
exclude(module: 'spring-core')
exclude(module: 'spring-expression')
exclude(module: 'spring-webmvc')
}
testCompile project(':cas-server-core')
testCompile project(':cas-server-core-tickets')
testCompile project(path: ":cas-server-core", configuration: "tests")
}


Original file line number Diff line number Diff line change
@@ -1,62 +1,52 @@
package org.jasig.cas.adaptors.trusted.web.flow;

import org.jasig.cas.CentralAuthenticationServiceImpl;
import org.jasig.cas.AbstractCentralAuthenticationService;
import org.jasig.cas.AbstractCentralAuthenticationServiceTests;
import org.jasig.cas.adaptors.trusted.authentication.handler.support.PrincipalBearingCredentialsAuthenticationHandler;
import org.jasig.cas.adaptors.trusted.authentication.principal.PrincipalBearingPrincipalResolver;
import org.jasig.cas.authentication.AuthenticationHandler;
import org.jasig.cas.authentication.AuthenticationManager;
import org.jasig.cas.authentication.PolicyBasedAuthenticationManager;
import org.jasig.cas.authentication.principal.DefaultPrincipalFactory;
import org.jasig.cas.authentication.principal.PrincipalResolver;
import org.jasig.cas.authentication.principal.SimpleWebApplicationServiceImpl;
import org.jasig.cas.logout.LogoutManager;
import org.jasig.cas.services.ServicesManager;
import org.jasig.cas.ticket.DefaultTicketFactory;
import org.jasig.cas.ticket.UniqueTicketIdGenerator;
import org.jasig.cas.ticket.registry.DefaultTicketRegistry;
import org.jasig.cas.util.DefaultUniqueTicketIdGenerator;
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;
import org.springframework.webflow.context.servlet.ServletExternalContext;
import org.springframework.webflow.test.MockRequestContext;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

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

/**
* @author Scott Battaglia
* @since 3.0.0.5
*
*/
public class PrincipalFromRequestRemoteUserNonInteractiveCredentialsActionTests {
public class PrincipalFromRequestRemoteUserNonInteractiveCredentialsActionTests extends AbstractCentralAuthenticationServiceTests {

private PrincipalFromRequestRemoteUserNonInteractiveCredentialsAction action;

@Before
public void setUp() throws Exception {


this.action = new PrincipalFromRequestRemoteUserNonInteractiveCredentialsAction();
this.action.setPrincipalFactory(new DefaultPrincipalFactory());

final Map<String, UniqueTicketIdGenerator> idGenerators = new HashMap<>();
idGenerators.put(SimpleWebApplicationServiceImpl.class.getName(), new DefaultUniqueTicketIdGenerator());


final AuthenticationManager authenticationManager = new PolicyBasedAuthenticationManager(
Collections.<AuthenticationHandler, PrincipalResolver>singletonMap(
new PrincipalBearingCredentialsAuthenticationHandler(),
new PrincipalBearingPrincipalResolver()));
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.setCentralAuthenticationService(centralAuthenticationService);
}

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

import org.jasig.cas.CentralAuthenticationServiceImpl;
import org.jasig.cas.AbstractCentralAuthenticationService;
import org.jasig.cas.AbstractCentralAuthenticationServiceTests;
import org.jasig.cas.adaptors.trusted.authentication.handler.support.PrincipalBearingCredentialsAuthenticationHandler;
import org.jasig.cas.adaptors.trusted.authentication.principal.PrincipalBearingPrincipalResolver;
import org.jasig.cas.authentication.AuthenticationHandler;
import org.jasig.cas.authentication.AuthenticationManager;
import org.jasig.cas.authentication.PolicyBasedAuthenticationManager;
import org.jasig.cas.authentication.principal.DefaultPrincipalFactory;
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,16 +21,16 @@
import java.util.Collections;

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

/**
* @author Scott Battaglia
* @since 3.0.5
*/
public class PrincipalFromRequestUserPrincipalNonInteractiveCredentialsActionTests {
public class PrincipalFromRequestUserPrincipalNonInteractiveCredentialsActionTests extends AbstractCentralAuthenticationServiceTests {

private PrincipalFromRequestUserPrincipalNonInteractiveCredentialsAction action;


@Before
public void setUp() throws Exception {
this.action = new PrincipalFromRequestUserPrincipalNonInteractiveCredentialsAction();
Expand All @@ -45,10 +41,9 @@ public void setUp() throws Exception {
new PrincipalBearingCredentialsAuthenticationHandler(),
new PrincipalBearingPrincipalResolver()));

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);
}

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

import org.jasig.cas.AbstractCentralAuthenticationServiceTest;
import org.jasig.cas.AbstractCentralAuthenticationServiceTests;
import org.jasig.cas.authentication.Credential;
import org.jasig.cas.services.TestUtils;
import org.jasig.cas.ticket.TicketGrantingTicket;
Expand All @@ -26,7 +26,7 @@
* @author Scott Battaglia
* @since 3.0.0.4
*/
public class AuthenticationViaFormActionTests extends AbstractCentralAuthenticationServiceTest {
public class AuthenticationViaFormActionTests extends AbstractCentralAuthenticationServiceTests {

private AuthenticationViaFormAction action;

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

import org.jasig.cas.AbstractCentralAuthenticationServiceTest;
import org.jasig.cas.AbstractCentralAuthenticationServiceTests;
import org.jasig.cas.ticket.TicketGrantingTicket;
import org.jasig.cas.web.support.WebUtils;
import org.junit.Before;
Expand All @@ -20,7 +20,7 @@
* @author Scott Battaglia
* @since 3.0.0.4
*/
public final class GenerateServiceTicketActionTests extends AbstractCentralAuthenticationServiceTest {
public final class GenerateServiceTicketActionTests extends AbstractCentralAuthenticationServiceTests {

private GenerateServiceTicketAction action;

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

import org.jasig.cas.AbstractCentralAuthenticationServiceTest;
import org.jasig.cas.AbstractCentralAuthenticationServiceTests;
import org.jasig.cas.logout.DefaultLogoutRequest;
import org.jasig.cas.logout.LogoutRequest;
import org.jasig.cas.logout.LogoutRequestStatus;
Expand Down Expand Up @@ -32,7 +32,7 @@
* @author Scott Battaglia
* @since 3.0.0
*/
public class LogoutActionTests extends AbstractCentralAuthenticationServiceTest {
public class LogoutActionTests extends AbstractCentralAuthenticationServiceTests {

private static final String COOKIE_TGC_ID = "CASTGC";

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

import org.jasig.cas.AbstractCentralAuthenticationServiceTest;
import org.jasig.cas.AbstractCentralAuthenticationServiceTests;
import org.jasig.cas.CasProtocolConstants;
import org.jasig.cas.authentication.principal.WebApplicationService;
import org.jasig.cas.ticket.TicketGrantingTicket;
Expand All @@ -23,7 +23,7 @@
* @author Marvin S. Addison
* @since 3.4.0
*/
public class SendTicketGrantingTicketActionTests extends AbstractCentralAuthenticationServiceTest {
public class SendTicketGrantingTicketActionTests extends AbstractCentralAuthenticationServiceTests {
private SendTicketGrantingTicketAction action;
private CookieRetrievingCookieGenerator ticketGrantingTicketCookieGenerator;
private MockRequestContext context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.jasig.cas.web.flow;

import org.jasig.cas.AbstractCentralAuthenticationServiceTest;
import org.jasig.cas.AbstractCentralAuthenticationServiceTests;
import org.jasig.cas.mock.MockTicketGrantingTicket;
import org.jasig.cas.ticket.TicketGrantingTicket;
import org.jasig.cas.web.support.WebUtils;
Expand All @@ -16,7 +16,7 @@
* @author Misagh Moayyed [email protected]
* @since 4.1.0
*/
public class TicketGrantingTicketCheckActionTests extends AbstractCentralAuthenticationServiceTest {
public class TicketGrantingTicketCheckActionTests extends AbstractCentralAuthenticationServiceTests {

@Test
public void verifyNullTicket() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.jasig.cas.web;

import org.jasig.cas.AbstractCentralAuthenticationServiceTest;
import org.jasig.cas.AbstractCentralAuthenticationServiceTests;
import org.jasig.cas.authentication.Credential;
import org.jasig.cas.authentication.principal.Service;
import org.jasig.cas.mock.MockValidationSpecification;
Expand All @@ -27,7 +27,7 @@
* @author Scott Battaglia
* @since 3.0.0
*/
public abstract class AbstractServiceValidateControllerTests extends AbstractCentralAuthenticationServiceTest {
public abstract class AbstractServiceValidateControllerTests extends AbstractCentralAuthenticationServiceTests {

protected AbstractServiceValidateController serviceValidateController;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.Map;

import org.jasig.cas.AbstractCentralAuthenticationServiceTest;
import org.jasig.cas.AbstractCentralAuthenticationServiceTests;
import org.jasig.cas.ticket.proxy.ProxyGrantingTicket;
import org.jasig.cas.ticket.ProxyGrantingTicketImpl;
import org.jasig.cas.ticket.support.NeverExpiresExpirationPolicy;
Expand All @@ -17,7 +17,7 @@
* @author Scott Battaglia
* @since 3.0.0
*/
public class ProxyControllerTests extends AbstractCentralAuthenticationServiceTest {
public class ProxyControllerTests extends AbstractCentralAuthenticationServiceTests {

private ProxyController proxyController;

Expand Down

0 comments on commit e4d9a44

Please sign in to comment.