[jsword-svn] r1961 - in trunk/jsword/src: main/java/org/crosswire/jsword/index/lucene/analysis test/java test/java/org/crosswire/jsword/book test/java/org/crosswire/jsword/book/sword test/java/org/crosswire/jsword/book/test test/java/org/crosswire/jsword/bridge test/java/org/crosswire/jsword/index/lucene/analysis

dmsmith at crosswire.org dmsmith at crosswire.org
Tue Oct 27 18:33:37 MST 2009


Author: dmsmith
Date: 2009-10-27 18:33:37 -0700 (Tue, 27 Oct 2009)
New Revision: 1961

Modified:
   trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/ConfigurableSnowballAnalyzer.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/KeyFilter.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/StrongsNumberFilter.java
   trunk/jsword/src/test/java/JSwordAllTests.java
   trunk/jsword/src/test/java/org/crosswire/jsword/book/BooksTest.java
   trunk/jsword/src/test/java/org/crosswire/jsword/book/ReadEverything.java
   trunk/jsword/src/test/java/org/crosswire/jsword/book/sword/ConfigEntryTableTest.java
   trunk/jsword/src/test/java/org/crosswire/jsword/book/test/Speed.java
   trunk/jsword/src/test/java/org/crosswire/jsword/bridge/DwrBridgeTest.java
   trunk/jsword/src/test/java/org/crosswire/jsword/index/lucene/analysis/ConfigurableSnowballAnalyzerTest.java
Log:
Fixed problems reported via the tests.

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/ConfigurableSnowballAnalyzer.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/ConfigurableSnowballAnalyzer.java	2009-10-27 23:17:16 UTC (rev 1960)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/ConfigurableSnowballAnalyzer.java	2009-10-28 01:33:37 UTC (rev 1961)
@@ -112,9 +112,6 @@
         stemmerName = language;
         if (stemmerName != null)
         {
-            // stemmer name are same as language name, in most cases
-            stemmerName = book.getLanguage().getName();
-
             // Check for allowed stemmers
             if (!allowedStemmers.matcher(stemmerName).matches())
             {

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/KeyFilter.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/KeyFilter.java	2009-10-27 23:17:16 UTC (rev 1960)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/KeyFilter.java	2009-10-28 01:33:37 UTC (rev 1961)
@@ -60,6 +60,6 @@
     public boolean incrementToken() throws IOException
     {
         // TODO(DMS): actually normalize
-        return super.incrementToken();
+        return input.incrementToken();
     }
 }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/StrongsNumberFilter.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/StrongsNumberFilter.java	2009-10-27 23:17:16 UTC (rev 1960)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/StrongsNumberFilter.java	2009-10-28 01:33:37 UTC (rev 1961)
@@ -66,7 +66,7 @@
         // then create a token without the suffix and also for the whole.
         if (number == null)
         {
-            if (super.incrementToken())
+            if (input.incrementToken())
             {
                 try
                 {

Modified: trunk/jsword/src/test/java/JSwordAllTests.java
===================================================================
--- trunk/jsword/src/test/java/JSwordAllTests.java	2009-10-27 23:17:16 UTC (rev 1960)
+++ trunk/jsword/src/test/java/JSwordAllTests.java	2009-10-28 01:33:37 UTC (rev 1961)
@@ -61,15 +61,27 @@
         suite.addTestSuite(org.crosswire.jsword.book.BookMetaDataTest.class);
         suite.addTestSuite(org.crosswire.jsword.book.SentanceUtilTest.class);
 
-        // run independently: suite.addTestSuite(org.crosswire.jsword.book.ReadEverything.class);
+        // run independently:
+        //suite.addTestSuite(org.crosswire.jsword.book.ReadEverything.class);
         // commented out because the tests were very poor.
         //suite.addTestSuite(org.crosswire.jsword.book.OsisTest.class);
 
+        // Not a JUnit test
+        //suite.addTestSuite(org.crosswire.jsword.book.test.Speed.class);
+
         /* FIXME
         suite.addTestSuite(org.crosswire.jsword.index.search.parse.ParserTest.class);
         suite.addTestSuite(org.crosswire.jsword.index.search.parse.WordsTest.class);
         */
 
+        suite.addTestSuite(org.crosswire.jsword.book.sword.ConfigEntryTableTest.class);
+        suite.addTestSuite(org.crosswire.jsword.book.sword.RawFileBackendTest.class);
+        suite.addTestSuite(org.crosswire.jsword.book.sword.SwordBookDriverTest.class);
+        suite.addTestSuite(org.crosswire.jsword.book.sword.SwordBookMetaDataTest.class);
+        suite.addTestSuite(org.crosswire.jsword.book.sword.SwordBookTest.class);
+
+        suite.addTestSuite(org.crosswire.jsword.bridge.DwrBridgeTest.class);
+
         suite.addTestSuite(org.crosswire.jsword.index.lucene.analysis.AnalyzerFactoryTest.class);
         suite.addTestSuite(org.crosswire.jsword.index.lucene.analysis.ChineseLuceneAnalyzerTest.class);
         suite.addTestSuite(org.crosswire.jsword.index.lucene.analysis.ConfigurableSnowballAnalyzerTest.class);

Modified: trunk/jsword/src/test/java/org/crosswire/jsword/book/BooksTest.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/book/BooksTest.java	2009-10-27 23:17:16 UTC (rev 1960)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/book/BooksTest.java	2009-10-28 01:33:37 UTC (rev 1961)
@@ -109,7 +109,6 @@
             assertTrue(bmd.getInitials().length() > 0);
             assertTrue(bmd.getName() != null);
             assertTrue(bmd.getName().length() > 0);
-            assertTrue(bmd.getName().length() > bmd.getInitials().length());
         }
     }
 

Modified: trunk/jsword/src/test/java/org/crosswire/jsword/book/ReadEverything.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/book/ReadEverything.java	2009-10-27 23:17:16 UTC (rev 1960)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/book/ReadEverything.java	2009-10-28 01:33:37 UTC (rev 1961)
@@ -21,22 +21,11 @@
  */
 package org.crosswire.jsword.book;
 
-import java.io.IOException;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Locale;
-import java.util.ResourceBundle;
 
-import org.crosswire.common.config.ChoiceFactory;
-import org.crosswire.common.config.Config;
-import org.crosswire.common.util.CWClassLoader;
-import org.crosswire.common.util.CWProject;
 import org.crosswire.common.util.Logger;
-import org.crosswire.common.util.ResourceUtil;
-import org.crosswire.common.xml.XMLUtil;
 import org.crosswire.jsword.passage.Key;
-import org.jdom.Document;
-import org.jdom.JDOMException;
 
 /**
  * Test to check that all books can be read.
@@ -57,11 +46,13 @@
     /**
      * Read all the books that we can get our hands on.
      */
-    public static void main(String[] args) throws IOException, JDOMException
+    public static void main(String[] args)
     {
         Logger.outputEverything();
 
-        // This must be the first static in the program.
+/*
+         // This must be the first static in the program.
+
         // To ensure this we place it at the top of the class!
         // This will set it as a place to look for overrides for
         // ResourceBundles, properties and other resources
@@ -84,19 +75,21 @@
 
         config.setProperties(ResourceUtil.getProperties("desktop")); //$NON-NLS-1$
         config.localToApplication();
-
-        // Loop through all the Bookks
+ */
+        // Loop through all the Books
         log.warn("*** Reading all known Books"); //$NON-NLS-1$
         List comments = Books.installed().getBooks();
         for (Iterator cit = comments.iterator(); cit.hasNext();)
         {
             Book book = (Book) cit.next();
 
-            log.warn("****** Reading: " + book.getInitials()); //$NON-NLS-1$
+            if (!book.isLocked())
+            {
+                log.warn("****** Reading: " + book.getInitials()); //$NON-NLS-1$
+                Key set = book.getGlobalKeyList();
 
-            Key set = book.getGlobalKeyList();
-
-            testReadMultiple(book, set);
+                testReadMultiple(book, set);
+            }
         }
     }
 

Modified: trunk/jsword/src/test/java/org/crosswire/jsword/book/sword/ConfigEntryTableTest.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/book/sword/ConfigEntryTableTest.java	2009-10-27 23:17:16 UTC (rev 1960)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/book/sword/ConfigEntryTableTest.java	2009-10-28 01:33:37 UTC (rev 1961)
@@ -50,7 +50,7 @@
         assertNotNull(table);
 
         table.add(ConfigEntryType.LANG, "de"); //$NON-NLS-1$
-        assertEquals(table.getValue(ConfigEntryType.LANG), "de"); //$NON-NLS-1$
+        assertEquals("de", ((Language) table.getValue(ConfigEntryType.LANG)).getCode()); //$NON-NLS-1$
     }
 
     public void testSaveConfigEntryTable()

Modified: trunk/jsword/src/test/java/org/crosswire/jsword/book/test/Speed.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/book/test/Speed.java	2009-10-27 23:17:16 UTC (rev 1960)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/book/test/Speed.java	2009-10-28 01:33:37 UTC (rev 1961)
@@ -33,7 +33,7 @@
 
 /**
  * Speed is a simple benchmark that tests how fast a version is. The
- * current set of tasks that we perform are rather arbitry (sp?).
+ * current set of tasks that we perform are rather arbitrary.
  * But that is something that we can improve on when we have more
  * usage information.
  *

Modified: trunk/jsword/src/test/java/org/crosswire/jsword/bridge/DwrBridgeTest.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/bridge/DwrBridgeTest.java	2009-10-27 23:17:16 UTC (rev 1960)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/bridge/DwrBridgeTest.java	2009-10-28 01:33:37 UTC (rev 1961)
@@ -45,10 +45,10 @@
 
     public void testGetBooks()
     {
-        String[][] bibles = dwrBridge.getInstalledBooks("bookCategory=Bible"); //$NON-NLS-1$
+        String[][] bibles = dwrBridge.getInstalledBooks("bookCategory=Biblical Texts"); //$NON-NLS-1$
         assertTrue(bibles.length > 1);
 
-        String[][] dicts  = dwrBridge.getInstalledBooks("bookCategory=Dictionary"); //$NON-NLS-1$
+        String[][] dicts  = dwrBridge.getInstalledBooks("bookCategory=Dictionaries"); //$NON-NLS-1$
         assertTrue(dicts.length > 1);
     }
 
@@ -57,7 +57,7 @@
         try
         {
             String verse = dwrBridge.getOSISString("KJV", "Gen 1:1", 0, 100); //$NON-NLS-1$ //$NON-NLS-2$
-            assertEquals(verse, "<div><title type=\"x-gen\">Genesis 1:1</title><verse osisID=\"Gen.1.1\"><w lemma=\"strong:H07225\">In the beginning</w> <w lemma=\"strong:H0430\">God</w> <w lemma=\"strong:H0853 strong:H01254\" morph=\"strongMorph:TH8804\">created</w> <w lemma=\"strong:H08064\">the heaven</w> <w lemma=\"strong:H0853\">and</w> <w lemma=\"strong:H0776\">the earth</w>.</verse></div>"); //$NON-NLS-1$
+            assertEquals(verse, "<div><title type=\"x-gen\">Gen 1:1</title><verse osisID=\"Gen.1.1\"><w lemma=\"strong:H07225\">In the beginning</w> <w lemma=\"strong:H0430\">God</w> <w lemma=\"strong:H0853 strong:H01254\" morph=\"strongMorph:TH8804\">created</w> <w lemma=\"strong:H08064\">the heaven</w> <w lemma=\"strong:H0853\">and</w> <w lemma=\"strong:H0776\">the earth</w>.</verse></div>"); //$NON-NLS-1$
             String hdef = dwrBridge.getOSISString("StrongsHebrew", "H07225", 0, 100); //$NON-NLS-1$ //$NON-NLS-2$
             assertEquals(hdef, "<div><title>07225</title>7225  re'shiyth  ray-sheeth'\r<lb></lb>\r<lb></lb> from the same as 7218; the first, in place, time, order or\r<lb></lb> rank (specifically, a firstfruit):--beginning, chief(-est),\r<lb></lb> first(-fruits, part, time), principal thing.\r<lb></lb> see HEBREW for 07218</div>"); //$NON-NLS-1$
         }
@@ -82,7 +82,7 @@
         try
         {
             String result = dwrBridge.search("KJV", "aaron AND moses AND egypt"); //$NON-NLS-1$ //$NON-NLS-2$
-            assertEquals(result, "Exo 5:4, 6:13, 26-27, 7:19, 8:5, 16, 12:1, 16:6, 32:1, Num 14:2, 26:59, 33:1, Jos 24:5, 1Sa 12:6, 8, Mic 6:4, Act 7:40"); //$NON-NLS-1$
+            assertEquals("Exo 5:4, 6:13, 26-27, 7:19, 8:5, 16, 12:1, 16:6, 32:1, Num 14:2, 26:59, 33:1, Jos 24:5, 1Sa 12:6, 8, Mic 6:4, Act 7:40", result); //$NON-NLS-1$
         }
         catch (BookException e)
         {

Modified: trunk/jsword/src/test/java/org/crosswire/jsword/index/lucene/analysis/ConfigurableSnowballAnalyzerTest.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/index/lucene/analysis/ConfigurableSnowballAnalyzerTest.java	2009-10-27 23:17:16 UTC (rev 1960)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/index/lucene/analysis/ConfigurableSnowballAnalyzerTest.java	2009-10-28 01:33:37 UTC (rev 1961)
@@ -69,7 +69,7 @@
         
         myAnalyzer.pickStemmer("French"); //$NON-NLS-1$
         
-        String testInput=" tant aim� le monde qu 'il a donn� son"; //$NON-NLS-1$
+        String testInput=" tant aimŽ le monde qu'il a donnŽ son"; //$NON-NLS-1$
       
         
         Query query = parser.parse(testInput);
@@ -97,13 +97,13 @@
         myAnalyzer.pickStemmer("French"); //$NON-NLS-1$
         myAnalyzer.setDoStemming(false);
         
-        String testInput=" tant aim� le monde qu 'il a donn� son"; //$NON-NLS-1$
+        String testInput=" tant aimŽ le monde qu'il a donnŽ son"; //$NON-NLS-1$
       
         
         Query query = parser.parse(testInput);
         //System.out.println(query.toString());
-        assertTrue(query.toString().indexOf(field+":aim� ") > -1); //$NON-NLS-1$
-        assertTrue(query.toString().indexOf(field+":donn� ") > -1); //$NON-NLS-1$
+        assertTrue(query.toString().indexOf(field+":aimŽ ") > -1); //$NON-NLS-1$
+        assertTrue(query.toString().indexOf(field+":donnŽ ") > -1); //$NON-NLS-1$
     }   
 
     public void testStemmerConfig() throws ParseException
@@ -112,12 +112,12 @@
         myAnalyzer.pickStemmer("French"); //$NON-NLS-1$
         myAnalyzer.setDoStemming(false);
         
-        String testInput=" tant aim� le monde qu 'il a donn� son"; //$NON-NLS-1$
+        String testInput=" tant aimŽ le monde qu'il a donnŽ son"; //$NON-NLS-1$
       
         
         Query query = parser.parse(testInput);
-        assertTrue(query.toString().indexOf(field+":aim� ") > -1); //$NON-NLS-1$
-        assertTrue(query.toString().indexOf(field+":donn� ") > -1); //$NON-NLS-1$
+        assertTrue(query.toString().indexOf(field+":aimŽ ") > -1); //$NON-NLS-1$
+        assertTrue(query.toString().indexOf(field+":donnŽ ") > -1); //$NON-NLS-1$
               
     }    
    
@@ -126,7 +126,7 @@
         
         myAnalyzer.pickStemmer("German"); //$NON-NLS-1$
                
-        String testInput="Denn also hat Gott die Welt geliebt, da� er seinen eingeborenen Sohn gab, auf da� jeder, der an ihn glaubt, nicht verloren gehe, sondern ewiges Leben habe"; //$NON-NLS-1$
+        String testInput="Denn also hat Gott die Welt geliebt, da§ er seinen eingeborenen Sohn gab, auf da§ jeder, der an ihn glaubt, nicht verloren gehe, sondern ewiges Leben habe"; //$NON-NLS-1$
               
         Query query = parser.parse(testInput);
         assertTrue(query.toString().indexOf(field+":denn ") > -1); //$NON-NLS-1$




More information about the jsword-svn mailing list