Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
clean up test sources rename to current package names and move to default location
regerc8d437b69a3f
diff --git a/test/de/anomic/data/DiffTest.java b/test/de/anomic/data/DiffTest.javadeleted file mode 100644index af6706ab9..000000000--- a/test/de/anomic/data/DiffTest.java+++ /dev/null@@ -1,111 +0,0 @@-package de.anomic.data;--import junit.framework.TestCase;--public class DiffTest extends TestCase {- final static boolean _1 = true; // temporary variables to make the matrix more readable- final static boolean __ = false;-- boolean[][] matrix =- {-// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19- {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,_1,_1,_1}-,{__,__,__,__,__,__,__,__,__,__,_1,__,__,__,__,__,__,_1,_1,_1}-,{__,__,__,__,__,__,__,__,__,__,__,_1,__,__,__,__,__,_1,_1,_1}-,{__,__,__,__,__,__,__,__,__,__,__,__,_1,__,__,__,__,_1,_1,_1}-,{__,__,__,__,__,__,__,__,__,__,__,__,__,_1,__,__,__,_1,_1,_1}-,{__,__,__,__,__,__,__,__,__,__,__,__,__,__,_1,__,__,_1,_1,_1}-,{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,_1,__,_1,_1,_1}-,{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,_1,_1,_1,_1}-,{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,_1,_1,_1}-,{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,_1,_1,_1}-,{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,_1,_1,_1}-,{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,_1,_1,_1}-,{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,_1,_1,_1}-,{__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,_1,_1,_1}-,{_1,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,_1,_1,_1}-,{__,_1,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,_1,_1,_1}-,{__,__,_1,__,__,__,__,__,__,__,__,__,__,__,__,__,__,_1,_1,_1}-,{__,__,__,_1,__,__,__,__,__,__,__,__,__,__,__,__,__,_1,_1,_1}-,{__,__,__,__,_1,__,__,__,__,__,__,__,__,__,__,__,__,_1,_1,_1}-,{__,__,__,__,__,_1,__,__,__,__,__,__,__,__,__,__,__,_1,_1,_1}-,{__,__,__,__,__,__,_1,__,__,__,__,__,__,__,__,__,__,_1,_1,_1}- };-/*- boolean[][] matrix = // [x][y] // a another test matrix- {-// 0 1 2 3 4 5 // X == 6- {__,__,__,__,__,__} // 0-,{_1,__,__,__,__,__} // 1-,{__,_1,__,__,__,__} // 2-,{__,__,_1,__,__,__} // 3-,{__,__,__,_1,__,__} // 4-,{__,__,__,__,_1,__} // 5-,{__,__,__,__,__,_1} // 6- }; // Y == 7-*/- /** the old buggy version */- private static int[] findDiagonalOld(int x, int y, boolean[][] matrix, int minLength) {- int rx, ry, yy, xx, i;- // Zeilenweise nach Diagonalen mit mindest-Laenge minLength suchen- for (yy=y; yy<matrix.length; yy++)- for (xx=x; xx<matrix[yy].length; xx++)- if (matrix[yy][xx]) {- rx = xx;- ry = yy;- for (i=1; (yy + i)<matrix.length && (xx + i)<matrix[yy].length; i++)- if (!matrix[yy + i][xx + i]) break;- if (i <= minLength && yy + i < matrix.length && xx + i < matrix[yy].length) {- // vorzeitig abgebrochen => zuwenige chars in Diagonale => weitersuchen- continue;- } else {- return new int[] { rx, ry, i };- }- }- return null;- }-- /** the fixed version */- private static int[] findDiagonalNew(int x, int y, boolean[][] matrix, int minLength) {- int rx, ry, yy, xx, i;- for (yy=y; yy<matrix.length; yy++)- for (xx=x; xx<matrix[yy].length; xx++)- if (matrix[yy][xx]) { // reverse order! [y][x]- rx = xx;- ry = yy;- for (i=1; (yy + i)<matrix.length && (xx + i)<matrix[yy].length; i++)- if (!matrix[yy + i][xx + i])- break;- if (i >= minLength)- return new int[] { rx, ry, i }; // swap back the x and y axes for better readability- }- return null;- }-- public void testReplace()- {- int[] vectorOld;- int[] vectorNew;- int minLength = 6;- int x = 0;- int y = 0;-- System.out.println("matrix.length: " + matrix.length) ;- System.out.println("matrix[0].length: " + matrix[0].length) ;-- vectorOld = findDiagonalOld(x, y, matrix, minLength);- vectorNew = findDiagonalNew(x, y, matrix, minLength);-- System.out.print("vectorOld: [ ");- if (vectorOld != null)- for (int i = 0; i < vectorOld.length; i++)- System.out.print(vectorOld[i] + ", ");- System.out.println("]");-- System.out.print("vectorNew: [ ");- if (vectorNew != null)- for (int i = 0; i < vectorNew.length; i++)- System.out.print(vectorNew[i] + ", ");- System.out.println("]");- }-}\ No newline at end of filediff --git a/test/net/yacy/cora/document/id/DigestURLTest.java b/test/net/yacy/cora/document/id/DigestURLTest.javaindex a5dc2dc94..059650bac 100644--- a/test/net/yacy/cora/document/id/DigestURLTest.java+++ b/test/net/yacy/cora/document/id/DigestURLTest.java@@ -1,12 +1,12 @@package net.yacy.cora.document.id;import java.net.MalformedURLException;-import junit.framework.TestCase;+import org.junit.Test;public class DigestURLTest extends TestCase {-+ @Testpublic void testIdentPort() throws MalformedURLException {String[][] testStrings = new String[][]{new String[]{"http://www.yacy.net:", "http://www.yacy.net/"},diff --git a/test/net/yacy/cora/document/id/MultiProtocolURLTest.java b/test/net/yacy/cora/document/id/MultiProtocolURLTest.javaindex 09b50c4ac..af6f932fc 100644--- a/test/net/yacy/cora/document/id/MultiProtocolURLTest.java+++ b/test/net/yacy/cora/document/id/MultiProtocolURLTest.java@@ -79,13 +79,16 @@ public class MultiProtocolURLTest {// valid IPv6 local loopback addressestesturls.put("http://[0:0:0:0:0:0:0:1]/index.html", Boolean.TRUE);testurls.put("http://[::1]/index.html", Boolean.TRUE);+ testurls.put("http://[::1]:8090/index.html", Boolean.TRUE);+ testurls.put("http://[0::1]/index.html", Boolean.TRUE);- // test urls for issue with IPv6 misinterpretation+ // test urls for possible issue with IPv6 misinterpretationtesturls.put("http://fcedit.com", Boolean.FALSE);testurls.put("http://fdedit.com", Boolean.FALSE);+ testurls.put("http://fe8edit.com", Boolean.FALSE);// valid IPv6 examples taken from http://www.ietf.org/rfc/rfc2732.txt cap 2.- testurls.put("http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html", Boolean.FALSE);+ testurls.put("http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html", Boolean.TRUE); // ip is link-local (fe80/10)testurls.put("http://[1080:0:0:0:8:800:200C:417A]/index.html", Boolean.FALSE);testurls.put("http://[3ffe:2a00:100:7031::1]", Boolean.FALSE);testurls.put("http://[1080::8:800:200C:417A]/foo", Boolean.FALSE);@@ -98,8 +101,8 @@ public class MultiProtocolURLTest {MultiProtocolURL uri = new MultiProtocolURL(u);boolean result = uri.isLocal();- assertEquals(u, testurls.get(u), result);System.out.println ("testIsLocal: " + u + " -> " + result);+ assertEquals(u, testurls.get(u), result);}}diff --git a/test/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnectorTest.java b/test/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnectorTest.javaindex 61bbec506..5f6c0b66f 100644--- a/test/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnectorTest.java+++ b/test/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnectorTest.java@@ -44,20 +44,15 @@ public class EmbeddedSolrConnectorTest {* Test of query solr via jetty*/@Test- public void testQuery() {+ public void testQuery() throws IOException {System.out.println("adding test document to solr");SolrInputDocument doc = new SolrInputDocument();doc.addField(CollectionSchema.id.name(), "ABCD0000abcd");doc.addField(CollectionSchema.title.name(), "Lorem ipsum");doc.addField(CollectionSchema.host_s.name(), "yacy.net");doc.addField(CollectionSchema.text_t.name(), "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");- try {- solr.add(doc);- } catch (final IOException ex) {- fail("IOException adding test document to Solr");- } catch (final SolrException ex) {- fail("SolrExceptin adding test document to Solr");- }++ solr.add(doc);solr.commit(true);System.out.println("query solr");diff --git a/test/de/anomic/kelondro/util/DateFormatterTest.java b/test/net/yacy/cora/protocol/HeaderFrameworkTest.javasimilarity index 74%rename from test/de/anomic/kelondro/util/DateFormatterTest.javarename to test/net/yacy/cora/protocol/HeaderFrameworkTest.javaindex 4e8d406ac..792e67be8 100644--- a/test/de/anomic/kelondro/util/DateFormatterTest.java+++ b/test/net/yacy/cora/protocol/HeaderFrameworkTest.java@@ -1,17 +1,15 @@-package de.anomic.kelondro.util;+package net.yacy.cora.protocol;import java.util.Date;--import net.yacy.cora.protocol.HeaderFramework;--import junit.framework.TestCase;+import org.junit.Test;-public class DateFormatterTest extends TestCase {+public class HeaderFrameworkTest extends TestCase {/*** Test of httpHeader date parsing routine*/+ @Testpublic void testParseHTTPDate() {Date parsedDate = HeaderFramework.parseHTTPDate("Tue, 08 Jul 2003 21:22:46 GMT");diff --git a/test/de/anomic/document/ParserTest.java b/test/net/yacy/document/ParserTest.javasimilarity index 98%rename from test/de/anomic/document/ParserTest.javarename to test/net/yacy/document/ParserTest.javaindex 701506438..6582edbfb 100644--- a/test/de/anomic/document/ParserTest.java+++ b/test/net/yacy/document/ParserTest.java@@ -1,4 +1,4 @@-package de.anomic.document;+package net.yacy.document;import static org.junit.Assert.assertThat;import static org.junit.matchers.JUnitMatchers.containsString;@@ -12,10 +12,6 @@ import java.io.Reader;import java.io.UnsupportedEncodingException;import java.net.MalformedURLException;import net.yacy.cora.document.id.AnchorURL;-import net.yacy.document.AbstractParser;--import net.yacy.document.Document;-import net.yacy.document.Parser;import net.yacy.document.parser.docParser;import net.yacy.document.parser.odtParser;import net.yacy.document.parser.ooxmlParser;diff --git a/test/de/anomic/document/parser/htmlParserTest.java b/test/net/yacy/document/parser/htmlParserTest.javasimilarity index 94%rename from test/de/anomic/document/parser/htmlParserTest.javarename to test/net/yacy/document/parser/htmlParserTest.javaindex 1afb2a113..f4f18ddaf 100644--- a/test/de/anomic/document/parser/htmlParserTest.java+++ b/test/net/yacy/document/parser/htmlParserTest.java@@ -1,13 +1,12 @@-package de.anomic.document.parser;+package net.yacy.document.parser;import java.nio.charset.Charset;--import net.yacy.document.parser.htmlParser;-import junit.framework.TestCase;+import org.junit.Test;public class htmlParserTest extends TestCase {-++ @Testpublic void testGetRealCharsetEncoding() {String[][] testStrings = new String[][] {new String[]{null,null},diff --git a/test/de/anomic/yacy/yacyVersionTest.java b/test/net/yacy/peers/operation/yacyVersionTest.javasimilarity index 97%rename from test/de/anomic/yacy/yacyVersionTest.javarename to test/net/yacy/peers/operation/yacyVersionTest.javaindex 1842aa726..8de1dfe11 100644--- a/test/de/anomic/yacy/yacyVersionTest.java+++ b/test/net/yacy/peers/operation/yacyVersionTest.java@@ -1,8 +1,8 @@-package de.anomic.yacy;+package net.yacy.peers.operation;-import net.yacy.peers.operation.yacyVersion;import junit.framework.TestCase;import org.junit.Assert;+import org.junit.Test;public class yacyVersionTest extends TestCase {@@ -10,6 +10,7 @@ public class yacyVersionTest extends TestCase {* Test method for 'yacy.combinedVersionString2PrettyString(String)'* @author Bost*/+ @Testpublic void testCombinedVersionString2PrettyString() {Assert.assertArrayEquals(new String[]{"dev","0000"}, yacyVersion.combined2prettyVersion("")); // not a numberAssert.assertArrayEquals(new String[]{"dev","0000"}, yacyVersion.combined2prettyVersion(" ")); // not a number