01: package org.archive.crawler.url.canonicalize;
02:
03: import org.apache.commons.httpclient.URIException;
04: import org.archive.net.UURIFactory;
05:
06: import junit.framework.TestCase;
07:
08: public class StripSessionCFIDsTest extends TestCase {
09: private static final String[] INPUTS = {
10: "http://a.b.c/boo?CFID=1169580&CFTOKEN=48630702"
11: + "&dtstamp=22%2F08%2F2006%7C06%3A58%3A11",
12: "http://a.b.c/boo?CFID=12412453&CFTOKEN=15501799"
13: + " &dt=19_08_2006_22_39_28",
14: "http://a.b.c/boo?CFID=14475712"
15: + " &CFTOKEN=2D89F5AF-3048-2957-DA4EE4B6B13661AB"
16: + "&r=468710288378&m=forgotten",
17: "http://a.b.c/boo?CFID=16603925"
18: + " &CFTOKEN=2AE13EEE-3048-85B0-56CEDAAB0ACA44B8",
19: "http://a.b.c/boo?CFID=4308017&CFTOKEN=63914124"
20: + "&requestID=200608200458360%2E39414378" };
21:
22: private static final String[] OUTPUTS = {
23: "http://a.b.c/boo?dtstamp=22%2F08%2F2006%7C06%3A58%3A11",
24: "http://a.b.c/boo?dt=19_08_2006_22_39_28",
25: "http://a.b.c/boo?r=468710288378&m=forgotten",
26: "http://a.b.c/boo?",
27: "http://a.b.c/boo?requestID=200608200458360%2E39414378" };
28:
29: public void testCanonicalize() throws URIException {
30: for (int i = 0; i < INPUTS.length; i++) {
31: String result = (new StripSessionCFIDs(INPUTS[i]))
32: .canonicalize(INPUTS[i], UURIFactory
33: .getInstance(INPUTS[i]));
34: assertEquals(result, OUTPUTS[i]);
35: }
36: }
37: }
|