You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by vm...@apache.org on 2019/10/22 11:44:55 UTC
svn commit: r1868749 -
/uima/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/action/MacroActionTest.java
Author: vmorari
Date: Tue Oct 22 11:44:55 2019
New Revision: 1868749
URL: http://svn.apache.org/viewvc?rev=1868749&view=rev
Log:
UIMA-6133: added test.
Modified:
uima/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/action/MacroActionTest.java
Modified: uima/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/action/MacroActionTest.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/action/MacroActionTest.java?rev=1868749&r1=1868748&r2=1868749&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/action/MacroActionTest.java (original)
+++ uima/ruta/trunk/ruta-core/src/test/java/org/apache/uima/ruta/action/MacroActionTest.java Tue Oct 22 11:44:55 2019
@@ -19,9 +19,25 @@
package org.apache.uima.ruta.action;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.FSIterator;
+import org.apache.uima.cas.Feature;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.cas.text.AnnotationIndex;
import org.apache.uima.ruta.engine.Ruta;
import org.apache.uima.ruta.engine.RutaTestUtils;
+import org.apache.uima.ruta.engine.RutaTestUtils.TestFeature;
+import org.junit.Ignore;
import org.junit.Test;
public class MacroActionTest {
@@ -84,5 +100,52 @@ public class MacroActionTest {
cas.release();
}
+
+ @Test
+ @Ignore
+ public void testShareSameNameArgumentAndLabel() throws Exception {
+ String document = "Day 5";
+ String script = "ACTION CreateDate(ANNOTATION day) = CREATE(Date, \"day\"=day);\n";
+ script += "(CW day:NUM){-> CreateDate(day)};\n";
+
+ Map<String, String> typeMap = new TreeMap<String, String>();
+ String typeName1 = "Date";
+ typeMap.put(typeName1, "uima.tcas.Annotation");
+
+ Map<String, List<TestFeature>> featureMap = new TreeMap<String, List<TestFeature>>();
+ List<TestFeature> list = new ArrayList<RutaTestUtils.TestFeature>();
+ featureMap.put(typeName1, list);
+ String fn1 = "day";
+ list.add(new TestFeature(fn1, "", "uima.tcas.Annotation"));
+
+
+ CAS cas = null;
+ try {
+ cas = RutaTestUtils.getCAS(document, typeMap, featureMap);
+ Ruta.apply(cas, script);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ Type t = null;
+ AnnotationIndex<AnnotationFS> ai = null;
+ FSIterator<AnnotationFS> iterator = null;
+
+ t = cas.getTypeSystem().getType(typeName1);
+ Feature feat = t.getFeatureByBaseName(fn1);
+
+ ai = cas.getAnnotationIndex(t);
+
+ iterator = ai.iterator();
+
+ AnnotationFS nextFS = iterator.next();
+
+ FeatureStructure fv1 = nextFS.getFeatureValue(feat);
+ assertNotNull(fv1);
+
+ assertEquals("5", ((AnnotationFS) fv1).getCoveredText());
+
+ cas.release();
+ }
}