From 919ac598c46c52bed22038b761fa84a3b5f94a65 Mon Sep 17 00:00:00 2001 From: Yonik Seeley Date: Sat, 20 Mar 2010 01:09:28 +0000 Subject: [PATCH] tests: kill prints, or change to logging git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/branches/newtrunk@925512 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/solr/BasicFunctionalityTest.java | 1 - .../test/org/apache/solr/OutputWriterTest.java | 2 +- .../analysis/TestPatternTokenizerFactory.java | 4 ++-- .../solr/client/solrj/LargeVolumeTestBase.java | 6 +++--- .../solr/client/solrj/SolrExampleTests.java | 18 +++++++++--------- .../solr/client/solrj/SolrQueryTest.java | 2 +- .../solrj/embedded/SolrExampleJettyTest.java | 2 +- .../embedded/SolrExampleStreamingTest.java | 2 +- .../solrj/response/QueryResponseTest.java | 8 +++++--- .../solrj/response/TestSpellCheckResponse.java | 2 +- .../solr/common/util/TestFastInputStream.java | 6 ++---- .../apache/solr/core/TestJmxIntegration.java | 8 ++++---- .../apache/solr/core/TestJmxMonitoredMap.java | 2 +- .../apache/solr/core/TestXIncludeConfig.java | 2 +- .../component/QueryElevationComponentTest.java | 2 +- .../component/TermVectorComponentTest.java | 6 +++--- .../solr/highlight/HighlighterConfigTest.java | 2 +- .../apache/solr/schema/BadIndexSchemaTest.java | 2 +- .../test/org/apache/solr/search/TestSort.java | 2 +- .../search/function/TestFunctionQuery.java | 2 +- .../test/test-files/solr/conf/solrconfig.xml | 7 ++++++- 21 files changed, 46 insertions(+), 42 deletions(-) diff --git a/solr/src/test/org/apache/solr/BasicFunctionalityTest.java b/solr/src/test/org/apache/solr/BasicFunctionalityTest.java index 7628934e551..93f9c61e628 100644 --- a/solr/src/test/org/apache/solr/BasicFunctionalityTest.java +++ b/solr/src/test/org/apache/solr/BasicFunctionalityTest.java @@ -68,7 +68,6 @@ public class BasicFunctionalityTest extends SolrTestCaseJ4 { public static void beforeClass() throws Exception { initCore("solrconfig.xml","schema.xml"); } - // tests the performance of dynamic field creation and // field property testing. /*** diff --git a/solr/src/test/org/apache/solr/OutputWriterTest.java b/solr/src/test/org/apache/solr/OutputWriterTest.java index 54c2e20b4d1..ecd92660ff0 100644 --- a/solr/src/test/org/apache/solr/OutputWriterTest.java +++ b/solr/src/test/org/apache/solr/OutputWriterTest.java @@ -74,7 +74,7 @@ public class OutputWriterTest extends AbstractSolrTestCase { lrf.args.put("wt", "xslt"); lrf.args.put("tr", "dummy.xsl"); String out = h.query(req("foo")); - System.out.println(out); + // System.out.println(out); assertTrue(out.contains("DUMMY")); } diff --git a/solr/src/test/org/apache/solr/analysis/TestPatternTokenizerFactory.java b/solr/src/test/org/apache/solr/analysis/TestPatternTokenizerFactory.java index eecf48c1141..11318eece76 100644 --- a/solr/src/test/org/apache/solr/analysis/TestPatternTokenizerFactory.java +++ b/solr/src/test/org/apache/solr/analysis/TestPatternTokenizerFactory.java @@ -59,8 +59,8 @@ public class TestPatternTokenizerFactory extends BaseTokenTestCase TokenStream stream = tokenizer.create( new StringReader( test[2] ) ); String out = tsToString( stream ); - System.out.println( test[2] + " ==> " + out ); - + // System.out.println( test[2] + " ==> " + out ); + assertEquals("pattern: "+test[1]+" with input: "+test[2], test[3], out ); // Make sure it is the same as if we called 'split' diff --git a/solr/src/test/org/apache/solr/client/solrj/LargeVolumeTestBase.java b/solr/src/test/org/apache/solr/client/solrj/LargeVolumeTestBase.java index dd10bbaf383..85d53c01fd6 100644 --- a/solr/src/test/org/apache/solr/client/solrj/LargeVolumeTestBase.java +++ b/solr/src/test/org/apache/solr/client/solrj/LargeVolumeTestBase.java @@ -46,7 +46,7 @@ public abstract class LargeVolumeTestBase extends SolrExampleTestBase threads[i] = new DocThread( "T"+i+":" ); threads[i].setName("DocThread-" + i); threads[i].start(); - System.out.println("Started thread: " + i); + log.info("Started thread: " + i); } for (int i=0; i(); } if (i > 0 && i % 5000 == 0) { - System.out.println(getName() + " - Committing " + i); + log.info(getName() + " - Committing " + i); resp = tserver.commit(); assertEquals(0, resp.getStatus()); } diff --git a/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java b/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java index ad578a252cb..e20c84779f1 100644 --- a/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java +++ b/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java @@ -74,15 +74,15 @@ abstract public class SolrExampleTests extends SolrExampleTestBase Assert.assertTrue(doc.getField("name").getValue() != null ); UpdateResponse upres = server.add( doc ); - System.out.println( "ADD:"+upres.getResponse() ); + // System.out.println( "ADD:"+upres.getResponse() ); Assert.assertEquals(0, upres.getStatus()); upres = server.commit( true, true ); - System.out.println( "COMMIT:"+upres.getResponse() ); + // System.out.println( "COMMIT:"+upres.getResponse() ); Assert.assertEquals(0, upres.getStatus()); upres = server.optimize( true, true ); - System.out.println( "OPTIMIZE:"+upres.getResponse() ); + // System.out.println( "OPTIMIZE:"+upres.getResponse() ); Assert.assertEquals(0, upres.getStatus()); SolrQuery query = new SolrQuery(); @@ -119,15 +119,15 @@ abstract public class SolrExampleTests extends SolrExampleTestBase docs.add(doc5); upres = server.add( docs ); - System.out.println( "ADD:"+upres.getResponse() ); + // System.out.println( "ADD:"+upres.getResponse() ); Assert.assertEquals(0, upres.getStatus()); upres = server.commit( true, true ); - System.out.println( "COMMIT:"+upres.getResponse() ); + // System.out.println( "COMMIT:"+upres.getResponse() ); Assert.assertEquals(0, upres.getStatus()); upres = server.optimize( true, true ); - System.out.println( "OPTIMIZE:"+upres.getResponse() ); + // System.out.println( "OPTIMIZE:"+upres.getResponse() ); Assert.assertEquals(0, upres.getStatus()); query = new SolrQuery("*:*"); @@ -192,7 +192,7 @@ abstract public class SolrExampleTests extends SolrExampleTestBase QueryResponse rsp = server.query( query ); assertEquals( 2, rsp.getResults().getNumFound() ); - System.out.println( rsp.getResults() ); + // System.out.println( rsp.getResults() ); // Now do it again server.add( docs ); @@ -543,7 +543,7 @@ abstract public class SolrExampleTests extends SolrExampleTestBase assertEquals( 1, facets.size() ); FacetField ff = facets.get( 0 ); assertEquals( "features", ff.getName() ); - System.out.println( "111: "+ff.getValues() ); + // System.out.println( "111: "+ff.getValues() ); // check all counts assertEquals( "[two (5), three (3), five (2), four (2)]", ff.getValues().toString() ); @@ -564,6 +564,6 @@ abstract public class SolrExampleTests extends SolrExampleTestBase rsp = server.query( query ); ff = rsp.getFacetField( "features" ); - System.out.println( rsp.getResults().getNumFound() + " :::: 444: "+ff.getValues() ); + // System.out.println( rsp.getResults().getNumFound() + " :::: 444: "+ff.getValues() ); } } diff --git a/solr/src/test/org/apache/solr/client/solrj/SolrQueryTest.java b/solr/src/test/org/apache/solr/client/solrj/SolrQueryTest.java index 2ef260d2c74..27aea101d92 100644 --- a/solr/src/test/org/apache/solr/client/solrj/SolrQueryTest.java +++ b/solr/src/test/org/apache/solr/client/solrj/SolrQueryTest.java @@ -89,7 +89,7 @@ public class SolrQueryTest extends TestCase { q.setTimeAllowed(null); Assert.assertEquals(null, q.getTimeAllowed() ); - System.out.println(q); + // System.out.println(q); } public void testFacetSort() { diff --git a/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleJettyTest.java b/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleJettyTest.java index d0c4a20b42c..4b799c3f3d1 100644 --- a/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleJettyTest.java +++ b/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleJettyTest.java @@ -47,7 +47,7 @@ public class SolrExampleJettyTest extends SolrExampleTests { jetty = new JettySolrRunner( context, 0 ); jetty.start(); port = jetty.getLocalPort(); - System.out.println("Assigned Port#" + port); + log.info("Assigned Port#" + port); server = this.createNewSolrServer(); } diff --git a/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java b/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java index 0820d7b9060..299957a115b 100644 --- a/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java +++ b/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java @@ -43,7 +43,7 @@ public class SolrExampleStreamingTest extends SolrExampleTests { jetty = new JettySolrRunner( context, 0 ); jetty.start(); port = jetty.getLocalPort(); - System.out.println("Assigned Port#" + port); + log.info("Assigned Port#" + port); server = this.createNewSolrServer(); } diff --git a/solr/src/test/org/apache/solr/client/solrj/response/QueryResponseTest.java b/solr/src/test/org/apache/solr/client/solrj/response/QueryResponseTest.java index 694cdacd214..c4e42ba6f01 100644 --- a/solr/src/test/org/apache/solr/client/solrj/response/QueryResponseTest.java +++ b/solr/src/test/org/apache/solr/client/solrj/response/QueryResponseTest.java @@ -49,9 +49,11 @@ public class QueryResponseTest { for (FacetField f : qr.getFacetDates()) { Assert.assertNotNull(f); - System.out.println(f.toString()); - System.out.println("GAP: " + f.getGap()); - System.out.println("END: " + f.getEnd()); + + // TODO - test values? + // System.out.println(f.toString()); + // System.out.println("GAP: " + f.getGap()); + // System.out.println("END: " + f.getEnd()); } } } diff --git a/solr/src/test/org/apache/solr/client/solrj/response/TestSpellCheckResponse.java b/solr/src/test/org/apache/solr/client/solrj/response/TestSpellCheckResponse.java index 3c2d0558a12..db14586dafa 100644 --- a/solr/src/test/org/apache/solr/client/solrj/response/TestSpellCheckResponse.java +++ b/solr/src/test/org/apache/solr/client/solrj/response/TestSpellCheckResponse.java @@ -51,7 +51,7 @@ public class TestSpellCheckResponse extends SolrExampleTestBase { jetty = new JettySolrRunner(context, 0); jetty.start(); port = jetty.getLocalPort(); - System.out.println("Assigned Port: " + port); + log.info("Assigned Port: " + port); server = this.createNewSolrServer(); } diff --git a/solr/src/test/org/apache/solr/common/util/TestFastInputStream.java b/solr/src/test/org/apache/solr/common/util/TestFastInputStream.java index c2196283cb6..ab27ba65330 100644 --- a/solr/src/test/org/apache/solr/common/util/TestFastInputStream.java +++ b/solr/src/test/org/apache/solr/common/util/TestFastInputStream.java @@ -44,16 +44,14 @@ public class TestFastInputStream { char[] cbuf = new char[ss.length()]; readChars(gzis, cbuf, 0, ss.length()); assertEquals(new String(cbuf), ss); - System.out.println("passes w/o FastInputStream"); + // System.out.println("passes w/o FastInputStream"); ByteArrayInputStream bis = new ByteArrayInputStream(b.toByteArray(), 0, b.size()); gzis = new GZIPInputStream(new FastInputStream(bis)); cbuf = new char[ss.length()]; readChars(gzis, cbuf, 0, ss.length()); assertEquals(new String(cbuf), ss); - System.out.println("passes w FastInputStream"); - - + // System.out.println("passes w FastInputStream"); } //code copied from NamedListCodec#readChars diff --git a/solr/src/test/org/apache/solr/core/TestJmxIntegration.java b/solr/src/test/org/apache/solr/core/TestJmxIntegration.java index 03650683a79..6a91e599430 100644 --- a/solr/src/test/org/apache/solr/core/TestJmxIntegration.java +++ b/solr/src/test/org/apache/solr/core/TestJmxIntegration.java @@ -61,7 +61,7 @@ public class TestJmxIntegration extends AbstractSolrTestCase { @Test public void testJmxRegistration() throws Exception { List servers = MBeanServerFactory.findMBeanServer(null); - System.out.println("Servers in testJmxRegistration: " + servers); + log.info("Servers in testJmxRegistration: " + servers); assertNotNull("MBeanServers were null", servers); assertFalse("No MBeanServer was found", servers.isEmpty()); @@ -83,8 +83,8 @@ public class TestJmxIntegration extends AbstractSolrTestCase { @Test public void testJmxUpdate() throws Exception { List servers = MBeanServerFactory.findMBeanServer(null); - System.err.println("Servers in testJmxUpdate: " + servers); - System.err.println(h.getCore().getInfoRegistry()); + log.info("Servers in testJmxUpdate: " + servers); + log.info(h.getCore().getInfoRegistry().toString()); SolrInfoMBean bean = null; // wait until searcher is registered @@ -97,7 +97,7 @@ public class TestJmxIntegration extends AbstractSolrTestCase { ObjectName searcher = getObjectName("searcher", bean); MBeanServer mbeanServer = servers.get(0); - System.err.println("Mbeans in server: " + mbeanServer.queryNames(null, null)); + log.info("Mbeans in server: " + mbeanServer.queryNames(null, null)); assertFalse("No mbean found for SolrIndexSearcher", mbeanServer.queryMBeans(searcher, null).isEmpty()); diff --git a/solr/src/test/org/apache/solr/core/TestJmxMonitoredMap.java b/solr/src/test/org/apache/solr/core/TestJmxMonitoredMap.java index 09fee57cbcc..c2407732ea6 100644 --- a/solr/src/test/org/apache/solr/core/TestJmxMonitoredMap.java +++ b/solr/src/test/org/apache/solr/core/TestJmxMonitoredMap.java @@ -59,7 +59,7 @@ public class TestJmxMonitoredMap { ServerSocket server = new ServerSocket(0); port = server.getLocalPort(); server.close(); - System.out.println("Using port: " + port); + // System.out.println("Using port: " + port); try { LocateRegistry.createRegistry(port); } catch (RemoteException e) { diff --git a/solr/src/test/org/apache/solr/core/TestXIncludeConfig.java b/solr/src/test/org/apache/solr/core/TestXIncludeConfig.java index 6111cacf467..e9ed211ff7a 100644 --- a/solr/src/test/org/apache/solr/core/TestXIncludeConfig.java +++ b/solr/src/test/org/apache/solr/core/TestXIncludeConfig.java @@ -45,7 +45,7 @@ public class TestXIncludeConfig extends AbstractSolrTestCase { SolrRequestHandler solrRequestHandler = core.getRequestHandler("dismaxOldStyleDefaults"); assertNotNull("Solr Req Handler is null", solrRequestHandler); } else { - System.out.println("Didn't run testXInclude, because this XML DocumentBuilderFactory doesn't support it"); + log.info("Didn't run testXInclude, because this XML DocumentBuilderFactory doesn't support it"); } } diff --git a/solr/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java b/solr/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java index d650b17406b..aae2971dd7d 100644 --- a/solr/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java +++ b/solr/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java @@ -218,7 +218,7 @@ public class QueryElevationComponentTest extends AbstractSolrTestCase { out.flush(); out.close(); - System.out.println( "OUT:"+file.getAbsolutePath() ); + log.info( "OUT:"+file.getAbsolutePath() ); } public void testElevationReloading() throws Exception diff --git a/solr/src/test/org/apache/solr/handler/component/TermVectorComponentTest.java b/solr/src/test/org/apache/solr/handler/component/TermVectorComponentTest.java index 16de7f680c9..7e361ee73cb 100644 --- a/solr/src/test/org/apache/solr/handler/component/TermVectorComponentTest.java +++ b/solr/src/test/org/apache/solr/handler/component/TermVectorComponentTest.java @@ -83,7 +83,7 @@ public class TermVectorComponentTest extends AbstractSolrTestCase { NamedList values = rsp.getValues(); NamedList termVectors = (NamedList) values.get(TermVectorComponent.TERM_VECTORS); assertTrue("termVectors is null and it shouldn't be", termVectors != null); - System.out.println("TVs:" + termVectors); + // System.out.println("TVs:" + termVectors); NamedList doc = (NamedList) termVectors.getVal(0); assertTrue("doc is null and it shouldn't be", doc != null); assertTrue(doc.size() + " does not equal: " + 2, doc.size() == 2); @@ -126,7 +126,7 @@ public class TermVectorComponentTest extends AbstractSolrTestCase { NamedList values = rsp.getValues(); NamedList termVectors = (NamedList) values.get(TermVectorComponent.TERM_VECTORS); assertTrue("termVectors is null and it shouldn't be", termVectors != null); - System.out.println("TVs: " + termVectors); + // System.out.println("TVs: " + termVectors); NamedList doc = (NamedList) termVectors.getVal(0); assertTrue("doc is null and it shouldn't be", doc != null); assertTrue(doc.size() + " does not equal: " + 2, doc.size() == 2); @@ -212,7 +212,7 @@ public class TermVectorComponentTest extends AbstractSolrTestCase { assertTrue("rb.outgoing Size: " + rb.outgoing.size() + " is not: " + rb.shards.length, rb.outgoing.size() == rb.shards.length); for (ShardRequest request : rb.outgoing) { ModifiableSolrParams solrParams = request.params; - System.out.println("Shard: " + Arrays.asList(request.shards) + " Params: " + solrParams); + log.info("Shard: " + Arrays.asList(request.shards) + " Params: " + solrParams); } } diff --git a/solr/src/test/org/apache/solr/highlight/HighlighterConfigTest.java b/solr/src/test/org/apache/solr/highlight/HighlighterConfigTest.java index d470bdeaecb..aeb3b25a46f 100644 --- a/solr/src/test/org/apache/solr/highlight/HighlighterConfigTest.java +++ b/solr/src/test/org/apache/solr/highlight/HighlighterConfigTest.java @@ -43,7 +43,7 @@ public class HighlighterConfigTest extends AbstractSolrTestCase { public void testConfig() { SolrHighlighter highlighter = h.getCore().getHighlighter(); - System.out.println( "highlighter" ); + log.info( "highlighter" ); assertTrue( highlighter instanceof DummyHighlighter ); diff --git a/solr/src/test/org/apache/solr/schema/BadIndexSchemaTest.java b/solr/src/test/org/apache/solr/schema/BadIndexSchemaTest.java index c20155d5734..665ea8be057 100644 --- a/solr/src/test/org/apache/solr/schema/BadIndexSchemaTest.java +++ b/solr/src/test/org/apache/solr/schema/BadIndexSchemaTest.java @@ -59,7 +59,7 @@ public class BadIndexSchemaTest extends AbstractSolrTestCase { IndexSchema schema = core.getSchema(); for( Throwable t : SolrConfig.severeErrors ) { - System.out.println( "ERROR:"+t.getMessage() ); + log.error( "ERROR:"+t.getMessage() ); } assertEquals( 3, SolrConfig.severeErrors.size() ); diff --git a/solr/src/test/org/apache/solr/search/TestSort.java b/solr/src/test/org/apache/solr/search/TestSort.java index 8b6efb2cfec..aff9ba64d2d 100755 --- a/solr/src/test/org/apache/solr/search/TestSort.java +++ b/solr/src/test/org/apache/solr/search/TestSort.java @@ -176,7 +176,7 @@ public class TestSort extends AbstractSolrTestCase { int id = sdocs[j].doc; String s = (String)((FieldDoc)sdocs[j]).fields[sortIdx]; if (id != collectedDocs.get(j).doc) { - System.out.println("Error at pos " + j); + log.error("Error at pos " + j); } assertEquals(id, collectedDocs.get(j).doc); } diff --git a/solr/src/test/org/apache/solr/search/function/TestFunctionQuery.java b/solr/src/test/org/apache/solr/search/function/TestFunctionQuery.java index 4df20dd67f0..e2c3619ed12 100755 --- a/solr/src/test/org/apache/solr/search/function/TestFunctionQuery.java +++ b/solr/src/test/org/apache/solr/search/function/TestFunctionQuery.java @@ -274,7 +274,7 @@ public class TestFunctionQuery extends AbstractSolrTestCase { } singleTest(field, "\0", answers); - System.out.println("Done test "+i); + // System.out.println("Done test "+i); } } diff --git a/solr/src/test/test-files/solr/conf/solrconfig.xml b/solr/src/test/test-files/solr/conf/solrconfig.xml index ab3dd110ce4..82d6c773b2e 100644 --- a/solr/src/test/test-files/solr/conf/solrconfig.xml +++ b/solr/src/test/test-files/solr/conf/solrconfig.xml @@ -44,7 +44,12 @@ It defaults to "index" if not present, and should probably not be changed if replication is in use. --> ${solr.data.dir:./solr/data} - + + + + 3.1