From d978defacf12b45c80ef92b42bd968065ea01467 Mon Sep 17 00:00:00 2001 From: Yonik Seeley Date: Tue, 7 Feb 2006 22:04:39 +0000 Subject: [PATCH] make apps/SolarTest runnable via ant test git-svn-id: https://svn.apache.org/repos/asf/incubator/solr/trunk@375736 13f79535-47bb-0310-9956-ffa450edef68 --- build.xml | 25 ++++- src/apps/SolarTest/{ => conf}/protwords.txt | 0 src/apps/SolarTest/{ => conf}/schema.xml | 0 src/apps/SolarTest/{ => conf}/solrconfig.xml | 0 src/apps/SolarTest/{ => conf}/stopwords.txt | 0 src/apps/SolarTest/{ => conf}/synonyms.txt | 0 src/apps/SolarTest/run | 1 - src/apps/SolarTest/src/SolrTest.java | 97 ++++++++++++-------- 8 files changed, 79 insertions(+), 44 deletions(-) rename src/apps/SolarTest/{ => conf}/protwords.txt (100%) rename src/apps/SolarTest/{ => conf}/schema.xml (100%) rename src/apps/SolarTest/{ => conf}/solrconfig.xml (100%) rename src/apps/SolarTest/{ => conf}/stopwords.txt (100%) rename src/apps/SolarTest/{ => conf}/synonyms.txt (100%) delete mode 100755 src/apps/SolarTest/run diff --git a/build.xml b/build.xml index ebca302bbce..634fafcda94 100644 --- a/build.xml +++ b/build.xml @@ -70,6 +70,12 @@ + + + + + + @@ -77,10 +83,11 @@ description="Compile unit tests." depends="compile"> - - - + + + @@ -89,6 +96,14 @@ description="Runs the unit tests." depends="compileTests"> + + + + + + + + @@ -103,7 +118,7 @@ description="Creates the Solr distribution files." depends="dist-src, dist-war, dist-bin" /> - + diff --git a/src/apps/SolarTest/protwords.txt b/src/apps/SolarTest/conf/protwords.txt similarity index 100% rename from src/apps/SolarTest/protwords.txt rename to src/apps/SolarTest/conf/protwords.txt diff --git a/src/apps/SolarTest/schema.xml b/src/apps/SolarTest/conf/schema.xml similarity index 100% rename from src/apps/SolarTest/schema.xml rename to src/apps/SolarTest/conf/schema.xml diff --git a/src/apps/SolarTest/solrconfig.xml b/src/apps/SolarTest/conf/solrconfig.xml similarity index 100% rename from src/apps/SolarTest/solrconfig.xml rename to src/apps/SolarTest/conf/solrconfig.xml diff --git a/src/apps/SolarTest/stopwords.txt b/src/apps/SolarTest/conf/stopwords.txt similarity index 100% rename from src/apps/SolarTest/stopwords.txt rename to src/apps/SolarTest/conf/stopwords.txt diff --git a/src/apps/SolarTest/synonyms.txt b/src/apps/SolarTest/conf/synonyms.txt similarity index 100% rename from src/apps/SolarTest/synonyms.txt rename to src/apps/SolarTest/conf/synonyms.txt diff --git a/src/apps/SolarTest/run b/src/apps/SolarTest/run deleted file mode 100755 index 639600fa881..00000000000 --- a/src/apps/SolarTest/run +++ /dev/null @@ -1 +0,0 @@ -java -cp "../solar/classes;classes;../../lucene/lucene-1.4.3.jar" SolarPerf -schema test_schema.xml -index F:/root/index -verbose -test newtest.txt diff --git a/src/apps/SolarTest/src/SolrTest.java b/src/apps/SolarTest/src/SolrTest.java index 04894bf9d9b..24e601fa223 100644 --- a/src/apps/SolarTest/src/SolrTest.java +++ b/src/apps/SolarTest/src/SolrTest.java @@ -83,7 +83,9 @@ public class SolrTest extends Thread { boolean sequenceTest=false; public void run() { + if (sequenceTest) { + try { for (int i=0; i 0) params = s.substring(startParams+2,endParams).trim(); if (startTests > 0) test = s.substring(startTests+1,endTests).trim(); - System.out.println("###req=" + req); - System.out.println("###params=" + params); - System.out.println("###tests=" + test); + // System.out.println("###req=" + req); + // System.out.println("###params=" + params); + // System.out.println("###tests=" + test); if (req.startsWith("<")) { resp = doUpdate(req); @@ -127,6 +129,11 @@ public class SolrTest extends Thread { System.out.println("#### no validation performed"); } } + } catch (RuntimeException e) { + numErr++; + throw(e); + } + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>> SUCCESS <<<<<<<<<<<<<<<<<<<<<<<<<<"); } @@ -322,46 +329,60 @@ public class SolrTest extends Thread { try { - IndexSchema schema = schemaFile==null ? null : new IndexSchema(schemaFile); - countdown = requests; - core=new SolrCore(dataDir,schema); + IndexSchema schema = schemaFile==null ? null : new IndexSchema(schemaFile); + countdown = requests; + core=new SolrCore(dataDir,schema); - try { - if (testFile != null) { - testDict = readDict(testFile); - testDictLineno = lineno; - } else { - if (readers > 0) requestDict = readDict(filename); - if (writers > 0) updateDict = readDict(updateFilename); + try { + if (testFile != null) { + testDict = readDict(testFile); + testDictLineno = lineno; + } else { + if (readers > 0) requestDict = readDict(filename); + if (writers > 0) updateDict = readDict(updateFilename); + } + } catch (IOException e) { + e.printStackTrace(); + System.out.println("Can't read "+filename); + return; } - } catch (IOException e) { + + SolrTest[] clients = new SolrTest[readers+writers]; + for (i=0; i>>>>>>>>>>>>>>>>>>>>>>> SUCCESS <<<<<<<<<<<<<<<<<<<<<<<<<<"); + } else { + System.exit(1); + } + } + + } catch (Throwable e) { + if (core!=null) {try{core.close();} catch (Throwable th){}} e.printStackTrace(); - System.out.println("Can't read "+filename); - return; + System.exit(1); } - SolrTest[] clients = new SolrTest[readers+writers]; - for (i=0; i