* add testcase for seesionid-removal git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7333 6c8d7289-2bf4-0310-a012-ef5d649a1542pull/1/head
parent
dca9e16f51
commit
fd74bc388c
@ -0,0 +1,35 @@
|
||||
package net.yacy.cora.document;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import net.yacy.cora.document.MultiProtocolURI;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
public class MultiProtocolURITest {
|
||||
|
||||
@Test public void testSessionIdRemoval() throws MalformedURLException {
|
||||
String[][] testURIs = new String[][] {
|
||||
// meaning: original uri, stripped version
|
||||
new String[]{"http://test.de/bla.php?phpsessionid=asdf", "http://test.de/bla.php"},
|
||||
new String[]{"http://test.de/bla?phpsessionid=asdf&fdsa=asdf", "http://test.de/bla?fdsa=asdf"},
|
||||
new String[]{"http://test.de/bla?asdf=fdsa&phpsessionid=asdf", "http://test.de/bla?asdf=fdsa"},
|
||||
new String[]{"http://test.de/bla?asdf=fdsa&phpsessionid=asdf&fdsa=asdf", "http://test.de/bla?asdf=fdsa&fdsa=asdf"},
|
||||
};
|
||||
TreeSet<String> idNames = new TreeSet<String>();
|
||||
idNames.add("phpsessionid");
|
||||
|
||||
MultiProtocolURI.initSessionIDNames(idNames);
|
||||
|
||||
for (int i=0; i<testURIs.length; i++) {
|
||||
MultiProtocolURI uri = new MultiProtocolURI(testURIs[i][0]);
|
||||
|
||||
assertEquals(uri.toNormalform(true, true, true), testURIs[i][1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in new issue