diff --git a/cas-client-core/pom.xml b/cas-client-core/pom.xml
index eb28d0e..f9311be 100644
--- a/cas-client-core/pom.xml
+++ b/cas-client-core/pom.xml
@@ -2,7 +2,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
org.jasig.cas
- 3.1.5
+ 3.1.6
cas-client
4.0.0
diff --git a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
index 3bc7a72..3642705 100644
--- a/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
+++ b/cas-client-core/src/main/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilter.java
@@ -166,4 +166,8 @@ public class Cas20ProxyReceivingTicketValidationFilter extends AbstractTicketVal
public void setTimerTask(final TimerTask timerTask) {
this.timerTask = timerTask;
}
+
+ public void setMillisBetweenCleanUps(final int millisBetweenCleanUps) {
+ this.millisBetweenCleanUps = millisBetweenCleanUps;
+ }
}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/proxy/CleanUpListenerTest.java b/cas-client-core/src/test/java/org/jasig/cas/client/proxy/CleanUpListenerTest.java
deleted file mode 100644
index 95b57bd..0000000
--- a/cas-client-core/src/test/java/org/jasig/cas/client/proxy/CleanUpListenerTest.java
+++ /dev/null
@@ -1,125 +0,0 @@
-package org.jasig.cas.client.proxy;
-
-import java.util.Timer;
-import java.util.TimerTask;
-
-import javax.servlet.ServletContext;
-import javax.servlet.ServletContextEvent;
-
-import junit.framework.TestCase;
-
-import org.jasig.cas.client.util.MethodFlag;
-import org.springframework.mock.web.MockServletContext;
-
-/**
- * Unit test for {@link CleanUpListener}
- *
- * @author Brad Cupit (brad [at] lsu {dot} edu)
- */
-public class CleanUpListenerTest extends TestCase {
- private final Timer defaultTimer = new Timer(true);
- /*
- private final CleanUpTimerTask defaultTimerTask = new CleanUpTimerTask();
-
-
- public void testStartsThreadAtStartup() throws Exception {
- final MethodFlag scheduleMethodFlag = new MethodFlag();
-
- final Timer timer = new Timer(true) {
- public void schedule(TimerTask task, long delay, long period) {
- scheduleMethodFlag.setCalled();
- }
- };
-
- final CleanUpListener cleanUpListener = new CleanUpListener(timer, defaultTimerTask);
- cleanUpListener.contextInitialized(new TestServletContextEvent(1));
-
- assertTrue(scheduleMethodFlag.wasCalled());
- }
-
- public void testShutsDownTimerThread() throws Exception {
- final MethodFlag cancelMethodFlag = new MethodFlag();
-
- final Timer timer = new Timer(true) {
- public void cancel() {
- cancelMethodFlag.setCalled();
- super.cancel();
- }
- };
-
- final CleanUpListener cleanUpListener = new CleanUpListener(timer, defaultTimerTask);
- cleanUpListener.contextInitialized(new TestServletContextEvent(1));
- cleanUpListener.contextDestroyed(null);
-
- assertTrue(cancelMethodFlag.wasCalled());
- }
-
- public void testCallsCleanAllOnSchedule() throws Exception {
- final MethodFlag timerTaskFlag = new MethodFlag();
-
- final TimerTask timerTask = new TimerTask() {
- public void run() {
- timerTaskFlag.setCalled();
- }
- };
-
- long millisBetweenCleanUps = 250;
-
- final CleanUpListener cleanUpListener = new CleanUpListener(defaultTimer, timerTask);
- cleanUpListener.contextInitialized(new TestServletContextEvent(millisBetweenCleanUps));
-
- // wait long enough for the clean up to occur
- Thread.sleep(millisBetweenCleanUps * 2);
-
- assertTrue(timerTaskFlag.wasCalled());
- }
-
- public void testDelaysFirstCleanAll() throws Exception {
- final MethodFlag timerTaskFlag = new MethodFlag();
-
- final TimerTask timerTask = new TimerTask() {
- public void run() {
- timerTaskFlag.setCalled();
- }
- };
-
- long millisBetweenCleanUps = 250;
-
- final CleanUpListener cleanUpListener = new CleanUpListener(defaultTimer, timerTask);
- cleanUpListener.contextInitialized(new TestServletContextEvent(millisBetweenCleanUps));
-
- assertFalse(timerTaskFlag.wasCalled());
-
- // wait long enough for the clean up to occur
- Thread.sleep(millisBetweenCleanUps * 2);
-
- assertTrue(timerTaskFlag.wasCalled());
- }
-
- public void testReturnsDefaultWhenNoContextParamConfigured() throws Exception {
- final ServletContext servletContext = new MockServletContext();
-
- long millisBetweenCleanups = new CleanUpListener().getMillisBetweenCleanups(servletContext);
- assertEquals(CleanUpListener.DEFAULT_MILLIS_BETWEEN_CLEANUPS, millisBetweenCleanups);
- }
-
- public void testFailsWithInvalidNumber() throws Exception {
- final ServletContext servletContext = new MockServletContext() {
- public String getInitParameter(String name) {
- if (name.equals(CleanUpListener.MILLIS_BETWEEN_CLEANUPS_INIT_PARAM)) {
- return "not a number";
- } else {
- return null;
- }
- }
- };
-
- try {
- new CleanUpListener().getMillisBetweenCleanups(servletContext);
- fail("expected an exception");
- } catch (RuntimeException e) {
- // expected, test passes
- }
- }
- */
-}
diff --git a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilterTest.java b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilterTest.java
index 9f6df06..432bb58 100644
--- a/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilterTest.java
+++ b/cas-client-core/src/test/java/org/jasig/cas/client/validation/Cas20ProxyReceivingTicketValidationFilterTest.java
@@ -2,12 +2,119 @@ package org.jasig.cas.client.validation;
import junit.framework.TestCase;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.jasig.cas.client.proxy.CleanUpTimerTask;
+import org.jasig.cas.client.proxy.ProxyGrantingTicketStorage;
+import org.jasig.cas.client.proxy.ProxyGrantingTicketStorageImpl;
+import org.jasig.cas.client.util.MethodFlag;
+
/**
* Unit test for {@link Cas20ProxyReceivingTicketValidationFilter}
*
* @author Brad Cupit (brad [at] lsu {dot} edu)
*/
public class Cas20ProxyReceivingTicketValidationFilterTest extends TestCase {
+
+ private final Timer defaultTimer = new Timer(true);
+
+ private final ProxyGrantingTicketStorage storage = new ProxyGrantingTicketStorageImpl();
+
+ private final CleanUpTimerTask defaultTimerTask = new CleanUpTimerTask(storage);
+
+ public void testStartsThreadAtStartup() throws Exception {
+ final MethodFlag scheduleMethodFlag = new MethodFlag();
+ final Cas20ProxyReceivingTicketValidationFilter filter = newCas20ProxyReceivingTicketValidationFilter();
+
+ final Timer timer = new Timer(true) {
+ public void schedule(TimerTask task, long delay, long period) {
+ scheduleMethodFlag.setCalled();
+ }
+ };
+
+ filter.setMillisBetweenCleanUps(1);
+ filter.setProxyGrantingTicketStorage(storage);
+ filter.setTimer(timer);
+ filter.setTimerTask(defaultTimerTask);
+
+ filter.init();
+ assertTrue(scheduleMethodFlag.wasCalled());
+ }
+
+ public void testShutsDownTimerThread() throws Exception {
+ final MethodFlag cancelMethodFlag = new MethodFlag();
+ final Cas20ProxyReceivingTicketValidationFilter filter = newCas20ProxyReceivingTicketValidationFilter();
+
+ final Timer timer = new Timer(true) {
+ public void cancel() {
+ cancelMethodFlag.setCalled();
+ super.cancel();
+ }
+ };
+
+ filter.setProxyGrantingTicketStorage(storage);
+ filter.setMillisBetweenCleanUps(1);
+ filter.setTimer(timer);
+ filter.setTimerTask(defaultTimerTask);
+ filter.init();
+ filter.destroy();
+
+ assertTrue(cancelMethodFlag.wasCalled());
+ }
+
+public void testCallsCleanAllOnSchedule() throws Exception {
+ final MethodFlag timerTaskFlag = new MethodFlag();
+ final Cas20ProxyReceivingTicketValidationFilter filter = newCas20ProxyReceivingTicketValidationFilter();
+
+ final TimerTask timerTask = new TimerTask() {
+ public void run() {
+ timerTaskFlag.setCalled();
+ }
+ };
+
+ final int millisBetweenCleanUps = 250;
+ filter.setProxyGrantingTicketStorage(storage);
+ filter.setTimerTask(timerTask);
+ filter.setTimer(defaultTimer);
+ filter.setMillisBetweenCleanUps(millisBetweenCleanUps);
+
+ filter.init();
+
+ // wait long enough for the clean up to occur
+ Thread.sleep(millisBetweenCleanUps * 2);
+
+ assertTrue(timerTaskFlag.wasCalled());
+ filter.destroy();
+ }
+
+ public void testDelaysFirstCleanAll() throws Exception {
+ final MethodFlag timerTaskFlag = new MethodFlag();
+ final Cas20ProxyReceivingTicketValidationFilter filter = newCas20ProxyReceivingTicketValidationFilter();
+
+ final TimerTask timerTask = new TimerTask() {
+ public void run() {
+ timerTaskFlag.setCalled();
+ }
+ };
+
+ final int millisBetweenCleanUps = 250;
+ filter.setProxyGrantingTicketStorage(storage);
+ filter.setMillisBetweenCleanUps(millisBetweenCleanUps);
+ filter.setTimer(defaultTimer);
+ filter.setTimerTask(timerTask);
+
+ filter.init();
+
+ assertFalse(timerTaskFlag.wasCalled());
+
+ // wait long enough for the clean up to occur
+ Thread.sleep(millisBetweenCleanUps * 2);
+
+ assertTrue(timerTaskFlag.wasCalled());
+
+ filter.destroy();
+ }
public void testThrowsForNullStorage() throws Exception {
Cas20ProxyReceivingTicketValidationFilter filter = newCas20ProxyReceivingTicketValidationFilter();
diff --git a/cas-client-integration-atlassian/pom.xml b/cas-client-integration-atlassian/pom.xml
index cc38cbd..79642f7 100644
--- a/cas-client-integration-atlassian/pom.xml
+++ b/cas-client-integration-atlassian/pom.xml
@@ -2,7 +2,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
org.jasig.cas
- 3.1.5
+ 3.1.6
cas-client
4.0.0
@@ -65,13 +65,13 @@
opensymphony
propertyset
-
+
com.atlassian.confluence
confluence
- 2.7.3
+ 2.7.3
provided
diff --git a/pom.xml b/pom.xml
index f88ed7d..6a4d35c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,7 +1,7 @@
4.0.0
org.jasig.cas
- 3.1.5
+ 3.1.6
cas-client
pom
JA-SIG CAS Client for Java