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 eh...@apache.org on 2010/03/17 19:33:09 UTC

svn commit: r924409 - in /lucene/solr/trunk/contrib/velocity: build.xml src/test/java/ src/test/org/ src/test/org/apache/ src/test/org/apache/solr/ src/test/org/apache/solr/velocity/ src/test/org/apache/solr/velocity/VelocityResponseWriterTest.java

Author: ehatcher
Date: Wed Mar 17 18:33:09 2010
New Revision: 924409

URL: http://svn.apache.org/viewvc?rev=924409&view=rev
Log:
Adding overdue unit test and adjusting build file accordingly

Added:
    lucene/solr/trunk/contrib/velocity/src/test/org/
    lucene/solr/trunk/contrib/velocity/src/test/org/apache/
    lucene/solr/trunk/contrib/velocity/src/test/org/apache/solr/
    lucene/solr/trunk/contrib/velocity/src/test/org/apache/solr/velocity/
    lucene/solr/trunk/contrib/velocity/src/test/org/apache/solr/velocity/VelocityResponseWriterTest.java
Removed:
    lucene/solr/trunk/contrib/velocity/src/test/java/
Modified:
    lucene/solr/trunk/contrib/velocity/build.xml

Modified: lucene/solr/trunk/contrib/velocity/build.xml
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/velocity/build.xml?rev=924409&r1=924408&r2=924409&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/velocity/build.xml (original)
+++ lucene/solr/trunk/contrib/velocity/build.xml Wed Mar 17 18:33:09 2010
@@ -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>
 

Added: lucene/solr/trunk/contrib/velocity/src/test/org/apache/solr/velocity/VelocityResponseWriterTest.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/velocity/src/test/org/apache/solr/velocity/VelocityResponseWriterTest.java?rev=924409&view=auto
==============================================================================
--- lucene/solr/trunk/contrib/velocity/src/test/org/apache/solr/velocity/VelocityResponseWriterTest.java (added)
+++ lucene/solr/trunk/contrib/velocity/src/test/org/apache/solr/velocity/VelocityResponseWriterTest.java Wed Mar 17 18:33:09 2010
@@ -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());
+  }
+}