Adding overdue unit test and adjusting build file accordingly

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@924409 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erik Hatcher 2010-03-17 18:33:09 +00:00
parent 92e2e200a3
commit a45422f66a
3 changed files with 32 additions and 8 deletions

View File

@ -69,27 +69,27 @@
<target name="compileTests" depends="compile">
<solr-javac destdir="target/test-classes"
classpathref="test.classpath">
<src path="src/test/java" />
<src path="src/test" />
</solr-javac>
</target>
<target name="test" depends="compileTests">
<mkdir dir="${junit.output.dir}"/>
<junit printsummary="on"
<junit printsummary="true" showoutput="true"
haltonfailure="no"
errorProperty="tests.failed"
failureProperty="tests.failed"
dir="src/test/resources/"
dir="src/main"
>
<formatter type="brief" usefile="false" if="junit.details"/>
<formatter type="brief" usefile="false"/>
<classpath refid="test.classpath"/>
<formatter type="xml"/>
<!--<formatter type="xml" usefile="false"/>-->
<batchtest fork="yes" todir="${junit.output.dir}" unless="testcase">
<fileset dir="src/test/java" includes="${junit.includes}"/>
<fileset dir="src/test" includes="${junit.includes}"/>
</batchtest>
<batchtest fork="yes" todir="${junit.output.dir}" if="testcase">
<fileset dir="src/test/java" includes="**/${testcase}.java"/>
<fileset dir="src/test" includes="**/${testcase}.java"/>
</batchtest>
</junit>

View File

@ -1 +0,0 @@
Yes, tests are forthcoming! Sorry Hudson.

View File

@ -0,0 +1,25 @@
package org.apache.solr.velocity;
import org.apache.solr.response.SolrQueryResponse;
import org.apache.solr.response.VelocityResponseWriter;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.util.AbstractSolrTestCase;
import java.io.StringWriter;
import java.io.IOException;
public class VelocityResponseWriterTest extends AbstractSolrTestCase {
public String getSchemaFile() { return "schema.xml"; }
public String getSolrConfigFile() { return "solrconfig.xml"; }
public void testTemplateName() throws IOException {
org.apache.solr.response.VelocityResponseWriter vrw = new VelocityResponseWriter();
SolrQueryRequest req = req("v.template","custom", "v.template.custom","$response.response.response_data");
SolrQueryResponse rsp = new SolrQueryResponse();
StringWriter buf = new StringWriter();
rsp.add("response_data", "testing");
vrw.write(buf, req, rsp);
assertEquals("testing", buf.toString());
}
}