|
1
|
|
/*
|
|
2
|
|
* Angkor Web Framework
|
|
3
|
|
*
|
|
4
|
|
* Distributable under LGPL license.
|
|
5
|
|
* See terms of license at gnu.org.
|
|
6
|
|
*/
|
|
7
|
|
|
|
8
|
|
package com.tirsen.angkor.test.unit.mock;
|
|
9
|
|
|
|
10
|
|
import junit.framework.Assert;
|
|
11
|
|
import org.apache.commons.logging.Log;
|
|
12
|
|
import org.apache.commons.logging.LogFactory;
|
|
13
|
|
|
|
14
|
|
import javax.servlet.FilterChain;
|
|
15
|
|
import javax.servlet.ServletException;
|
|
16
|
|
import javax.servlet.ServletRequest;
|
|
17
|
|
import javax.servlet.ServletResponse;
|
|
18
|
|
import java.io.IOException;
|
|
19
|
|
|
|
20
|
|
/**
|
|
21
|
|
* TODO document MockFilterChain
|
|
22
|
|
*
|
|
23
|
|
* <!-- $Id: MockFilterChain.java,v 1.3 2002/10/09 21:37:37 tirsen Exp $ -->
|
|
24
|
|
*
|
|
25
|
|
* @author $Author: tirsen $
|
|
26
|
|
* @version $Revision: 1.3 $
|
|
27
|
|
*/
|
|
28
|
|
public class MockFilterChain implements FilterChain
|
|
29
|
|
{
|
|
30
|
|
private static Log logger = LogFactory.getLog(MockFilterChain.class);
|
|
31
|
|
|
|
32
|
|
private boolean hasBeenExecuted = false;
|
|
33
|
|
|
|
34
|
1
|
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse) throws IOException, ServletException
|
|
35
|
|
{
|
|
36
|
1
|
Assert.assertFalse("doFilter executed twice", hasBeenExecuted);
|
|
37
|
1
|
hasBeenExecuted = true;
|
|
38
|
|
}
|
|
39
|
|
|
|
40
|
1
|
public void assertExecuted()
|
|
41
|
|
{
|
|
42
|
1
|
Assert.assertTrue(hasBeenExecuted);
|
|
43
|
|
}
|
|
44
|
|
}
|
|
45
|
|
|