You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2014/09/11 09:42:55 UTC

svn commit: r1624217 - in /ofbiz/trunk/specialpurpose/lucene: build.xml src/org/ofbiz/content/test/LuceneTests.java

Author: jacopoc
Date: Thu Sep 11 07:42:55 2014
New Revision: 1624217

URL: http://svn.apache.org/r1624217
Log:
Fixed a few issues in the unit tests of the specialpurpose/lucene component.

Modified:
    ofbiz/trunk/specialpurpose/lucene/build.xml
    ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/test/LuceneTests.java

Modified: ofbiz/trunk/specialpurpose/lucene/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/lucene/build.xml?rev=1624217&r1=1624216&r2=1624217&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/lucene/build.xml (original)
+++ ofbiz/trunk/specialpurpose/lucene/build.xml Thu Sep 11 07:42:55 2014
@@ -52,4 +52,8 @@ under the License.
         <fileset dir="../../applications/content/build/lib" includes="*.jar"/>
     </path>
 
+    <target name="jar" depends="classes">
+        <main-jar/>
+        <test-jar/>
+    </target>
 </project>

Modified: ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/test/LuceneTests.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/test/LuceneTests.java?rev=1624217&r1=1624216&r2=1624217&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/test/LuceneTests.java (original)
+++ ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/test/LuceneTests.java Thu Sep 11 07:42:55 2014
@@ -39,6 +39,7 @@ import org.apache.lucene.store.FSDirecto
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.content.search.SearchWorker;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.service.ServiceUtil;
 import org.ofbiz.service.testtools.OFBizTestCase;
 
 public class LuceneTests extends OFBizTestCase {
@@ -58,20 +59,21 @@ public class LuceneTests extends OFBizTe
     protected void tearDown() throws Exception {
     }
 
-    public void testCreateIndex() throws Exception {
+    public void testSearchTermHand() throws Exception {
         Map<String, Object> ctx = new HashMap<String, Object>();
         ctx.put("contentId", "WebStoreCONTENT");
         ctx.put("userLogin", userLogin);
         Map<String, Object> resp = dispatcher.runSync("indexContentTree", ctx);
-    }
-
-    public void testSearchTermHand() throws Exception {
+        assertTrue("Could not init search index", ServiceUtil.isSuccess(resp));
+        try {
+            Thread.sleep(3000); // sleep 3 seconds to give enough time to the indexer to process the entries
+        } catch(Exception e) {}
         Directory directory = FSDirectory.open(new File(SearchWorker.getIndexPath("content")));
         DirectoryReader r = null;
         try {
             r = DirectoryReader.open(directory);
         } catch (Exception e) {
-            // ignore
+            fail("Could not open search index: " + directory);
         }
 
         BooleanQuery combQuery = new BooleanQuery();