You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by jo...@apache.org on 2009/09/10 10:53:14 UTC
svn commit: r813315 - in /incubator/uima/sandbox/trunk/Lucas/src/test:
java/org/apache/uima/lucas/consumer/LuceneCASIndexerTest.java
resources/lucas.xml
Author: joern
Date: Thu Sep 10 08:53:13 2009
New Revision: 813315
URL: http://svn.apache.org/viewvc?rev=813315&view=rev
Log:
UIMA-1558 LuceneCASIndexerTest fails if the created LuceneCASIndexer procsess a CAS
Modified:
incubator/uima/sandbox/trunk/Lucas/src/test/java/org/apache/uima/lucas/consumer/LuceneCASIndexerTest.java
incubator/uima/sandbox/trunk/Lucas/src/test/resources/lucas.xml
Modified: incubator/uima/sandbox/trunk/Lucas/src/test/java/org/apache/uima/lucas/consumer/LuceneCASIndexerTest.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/Lucas/src/test/java/org/apache/uima/lucas/consumer/LuceneCASIndexerTest.java?rev=813315&r1=813314&r2=813315&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/Lucas/src/test/java/org/apache/uima/lucas/consumer/LuceneCASIndexerTest.java (original)
+++ incubator/uima/sandbox/trunk/Lucas/src/test/java/org/apache/uima/lucas/consumer/LuceneCASIndexerTest.java Thu Sep 10 08:53:13 2009
@@ -54,9 +54,9 @@
private static final String pathSep = System.getProperty("file.separator");
- private static final String TEST_FILTER_ANNOTATION = "testFilterAnnotation";
+ private static final String TEST_FILTER_ANNOTATION = "stopwords";
- private static final String TEST_FILTER_FIELD = "testFilterField";
+ private static final String TEST_FILTER_FIELD = "hypernyms";
private static final String FIELD_NAME = "annotation1";
@@ -81,6 +81,9 @@
@After
public void tearDown() throws Exception {
+ if (luceneCASIndexer == null)
+ return;
+
FSDirectory directory = (FSDirectory) luceneCASIndexer.getIndexWriter().getDirectory();
File directoryFile = directory.getFile();
luceneCASIndexer.destroy();
@@ -110,32 +113,32 @@
assertEquals(2, fieldDescription.getAnnotationDescriptions().size());
}
-// @Test
-// public void testPreloadResources() throws IOException {
-// Collection<FieldDescription> fieldDescriptions = luceneCASIndexer.getFieldDescriptions();
-// TokenFilterFactory testFactoryField = createMock(TokenFilterFactory.class);
-// TokenFilterFactory testFactoryAnnotation = createMock(TokenFilterFactory.class);
-//
-// Capture<Properties> propertiesCaptureField = new Capture<Properties>();
-// Capture<Properties> propertiesCaptureAnnotation = new Capture<Properties>();
-//
-// testFactoryField.preloadResources(capture(propertiesCaptureField));
-// testFactoryAnnotation.preloadResources(capture(propertiesCaptureAnnotation));
-//
-// replay(testFactoryField);
-// replay(testFactoryAnnotation);
-//
-// luceneCASIndexer.preloadResources(fieldDescriptions, ImmutableBiMap.of(TEST_FILTER_ANNOTATION,
-// testFactoryAnnotation, TEST_FILTER_FIELD, testFactoryField));
-// verify(testFactoryField);
-// verify(testFactoryAnnotation);
-//
-// Properties fieldFilterProperties = propertiesCaptureField.getValue();
-// assertEquals("value1", fieldFilterProperties.getProperty("key1"));
-//
-// Properties annotationFilterProperties = propertiesCaptureAnnotation.getValue();
-// assertEquals("value2", annotationFilterProperties.getProperty("key2"));
-// }
+ @Test
+ public void testPreloadResources() throws IOException {
+ Collection<FieldDescription> fieldDescriptions = luceneCASIndexer.getFieldDescriptions();
+ TokenFilterFactory testFactoryField = createMock(TokenFilterFactory.class);
+ TokenFilterFactory testFactoryAnnotation = createMock(TokenFilterFactory.class);
+
+ Capture<Properties> propertiesCaptureField = new Capture<Properties>();
+ Capture<Properties> propertiesCaptureAnnotation = new Capture<Properties>();
+
+ testFactoryField.preloadResources(capture(propertiesCaptureField));
+ testFactoryAnnotation.preloadResources(capture(propertiesCaptureAnnotation));
+
+ replay(testFactoryField);
+ replay(testFactoryAnnotation);
+
+ luceneCASIndexer.preloadResources(fieldDescriptions, ImmutableBiMap.of(TEST_FILTER_ANNOTATION,
+ testFactoryAnnotation, TEST_FILTER_FIELD, testFactoryField));
+ verify(testFactoryField);
+ verify(testFactoryAnnotation);
+
+ Properties fieldFilterProperties = propertiesCaptureField.getValue();
+ assertEquals("src/test/resources/hypernyms.txt", fieldFilterProperties.getProperty("filePath"));
+
+ Properties annotationFilterProperties = propertiesCaptureAnnotation.getValue();
+ assertEquals("src/test/resources/stopwords.txt", annotationFilterProperties.getProperty("filePath"));
+ }
@Test
public void testIndexOneDocument() throws ResourceInitializationException,
Modified: incubator/uima/sandbox/trunk/Lucas/src/test/resources/lucas.xml
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/Lucas/src/test/resources/lucas.xml?rev=813315&r1=813314&r2=813315&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/Lucas/src/test/resources/lucas.xml (original)
+++ incubator/uima/sandbox/trunk/Lucas/src/test/resources/lucas.xml Thu Sep 10 08:53:13 2009
@@ -25,12 +25,12 @@
<field name="annotation1" index="yes" termVector="no" stored="yes"
merge="true">
<filters>
- <filter name="uppercase" />
+ <filter name="hypernyms" filePath="src/test/resources/hypernyms.txt"/>
</filters>
<annotations>
<annotation type="org.apache.uima.lucas.indexer.types.test.Annotation1">
<filters>
- <filter name="uppercase"/>
+ <filter name="stopwords" filePath="src/test/resources/stopwords.txt"/>
</filters>
<features>
<feature name="featureString" />