You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by yo...@apache.org on 2006/02/07 23:04:40 UTC
svn commit: r375736 - in /incubator/solr/trunk: ./ src/apps/SolarTest/
src/apps/SolarTest/conf/ src/apps/SolarTest/src/
Author: yonik
Date: Tue Feb 7 14:04:39 2006
New Revision: 375736
URL: http://svn.apache.org/viewcvs?rev=375736&view=rev
Log:
make apps/SolarTest runnable via ant test
Added:
incubator/solr/trunk/src/apps/SolarTest/conf/
incubator/solr/trunk/src/apps/SolarTest/conf/protwords.txt
- copied unchanged from r375450, incubator/solr/trunk/src/apps/SolarTest/protwords.txt
incubator/solr/trunk/src/apps/SolarTest/conf/schema.xml
- copied unchanged from r375450, incubator/solr/trunk/src/apps/SolarTest/schema.xml
incubator/solr/trunk/src/apps/SolarTest/conf/solrconfig.xml
- copied unchanged from r375450, incubator/solr/trunk/src/apps/SolarTest/solrconfig.xml
incubator/solr/trunk/src/apps/SolarTest/conf/stopwords.txt
- copied unchanged from r375450, incubator/solr/trunk/src/apps/SolarTest/stopwords.txt
incubator/solr/trunk/src/apps/SolarTest/conf/synonyms.txt
- copied unchanged from r375450, incubator/solr/trunk/src/apps/SolarTest/synonyms.txt
Removed:
incubator/solr/trunk/src/apps/SolarTest/protwords.txt
incubator/solr/trunk/src/apps/SolarTest/run
incubator/solr/trunk/src/apps/SolarTest/schema.xml
incubator/solr/trunk/src/apps/SolarTest/solrconfig.xml
incubator/solr/trunk/src/apps/SolarTest/stopwords.txt
incubator/solr/trunk/src/apps/SolarTest/synonyms.txt
Modified:
incubator/solr/trunk/CHANGES.txt (props changed)
incubator/solr/trunk/LICENSE.txt (props changed)
incubator/solr/trunk/build.xml (contents, props changed)
incubator/solr/trunk/src/apps/SolarTest/src/SolrTest.java
Propchange: incubator/solr/trunk/CHANGES.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/solr/trunk/LICENSE.txt
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/solr/trunk/build.xml
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/build.xml?rev=375736&r1=375735&r2=375736&view=diff
==============================================================================
--- incubator/solr/trunk/build.xml (original)
+++ incubator/solr/trunk/build.xml Tue Feb 7 14:04:39 2006
@@ -70,6 +70,12 @@
<!-- For now, it's the same as main classpath. Later it will have JUnit, Clover, etc. -->
<path id="test.compile.classpath">
<path refid="compile.classpath" />
+ <pathelement location="${dest}"/>
+ </path>
+
+ <path id="test.run.classpath">
+ <path refid="test.compile.classpath" />
+ <pathelement location="${dest}/tests"/>
</path>
<!-- Compile unit tests. -->
@@ -77,10 +83,11 @@
description="Compile unit tests."
depends="compile">
<mkdir dir="${dest}/tests" />
- <javac destdir="${dest}/tests"
- classpathref="test.compile.classpath">
- <src dir="${src}/test" />
- <src dir="${src}/apps/SolarTest/src" />
+ <javac
+ destdir="${dest}/tests"
+ classpathref="test.compile.classpath">
+ <src path="${src}/test" />
+ <src path="${src}/apps/SolarTest/src" />
</javac>
</target>
@@ -89,6 +96,14 @@
description="Runs the unit tests."
depends="compileTests">
<echo message="TO-DO later or after we convert tests to JUnit." />
+
+ <java classname="SolrTest" fork="true" dir="src/apps/SolarTest" failonerror="true">
+ <arg line="-test newtest.txt"/>
+ <classpath>
+ <path refid="test.run.classpath" />
+ </classpath>
+ </java>
+
</target>
@@ -103,7 +118,7 @@
description="Creates the Solr distribution files."
depends="dist-src, dist-war, dist-bin" />
- <!-- Creates the demo WAR file. -->
+ <!-- Creates the Solr WAR file. -->
<target name="dist-war"
description="Creates the demo WAR file."
depends="compile">
Propchange: incubator/solr/trunk/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/solr/trunk/src/apps/SolarTest/src/SolrTest.java
URL: http://svn.apache.org/viewcvs/incubator/solr/trunk/src/apps/SolarTest/src/SolrTest.java?rev=375736&r1=375735&r2=375736&view=diff
==============================================================================
--- incubator/solr/trunk/src/apps/SolarTest/src/SolrTest.java (original)
+++ incubator/solr/trunk/src/apps/SolarTest/src/SolrTest.java Tue Feb 7 14:04:39 2006
@@ -83,7 +83,9 @@
boolean sequenceTest=false;
public void run() {
+
if (sequenceTest) {
+ try {
for (int i=0; i<testDict.length; i++) {
String s = testDict[i];
int lineno = testDictLineno.get(i);
@@ -112,9 +114,9 @@
if (startParams > 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 @@
System.out.println("#### no validation performed");
}
}
+ } catch (RuntimeException e) {
+ numErr++;
+ throw(e);
+ }
+
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>> SUCCESS <<<<<<<<<<<<<<<<<<<<<<<<<<");
}
@@ -322,46 +329,60 @@
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) {
- e.printStackTrace();
- System.out.println("Can't read "+filename);
- return;
- }
- SolrTest[] clients = new SolrTest[readers+writers];
- for (i=0; i<readers; i++) {
- clients[i] = new SolrTest();
- if (testFile != null) clients[i].sequenceTest=true;
- clients[i].start();
- }
- for (i=readers; i<readers+writers; i++) {
- clients[i] = new SolrTest();
- clients[i].isWriter = true;
- clients[i].start();
- }
+ SolrTest[] clients = new SolrTest[readers+writers];
+ for (i=0; i<readers; i++) {
+ clients[i] = new SolrTest();
+ if (testFile != null) clients[i].sequenceTest=true;
+ clients[i].start();
+ }
+ for (i=readers; i<readers+writers; i++) {
+ clients[i] = new SolrTest();
+ clients[i].isWriter = true;
+ clients[i].start();
+ }
- for (i=0; i<readers; i++) {
- clients[i].join();
- }
- for (i=readers; i<readers+writers; i++) {
- clients[i].join();
- }
+ for (i=0; i<readers; i++) {
+ clients[i].join();
+ }
+ for (i=readers; i<readers+writers; i++) {
+ clients[i].join();
+ }
+
+ core.close();
+ core=null;
- } finally {
- if (core != null) core.close();
+ if (testFile!=null) {
+ if (clients[0].numErr == 0) {
+ System.out.println(">>>>>>>>>>>>>>>>>>>>>>>> SUCCESS <<<<<<<<<<<<<<<<<<<<<<<<<<");
+ } else {
+ System.exit(1);
+ }
+ }
+
+ } catch (Throwable e) {
+ if (core!=null) {try{core.close();} catch (Throwable th){}}
+ e.printStackTrace();
+ System.exit(1);
}
+
}