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
This commit is contained in:
Yonik Seeley 2010-03-20 01:09:28 +00:00
parent 48d41551cb
commit 919ac598c4
21 changed files with 46 additions and 42 deletions

View File

@ -68,7 +68,6 @@ public class BasicFunctionalityTest extends SolrTestCaseJ4 {
public static void beforeClass() throws Exception { public static void beforeClass() throws Exception {
initCore("solrconfig.xml","schema.xml"); initCore("solrconfig.xml","schema.xml");
} }
// tests the performance of dynamic field creation and // tests the performance of dynamic field creation and
// field property testing. // field property testing.
/*** /***

View File

@ -74,7 +74,7 @@ public class OutputWriterTest extends AbstractSolrTestCase {
lrf.args.put("wt", "xslt"); lrf.args.put("wt", "xslt");
lrf.args.put("tr", "dummy.xsl"); lrf.args.put("tr", "dummy.xsl");
String out = h.query(req("foo")); String out = h.query(req("foo"));
System.out.println(out); // System.out.println(out);
assertTrue(out.contains("DUMMY")); assertTrue(out.contains("DUMMY"));
} }

View File

@ -59,8 +59,8 @@ public class TestPatternTokenizerFactory extends BaseTokenTestCase
TokenStream stream = tokenizer.create( new StringReader( test[2] ) ); TokenStream stream = tokenizer.create( new StringReader( test[2] ) );
String out = tsToString( stream ); 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 ); assertEquals("pattern: "+test[1]+" with input: "+test[2], test[3], out );
// Make sure it is the same as if we called 'split' // Make sure it is the same as if we called 'split'

View File

@ -46,7 +46,7 @@ public abstract class LargeVolumeTestBase extends SolrExampleTestBase
threads[i] = new DocThread( "T"+i+":" ); threads[i] = new DocThread( "T"+i+":" );
threads[i].setName("DocThread-" + i); threads[i].setName("DocThread-" + i);
threads[i].start(); threads[i].start();
System.out.println("Started thread: " + i); log.info("Started thread: " + i);
} }
for (int i=0; i<threadCount; i++) { for (int i=0; i<threadCount; i++) {
threads[i].join(); threads[i].join();
@ -57,7 +57,7 @@ public abstract class LargeVolumeTestBase extends SolrExampleTestBase
gserver.commit(); gserver.commit();
query(threadCount * numdocs); query(threadCount * numdocs);
System.out.println("done"); log.info("done");
} }
private void query(int count) throws SolrServerException, IOException { private void query(int count) throws SolrServerException, IOException {
@ -90,7 +90,7 @@ public abstract class LargeVolumeTestBase extends SolrExampleTestBase
docs = new ArrayList<SolrInputDocument>(); docs = new ArrayList<SolrInputDocument>();
} }
if (i > 0 && i % 5000 == 0) { if (i > 0 && i % 5000 == 0) {
System.out.println(getName() + " - Committing " + i); log.info(getName() + " - Committing " + i);
resp = tserver.commit(); resp = tserver.commit();
assertEquals(0, resp.getStatus()); assertEquals(0, resp.getStatus());
} }

View File

@ -74,15 +74,15 @@ abstract public class SolrExampleTests extends SolrExampleTestBase
Assert.assertTrue(doc.getField("name").getValue() != null ); Assert.assertTrue(doc.getField("name").getValue() != null );
UpdateResponse upres = server.add( doc ); UpdateResponse upres = server.add( doc );
System.out.println( "ADD:"+upres.getResponse() ); // System.out.println( "ADD:"+upres.getResponse() );
Assert.assertEquals(0, upres.getStatus()); Assert.assertEquals(0, upres.getStatus());
upres = server.commit( true, true ); upres = server.commit( true, true );
System.out.println( "COMMIT:"+upres.getResponse() ); // System.out.println( "COMMIT:"+upres.getResponse() );
Assert.assertEquals(0, upres.getStatus()); Assert.assertEquals(0, upres.getStatus());
upres = server.optimize( true, true ); upres = server.optimize( true, true );
System.out.println( "OPTIMIZE:"+upres.getResponse() ); // System.out.println( "OPTIMIZE:"+upres.getResponse() );
Assert.assertEquals(0, upres.getStatus()); Assert.assertEquals(0, upres.getStatus());
SolrQuery query = new SolrQuery(); SolrQuery query = new SolrQuery();
@ -119,15 +119,15 @@ abstract public class SolrExampleTests extends SolrExampleTestBase
docs.add(doc5); docs.add(doc5);
upres = server.add( docs ); upres = server.add( docs );
System.out.println( "ADD:"+upres.getResponse() ); // System.out.println( "ADD:"+upres.getResponse() );
Assert.assertEquals(0, upres.getStatus()); Assert.assertEquals(0, upres.getStatus());
upres = server.commit( true, true ); upres = server.commit( true, true );
System.out.println( "COMMIT:"+upres.getResponse() ); // System.out.println( "COMMIT:"+upres.getResponse() );
Assert.assertEquals(0, upres.getStatus()); Assert.assertEquals(0, upres.getStatus());
upres = server.optimize( true, true ); upres = server.optimize( true, true );
System.out.println( "OPTIMIZE:"+upres.getResponse() ); // System.out.println( "OPTIMIZE:"+upres.getResponse() );
Assert.assertEquals(0, upres.getStatus()); Assert.assertEquals(0, upres.getStatus());
query = new SolrQuery("*:*"); query = new SolrQuery("*:*");
@ -192,7 +192,7 @@ abstract public class SolrExampleTests extends SolrExampleTestBase
QueryResponse rsp = server.query( query ); QueryResponse rsp = server.query( query );
assertEquals( 2, rsp.getResults().getNumFound() ); assertEquals( 2, rsp.getResults().getNumFound() );
System.out.println( rsp.getResults() ); // System.out.println( rsp.getResults() );
// Now do it again // Now do it again
server.add( docs ); server.add( docs );
@ -543,7 +543,7 @@ abstract public class SolrExampleTests extends SolrExampleTestBase
assertEquals( 1, facets.size() ); assertEquals( 1, facets.size() );
FacetField ff = facets.get( 0 ); FacetField ff = facets.get( 0 );
assertEquals( "features", ff.getName() ); assertEquals( "features", ff.getName() );
System.out.println( "111: "+ff.getValues() ); // System.out.println( "111: "+ff.getValues() );
// check all counts // check all counts
assertEquals( "[two (5), three (3), five (2), four (2)]", ff.getValues().toString() ); 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 ); rsp = server.query( query );
ff = rsp.getFacetField( "features" ); ff = rsp.getFacetField( "features" );
System.out.println( rsp.getResults().getNumFound() + " :::: 444: "+ff.getValues() ); // System.out.println( rsp.getResults().getNumFound() + " :::: 444: "+ff.getValues() );
} }
} }

View File

@ -89,7 +89,7 @@ public class SolrQueryTest extends TestCase {
q.setTimeAllowed(null); q.setTimeAllowed(null);
Assert.assertEquals(null, q.getTimeAllowed() ); Assert.assertEquals(null, q.getTimeAllowed() );
System.out.println(q); // System.out.println(q);
} }
public void testFacetSort() { public void testFacetSort() {

View File

@ -47,7 +47,7 @@ public class SolrExampleJettyTest extends SolrExampleTests {
jetty = new JettySolrRunner( context, 0 ); jetty = new JettySolrRunner( context, 0 );
jetty.start(); jetty.start();
port = jetty.getLocalPort(); port = jetty.getLocalPort();
System.out.println("Assigned Port#" + port); log.info("Assigned Port#" + port);
server = this.createNewSolrServer(); server = this.createNewSolrServer();
} }

View File

@ -43,7 +43,7 @@ public class SolrExampleStreamingTest extends SolrExampleTests {
jetty = new JettySolrRunner( context, 0 ); jetty = new JettySolrRunner( context, 0 );
jetty.start(); jetty.start();
port = jetty.getLocalPort(); port = jetty.getLocalPort();
System.out.println("Assigned Port#" + port); log.info("Assigned Port#" + port);
server = this.createNewSolrServer(); server = this.createNewSolrServer();
} }

View File

@ -49,9 +49,11 @@ public class QueryResponseTest {
for (FacetField f : qr.getFacetDates()) { for (FacetField f : qr.getFacetDates()) {
Assert.assertNotNull(f); Assert.assertNotNull(f);
System.out.println(f.toString());
System.out.println("GAP: " + f.getGap()); // TODO - test values?
System.out.println("END: " + f.getEnd()); // System.out.println(f.toString());
// System.out.println("GAP: " + f.getGap());
// System.out.println("END: " + f.getEnd());
} }
} }
} }

View File

@ -51,7 +51,7 @@ public class TestSpellCheckResponse extends SolrExampleTestBase {
jetty = new JettySolrRunner(context, 0); jetty = new JettySolrRunner(context, 0);
jetty.start(); jetty.start();
port = jetty.getLocalPort(); port = jetty.getLocalPort();
System.out.println("Assigned Port: " + port); log.info("Assigned Port: " + port);
server = this.createNewSolrServer(); server = this.createNewSolrServer();
} }

View File

@ -44,16 +44,14 @@ public class TestFastInputStream {
char[] cbuf = new char[ss.length()]; char[] cbuf = new char[ss.length()];
readChars(gzis, cbuf, 0, ss.length()); readChars(gzis, cbuf, 0, ss.length());
assertEquals(new String(cbuf), ss); 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()); ByteArrayInputStream bis = new ByteArrayInputStream(b.toByteArray(), 0, b.size());
gzis = new GZIPInputStream(new FastInputStream(bis)); gzis = new GZIPInputStream(new FastInputStream(bis));
cbuf = new char[ss.length()]; cbuf = new char[ss.length()];
readChars(gzis, cbuf, 0, ss.length()); readChars(gzis, cbuf, 0, ss.length());
assertEquals(new String(cbuf), ss); assertEquals(new String(cbuf), ss);
System.out.println("passes w FastInputStream"); // System.out.println("passes w FastInputStream");
} }
//code copied from NamedListCodec#readChars //code copied from NamedListCodec#readChars

View File

@ -61,7 +61,7 @@ public class TestJmxIntegration extends AbstractSolrTestCase {
@Test @Test
public void testJmxRegistration() throws Exception { public void testJmxRegistration() throws Exception {
List<MBeanServer> servers = MBeanServerFactory.findMBeanServer(null); List<MBeanServer> servers = MBeanServerFactory.findMBeanServer(null);
System.out.println("Servers in testJmxRegistration: " + servers); log.info("Servers in testJmxRegistration: " + servers);
assertNotNull("MBeanServers were null", servers); assertNotNull("MBeanServers were null", servers);
assertFalse("No MBeanServer was found", servers.isEmpty()); assertFalse("No MBeanServer was found", servers.isEmpty());
@ -83,8 +83,8 @@ public class TestJmxIntegration extends AbstractSolrTestCase {
@Test @Test
public void testJmxUpdate() throws Exception { public void testJmxUpdate() throws Exception {
List<MBeanServer> servers = MBeanServerFactory.findMBeanServer(null); List<MBeanServer> servers = MBeanServerFactory.findMBeanServer(null);
System.err.println("Servers in testJmxUpdate: " + servers); log.info("Servers in testJmxUpdate: " + servers);
System.err.println(h.getCore().getInfoRegistry()); log.info(h.getCore().getInfoRegistry().toString());
SolrInfoMBean bean = null; SolrInfoMBean bean = null;
// wait until searcher is registered // wait until searcher is registered
@ -97,7 +97,7 @@ public class TestJmxIntegration extends AbstractSolrTestCase {
ObjectName searcher = getObjectName("searcher", bean); ObjectName searcher = getObjectName("searcher", bean);
MBeanServer mbeanServer = servers.get(0); 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()); assertFalse("No mbean found for SolrIndexSearcher", mbeanServer.queryMBeans(searcher, null).isEmpty());

View File

@ -59,7 +59,7 @@ public class TestJmxMonitoredMap {
ServerSocket server = new ServerSocket(0); ServerSocket server = new ServerSocket(0);
port = server.getLocalPort(); port = server.getLocalPort();
server.close(); server.close();
System.out.println("Using port: " + port); // System.out.println("Using port: " + port);
try { try {
LocateRegistry.createRegistry(port); LocateRegistry.createRegistry(port);
} catch (RemoteException e) { } catch (RemoteException e) {

View File

@ -45,7 +45,7 @@ public class TestXIncludeConfig extends AbstractSolrTestCase {
SolrRequestHandler solrRequestHandler = core.getRequestHandler("dismaxOldStyleDefaults"); SolrRequestHandler solrRequestHandler = core.getRequestHandler("dismaxOldStyleDefaults");
assertNotNull("Solr Req Handler is null", solrRequestHandler); assertNotNull("Solr Req Handler is null", solrRequestHandler);
} else { } 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");
} }
} }

View File

@ -218,7 +218,7 @@ public class QueryElevationComponentTest extends AbstractSolrTestCase {
out.flush(); out.flush();
out.close(); out.close();
System.out.println( "OUT:"+file.getAbsolutePath() ); log.info( "OUT:"+file.getAbsolutePath() );
} }
public void testElevationReloading() throws Exception public void testElevationReloading() throws Exception

View File

@ -83,7 +83,7 @@ public class TermVectorComponentTest extends AbstractSolrTestCase {
NamedList values = rsp.getValues(); NamedList values = rsp.getValues();
NamedList termVectors = (NamedList) values.get(TermVectorComponent.TERM_VECTORS); NamedList termVectors = (NamedList) values.get(TermVectorComponent.TERM_VECTORS);
assertTrue("termVectors is null and it shouldn't be", termVectors != null); 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); NamedList doc = (NamedList) termVectors.getVal(0);
assertTrue("doc is null and it shouldn't be", doc != null); assertTrue("doc is null and it shouldn't be", doc != null);
assertTrue(doc.size() + " does not equal: " + 2, doc.size() == 2); assertTrue(doc.size() + " does not equal: " + 2, doc.size() == 2);
@ -126,7 +126,7 @@ public class TermVectorComponentTest extends AbstractSolrTestCase {
NamedList values = rsp.getValues(); NamedList values = rsp.getValues();
NamedList termVectors = (NamedList) values.get(TermVectorComponent.TERM_VECTORS); NamedList termVectors = (NamedList) values.get(TermVectorComponent.TERM_VECTORS);
assertTrue("termVectors is null and it shouldn't be", termVectors != null); 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); NamedList doc = (NamedList) termVectors.getVal(0);
assertTrue("doc is null and it shouldn't be", doc != null); assertTrue("doc is null and it shouldn't be", doc != null);
assertTrue(doc.size() + " does not equal: " + 2, doc.size() == 2); 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); assertTrue("rb.outgoing Size: " + rb.outgoing.size() + " is not: " + rb.shards.length, rb.outgoing.size() == rb.shards.length);
for (ShardRequest request : rb.outgoing) { for (ShardRequest request : rb.outgoing) {
ModifiableSolrParams solrParams = request.params; ModifiableSolrParams solrParams = request.params;
System.out.println("Shard: " + Arrays.asList(request.shards) + " Params: " + solrParams); log.info("Shard: " + Arrays.asList(request.shards) + " Params: " + solrParams);
} }
} }

View File

@ -43,7 +43,7 @@ public class HighlighterConfigTest extends AbstractSolrTestCase {
public void testConfig() public void testConfig()
{ {
SolrHighlighter highlighter = h.getCore().getHighlighter(); SolrHighlighter highlighter = h.getCore().getHighlighter();
System.out.println( "highlighter" ); log.info( "highlighter" );
assertTrue( highlighter instanceof DummyHighlighter ); assertTrue( highlighter instanceof DummyHighlighter );

View File

@ -59,7 +59,7 @@ public class BadIndexSchemaTest extends AbstractSolrTestCase {
IndexSchema schema = core.getSchema(); IndexSchema schema = core.getSchema();
for( Throwable t : SolrConfig.severeErrors ) { for( Throwable t : SolrConfig.severeErrors ) {
System.out.println( "ERROR:"+t.getMessage() ); log.error( "ERROR:"+t.getMessage() );
} }
assertEquals( 3, SolrConfig.severeErrors.size() ); assertEquals( 3, SolrConfig.severeErrors.size() );

View File

@ -176,7 +176,7 @@ public class TestSort extends AbstractSolrTestCase {
int id = sdocs[j].doc; int id = sdocs[j].doc;
String s = (String)((FieldDoc)sdocs[j]).fields[sortIdx]; String s = (String)((FieldDoc)sdocs[j]).fields[sortIdx];
if (id != collectedDocs.get(j).doc) { 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); assertEquals(id, collectedDocs.get(j).doc);
} }

View File

@ -274,7 +274,7 @@ public class TestFunctionQuery extends AbstractSolrTestCase {
} }
singleTest(field, "\0", answers); singleTest(field, "\0", answers);
System.out.println("Done test "+i); // System.out.println("Done test "+i);
} }
} }

View File

@ -44,7 +44,12 @@
It defaults to "index" if not present, and should probably It defaults to "index" if not present, and should probably
not be changed if replication is in use. --> not be changed if replication is in use. -->
<dataDir>${solr.data.dir:./solr/data}</dataDir> <dataDir>${solr.data.dir:./solr/data}</dataDir>
<!-- The DirectoryFactory to use for indexes.
solr.StandardDirectoryFactory, the default, is filesystem based.
solr.RAMDirectoryFactory is memory based and not persistent. -->
<directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.StandardDirectoryFactory}"/>
<luceneMatchVersion>3.1</luceneMatchVersion> <luceneMatchVersion>3.1</luceneMatchVersion>
<indexDefaults> <indexDefaults>