You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by tw...@apache.org on 2007/01/16 15:55:06 UTC
svn commit: r496716 - in /incubator/uima/uimaj/trunk/uimaj-core/src/test:
java/org/apache/uima/cas/test/TypeOrderTest.java
resources/CASTests/CasTypeOrderTestRef.txt
resources/CASTests/desc/typePriorityTestCaseDescriptor.xml
Author: twgoetz
Date: Tue Jan 16 06:55:06 2007
New Revision: 496716
URL: http://svn.apache.org/viewvc?view=rev&rev=496716
Log:
Jira UIMA-197: fix type order test case for Java 1.6.
https://issues.apache.org/jira/browse/UIMA-197
Added:
incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/CASTests/desc/typePriorityTestCaseDescriptor.xml
Modified:
incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TypeOrderTest.java
incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/CASTests/CasTypeOrderTestRef.txt
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TypeOrderTest.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TypeOrderTest.java?view=diff&rev=496716&r1=496715&r2=496716
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TypeOrderTest.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TypeOrderTest.java Tue Jan 16 06:55:06 2007
@@ -21,11 +21,14 @@
import java.io.File;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.io.OutputStreamWriter;
import junit.framework.Assert;
import junit.framework.TestCase;
+import org.apache.uima.UIMAFramework;
+import org.apache.uima.analysis_engine.AnalysisEngine;
import org.apache.uima.cas.CAS;
import org.apache.uima.cas.CASException;
import org.apache.uima.cas.FSIndex;
@@ -41,8 +44,13 @@
import org.apache.uima.cas.admin.TypeSystemMgr;
import org.apache.uima.cas.impl.CASImpl;
import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.resource.ResourceSpecifier;
import org.apache.uima.test.junit_extension.FileCompare;
import org.apache.uima.test.junit_extension.JUnitExtension;
+import org.apache.uima.util.InvalidXMLException;
+import org.apache.uima.util.XMLInputSource;
+import org.apache.uima.util.XMLParser;
public class TypeOrderTest extends TestCase {
@@ -71,7 +79,7 @@
public static final String SENT_TYPE = "Sentence";
- private CASMgr casMgr;
+// private CASMgr casMgr;
private CAS cas;
@@ -90,8 +98,26 @@
*/
protected void setUp() throws Exception {
super.setUp();
- this.casMgr = initCAS();
- this.cas = this.casMgr.getCAS().getCurrentView();
+// this.casMgr = initCAS();
+ File descriptorFile = JUnitExtension.getFile("CASTests/desc/typePriorityTestCaseDescriptor.xml");
+ assertTrue("Descriptor must exist: " + descriptorFile.getAbsolutePath(), descriptorFile.exists());
+
+ try {
+ XMLParser parser = UIMAFramework.getXMLParser();
+ ResourceSpecifier spec = (ResourceSpecifier) parser.parse(new XMLInputSource(descriptorFile));
+ AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(spec);
+ this.cas = ae.newCAS();
+ assertTrue(this.cas != null);
+ } catch (IOException e) {
+ e.printStackTrace();
+ assertTrue(false);
+ } catch (InvalidXMLException e) {
+ e.printStackTrace();
+ assertTrue(false);
+ } catch (ResourceInitializationException e) {
+ e.printStackTrace();
+ assertTrue(false);
+ }
TypeSystem ts = this.cas.getTypeSystem();
// assert(wordType != null);
@@ -102,7 +128,7 @@
}
public void tearDown() {
- this.casMgr = null;
+// this.casMgr = null;
this.cas = null;
this.tokenType = null;
this.sentenceType = null;
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/CASTests/CasTypeOrderTestRef.txt
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/CASTests/CasTypeOrderTestRef.txt?view=diff&rev=496716&r1=496715&r2=496716
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/CASTests/CasTypeOrderTestRef.txt (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/CASTests/CasTypeOrderTestRef.txt Tue Jan 16 06:55:06 2007
@@ -1,100 +1,100 @@
-uima.tcas.Annotation: 0 - 1
Token: 0 - 1
Token: 0 - 1
Token: 0 - 1
Sentence: 0 - 1
-uima.tcas.Annotation: 2 - 3
+uima.tcas.Annotation: 0 - 1
Token: 2 - 3
Token: 2 - 3
Token: 2 - 3
Sentence: 2 - 3
-uima.tcas.Annotation: 4 - 5
+uima.tcas.Annotation: 2 - 3
Token: 4 - 5
Token: 4 - 5
Token: 4 - 5
Sentence: 4 - 5
-uima.tcas.Annotation: 6 - 7
+uima.tcas.Annotation: 4 - 5
Token: 6 - 7
Token: 6 - 7
Token: 6 - 7
Sentence: 6 - 7
-uima.tcas.Annotation: 8 - 9
+uima.tcas.Annotation: 6 - 7
Token: 8 - 9
Token: 8 - 9
Token: 8 - 9
Sentence: 8 - 9
-uima.tcas.Annotation: 10 - 11
+uima.tcas.Annotation: 8 - 9
Token: 10 - 11
Token: 10 - 11
Token: 10 - 11
Sentence: 10 - 11
-uima.tcas.Annotation: 12 - 13
+uima.tcas.Annotation: 10 - 11
Token: 12 - 13
Token: 12 - 13
Token: 12 - 13
Sentence: 12 - 13
-uima.tcas.Annotation: 14 - 15
+uima.tcas.Annotation: 12 - 13
Token: 14 - 15
Token: 14 - 15
Token: 14 - 15
Sentence: 14 - 15
-uima.tcas.Annotation: 16 - 17
+uima.tcas.Annotation: 14 - 15
Token: 16 - 17
Token: 16 - 17
Token: 16 - 17
Sentence: 16 - 17
-uima.tcas.Annotation: 18 - 19
+uima.tcas.Annotation: 16 - 17
Token: 18 - 19
Token: 18 - 19
Token: 18 - 19
Sentence: 18 - 19
-uima.tcas.Annotation: 20 - 21
+uima.tcas.Annotation: 18 - 19
Token: 20 - 21
Token: 20 - 21
Token: 20 - 21
Sentence: 20 - 21
-uima.tcas.Annotation: 22 - 23
+uima.tcas.Annotation: 20 - 21
Token: 22 - 23
Token: 22 - 23
Token: 22 - 23
Sentence: 22 - 23
-uima.tcas.Annotation: 24 - 25
+uima.tcas.Annotation: 22 - 23
Token: 24 - 25
Token: 24 - 25
Token: 24 - 25
Sentence: 24 - 25
-uima.tcas.Annotation: 26 - 27
+uima.tcas.Annotation: 24 - 25
Token: 26 - 27
Token: 26 - 27
Token: 26 - 27
Sentence: 26 - 27
-uima.tcas.Annotation: 28 - 29
+uima.tcas.Annotation: 26 - 27
Token: 28 - 29
Token: 28 - 29
Token: 28 - 29
Sentence: 28 - 29
-uima.tcas.Annotation: 30 - 31
+uima.tcas.Annotation: 28 - 29
Token: 30 - 31
Token: 30 - 31
Token: 30 - 31
Sentence: 30 - 31
-uima.tcas.Annotation: 32 - 33
+uima.tcas.Annotation: 30 - 31
Token: 32 - 33
Token: 32 - 33
Token: 32 - 33
Sentence: 32 - 33
-uima.tcas.Annotation: 34 - 35
+uima.tcas.Annotation: 32 - 33
Token: 34 - 35
Token: 34 - 35
Token: 34 - 35
Sentence: 34 - 35
-uima.tcas.Annotation: 36 - 37
+uima.tcas.Annotation: 34 - 35
Token: 36 - 37
Token: 36 - 37
Token: 36 - 37
Sentence: 36 - 37
-uima.tcas.Annotation: 38 - 39
+uima.tcas.Annotation: 36 - 37
Token: 38 - 39
Token: 38 - 39
Token: 38 - 39
Sentence: 38 - 39
+uima.tcas.Annotation: 38 - 39
Added: incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/CASTests/desc/typePriorityTestCaseDescriptor.xml
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/CASTests/desc/typePriorityTestCaseDescriptor.xml?view=auto&rev=496716
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/CASTests/desc/typePriorityTestCaseDescriptor.xml (added)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/resources/CASTests/desc/typePriorityTestCaseDescriptor.xml Tue Jan 16 06:55:06 2007
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<analysisEngineDescription
+ xmlns="http://uima.apache.org/resourceSpecifier">
+ <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+ <primitive>true</primitive>
+ <annotatorImplementationName>
+ org.apache.uima.cas.test.TestAnnotator
+ </annotatorImplementationName>
+ <analysisEngineMetaData>
+ <name>aeDescriptor</name>
+ <description></description>
+ <version>1.0</version>
+ <vendor></vendor>
+ <configurationParameters />
+ <configurationParameterSettings />
+ <typeSystemDescription>
+ <imports>
+ <import location="casTestCaseTypesystem.xml" />
+ </imports>
+ </typeSystemDescription>
+ <typePriorities>
+ <priorityList>
+ <type>Token</type>
+ <type>Sentence</type>
+ <type>uima.tcas.Annotation</type>
+ </priorityList>
+ </typePriorities>
+ <fsIndexCollection>
+ <fsIndexes>
+ <fsIndexDescription>
+ <label>Annotation Set Index</label>
+ <typeName>uima.tcas.Annotation</typeName>
+ <kind>set</kind>
+ <keys>
+ <fsIndexKey>
+ <featureName>begin</featureName>
+ <comparator>standard</comparator>
+ </fsIndexKey>
+ <fsIndexKey>
+ <featureName>end</featureName>
+ <comparator>reverse</comparator>
+ </fsIndexKey>
+ </keys>
+ </fsIndexDescription>
+ <fsIndexDescription>
+ <label>Annotation Bag Index</label>
+ <typeName>uima.tcas.Annotation</typeName>
+ <kind>bag</kind>
+ <keys>
+ <fsIndexKey>
+ <featureName>begin</featureName>
+ <comparator>standard</comparator>
+ </fsIndexKey>
+ <fsIndexKey>
+ <featureName>end</featureName>
+ <comparator>reverse</comparator>
+ </fsIndexKey>
+ </keys>
+ </fsIndexDescription>
+ <fsIndexDescription>
+ <label>TypeOrderIndex</label>
+ <typeName>uima.tcas.Annotation</typeName>
+ <kind>sorted</kind>
+ <keys>
+ <fsIndexKey>
+ <featureName>begin</featureName>
+ <comparator>standard</comparator>
+ </fsIndexKey>
+ <fsIndexKey>
+ <featureName>end</featureName>
+ <comparator>reverse</comparator>
+ </fsIndexKey>
+ <fsIndexKey>
+ <typePriority />
+ </fsIndexKey>
+ </keys>
+ </fsIndexDescription>
+ </fsIndexes>
+ </fsIndexCollection>
+ <capabilities>
+ <capability>
+ <inputs />
+ <outputs />
+ <languagesSupported />
+ </capability>
+ </capabilities>
+ <operationalProperties>
+ <modifiesCas>true</modifiesCas>
+ <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+ <outputsNewCASes>false</outputsNewCASes>
+ </operationalProperties>
+ </analysisEngineMetaData>
+ <resourceManagerConfiguration />
+</analysisEngineDescription>