View Javadoc

    1   package org.archive.crawler.url.canonicalize;
    2
    3   import org.apache.commons.httpclient.URIException;
    4   import org.archive.net.UURIFactory;
    5
    6   import junit.framework.TestCase;
    7
    8   public class StripSessionCFIDsTest extends TestCase {
    9       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
    23      private static final String [] OUTPUTS = {
    24          "http://a.b.c/boo?dtstamp=22%2F08%2F2006%7C06%3A58%3A11",
    25          "http://a.b.c/boo?dt=19_08_2006_22_39_28",
    26          "http://a.b.c/boo?r=468710288378&m=forgotten",
    27          "http://a.b.c/boo?",
    28          "http://a.b.c/boo?requestID=200608200458360%2E39414378"
    29      };
    30
    31      public void testCanonicalize() throws URIException {
    32          for (int i = 0; i < INPUTS.length; i++) {
    33              String result = (new StripSessionCFIDs(INPUTS[i])).
    34                  canonicalize(INPUTS[i], UURIFactory.getInstance(INPUTS[i]));
    35              assertEquals(result, OUTPUTS[i]);
    36          }
    37      }
    38  }