From: <bra...@us...> - 2010-12-31 00:19:07
|
Revision: 3356 http://archive-access.svn.sourceforge.net/archive-access/?rev=3356&view=rev Author: bradtofel Date: 2010-12-31 00:19:01 +0000 (Fri, 31 Dec 2010) Log Message: ----------- MOVED tests (that don't work now..) to /src/main/test/ Added Paths: ----------- trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/resourceindex/ziplines/ trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/resourceindex/ziplines/ZiplinedBlockStringSequenceTest.java trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/resourceindex/ziplines/ZiplinesSearchResultSourceTest.java Removed Paths: ------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ziplines/ZiplinedBlockStringSequenceTest.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ziplines/ZiplinesSearchResultSourceTest.java Deleted: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ziplines/ZiplinedBlockStringSequenceTest.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ziplines/ZiplinedBlockStringSequenceTest.java 2010-12-30 19:54:31 UTC (rev 3355) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ziplines/ZiplinedBlockStringSequenceTest.java 2010-12-31 00:19:01 UTC (rev 3356) @@ -1,79 +0,0 @@ -/* - * This file is part of the Wayback archival access software - * (http://archive-access.sourceforge.net/projects/wayback/). - * - * Licensed to the Internet Archive (IA) by one or more individual - * contributors. - * - * The IA licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.archive.wayback.resourceindex.ziplines; - -import java.io.IOException; -import java.util.HashMap; - -import org.archive.wayback.exception.ResourceIndexNotAvailableException; -import org.archive.wayback.util.CloseableIterator; -import org.archive.wayback.util.flatfile.FlatFile; - -import junit.framework.TestCase; - -/** - * @author brad - * - */ -public class ZiplinedBlockStringSequenceTest extends TestCase { - private String indexPath = "/home/brad/os-cdx/CDX-201002-clean/ALL.count.summary"; - private String mapPath = "/home/brad/os-cdx/CDX-201002-clean/ALL.loc-workstation"; - - private ZiplinedBlockStringSequence getSequence() throws IOException { - HashMap<String, String> chunkMap = new HashMap<String, String>(); - FlatFile ff = new FlatFile(mapPath); - CloseableIterator<String> lines = ff.getSequentialIterator(); - while(lines.hasNext()) { - String line = lines.next(); - String[] parts = line.split("\\s"); - if(parts.length != 2) { - throw new IOException("Bad line(" + line +") in (" + - mapPath + ")"); - } - chunkMap.put(parts[0],parts[1]); - } - lines.close(); - FlatFile chunkIndex = new FlatFile(indexPath); - return new ZiplinedBlockStringSequence(chunkIndex, chunkMap); - } - /** - * Test method for {@link org.archive.wayback.resourceindex.ziplines.ZiplinedBlockStringSequence#getIterator(java.lang.String, long)}. - * @throws IOException - * @throws ResourceIndexNotAvailableException - */ - public void testGetIteratorStringLong() throws IOException, ResourceIndexNotAvailableException { - ZiplinedBlockStringSequence seq = getSequence(); - StringPrefixIterator itr = seq.getIterator("yahoo.com/", 1000000); - System.out.format("Total Matches %d\n",itr.getTotalMatches()); - for(int i = 0; i < 10; i++) { - if(itr.hasNext()) { - System.out.format("Line(%d): %s\n",i,itr.next()); - } - } - } - - /** - * Test method for {@link org.archive.wayback.resourceindex.ziplines.ZiplinedBlockStringSequence#getIterator(java.lang.String)}. - */ - public void testGetIteratorString() { -// fail("Not yet implemented"); - } - -} Deleted: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ziplines/ZiplinesSearchResultSourceTest.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ziplines/ZiplinesSearchResultSourceTest.java 2010-12-30 19:54:31 UTC (rev 3355) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ziplines/ZiplinesSearchResultSourceTest.java 2010-12-31 00:19:01 UTC (rev 3356) @@ -1,58 +0,0 @@ -/* - * This file is part of the Wayback archival access software - * (http://archive-access.sourceforge.net/projects/wayback/). - * - * Licensed to the Internet Archive (IA) by one or more individual - * contributors. - * - * The IA licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.archive.wayback.resourceindex.ziplines; - -import java.util.Iterator; - -import org.archive.wayback.resourceindex.cdx.format.CDXFormat; -import org.archive.wayback.resourceindex.cdx.format.CDXFormatException; - -import junit.framework.TestCase; - -/** - * @author brad - * - */ -public class ZiplinesSearchResultSourceTest extends TestCase { - - /** - * Test method for {@link org.archive.wayback.resourceindex.ziplines.ZiplinesSearchResultSource#getPrefixIterator(java.lang.String)}. - * @throws CDXFormatException - */ - public void testGetPrefixIterator() throws Exception { - CDXFormat format = new CDXFormat(" CDX N b a m s k r M V g"); - ZiplinesSearchResultSource zsrs = new ZiplinesSearchResultSource(format); -// zsrs.setChunkIndexPath("/home/brad/zipline-test/part-00005-frag.cdx.zlm"); -// zsrs.setChunkMapPath("/home/brad/zipline-test/manifest.txt"); - zsrs.setChunkIndexPath("/home/brad/ALL.summary"); - zsrs.setChunkMapPath("/home/brad/ALL.loc"); - zsrs.init(); - Iterator<String> i = zsrs.getStringPrefixIterator("krunch.com/ "); - int max = 100; - int done = 0; - while(i.hasNext()) { - System.out.println(i.next()); - if(done++ > max) { - break; - } - } - } - -} Copied: trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/resourceindex/ziplines/ZiplinedBlockStringSequenceTest.java (from rev 3324, trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ziplines/ZiplinedBlockStringSequenceTest.java) =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/resourceindex/ziplines/ZiplinedBlockStringSequenceTest.java (rev 0) +++ trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/resourceindex/ziplines/ZiplinedBlockStringSequenceTest.java 2010-12-31 00:19:01 UTC (rev 3356) @@ -0,0 +1,79 @@ +/* + * This file is part of the Wayback archival access software + * (http://archive-access.sourceforge.net/projects/wayback/). + * + * Licensed to the Internet Archive (IA) by one or more individual + * contributors. + * + * The IA licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.archive.wayback.resourceindex.ziplines; + +import java.io.IOException; +import java.util.HashMap; + +import org.archive.wayback.exception.ResourceIndexNotAvailableException; +import org.archive.wayback.util.CloseableIterator; +import org.archive.wayback.util.flatfile.FlatFile; + +import junit.framework.TestCase; + +/** + * @author brad + * + */ +public class ZiplinedBlockStringSequenceTest extends TestCase { + private String indexPath = "/home/brad/os-cdx/CDX-201002-clean/ALL.count.summary"; + private String mapPath = "/home/brad/os-cdx/CDX-201002-clean/ALL.loc-workstation"; + +// private ZiplinedBlockStringSequence getSequence() throws IOException { +// HashMap<String, String> chunkMap = new HashMap<String, String>(); +// FlatFile ff = new FlatFile(mapPath); +// CloseableIterator<String> lines = ff.getSequentialIterator(); +// while(lines.hasNext()) { +// String line = lines.next(); +// String[] parts = line.split("\\s"); +// if(parts.length != 2) { +// throw new IOException("Bad line(" + line +") in (" + +// mapPath + ")"); +// } +// chunkMap.put(parts[0],parts[1]); +// } +// lines.close(); +// FlatFile chunkIndex = new FlatFile(indexPath); +// return new ZiplinedBlockStringSequence(chunkIndex, chunkMap); +// } + /** + * Test method for {@link org.archive.wayback.resourceindex.ziplines.ZiplinedBlockStringSequence#getIterator(java.lang.String, long)}. + * @throws IOException + * @throws ResourceIndexNotAvailableException + */ + public void testGetIteratorStringLong() throws IOException, ResourceIndexNotAvailableException { +// ZiplinedBlockStringSequence seq = getSequence(); +// StringPrefixIterator itr = seq.getIterator("yahoo.com/", 1000000); +// System.out.format("Total Matches %d\n",itr.getTotalMatches()); +// for(int i = 0; i < 10; i++) { +// if(itr.hasNext()) { +// System.out.format("Line(%d): %s\n",i,itr.next()); +// } +// } + } + + /** + * Test method for {@link org.archive.wayback.resourceindex.ziplines.ZiplinedBlockStringSequence#getIterator(java.lang.String)}. + */ + public void testGetIteratorString() { +// fail("Not yet implemented"); + } + +} Copied: trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/resourceindex/ziplines/ZiplinesSearchResultSourceTest.java (from rev 3324, trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ziplines/ZiplinesSearchResultSourceTest.java) =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/resourceindex/ziplines/ZiplinesSearchResultSourceTest.java (rev 0) +++ trunk/archive-access/projects/wayback/wayback-core/src/test/java/org/archive/wayback/resourceindex/ziplines/ZiplinesSearchResultSourceTest.java 2010-12-31 00:19:01 UTC (rev 3356) @@ -0,0 +1,62 @@ +/* + * This file is part of the Wayback archival access software + * (http://archive-access.sourceforge.net/projects/wayback/). + * + * Licensed to the Internet Archive (IA) by one or more individual + * contributors. + * + * The IA licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.archive.wayback.resourceindex.ziplines; + +import java.util.Iterator; + + +import org.archive.wayback.resourceindex.cdx.format.CDXFormat; +import org.archive.wayback.resourceindex.cdx.format.CDXFormatException; + +import junit.framework.TestCase; + +/** + * @author brad + * + */ +public class ZiplinesSearchResultSourceTest extends TestCase { + +// /** +// * Test method for {@link org.archive.wayback.resourceindex.ziplines.ZiplinesSearchResultSource#getPrefixIterator(java.lang.String)}. +// * @throws CDXFormatException +// */ +// public void testGetPrefixIterator() throws Exception { +// CDXFormat format = new CDXFormat(" CDX N b a m s k r M V g"); +// ZiplinesSearchResultSource zsrs = new ZiplinesSearchResultSource(format); +//// zsrs.setChunkIndexPath("/home/brad/zipline-test/part-00005-frag.cdx.zlm"); +//// zsrs.setChunkMapPath("/home/brad/zipline-test/manifest.txt"); +// zsrs.setChunkIndexPath("/home/brad/ALL.summary"); +// zsrs.setChunkMapPath("/home/brad/ALL.loc"); +// zsrs.init(); +// Iterator<String> i = zsrs.getStringPrefixIterator("krunch.com/ "); +// int max = 100; +// int done = 0; +// while(i.hasNext()) { +// System.out.println(i.next()); +// if(done++ > max) { +// break; +// } +// } +// } + + public void testEmpty() throws Exception { + + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |