You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2012/12/12 15:58:42 UTC

svn commit: r1420723 [11/12] - in /uima/sandbox/trunk/uimaFIT: ./ src/ src/main/ src/main/assembly/ src/main/java/ src/main/java/org/ src/main/java/org/uimafit/ src/main/java/org/uimafit/component/ src/main/java/org/uimafit/component/initialize/ src/ma...

Added: uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/testing/factory/TokenBuilderTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/testing/factory/TokenBuilderTest.java?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/testing/factory/TokenBuilderTest.java (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/testing/factory/TokenBuilderTest.java Wed Dec 12 14:58:37 2012
@@ -0,0 +1,231 @@
+/* 
+ Copyright 2009-2010	Regents of the University of Colorado.  
+ All rights reserved. 
+
+ Licensed under the Apache License, Version 2.0 (the "License"); 
+ you may not use this file except in compliance with the License. 
+ You may obtain a copy of the License at 
+
+ http://www.apache.org/licenses/LICENSE-2.0 
+
+ Unless required by applicable law or agreed to in writing, software 
+ distributed under the License is distributed on an "AS IS" BASIS, 
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ See the License for the specific language governing permissions and 
+ limitations under the License.
+ */
+
+package org.uimafit.testing.factory;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.uima.UIMAException;
+import org.apache.uima.cas.FSIndex;
+import org.apache.uima.cas.FSIterator;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.tcas.Annotation;
+import org.apache.uima.pear.util.FileUtil;
+import org.junit.Test;
+import org.uimafit.ComponentTestBase;
+import org.uimafit.type.Sentence;
+import org.uimafit.type.Token;
+import org.uimafit.util.JCasUtil;
+
+/**
+ * @author Steven Bethard, Philip Ogren
+ */
+
+public class TokenBuilderTest extends ComponentTestBase {
+
+	@Test
+	public void test1() throws UIMAException {
+		String text = "What if we built a rocket ship made of cheese?"
+				+ "We could fly it to the moon for repairs.";
+		tokenBuilder
+				.buildTokens(
+						jCas,
+						text,
+						"What if we built a rocket ship made of cheese ? \r\n We could fly it to the moon for repairs .",
+						"A B C D E F G H I J K L M N O P Q R S T U");
+
+		FSIndex<Annotation> sentenceIndex = jCas.getAnnotationIndex(Sentence.type);
+		assertEquals(2, sentenceIndex.size());
+		FSIterator<Annotation> sentences = sentenceIndex.iterator();
+		Sentence sentence = (Sentence) sentences.next();
+		assertEquals("What if we built a rocket ship made of cheese?", sentence.getCoveredText());
+		sentence = (Sentence) sentences.next();
+		assertEquals("We could fly it to the moon for repairs.", sentence.getCoveredText());
+
+		FSIndex<Annotation> tokenIndex = jCas.getAnnotationIndex(Token.type);
+		assertEquals(21, tokenIndex.size());
+		Token token = JCasUtil.selectByIndex(jCas, Token.class, 0);
+		testToken(token, "What", 0, 4, "A", null);
+		token = JCasUtil.selectByIndex(jCas, Token.class, 1);
+		testToken(token, "if", 5, 7, "B", null);
+		token = JCasUtil.selectByIndex(jCas, Token.class, 9);
+		testToken(token, "cheese", 39, 45, "J", null);
+		token = JCasUtil.selectByIndex(jCas, Token.class, 10);
+		testToken(token, "?", 45, 46, "K", null);
+		token = JCasUtil.selectByIndex(jCas, Token.class, 11);
+		testToken(token, "We", 46, 48, "L", null);
+		token = JCasUtil.selectByIndex(jCas, Token.class, 12);
+		testToken(token, "could", 49, 54, "M", null);
+		token = JCasUtil.selectByIndex(jCas, Token.class, 19);
+		testToken(token, "repairs", 78, 85, "T", null);
+		token = JCasUtil.selectByIndex(jCas, Token.class, 20);
+		testToken(token, ".", 85, 86, "U", null);
+	}
+
+	@Test
+	public void test2() throws UIMAException {
+		String text = "What if we built a rocket ship made of cheese? \n"
+				+ "We could fly it to the moon for repairs.";
+		tokenBuilder
+				.buildTokens(
+						jCas,
+						text,
+						"What if we built a rocket ship made of cheese ? \n We could fly it to the moon for repairs .",
+						"A B C D E F G H I J K L M N O P Q R S T U");
+
+		Token token = JCasUtil.selectByIndex(jCas, Token.class, 10);
+		testToken(token, "?", 45, 46, "K", null);
+		token = JCasUtil.selectByIndex(jCas, Token.class, 11);
+		testToken(token, "We", 48, 50, "L", null);
+
+		jCas.reset();
+		text = "What if we built a rocket ship made of cheese? \n"
+				+ "We could fly it to the moon for repairs.";
+		tokenBuilder
+				.buildTokens(
+						jCas,
+						text,
+						"What if we built a rocket ship made of cheese ?\nWe could fly it to the moon for repairs .",
+						"A B C D E F G H I J K L M N O P Q R S T U");
+
+		token = JCasUtil.selectByIndex(jCas, Token.class, 10);
+		testToken(token, "?", 45, 46, "K", null);
+		token = JCasUtil.selectByIndex(jCas, Token.class, 11);
+		testToken(token, "We", 48, 50, "L", null);
+	}
+
+	@Test
+	public void test3() throws UIMAException {
+		String text = "If you like line writer, then you should really check out line rider.";
+		tokenBuilder.buildTokens(jCas, text);
+
+		FSIndex<Annotation> tokenIndex = jCas.getAnnotationIndex(Token.type);
+		assertEquals(13, tokenIndex.size());
+		Token token = JCasUtil.selectByIndex(jCas, Token.class, 0);
+		testToken(token, "If", 0, 2, null, null);
+		token = JCasUtil.selectByIndex(jCas, Token.class, 12);
+		testToken(token, "rider.", 63, 69, null, null);
+		FSIndex<Annotation> sentenceIndex = jCas.getAnnotationIndex(Sentence.type);
+		assertEquals(1, sentenceIndex.size());
+		Sentence sentence = JCasUtil.selectByIndex(jCas, Sentence.class, 0);
+		assertEquals(text, sentence.getCoveredText());
+	}
+
+	private void testToken(Token token, String coveredText, int begin, int end,
+			String partOfSpeech, String stem) {
+		assertEquals(coveredText, token.getCoveredText());
+		assertEquals(begin, token.getBegin());
+		assertEquals(end, token.getEnd());
+		assertEquals(partOfSpeech, token.getPos());
+		assertEquals(stem, token.getStem());
+	}
+
+	@Test
+	public void testSpaceSplit() {
+		String[] splits = " asdf ".split(" ");
+		assertEquals(2, splits.length);
+	}
+
+	@Test
+	public void testBadInput() throws UIMAException {
+		String text = "If you like line writer, then you should really check out line rider.";
+		IllegalArgumentException iae = null;
+		try {
+			tokenBuilder.buildTokens(jCas, text,
+					"If you like line rider, then you really don't need line writer");
+		}
+		catch (IllegalArgumentException e) {
+			iae = e;
+		}
+		assertNotNull(iae);
+	}
+
+	@Test
+	public void testStems() throws UIMAException {
+		String text = "Me and all my friends are non-conformists.";
+		tokenBuilder.buildTokens(jCas, text, "Me and all my friends are non - conformists .",
+				"M A A M F A N - C .", "me and all my friend are non - conformist .");
+
+		assertEquals("Me and all my friends are non-conformists.", jCas.getDocumentText());
+		Token friendToken = JCasUtil.selectByIndex(jCas, Token.class, 4);
+		assertEquals("friends", friendToken.getCoveredText());
+		assertEquals("F", friendToken.getPos());
+		assertEquals("friend", friendToken.getStem());
+	}
+
+	@Test
+	public void test4() throws UIMAException {
+		String text = "a b-c de--fg h,i,j,k";
+		tokenBuilder.buildTokens(jCas, text, "a b - c d e - - f g h , i , j , k");
+
+		FSIterator<Annotation> tokens = jCas.getAnnotationIndex(Token.type).iterator();
+		int tokenCount = 0;
+		while (tokens.hasNext()) {
+			tokenCount++;
+			tokens.next();
+		}
+		assertEquals(17, tokenCount);
+	}
+
+	@Test
+	public void test5() throws Exception {
+		JCas myView = jCas.createView("MyView");
+
+		tokenBuilder.buildTokens(myView, "red and blue cars and tipsy motorcycles");
+
+		Token token = JCasUtil.selectByIndex(myView, Token.class, 6);
+		assertEquals("motorcycles", token.getCoveredText());
+
+	}
+
+	@Test
+	public void testNewlinesFromFile() throws Exception {
+		String text = FileUtil.loadTextFile(new File(
+				"src/test/resources/data/docs/unix-newlines.txt"), "UTF-8");
+		text = text.substring(1); // remove "\uFEFF" character from begining of text
+		tokenBuilder.buildTokens(jCas, text);
+
+		Collection<Sentence> sentences = JCasUtil.select(jCas, Sentence.class);
+		assertEquals(4, sentences.size());
+		Iterator<Sentence> iterator = sentences.iterator();
+		assertEquals("sentence 1.", iterator.next().getCoveredText());
+		assertEquals("sentence 2.", iterator.next().getCoveredText());
+		assertEquals("sentence 3.", iterator.next().getCoveredText());
+		assertEquals("sentence 4.", iterator.next().getCoveredText());
+
+		jCas.reset();
+		text = FileUtil.loadTextFile(new File("src/test/resources/data/docs/windows-newlines.txt"),
+				"UTF-8");
+		text = text.substring(1); // remove "\uFEFF" character from begining of text
+		tokenBuilder.buildTokens(jCas, text);
+
+		sentences = JCasUtil.select(jCas, Sentence.class);
+		assertEquals(4, sentences.size());
+		iterator = sentences.iterator();
+		assertEquals("sentence 1.", iterator.next().getCoveredText());
+		assertEquals("sentence 2.", iterator.next().getCoveredText());
+		assertEquals("sentence 3.", iterator.next().getCoveredText());
+		assertEquals("sentence 4.", iterator.next().getCoveredText());
+
+	}
+
+}

Propchange: uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/testing/factory/TokenBuilderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/CasUtilTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/CasUtilTest.java?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/CasUtilTest.java (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/CasUtilTest.java Wed Dec 12 14:58:37 2012
@@ -0,0 +1,193 @@
+/*
+ Copyright 2009
+ Ubiquitous Knowledge Processing (UKP) Lab
+ Technische Universitaet Darmstadt
+ All rights reserved.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+package org.uimafit.util;
+
+import static java.util.Arrays.asList;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.uimafit.util.CasUtil.getAnnotationType;
+import static org.uimafit.util.CasUtil.getType;
+import static org.uimafit.util.CasUtil.select;
+import static org.uimafit.util.CasUtil.selectFS;
+import static org.uimafit.util.CasUtil.iterator;
+import static org.uimafit.util.CasUtil.iteratorFS;
+import static org.uimafit.util.CasUtil.selectByIndex;
+import static org.uimafit.util.CasUtil.toText;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.uima.UIMAException;
+import org.apache.uima.cas.ArrayFS;
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.jcas.cas.TOP;
+import org.apache.uima.jcas.tcas.Annotation;
+import org.junit.Test;
+import org.uimafit.ComponentTestBase;
+import org.uimafit.type.Token;
+
+/**
+ * Test cases for {@link JCasUtil}.
+ *
+ * @author Richard Eckart de Castilho
+ */
+public class CasUtilTest extends ComponentTestBase {
+	@Test
+	public void testGetType() throws UIMAException {
+		String text = "Rot wood cheeses dew?";
+		tokenBuilder.buildTokens(jCas, text);
+
+		CAS cas = jCas.getCas();
+
+		assertEquals(Token.class.getName(), getType(cas, Token.class.getName()).getName());
+		assertEquals(Token.class.getName(), getType(cas, Token.class).getName());
+		assertEquals(Token.class.getName(), getAnnotationType(cas, Token.class.getName()).getName());
+		assertEquals(Token.class.getName(), getAnnotationType(cas, Token.class).getName());
+		assertEquals("uima.cas.TOP", getType(cas, TOP.class).getName());
+		assertEquals("uima.cas.TOP", getType(cas, TOP.class.getName()).getName());
+		assertEquals("uima.tcas.Annotation", getType(cas, Annotation.class).getName());
+		assertEquals("uima.tcas.Annotation", getType(cas, Annotation.class.getName()).getName());
+		assertEquals("uima.tcas.Annotation", getAnnotationType(cas, Annotation.class).getName());
+		assertEquals("uima.tcas.Annotation", getAnnotationType(cas, Annotation.class.getName()).getName());
+	}
+
+	@Test(expected=IllegalArgumentException.class)
+	public void testGetNonExistingType() throws UIMAException {
+		String text = "Rot wood cheeses dew?";
+		tokenBuilder.buildTokens(jCas, text);
+
+		CAS cas = jCas.getCas();
+
+		getType(cas, Token.class.getName()+"_dummy");
+	}
+
+	@Test(expected=IllegalArgumentException.class)
+	public void testGetNonAnnotationType() throws UIMAException {
+		String text = "Rot wood cheeses dew?";
+		tokenBuilder.buildTokens(jCas, text);
+
+		CAS cas = jCas.getCas();
+
+		getAnnotationType(cas, TOP.class);
+	}
+
+	@Test
+	public void testSelectByIndex() throws UIMAException {
+		String text = "Rot wood cheeses dew?";
+		tokenBuilder.buildTokens(jCas, text);
+
+		CAS cas = jCas.getCas();
+		Type type = JCasUtil.getType(jCas, Token.class);
+
+		assertEquals("dew?", selectByIndex(cas, type, -1).getCoveredText());
+		assertEquals("dew?", selectByIndex(cas, type, 3).getCoveredText());
+		assertEquals("Rot", selectByIndex(cas, type, 0).getCoveredText());
+		assertEquals("Rot", selectByIndex(cas, type, -4).getCoveredText());
+		assertNull(selectByIndex(cas, type, -5));
+		assertNull(selectByIndex(cas, type, 4));
+	}
+
+	@SuppressWarnings({ "unchecked", "rawtypes" })
+	@Test
+	public void testSelectOnAnnotations() throws Exception {
+		String text = "Rot wood cheeses dew?";
+		tokenBuilder.buildTokens(jCas, text);
+
+		CAS cas = jCas.getCas();
+
+		assertEquals(
+				asList("Rot", "wood", "cheeses", "dew?"),
+				toText(select(cas, getType(cas, Token.class.getName()))));
+
+		assertEquals(
+				asList("Rot", "wood", "cheeses", "dew?"),
+				toText((Collection<AnnotationFS>)(Collection)selectFS(cas, getType(cas, Token.class.getName()))));
+	}
+
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	@Test
+	public void testSelectOnArrays() throws Exception {
+		String text = "Rot wood cheeses dew?";
+		tokenBuilder.buildTokens(jCas, text);
+
+		CAS cas = jCas.getCas();
+
+		Collection<FeatureStructure> allFS = selectFS(cas, getType(cas, TOP.class.getName()));
+		ArrayFS allFSArray = cas.createArrayFS(allFS.size());
+		int i = 0;
+		for (FeatureStructure fs : allFS) {
+			allFSArray.set(i, fs);
+			i++;
+		}
+
+		// Print what is expected
+		for (FeatureStructure fs : allFS) {
+			System.out.println("Type: "+fs.getType().getName()+"]");
+		}
+		System.out.println("Tokens: ["+toText(select(cas, getType(cas, Token.class.getName())))+"]");
+
+		// Document Annotation, one sentence and 4 tokens.
+		assertEquals(6, allFS.size());
+
+		assertEquals(
+				toText(select(cas, getType(cas, Token.class.getName()))),
+				toText(select(allFSArray, getType(cas, Token.class.getName()))));
+
+		assertEquals(
+				toText((Iterable) selectFS(cas, getType(cas, Token.class.getName()))),
+				toText((Iterable) selectFS(allFSArray, getType(cas, Token.class.getName()))));
+	}
+
+	@SuppressWarnings({ "unchecked", "rawtypes" })
+	@Test
+	public void testIterator() throws Exception {
+		String text = "Rot wood cheeses dew?";
+		tokenBuilder.buildTokens(jCas, text);
+
+		CAS cas = jCas.getCas();
+
+		assertEquals(
+				asList("Rot", "wood", "cheeses", "dew?"),
+				toText(iterator(cas, getType(cas, Token.class))));
+
+		assertEquals(
+				asList("Rot", "wood", "cheeses", "dew?"),
+				toText((Iterator<AnnotationFS>)(Iterator)iteratorFS(cas, getType(cas, Token.class))));
+	}
+
+	@SuppressWarnings({ "unchecked", "rawtypes" })
+	@Test
+	public void testIterate() throws Exception {
+		String text = "Rot wood cheeses dew?";
+		tokenBuilder.buildTokens(jCas, text);
+
+		CAS cas = jCas.getCas();
+
+		assertEquals(
+				asList("Rot", "wood", "cheeses", "dew?"),
+				toText(select(cas, getType(cas, Token.class))));
+
+		assertEquals(
+				asList("Rot", "wood", "cheeses", "dew?"),
+				toText((Iterable<AnnotationFS>)(Iterable)selectFS(cas, getType(cas, Token.class))));
+	}
+}

Propchange: uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/CasUtilTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/ContainmentIndexTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/ContainmentIndexTest.java?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/ContainmentIndexTest.java (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/ContainmentIndexTest.java Wed Dec 12 14:58:37 2012
@@ -0,0 +1,72 @@
+/*
+ Copyright 2009-2010
+ Ubiquitous Knowledge Processing (UKP) Lab
+ Technische Universitaet Darmstadt
+ All rights reserved.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+
+package org.uimafit.util;
+
+import static java.util.Arrays.asList;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.uimafit.util.JCasUtil.select;
+import static org.uimafit.util.JCasUtil.selectCovered;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+import org.uimafit.ComponentTestBase;
+import org.uimafit.type.Sentence;
+import org.uimafit.type.Token;
+import org.uimafit.util.ContainmentIndex.Type;
+
+/**
+ * Unit test for {@link ContainmentIndex}.
+ * 
+ * @author Richard Eckart de Castilho
+ */
+public class ContainmentIndexTest extends ComponentTestBase {
+	@Test
+	public void test() throws Exception {
+		String text = "Will you come home today ? \n No , tomorrow !";
+		tokenBuilder.buildTokens(jCas, text);
+
+		List<Sentence> sentences = new ArrayList<Sentence>(select(jCas, Sentence.class));
+		List<Token> tokens = new ArrayList<Token>(select(jCas, Token.class));
+
+		ContainmentIndex<Sentence, Token> idx = ContainmentIndex.create(jCas, Sentence.class,
+				Token.class, Type.BOTH);
+
+		assertEquals(selectCovered(Token.class, sentences.get(0)),
+				idx.containedIn(sentences.get(0)));
+		assertEquals(selectCovered(Token.class, sentences.get(1)),
+				idx.containedIn(sentences.get(1)));
+
+		assertEquals(asList(sentences.get(0)), idx.containing(tokens.get(0)));
+		assertEquals(asList(sentences.get(1)), idx.containing(tokens.get(tokens.size() - 1)));
+
+		assertTrue(idx.isContainedIn(sentences.get(0), tokens.get(0)));
+		assertFalse(idx.isContainedIn(sentences.get(0), tokens.get(tokens.size() - 1)));
+
+		// After removing the annotation the index has to be rebuilt.
+		assertTrue(idx.isContainedInAny(tokens.get(0)));
+		sentences.get(0).removeFromIndexes();
+		idx = ContainmentIndex.create(jCas, Sentence.class, Token.class, Type.BOTH);
+		assertFalse(idx.isContainedInAny(tokens.get(0)));
+	}
+}

Propchange: uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/ContainmentIndexTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/DisableLoggingTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/DisableLoggingTest.java?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/DisableLoggingTest.java (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/DisableLoggingTest.java Wed Dec 12 14:58:37 2012
@@ -0,0 +1,106 @@
+/* 
+ Copyright 2009-2010	Regents of the University of Colorado.  
+ All rights reserved. 
+
+ Licensed under the Apache License, Version 2.0 (the "License"); 
+ you may not use this file except in compliance with the License. 
+ You may obtain a copy of the License at 
+
+ http://www.apache.org/licenses/LICENSE-2.0 
+
+ Unless required by applicable law or agreed to in writing, software 
+ distributed under the License is distributed on an "AS IS" BASIS, 
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ See the License for the specific language governing permissions and 
+ limitations under the License.
+ */
+
+package org.uimafit.util;
+
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+import org.uimafit.testing.util.DisableLogging;
+
+/**
+ * @author Steven Bethard, Philip Ogren
+ */
+public class DisableLoggingTest {
+
+	@Test
+	public void test() {
+		// get the top logger and remove all handlers
+		Logger topLogger = Logger.getLogger("");
+		Handler[] handlers = topLogger.getHandlers();
+		for (Handler handler : handlers) {
+			topLogger.removeHandler(handler);
+		}
+
+		// add a single hander that writes to a string buffer
+		final StringBuffer buffer = new StringBuffer();
+		Handler bufferhandler = new Handler() {
+			@Override
+			public void close() throws SecurityException {/* do nothing */
+			}
+
+			@Override
+			public void flush() {/* do nothing */
+			}
+
+			@Override
+			public void publish(LogRecord record) {
+				buffer.append(record.getMessage());
+			}
+		};
+		topLogger.addHandler(bufferhandler);
+
+		// log to the buffer
+		Logger.getLogger("foo").info("Hello!");
+		Assert.assertEquals("Hello!", buffer.toString());
+
+		// disable logging, and make sure nothing is written to the buffer
+		buffer.setLength(0);
+		Level level = DisableLogging.disableLogging();
+		Logger.getLogger("bar").info("Hello!");
+		Assert.assertEquals("", buffer.toString());
+
+		// enable logging, and make sure things are written to the buffer
+		DisableLogging.enableLogging(level);
+		Logger.getLogger("baz").info("Hello!");
+		Assert.assertEquals("Hello!", buffer.toString());
+
+		// try disabling logging with a logger that has its own handler
+		buffer.setLength(0);
+		Logger logger = Logger.getLogger("foo.bar.baz");
+		logger.addHandler(new Handler() {
+			@Override
+			public void close() throws SecurityException {/* do nothing */
+			}
+
+			@Override
+			public void flush() { /* do nothing */
+			}
+
+			@Override
+			public void publish(LogRecord record) {
+				buffer.append("Not disabled!");
+			}
+		});
+		level = DisableLogging.disableLogging();
+		logger.info("Hello!");
+		Assert.assertEquals("", buffer.toString());
+		DisableLogging.enableLogging(level);
+
+		// restore the original handlers
+		topLogger.removeHandler(bufferhandler);
+		for (Handler handler : handlers) {
+			topLogger.addHandler(handler);
+		}
+
+	}
+}

Propchange: uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/DisableLoggingTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/FSCollectionFactoryTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/FSCollectionFactoryTest.java?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/FSCollectionFactoryTest.java (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/FSCollectionFactoryTest.java Wed Dec 12 14:58:37 2012
@@ -0,0 +1,195 @@
+/*
+ Copyright 2012
+ Ubiquitous Knowledge Processing (UKP) Lab
+ Technische Universitaet Darmstadt
+ All rights reserved.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ getCoveredAnnotations() contains code adapted from the UIMA Subiterator class.
+ */
+package org.uimafit.util;
+
+import static java.util.Arrays.asList;
+import static org.apache.commons.lang.ArrayUtils.toObject;
+import static org.junit.Assert.assertEquals;
+import static org.uimafit.util.FSCollectionFactory.*;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.tcas.Annotation;
+import org.junit.Before;
+import org.junit.Test;
+import org.uimafit.factory.JCasFactory;
+import org.uimafit.type.Token;
+
+/**
+ * @author Richard Eckart de Castilho
+ */
+public class FSCollectionFactoryTest {
+	private JCas jcas;
+	private Collection<FeatureStructure> tokenFSs;
+	private Collection<Annotation> tokens;
+	
+	@Before
+	public void init() throws Exception {
+		jcas = JCasFactory.createJCas();
+		
+		tokenFSs = new ArrayList<FeatureStructure>();
+		tokens = new ArrayList<Annotation>();
+
+		Token t1 = new Token(jcas, 0, 1);
+		tokenFSs.add(t1);
+		tokens.add(t1);
+		t1.addToIndexes();
+
+		Token t2 = new Token(jcas, 2, 3);
+		tokenFSs.add(t2);
+		tokens.add(t2);
+		t2.addToIndexes();
+	}
+
+	@Test
+	public void testCreateFSList() throws Exception {
+		assertEquals(tokens, create(createFSList(jcas, tokens)));
+		assertEquals(tokens, create(createFSList(jcas, tokens), Token.class));
+	}
+	
+	@Test
+	public void testCreateFSArray() throws Exception {
+		assertEquals(tokenFSs, create(createFSArray(jcas.getCas(), tokenFSs)));
+		assertEquals(tokenFSs, create(createFSArray(jcas.getCas(),
+				tokenFSs.toArray(new FeatureStructure[tokenFSs.size()]))));
+		assertEquals(tokens, create(createFSArray(jcas.getCas(), tokens)));
+		assertEquals(tokens, create(createFSArray(jcas, tokens)));
+		assertEquals(tokens,
+				create(createFSArray(jcas.getCas(), tokens.toArray(new Annotation[tokens.size()]))));
+		assertEquals(tokens,
+				create(createFSArray(jcas, tokens.toArray(new Annotation[tokens.size()]))));
+		assertEquals(tokens,
+				create(createFSArray(jcas, tokens.toArray(new Annotation[tokens.size()])), Token.class));
+	}
+
+	@Test
+	public void testCreateBooleanArray() throws Exception {
+		assertEquals(asList(true, false),
+				asList(toObject(createBooleanArray(jcas.getCas(), asList(true, false)).toArray())));
+		assertEquals(asList(true, false),
+				asList(toObject(createBooleanArray(jcas.getCas(), new boolean[] {true, false}).toArray())));
+		assertEquals(asList(true, false),
+				asList(toObject(createBooleanArray(jcas, asList(true, false)).toArray())));
+		assertEquals(asList(true, false),
+				asList(toObject(createBooleanArray(jcas, new boolean[] {true, false}).toArray())));
+	}
+
+	@Test
+	public void testCreateByteArray() throws Exception {
+		assertEquals(asList((byte) 0, (byte) 1),
+				asList(toObject(createByteArray(jcas.getCas(), asList((byte) 0, (byte) 1)).toArray())));
+		assertEquals(asList((byte) 0, (byte) 1),
+				asList(toObject(createByteArray(jcas.getCas(), new byte[] {0, 1}).toArray())));
+		assertEquals(asList((byte) 0, (byte) 1),
+				asList(toObject(createByteArray(jcas, asList((byte) 0, (byte) 1)).toArray())));
+		assertEquals(asList((byte) 0, (byte) 1),
+				asList(toObject(createByteArray(jcas, new byte[] {0, 1}).toArray())));
+	}
+
+	@Test
+	public void testCreateDoubleArray() throws Exception {
+		assertEquals(asList(0.0, 1.0),
+				asList(toObject(createDoubleArray(jcas.getCas(), asList(0.0, 1.0)).toArray())));
+		assertEquals(asList(0.0, 1.0),
+				asList(toObject(createDoubleArray(jcas.getCas(), new double[] {0.0, 1.0}).toArray())));
+		assertEquals(asList(0.0, 1.0),
+				asList(toObject(createDoubleArray(jcas, asList(0.0, 1.0)).toArray())));
+		assertEquals(asList(0.0, 1.0),
+				asList(toObject(createDoubleArray(jcas, new double[] {0.0, 1.0}).toArray())));
+	}
+
+	@Test
+	public void testCreateFloatArray() throws Exception {
+		assertEquals(asList(0.0f, 1.0f),
+				asList(toObject(createFloatArray(jcas.getCas(), asList(0.0f, 1.0f)).toArray())));
+		assertEquals(asList(0.0f, 1.0f),
+				asList(toObject(createFloatArray(jcas.getCas(), new float[] {0.0f, 1.0f}).toArray())));
+		assertEquals(asList(0.0f, 1.0f),
+				asList(toObject(createFloatArray(jcas, asList(0.0f, 1.0f)).toArray())));
+		assertEquals(asList(0.0f, 1.0f),
+				asList(toObject(createFloatArray(jcas, new float[] {0.0f, 1.0f}).toArray())));
+	}
+
+	@Test
+	public void testCreateFloatList() throws Exception {
+		assertEquals(asList(0.0f, 1.0f), create(createFloatList(jcas, asList(0.0f, 1.0f))));
+	}
+
+	@Test
+	public void testCreateIntArray() throws Exception {
+		assertEquals(asList(0, 1),
+				asList(toObject(createIntArray(jcas.getCas(), asList(0, 1)).toArray())));
+		assertEquals(asList(0, 1),
+				asList(toObject(createIntArray(jcas.getCas(), new int[] {0, 1}).toArray())));
+		assertEquals(asList(0, 1),
+				asList(toObject(createIntArray(jcas, asList(0, 1)).toArray())));
+		assertEquals(asList(0, 1),
+				asList(toObject(createIntArray(jcas, new int[] {0, 1}).toArray())));
+	}
+
+	@Test
+	public void testCreateIntegerList() throws Exception {
+		assertEquals(asList(0, 1), create(createIntegerList(jcas, asList(0, 1))));
+	}
+
+	@Test
+	public void testCreateLongArray() throws Exception {
+		assertEquals(asList(0l, 1l),
+				asList(toObject(createLongArray(jcas.getCas(), asList(0l, 1l)).toArray())));
+		assertEquals(asList(0l, 1l),
+				asList(toObject(createLongArray(jcas.getCas(), new long[] {0l, 1l}).toArray())));
+		assertEquals(asList(0l, 1l),
+				asList(toObject(createLongArray(jcas, asList(0l, 1l)).toArray())));
+		assertEquals(asList(0l, 1l),
+				asList(toObject(createLongArray(jcas, new long[] {0l, 1l}).toArray())));
+	}
+
+	@Test
+	public void testCreateShortArray() throws Exception {
+		assertEquals(asList((short) 0, (short) 1),
+				asList(toObject(createShortArray(jcas.getCas(), asList((short) 0, (short) 1)).toArray())));
+		assertEquals(asList((short) 0, (short) 1),
+				asList(toObject(createShortArray(jcas.getCas(), new short[] {0, 1}).toArray())));
+		assertEquals(asList((short) 0, (short) 1),
+				asList(toObject(createShortArray(jcas, asList((short) 0, (short) 1)).toArray())));
+		assertEquals(asList((short) 0, (short) 1),
+				asList(toObject(createShortArray(jcas, new short[] {0, 1}).toArray())));
+	}
+
+	@Test
+	public void testCreateStringArray() throws Exception {
+		assertEquals(asList("0", "1"),
+				asList(createStringArray(jcas.getCas(), asList("0", "1")).toArray()));
+		assertEquals(asList("0", "1"),
+				asList(createStringArray(jcas.getCas(), new String[] {"0", "1"}).toArray()));
+		assertEquals(asList("0", "1"),
+				asList(createStringArray(jcas, asList("0", "1")).toArray()));
+		assertEquals(asList("0", "1"),
+				asList(createStringArray(jcas, new String[] {"0", "1"}).toArray()));
+	}
+	
+	@Test
+	public void testCreateStringList() throws Exception {
+		assertEquals(asList("0", "1"), create(createStringList(jcas, asList("0", "1"))));
+	}
+}

Propchange: uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/FSCollectionFactoryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/HideOutputTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/HideOutputTest.java?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/HideOutputTest.java (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/HideOutputTest.java Wed Dec 12 14:58:37 2012
@@ -0,0 +1,71 @@
+/* 
+ Copyright 2009-2010	Regents of the University of Colorado.  
+ All rights reserved. 
+
+ Licensed under the Apache License, Version 2.0 (the "License"); 
+ you may not use this file except in compliance with the License. 
+ You may obtain a copy of the License at 
+
+ http://www.apache.org/licenses/LICENSE-2.0 
+
+ Unless required by applicable law or agreed to in writing, software 
+ distributed under the License is distributed on an "AS IS" BASIS, 
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ See the License for the specific language governing permissions and 
+ limitations under the License.
+ */
+package org.uimafit.util;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+import org.uimafit.testing.util.HideOutput;
+
+/**
+ * @author Steven Bethard, Philip Ogren
+ */
+
+public class HideOutputTest {
+
+	@Test
+	public void testHideOutput() throws IOException {
+		// message that will be written to stdout and stderr
+		String className = this.getClass().getName();
+		String message = String.format("If you see this output, %s is failing\n", className);
+
+		// redirect stdout and stderr to streams we can read strings from
+		PrintStream oldOut = System.out;
+		PrintStream oldErr = System.err;
+		ByteArrayOutputStream stringOut = new ByteArrayOutputStream();
+		ByteArrayOutputStream stringErr = new ByteArrayOutputStream();
+		System.setOut(new PrintStream(stringOut));
+		System.setErr(new PrintStream(stringErr));
+		try {
+			// check that nothing is written to stdout or stderr while hidden
+			HideOutput ho = new HideOutput();
+			System.out.print(message);
+			System.err.print(message);
+			Assert.assertEquals("", stringOut.toString());
+			Assert.assertEquals("", stringErr.toString());
+
+			// check that data is again written to stdout and stderr after restoring
+			ho.restoreOutput();
+			System.out.print(message);
+			System.err.print(message);
+			Assert.assertEquals(message, stringOut.toString());
+			Assert.assertEquals(message, stringErr.toString());
+		}
+		// restore stdout and stderr at the end of the test
+		finally {
+			System.setOut(oldOut);
+			System.setErr(oldErr);
+			stringOut.close();
+			stringErr.close();
+		}
+
+	}
+}

Propchange: uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/HideOutputTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/JCasIterableTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/JCasIterableTest.java?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/JCasIterableTest.java (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/JCasIterableTest.java Wed Dec 12 14:58:37 2012
@@ -0,0 +1,42 @@
+/* 
+ Copyright 2009-2010	Regents of the University of Colorado.  
+ All rights reserved. 
+
+ Licensed under the Apache License, Version 2.0 (the "License"); 
+ you may not use this file except in compliance with the License. 
+ You may obtain a copy of the License at 
+
+ http://www.apache.org/licenses/LICENSE-2.0 
+
+ Unless required by applicable law or agreed to in writing, software 
+ distributed under the License is distributed on an "AS IS" BASIS, 
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ See the License for the specific language governing permissions and 
+ limitations under the License.
+ */
+package org.uimafit.util;
+
+/**
+ * @author Philip Ogren
+ */
+
+import java.util.Iterator;
+
+import org.apache.uima.cas.CASException;
+import org.junit.Test;
+import org.uimafit.ComponentTestBase;
+
+public class JCasIterableTest extends ComponentTestBase {
+
+	@Test
+	public void testResetViews() throws CASException {
+		jCas.createView("point");
+		Iterator<?> views = jCas.getViewIterator();
+		while (views.hasNext()) {
+			// JCas view = (JCas) views.next();
+			views.next();
+		}
+		jCas.reset();
+
+	}
+}

Propchange: uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/JCasIterableTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/JCasUtilTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/JCasUtilTest.java?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/JCasUtilTest.java (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/JCasUtilTest.java Wed Dec 12 14:58:37 2012
@@ -0,0 +1,630 @@
+/*
+ Copyright 2009
+ Ubiquitous Knowledge Processing (UKP) Lab
+ Technische Universitaet Darmstadt
+ All rights reserved.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ getCoveredAnnotations() contains code adapted from the UIMA Subiterator class.
+ */
+package org.uimafit.util;
+
+import static java.util.Arrays.asList;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.uimafit.factory.TypeSystemDescriptionFactory.createTypeSystemDescription;
+import static org.uimafit.util.JCasUtil.exists;
+import static org.uimafit.util.JCasUtil.getAnnotationType;
+import static org.uimafit.util.JCasUtil.getType;
+import static org.uimafit.util.JCasUtil.getView;
+import static org.uimafit.util.JCasUtil.indexCovered;
+import static org.uimafit.util.JCasUtil.indexCovering;
+import static org.uimafit.util.JCasUtil.isCovered;
+import static org.uimafit.util.JCasUtil.select;
+import static org.uimafit.util.JCasUtil.selectBetween;
+import static org.uimafit.util.JCasUtil.selectCovered;
+import static org.uimafit.util.JCasUtil.selectCovering;
+import static org.uimafit.util.JCasUtil.selectFollowing;
+import static org.uimafit.util.JCasUtil.selectPreceding;
+import static org.uimafit.util.JCasUtil.selectSingle;
+import static org.uimafit.util.JCasUtil.selectSingleRelative;
+import static org.uimafit.util.JCasUtil.toText;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+
+import org.apache.uima.UIMAException;
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.cas.EmptyFSList;
+import org.apache.uima.jcas.cas.FSArray;
+import org.apache.uima.jcas.cas.NonEmptyFSList;
+import org.apache.uima.jcas.cas.TOP;
+import org.apache.uima.jcas.tcas.Annotation;
+import org.apache.uima.util.CasCreationUtils;
+import org.junit.Test;
+import org.uimafit.ComponentTestBase;
+import org.uimafit.type.AnalyzedText;
+import org.uimafit.type.Sentence;
+import org.uimafit.type.Token;
+
+/**
+ * Test cases for {@link JCasUtil}.
+ *
+ * @author Richard Eckart de Castilho
+ * @author Torsten Zesch
+ */
+public class JCasUtilTest extends ComponentTestBase {
+	/**
+	 * Test Tokens (Stems + Lemmas) overlapping with each other.
+	 */
+	@Test
+	public void testSelectCoveredOverlapping() throws Exception {
+		add(jCas, 3, 16);
+		add(jCas, 37, 61);
+		add(jCas, 49, 75);
+		add(jCas, 54, 58);
+		add(jCas, 66, 84);
+
+		for (Token t : select(jCas, Token.class)) {
+			// The naive approach is assumed to be correct
+			List<Sentence> stem1 = selectCovered(jCas, Sentence.class, t.getBegin(), t.getEnd());
+			List<Sentence> stem2 = selectCovered(jCas, Sentence.class, t);
+			check(jCas, t, stem1, stem2);
+		}
+	}
+
+	/**
+	 * Test what happens if there is actually nothing overlapping with the Token.
+	 */
+	@Test
+	public void testSelectCoveredNoOverlap() throws Exception {
+		new Sentence(jCas, 3, 31).addToIndexes();
+		new Sentence(jCas, 21, 21).addToIndexes();
+		new Sentence(jCas, 24, 44).addToIndexes();
+		new Sentence(jCas, 30, 45).addToIndexes();
+		new Sentence(jCas, 32, 43).addToIndexes();
+		new Sentence(jCas, 47, 61).addToIndexes();
+		new Sentence(jCas, 48, 77).addToIndexes();
+		new Sentence(jCas, 65, 82).addToIndexes();
+		new Sentence(jCas, 68, 80).addToIndexes();
+		new Sentence(jCas, 72, 65).addToIndexes();
+
+		new Token(jCas, 73, 96).addToIndexes();
+
+		for (Token t : select(jCas, Token.class)) {
+			// The naive approach is assumed to be correct
+			List<Sentence> stem1 = selectCovered(jCas, Sentence.class, t.getBegin(), t.getEnd());
+			List<Sentence> stem2 = selectCovered(jCas, Sentence.class, t);
+			check(jCas, t, stem1, stem2);
+		}
+	}
+
+	@Test
+	public void testSelectCoverRandom() throws Exception {
+		final int ITERATIONS = 10;
+
+		for (int i = 0; i < ITERATIONS; i++) {
+			CAS cas = jCas.getCas();
+			initRandomCas(cas, 10 * i);
+
+			JCas jcas = cas.getJCas();
+			long timeNaive = 0;
+			long timeOptimized = 0;
+			for (Token t : select(jcas, Token.class)) {
+				long ti = System.currentTimeMillis();
+				// The naive approach is assumed to be correct
+				List<Sentence> stem1 = selectCovered(jcas, Sentence.class, t.getBegin(), t.getEnd());
+				timeNaive += System.currentTimeMillis() - ti;
+
+				ti = System.currentTimeMillis();
+				List<Sentence> stem2 = selectCovered(jcas, Sentence.class, t);
+				timeOptimized += System.currentTimeMillis() - ti;
+
+				Collection<Sentence> stem3 = indexCovered(jcas, Token.class, Sentence.class).get(t);
+
+				check(jcas, t, stem1, stem2);
+				check(jcas, t, stem1, stem3);
+			}
+			System.out.format("Speed up factor %.2f [naive:%d optimized:%d diff:%d]\n", 
+					 (double) timeNaive / (double) timeOptimized, timeNaive, timeOptimized, 
+					timeNaive - timeOptimized);
+		}
+	}
+	
+	/**
+	 * Test what happens if there is actually nothing overlapping with the Token.
+	 */
+	@Test
+	public void testSelectBetweenInclusion() throws Exception {
+		Token t1 = new Token(jCas, 45, 57);
+		t1.addToIndexes();
+		Token t2 = new Token(jCas, 52, 52);
+		t2.addToIndexes();
+		
+		new Sentence(jCas, 52, 52).addToIndexes();
+
+		List<Sentence> stem1 = selectBetween(jCas, Sentence.class, t1, t2);
+		assertTrue(stem1.isEmpty());
+	}
+
+	@Test
+	public void testSelectBetweenRandom() throws Exception {
+		final int ITERATIONS = 10;
+
+		Random rnd = new Random();
+
+		for (int i = 1; i <= ITERATIONS; i++) {
+			CAS cas = jCas.getCas();
+			initRandomCas(cas, 10 * i);
+
+			JCas jcas = cas.getJCas();
+			List<Token> tokens = new ArrayList<Token>(select(jcas, Token.class));
+
+			long timeNaive = 0;
+			long timeOptimized = 0;
+			for (int j = 0; j < ITERATIONS; j++) {
+				Token t1 = tokens.get(rnd.nextInt(tokens.size()));
+				Token t2 = tokens.get(rnd.nextInt(tokens.size()));
+				
+				int left = Math.min(t1.getEnd(), t2.getEnd());
+				int right = Math.max(t1.getBegin(), t2.getBegin());
+
+				long ti;
+				List<Sentence> reference;
+				if (
+					(t1.getBegin() < t2.getBegin() && t2.getBegin() < t1.getEnd()) ||
+					(t1.getBegin() < t2.getEnd() && t2.getEnd() < t1.getEnd()) ||
+					(t2.getBegin() < t1.getBegin() && t1.getBegin() < t2.getEnd()) ||
+					(t2.getBegin() < t1.getEnd() && t1.getEnd() < t2.getEnd())
+				) {
+					// If the boundary annotations overlap, the result must be empty
+					ti = System.currentTimeMillis();
+					reference = new ArrayList<Sentence>();
+					timeNaive += System.currentTimeMillis() - ti;
+				}
+				else {
+					ti = System.currentTimeMillis();
+					reference = selectCovered(jcas, Sentence.class, left, right);
+					timeNaive += System.currentTimeMillis() - ti;
+				}
+				
+				ti = System.currentTimeMillis();
+				List<Sentence> actual = selectBetween(Sentence.class, t1, t2);
+				timeOptimized += System.currentTimeMillis() - ti;
+
+				assertEquals("Naive: Searching between "+t1+" and "+t2, reference, actual);
+			}
+			
+			System.out.format("Speed up factor %.2f [naive:%d optimized:%d diff:%d]\n", 
+					 (double) timeNaive / (double) timeOptimized, timeNaive, timeOptimized, 
+					timeNaive - timeOptimized);
+		}
+	}
+	
+	/**
+	 * Test Tokens (Stems + Lemmas) overlapping with each other.
+	 */
+	@Test
+	public void testSelectCoveringOverlapping() throws Exception {
+		add(jCas, 3, 16);
+		add(jCas, 37, 61);
+		add(jCas, 49, 75);
+		add(jCas, 54, 58);
+		add(jCas, 66, 84);
+
+		assertEquals(0, selectCovering(jCas, Token.class, 36, 52).size());
+		assertEquals(1, selectCovering(jCas, Token.class, 37, 52).size());
+		assertEquals(2, selectCovering(jCas, Token.class, 49, 52).size());
+	}
+	
+	private void initRandomCas(CAS cas, int size)
+	{
+		Random rnd = new Random();
+		List<Type> types = new ArrayList<Type>();
+		types.add(cas.getTypeSystem().getType(Token.class.getName()));
+		types.add(cas.getTypeSystem().getType(Sentence.class.getName()));
+
+		// Shuffle the types
+		for (int n = 0; n < 10; n++) {
+			Type t = types.remove(rnd.nextInt(types.size()));
+			types.add(t);
+		}
+
+		// Randomly generate annotations
+		for (int n = 0; n < size; n++) {
+			for (Type t : types) {
+				int begin = rnd.nextInt(100);
+				int end = begin + rnd.nextInt(30);
+				cas.addFsToIndexes(cas.createAnnotation(t, begin, end));
+			}
+		}
+	}
+
+	@SuppressWarnings("unused")
+	private void print(Collection<? extends Annotation> annos) {
+		for (Annotation a : annos) {
+			System.out
+					.println(a.getClass().getSimpleName() + " " + a.getBegin() + " " + a.getEnd());
+		}
+	}
+
+	private Token add(JCas jcas, int begin, int end) {
+		Token t = new Token(jcas, begin, end);
+		t.addToIndexes();
+		new Sentence(jcas, begin, end).addToIndexes();
+		return t;
+	}
+
+	private void check(JCas jcas, Token t, Collection<? extends Annotation> a1,
+			Collection<? extends Annotation> a2) {
+		// List<Annotation> annos = new ArrayList<Annotation>();
+		// FSIterator fs = jcas.getAnnotationIndex().iterator();
+		// while (fs.hasNext()) {
+		// annos.add((Annotation) fs.next());
+		// }
+		//
+		// System.out.println("--- Index");
+		// print(annos);
+		// System.out.println("--- Container");
+		// print(Collections.singleton(t));
+		// System.out.println("--- Naive");
+		// print(a1);
+		// System.out.println("--- Optimized");
+		// print(a2);
+		assertEquals("Container: [" + t.getBegin() + ".." + t.getEnd() + "]", a1, a2);
+	}
+
+	@Test
+	public void testIterator() throws Exception {
+		String text = "Rot wood cheeses dew?";
+		tokenBuilder.buildTokens(jCas, text);
+
+		assertEquals(asList("Rot", "wood", "cheeses", "dew?"),
+				toText(JCasUtil.select(jCas, Token.class)));
+	}
+
+	@Test
+	public void testSelectByIndex() throws UIMAException {
+		String text = "Rot wood cheeses dew?";
+		tokenBuilder.buildTokens(jCas, text);
+
+		assertEquals("dew?", JCasUtil.selectByIndex(jCas, Token.class, -1).getCoveredText());
+		assertEquals("dew?", JCasUtil.selectByIndex(jCas, Token.class, 3).getCoveredText());
+		assertEquals("Rot", JCasUtil.selectByIndex(jCas, Token.class, 0).getCoveredText());
+		assertEquals("Rot", JCasUtil.selectByIndex(jCas, Token.class, -4).getCoveredText());
+		assertNull(JCasUtil.selectByIndex(jCas, Token.class, -5));
+		assertNull(JCasUtil.selectByIndex(jCas, Token.class, 4));
+	}
+
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	@Test
+	public void testSelectOnArrays() throws Exception {
+		String text = "Rot wood cheeses dew?";
+		tokenBuilder.buildTokens(jCas, text);
+
+		Collection<TOP> allFS = select(jCas, TOP.class);
+		FSArray allFSArray = new FSArray(jCas, allFS.size());
+		int i = 0;
+		for (FeatureStructure fs : allFS) {
+			allFSArray.set(i, fs);
+			i++;
+		}
+
+		// Print what is expected
+		for (FeatureStructure fs : allFS) {
+			System.out.println("Type: " + fs.getType().getName() + "]");
+		}
+		System.out.println("Tokens: [" + toText(select(jCas, Token.class)) + "]");
+
+		// Document Annotation, one sentence and 4 tokens.
+		assertEquals(6, allFS.size());
+
+		assertEquals(toText(select(jCas, Token.class)), toText(select(allFSArray, Token.class)));
+
+		assertEquals(toText((Iterable) select(jCas, Token.class)),
+				toText((Iterable) select(allFSArray, Token.class)));
+	}
+
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	@Test
+	public void testSelectOnLists() throws Exception {
+		String text = "Rot wood cheeses dew?";
+		tokenBuilder.buildTokens(jCas, text);
+
+		Collection<TOP> allFS = select(jCas, TOP.class);
+
+		// Building a list... OMG!
+		NonEmptyFSList allFSList = new NonEmptyFSList(jCas);
+		NonEmptyFSList head = allFSList;
+		Iterator<TOP> i = allFS.iterator();
+		while (i.hasNext()) {
+			head.setHead(i.next());
+			if (i.hasNext()) {
+				head.setTail(new NonEmptyFSList(jCas));
+				head = (NonEmptyFSList) head.getTail();
+			}
+			else {
+				head.setTail(new EmptyFSList(jCas));
+			}
+		}
+
+		// Print what is expected
+		for (FeatureStructure fs : allFS) {
+			System.out.println("Type: " + fs.getType().getName() + "]");
+		}
+		System.out.println("Tokens: [" + toText(select(jCas, Token.class)) + "]");
+
+		// Document Annotation, one sentence and 4 tokens.
+		assertEquals(6, allFS.size());
+
+		assertEquals(toText(select(jCas, Token.class)), toText(select(allFSList, Token.class)));
+
+		assertEquals(toText((Iterable) select(jCas, Token.class)),
+				toText((Iterable) select(allFSList, Token.class)));
+	}
+
+	@Test
+	public void testToText() throws UIMAException {
+		String text = "Rot wood cheeses dew?";
+		tokenBuilder.buildTokens(jCas, text);
+		assertEquals(asList(text.split(" ")), toText(select(jCas, Token.class)));
+	}
+
+	@Test
+	public void testSelectSingleRelative() throws UIMAException {
+		String text = "one two three";
+		tokenBuilder.buildTokens(jCas, text);
+		List<Token> token = new ArrayList<Token>(select(jCas, Token.class));
+
+		Token preceding = selectSingleRelative(jCas, Token.class, token.get(1), -1);
+		assertEquals(token.get(0).getCoveredText(), preceding.getCoveredText());
+		
+		Token following = selectSingleRelative(jCas, Token.class, token.get(1), 1);
+		assertEquals(token.get(2).getCoveredText(), following.getCoveredText());
+	}
+
+	@Test
+	public void testSelectFollowingPreceding() throws UIMAException {
+		String text = "one two three";
+		tokenBuilder.buildTokens(jCas, text);
+		List<Token> token = new ArrayList<Token>(select(jCas, Token.class));
+
+		assertEquals(token.get(0).getCoveredText(),
+				selectPreceding(jCas, Token.class, token.get(1), 1).get(0).getCoveredText());
+		assertEquals(token.get(2).getCoveredText(),
+				selectFollowing(jCas, Token.class, token.get(1), 1).get(0).getCoveredText());
+	}
+
+	@Test
+	public void testSelectFollowingPrecedingBuiltinTypes() {
+		this.jCas.setDocumentText("A B C");
+		// remove the DocumentAnnotation
+		for (Annotation ann : JCasUtil.select(jCas, Annotation.class)) {
+			ann.removeFromIndexes();
+		}
+		Annotation a = new Annotation(this.jCas, 0, 1);
+		Annotation b = new Annotation(this.jCas, 2, 3);
+		Annotation c = new Annotation(this.jCas, 4, 5);
+		for (Annotation ann : Arrays.asList(a, b, c)) {
+			ann.addToIndexes();
+		}
+
+		assertEquals(Arrays.asList(a), selectPreceding(this.jCas, Annotation.class, b, 2));
+		assertEquals(Arrays.asList(a, b), selectPreceding(this.jCas, Annotation.class, c, 2));
+		assertEquals(Arrays.asList(b, c), selectFollowing(this.jCas, Annotation.class, a, 2));
+		assertEquals(Arrays.asList(c), selectFollowing(this.jCas, Annotation.class, b, 2));
+	}
+
+	@Test
+	public void testSelectFollowingPrecedingDifferentTypes() {
+		this.jCas.setDocumentText("A B C D E");
+		Token a = new Token(this.jCas, 0, 1);
+		Token b = new Token(this.jCas, 2, 3);
+		Token c = new Token(this.jCas, 4, 5);
+		Token d = new Token(this.jCas, 6, 7);
+		Token e = new Token(this.jCas, 8, 9);
+		for (Token token : Arrays.asList(a, b, c, d, e)) {
+			token.addToIndexes();
+		}
+		Sentence sentence = new Sentence(this.jCas, 2, 5);
+		sentence.addToIndexes();
+
+		List<Token> preceding = selectPreceding(this.jCas, Token.class, sentence, 1);
+		assertEquals(Arrays.asList("A"), JCasUtil.toText(preceding));
+		assertEquals(Arrays.asList(a), preceding);
+		preceding = selectPreceding(this.jCas, Token.class, sentence, 2);
+		assertEquals(Arrays.asList("A"), JCasUtil.toText(preceding));
+		assertEquals(Arrays.asList(a), preceding);
+
+		List<Token> following = selectFollowing(this.jCas, Token.class, sentence, 1);
+		assertEquals(Arrays.asList("D"), JCasUtil.toText(following));
+		assertEquals(Arrays.asList(d), following);
+		following = selectFollowing(this.jCas, Token.class, sentence, 2);
+		assertEquals(Arrays.asList("D", "E"), JCasUtil.toText(following));
+		assertEquals(Arrays.asList(d, e), following);
+		following = selectFollowing(this.jCas, Token.class, sentence, 3);
+		assertEquals(Arrays.asList("D", "E"), JCasUtil.toText(following));
+		assertEquals(Arrays.asList(d, e), following);
+	}
+
+	@Test
+	public void testSelectFollowingPrecedingDifferentTypesMatchingSpansReversePriorities() {
+		this.jCas.setDocumentText("A B C D E");
+		Sentence a = new Sentence(this.jCas, 0, 1);
+		Sentence b = new Sentence(this.jCas, 2, 3);
+		Sentence c = new Sentence(this.jCas, 4, 5);
+		Sentence d = new Sentence(this.jCas, 6, 7);
+		Sentence e = new Sentence(this.jCas, 8, 9);
+		for (Sentence sentence : Arrays.asList(a, b, c, d, e)) {
+			sentence.addToIndexes();
+		}
+		AnalyzedText text = new AnalyzedText(this.jCas, 2, 3);
+		text.addToIndexes();
+
+		List<Sentence> preceding = selectPreceding(this.jCas, Sentence.class, text, 1);
+		assertEquals(Arrays.asList("A"), JCasUtil.toText(preceding));
+		assertEquals(Arrays.asList(a), preceding);
+		preceding = selectPreceding(this.jCas, Sentence.class, text, 2);
+		assertEquals(Arrays.asList("A"), JCasUtil.toText(preceding));
+		assertEquals(Arrays.asList(a), preceding);
+
+		List<Sentence> following = selectFollowing(this.jCas, Sentence.class, text, 1);
+		assertEquals(Arrays.asList("C"), JCasUtil.toText(following));
+		assertEquals(Arrays.asList(c), following);
+		following = selectFollowing(this.jCas, Sentence.class, text, 2);
+		assertEquals(Arrays.asList("C", "D"), JCasUtil.toText(following));
+		assertEquals(Arrays.asList(c, d), following);
+	}
+
+	@Test
+	public void testExists() throws UIMAException {
+		JCas jcas = CasCreationUtils.createCas(createTypeSystemDescription(), null, null).getJCas();
+
+		assertFalse(exists(jcas, Token.class));
+
+		new Token(jcas, 0, 1).addToIndexes();
+
+		assertTrue(exists(jcas, Token.class));
+	}
+
+	@Test
+	public void testSelectSingle() throws UIMAException {
+		JCas jcas = CasCreationUtils.createCas(createTypeSystemDescription(), null, null).getJCas();
+
+		try {
+			selectSingle(jcas, Token.class);
+			fail("Found annotation that has not yet been created");
+		}
+		catch (IllegalArgumentException e) {
+			// OK
+		}
+
+		new Token(jcas, 0, 1).addToIndexes();
+
+		selectSingle(jcas, Token.class);
+
+		new Token(jcas, 1, 2).addToIndexes();
+
+		try {
+			selectSingle(jcas, Token.class);
+			fail("selectSingle must fail if there is more than one annotation of the type");
+		}
+		catch (IllegalArgumentException e) {
+			// OK
+		}
+	}
+
+	@Test
+	public void testSelectIsCovered() throws UIMAException {
+		String text = "Will you come home today ? \n No , tomorrow !";
+		tokenBuilder.buildTokens(jCas, text);
+
+		List<Sentence> sentences = new ArrayList<Sentence>(select(jCas, Sentence.class));
+		List<Token> tokens = new ArrayList<Token>(select(jCas, Token.class));
+
+		assertEquals(6, selectCovered(Token.class, sentences.get(0)).size());
+		assertEquals(4, selectCovered(Token.class, sentences.get(1)).size());
+
+		assertTrue(isCovered(jCas, sentences.get(0), Token.class));
+		tokens.get(0).removeFromIndexes();
+		tokens.get(1).removeFromIndexes();
+		tokens.get(2).removeFromIndexes();
+		tokens.get(3).removeFromIndexes();
+		tokens.get(4).removeFromIndexes();
+		tokens.get(5).removeFromIndexes();
+		assertFalse(isCovered(jCas, sentences.get(0), Token.class));
+	}
+
+	@Test
+	public void testGetInternalUimaType() {
+		Type t = getType(jCas, Annotation.class);
+		assertNotNull(t);
+	}
+
+	@Test
+	public void testGetView() throws Exception {
+		JCas jcas = CasCreationUtils.createCas(createTypeSystemDescription(), null, null).getJCas();
+
+		assertNull(getView(jcas, "view1", null));
+		assertNotNull(getView(jcas, "view1", true));
+		assertNotNull(getView(jcas, "view1", null));
+	}
+
+	@Test(expected = IllegalArgumentException.class)
+	public void testGetNonExistingView() throws Exception {
+		JCas jcas = CasCreationUtils.createCas(createTypeSystemDescription(), null, null).getJCas();
+		assertNull(getView(jcas, "view1", false));
+	}
+
+	@Test
+	public void testGetType() throws UIMAException {
+		String text = "Rot wood cheeses dew?";
+		tokenBuilder.buildTokens(jCas, text);
+
+		assertEquals(Token.class.getName(), getType(jCas, Token.class).getName());
+		assertEquals(Token.class.getName(), getAnnotationType(jCas, Token.class).getName());
+		assertEquals("uima.cas.TOP", getType(jCas, TOP.class).getName());
+		assertEquals("uima.tcas.Annotation", getType(jCas, Annotation.class).getName());
+		assertEquals("uima.tcas.Annotation", getAnnotationType(jCas, Annotation.class).getName());
+	}
+
+	@Test(expected = IllegalArgumentException.class)
+	public void testGetNonAnnotationType() throws UIMAException {
+		String text = "Rot wood cheeses dew?";
+		tokenBuilder.buildTokens(jCas, text);
+
+		getAnnotationType(jCas, TOP.class);
+	}
+
+	@Test
+	public void testIndexCovering() throws Exception {
+		String text = "Will you come home today ? \n No , tomorrow !";
+		tokenBuilder.buildTokens(jCas, text);
+
+		List<Sentence> sentences = new ArrayList<Sentence>(select(jCas, Sentence.class));
+		List<Token> tokens = new ArrayList<Token>(select(jCas, Token.class));
+
+		Map<Token, Collection<Sentence>> index = indexCovering(jCas, Token.class, Sentence.class);
+
+		// Check covering annotations are found
+		assertEquals(asList(sentences.get(0)), index.get(tokens.get(0)));
+		assertEquals(asList(sentences.get(1)), index.get(tokens.get(tokens.size() - 1)));
+
+		// Check sentence 0 contains first token
+		assertTrue(index.get(tokens.get(0)).contains(sentences.get(0)));
+
+		// Check sentence 0 does not contain last token.
+		assertFalse(index.get(tokens.get(tokens.size() - 1)).contains(sentences.get(0)));
+
+		// Check the first token is contained in any sentence
+		assertTrue(!index.get(tokens.get(0)).isEmpty());
+		// After removing the annotation the index has to be rebuilt.
+		sentences.get(0).removeFromIndexes();
+		index = indexCovering(jCas, Token.class, Sentence.class);
+		// Check the first token is not contained in any sentence
+		assertFalse(!index.get(tokens.get(0)).isEmpty());
+	}
+}

Propchange: uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/JCasUtilTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/LocaleUtilTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/LocaleUtilTest.java?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/LocaleUtilTest.java (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/LocaleUtilTest.java Wed Dec 12 14:58:37 2012
@@ -0,0 +1,65 @@
+/* 
+ Copyright 2010	Regents of the University of Colorado.  
+ All rights reserved. 
+
+ Licensed under the Apache License, Version 2.0 (the "License"); 
+ you may not use this file except in compliance with the License. 
+ You may obtain a copy of the License at 
+
+ http://www.apache.org/licenses/LICENSE-2.0 
+
+ Unless required by applicable law or agreed to in writing, software 
+ distributed under the License is distributed on an "AS IS" BASIS, 
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ See the License for the specific language governing permissions and 
+ limitations under the License.
+ */
+package org.uimafit.util;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.uimafit.util.LocaleUtil.createLocale;
+import static org.uimafit.util.LocaleUtil.getLocaleConstant;
+
+import java.util.Locale;
+
+import org.junit.Test;
+
+/**
+ * 
+ * @author Philip Ogren
+ * 
+ */
+public class LocaleUtilTest {
+
+	@Test
+	public void testGetLocaleConstant() throws Exception {
+		assertEquals(Locale.US, getLocaleConstant("US"));
+		assertNull(getLocaleConstant("UN"));
+		assertEquals(Locale.ENGLISH, getLocaleConstant("ENGLISH"));
+		assertEquals(Locale.CHINA, getLocaleConstant("CHINA"));
+		assertNull(getLocaleConstant(""));
+		assertNull(getLocaleConstant(null));
+	}
+
+	@Test
+	public void testCreateLocale() throws Exception {
+		assertEquals(new Locale("en", "US"), createLocale("en-US"));
+		assertEquals(new Locale("es"), createLocale("es"));
+		assertEquals(new Locale("ko", "KR"), createLocale("ko-KR"));
+		assertEquals(new Locale("es", "ES", "Traditional_WIN"),
+				createLocale("es-ES-Traditional_WIN"));
+		assertEquals(new Locale("en", "US", "Colorado"), createLocale("en-US-Colorado"));
+		assertEquals(new Locale("en", "US", "Colorado-Boulder"),
+				createLocale("en-US-Colorado-Boulder"));
+		assertEquals(new Locale("de", "", "POSIX"), createLocale("de--POSIX"));
+		// The following examples were taken from the javadoc for java.util.Locale.toString()
+		assertEquals(new Locale("en"), createLocale("en"));
+		assertEquals(new Locale("de", "DE"), createLocale("de_DE"));
+		assertEquals(new Locale("", "GB"), createLocale("_GB"));
+		assertEquals(new Locale("en", "US", "WIN"), createLocale("en_US_WIN"));
+		assertEquals(new Locale("de", "", "POSIX"), createLocale("de__POSIX"));
+		assertEquals(new Locale("fr", "", "MAC"), createLocale("fr__MAC"));
+	}
+
+}

Propchange: uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/LocaleUtilTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/SimplePipelineTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/SimplePipelineTest.java?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/SimplePipelineTest.java (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/SimplePipelineTest.java Wed Dec 12 14:58:37 2012
@@ -0,0 +1,51 @@
+/* 
+ Copyright 2009-2010	Regents of the University of Colorado.  
+ All rights reserved. 
+
+ Licensed under the Apache License, Version 2.0 (the "License"); 
+ you may not use this file except in compliance with the License. 
+ You may obtain a copy of the License at 
+
+ http://www.apache.org/licenses/LICENSE-2.0 
+
+ Unless required by applicable law or agreed to in writing, software 
+ distributed under the License is distributed on an "AS IS" BASIS, 
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ See the License for the specific language governing permissions and 
+ limitations under the License.
+ */
+
+package org.uimafit.util;
+
+import java.io.IOException;
+
+import org.apache.uima.UIMAException;
+import org.apache.uima.analysis_engine.AnalysisEngineDescription;
+import org.junit.Test;
+import org.uimafit.ComponentTestBase;
+import org.uimafit.factory.AnalysisEngineFactory;
+import org.uimafit.factory.JCasFactory;
+import org.uimafit.factory.testAes.Annotator1;
+import org.uimafit.factory.testAes.Annotator2;
+import org.uimafit.factory.testAes.Annotator3;
+import org.uimafit.pipeline.SimplePipeline;
+
+/**
+ * @author Philip Ogren
+ */
+
+public class SimplePipelineTest extends ComponentTestBase {
+
+	@Test
+	public void test1() throws UIMAException, IOException {
+		JCasFactory.loadJCas(jCas, "src/test/resources/data/docs/test.xmi");
+		AnalysisEngineDescription aed1 = AnalysisEngineFactory.createPrimitiveDescription(
+				Annotator1.class, typeSystemDescription);
+		AnalysisEngineDescription aed2 = AnalysisEngineFactory.createPrimitiveDescription(
+				Annotator2.class, typeSystemDescription);
+		AnalysisEngineDescription aed3 = AnalysisEngineFactory.createPrimitiveDescription(
+				Annotator3.class, typeSystemDescription);
+		SimplePipeline.runPipeline(jCas, aed1, aed2, aed3);
+
+	}
+}

Propchange: uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/SimplePipelineTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/TypeSystemUtil.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/TypeSystemUtil.java?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/TypeSystemUtil.java (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/TypeSystemUtil.java Wed Dec 12 14:58:37 2012
@@ -0,0 +1,45 @@
+/* 
+  Copyright 2010 Regents of the University of Colorado.  
+ All rights reserved. 
+
+ Licensed under the Apache License, Version 2.0 (the "License"); 
+ you may not use this file except in compliance with the License. 
+ You may obtain a copy of the License at 
+
+ http://www.apache.org/licenses/LICENSE-2.0 
+
+ Unless required by applicable law or agreed to in writing, software 
+ distributed under the License is distributed on an "AS IS" BASIS, 
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ See the License for the specific language governing permissions and 
+ limitations under the License.
+ */
+package org.uimafit.util;
+
+import org.apache.uima.jcas.JCas;
+import org.uimafit.type.AnalyzedText;
+
+/**
+ * @author Philip Ogren
+ */
+
+public class TypeSystemUtil {
+
+	public static String getAnalyzedText(JCas jCas) {
+		return _getAnalyzedText(jCas).getText();
+	}
+
+	public static void setAnalyzedText(JCas jCas, String text) {
+		_getAnalyzedText(jCas).setText(text);
+	}
+
+	private static AnalyzedText _getAnalyzedText(JCas jCas) {
+		AnalyzedText analyzedText = JCasUtil.selectByIndex(jCas, AnalyzedText.class, 0);
+		if (analyzedText == null) {
+			analyzedText = new AnalyzedText(jCas);
+			analyzedText.setText(jCas.getDocumentText());
+			analyzedText.addToIndexes();
+		}
+		return analyzedText;
+	}
+}

Propchange: uima/sandbox/trunk/uimaFIT/src/test/java/org/uimafit/util/TypeSystemUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/src/test/resources/META-INF/org.uimafit/fsindexes.txt
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/resources/META-INF/org.uimafit/fsindexes.txt?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/resources/META-INF/org.uimafit/fsindexes.txt (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/resources/META-INF/org.uimafit/fsindexes.txt Wed Dec 12 14:58:37 2012
@@ -0,0 +1 @@
+classpath*:org/uimafit/index/**/*.xml

Propchange: uima/sandbox/trunk/uimaFIT/src/test/resources/META-INF/org.uimafit/fsindexes.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/src/test/resources/META-INF/org.uimafit/types.txt
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/resources/META-INF/org.uimafit/types.txt?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/resources/META-INF/org.uimafit/types.txt (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/resources/META-INF/org.uimafit/types.txt Wed Dec 12 14:58:37 2012
@@ -0,0 +1 @@
+classpath*:org/uimafit/type/**/*.xml

Propchange: uima/sandbox/trunk/uimaFIT/src/test/resources/META-INF/org.uimafit/types.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/src/test/resources/data/descriptor/DefaultValueAE1.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/resources/data/descriptor/DefaultValueAE1.xml?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/resources/data/descriptor/DefaultValueAE1.xml (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/resources/data/descriptor/DefaultValueAE1.xml Wed Dec 12 14:58:37 2012
@@ -0,0 +1,18 @@
+<?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.uimafit.component.initialize.ConfigurationParameterInitializerTest$DefaultValueAE1</annotatorImplementationName>
+  <analysisEngineMetaData>
+    <name/>
+    <configurationParameters/>
+    <configurationParameterSettings/>
+    <typeSystemDescription/>
+    <capabilities/>
+    <operationalProperties>
+      <modifiesCas>true</modifiesCas>
+      <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+      <outputsNewCASes>false</outputsNewCASes>
+    </operationalProperties>
+  </analysisEngineMetaData>
+</analysisEngineDescription>

Propchange: uima/sandbox/trunk/uimaFIT/src/test/resources/data/descriptor/DefaultValueAE1.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/src/test/resources/data/descriptor/DefaultValueAE2.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/resources/data/descriptor/DefaultValueAE2.xml?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/resources/data/descriptor/DefaultValueAE2.xml (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/resources/data/descriptor/DefaultValueAE2.xml Wed Dec 12 14:58:37 2012
@@ -0,0 +1,18 @@
+<?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.uimafit.component.initialize.ConfigurationParameterInitializerTest$DefaultValueAE2</annotatorImplementationName>
+  <analysisEngineMetaData>
+    <name/>
+    <configurationParameters/>
+    <configurationParameterSettings/>
+    <typeSystemDescription/>
+    <capabilities/>
+    <operationalProperties>
+      <modifiesCas>true</modifiesCas>
+      <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+      <outputsNewCASes>false</outputsNewCASes>
+    </operationalProperties>
+  </analysisEngineMetaData>
+</analysisEngineDescription>

Propchange: uima/sandbox/trunk/uimaFIT/src/test/resources/data/descriptor/DefaultValueAE2.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/src/test/resources/data/descriptor/README
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/resources/data/descriptor/README?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/resources/data/descriptor/README (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/resources/data/descriptor/README Wed Dec 12 14:58:37 2012
@@ -0,0 +1,2 @@
+These files are used by ConfigurationParameterInitializerTest.  
+For a description on how they were generated see org.uimafit.component.initialize.ConfigurationParameterInitializerTest.main(String[])
\ No newline at end of file

Propchange: uima/sandbox/trunk/uimaFIT/src/test/resources/data/descriptor/README
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/A.txt
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/A.txt?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/A.txt (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/A.txt Wed Dec 12 14:58:37 2012
@@ -0,0 +1 @@
+Aaa Bbbb Cc Dddd eeee ff .
\ No newline at end of file

Propchange: uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/A.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/bad.xcas
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/bad.xcas?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/bad.xcas (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/bad.xcas Wed Dec 12 14:58:37 2012
@@ -0,0 +1 @@
+This is not an xcas file though it has an xcas extention.
\ No newline at end of file

Added: uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/test.xcas
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/test.xcas?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/test.xcas (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/test.xcas Wed Dec 12 14:58:37 2012
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><CAS version="2"><uima.cas.Sofa _indexed="0" _id="1" sofaNum="1" sofaID="_InitialView" mimeType="text" sofaString="... the more knowledge advances the more it becomes possible to condense it into little books."/><uima.tcas.DocumentAnnotation _indexed="1" _id="8" _ref_sofa="1" begin="0" end="94" language="x-unspecified"/><org.uimafit.type.Token _indexed="1" _id="13" _ref_sofa="1" begin="0" end="3" pos="." stem="..."/><org.uimafit.type.Token _indexed="1" _id="19" _ref_sofa="1" begin="4" end="7" pos="T" stem="the"/><org.uimafit.type.Token _indexed="1" _id="25" _ref_sofa="1" begin="8" end="12" pos="M" stem="more"/><org.uimafit.type.Token _indexed="1" _id="31" _ref_sofa="1" begin="13" end="22" pos="K" stem="knowledge"/><org.uimafit.type.Token _indexed="1" _id="37" _ref_sofa="1" begin="23" end="31" pos="A" stem="advance"/><org.uimafit.type.Token _indexed="1" _id="43" _ref_sofa="1" begin="32" end="35" pos="T" stem="the"/><org.uimafit.type.Token
  _indexed="1" _id="49" _ref_sofa="1" begin="36" end="40" pos="M" stem="more"/><org.uimafit.type.Token _indexed="1" _id="55" _ref_sofa="1" begin="41" end="43" pos="I" stem="it"/><org.uimafit.type.Token _indexed="1" _id="61" _ref_sofa="1" begin="44" end="51" pos="B" stem="become"/><org.uimafit.type.Token _indexed="1" _id="67" _ref_sofa="1" begin="52" end="60" pos="P" stem="possible"/><org.uimafit.type.Token _indexed="1" _id="73" _ref_sofa="1" begin="61" end="63" pos="T" stem="to"/><org.uimafit.type.Token _indexed="1" _id="79" _ref_sofa="1" begin="64" end="72" pos="C" stem="condense"/><org.uimafit.type.Token _indexed="1" _id="85" _ref_sofa="1" begin="73" end="75" pos="I" stem="it"/><org.uimafit.type.Token _indexed="1" _id="91" _ref_sofa="1" begin="76" end="80" pos="I" stem="into"/><org.uimafit.type.Token _indexed="1" _id="97" _ref_sofa="1" begin="81" end="87" pos="L" stem="little"/><org.uimafit.type.Token _indexed="1" _id="103" _ref_sofa="1" begin="88" end="93" pos="B" stem="bo
 ok"/><org.uimafit.type.Token _indexed="1" _id="109" _ref_sofa="1" begin="93" end="94" pos="." stem="."/><org.uimafit.type.Sentence _indexed="1" _id="115" _ref_sofa="1" begin="0" end="94"/></CAS>
\ No newline at end of file

Added: uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/test.xmi
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/test.xmi?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/test.xmi (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/test.xmi Wed Dec 12 14:58:37 2012
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><xmi:XMI xmlns:cas="http:///uima/cas.ecore" xmlns:xmi="http://www.omg.org/XMI" xmlns:type="http:///org/uimafit/type.ecore" xmlns:tcas="http:///uima/tcas.ecore" xmi:version="2.0"><cas:NULL xmi:id="0"/><cas:Sofa xmi:id="1" sofaNum="1" sofaID="_InitialView" mimeType="text" sofaString="Me and all my friends are non-conformists."/><tcas:DocumentAnnotation xmi:id="8" sofa="1" begin="0" end="42" language="x-unspecified"/><type:Token xmi:id="13" sofa="1" begin="0" end="2" pos="M" stem="me"/><type:Token xmi:id="19" sofa="1" begin="3" end="6" pos="A" stem="and"/><type:Token xmi:id="25" sofa="1" begin="7" end="10" pos="A" stem="all"/><type:Token xmi:id="31" sofa="1" begin="11" end="13" pos="M" stem="my"/><type:Token xmi:id="37" sofa="1" begin="14" end="21" pos="F" stem="friend"/><type:Token xmi:id="43" sofa="1" begin="22" end="25" pos="A" stem="are"/><type:Token xmi:id="49" sofa="1" begin="26" end="29" pos="N" stem="non"/><type:Token xmi:id="55" so
 fa="1" begin="29" end="30" pos="-" stem="-"/><type:Token xmi:id="61" sofa="1" begin="30" end="41" pos="C" stem="conformist"/><type:Token xmi:id="67" sofa="1" begin="41" end="42" pos="." stem="."/><type:Sentence xmi:id="73" sofa="1" begin="0" end="42"/><cas:View sofa="1" members="8 13 19 25 31 37 43 49 55 61 67 73"/></xmi:XMI>
\ No newline at end of file

Added: uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/unix-newlines.txt
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/unix-newlines.txt?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/unix-newlines.txt (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/unix-newlines.txt Wed Dec 12 14:58:37 2012
@@ -0,0 +1,8 @@
+sentence 1.
+sentence 2.
+
+
+sentence 3.
+
+sentence 4.
+

Propchange: uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/unix-newlines.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/windows-newlines.txt
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/windows-newlines.txt?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/windows-newlines.txt (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/windows-newlines.txt Wed Dec 12 14:58:37 2012
@@ -0,0 +1,9 @@
+sentence 1.
+sentence 2.
+
+
+sentence 3.
+
+sentence 4.
+
+

Propchange: uima/sandbox/trunk/uimaFIT/src/test/resources/data/docs/windows-newlines.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/src/test/resources/data/html/1.html
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/resources/data/html/1.html?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/resources/data/html/1.html (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/resources/data/html/1.html Wed Dec 12 14:58:37 2012
@@ -0,0 +1,5 @@
+<html>
+<head>
+<Title>Test 1</head>
+<body>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
\ No newline at end of file

Propchange: uima/sandbox/trunk/uimaFIT/src/test/resources/data/html/1.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/src/test/resources/data/html/2/2.1.html
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/resources/data/html/2/2.1.html?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/resources/data/html/2/2.1.html (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/resources/data/html/2/2.1.html Wed Dec 12 14:58:37 2012
@@ -0,0 +1,6 @@
+<html>
+<head><Title>Test 2.1</title></head>
+<body>
+<!------- bad comment --------->Hello!
+</BODY>
+</HtMl>
\ No newline at end of file

Propchange: uima/sandbox/trunk/uimaFIT/src/test/resources/data/html/2/2.1.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/src/test/resources/data/html/2/2.2.html
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/resources/data/html/2/2.2.html?rev=1420723&view=auto
==============================================================================
    (empty)

Propchange: uima/sandbox/trunk/uimaFIT/src/test/resources/data/html/2/2.2.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/src/test/resources/data/html/3.html
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/resources/data/html/3.html?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/resources/data/html/3.html (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/resources/data/html/3.html Wed Dec 12 14:58:37 2012
@@ -0,0 +1 @@
+<html><body><h1>Test 3
\ No newline at end of file

Propchange: uima/sandbox/trunk/uimaFIT/src/test/resources/data/html/3.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/src/test/resources/data/html/4/1/4.1.1.html
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/resources/data/html/4/1/4.1.1.html?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/resources/data/html/4/1/4.1.1.html (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/resources/data/html/4/1/4.1.1.html Wed Dec 12 14:58:37 2012
@@ -0,0 +1,7 @@
+<html>
+<head><title>Test 4.1.1</title>
+</head>
+<h2><b><i><u>Some text
+breaking</i> across
+the lines</h2>
+ </html>
\ No newline at end of file

Propchange: uima/sandbox/trunk/uimaFIT/src/test/resources/data/html/4/1/4.1.1.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/trunk/uimaFIT/src/test/resources/data/reference/JCasBuilderTest.dump
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/resources/data/reference/JCasBuilderTest.dump?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/resources/data/reference/JCasBuilderTest.dump (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/resources/data/reference/JCasBuilderTest.dump Wed Dec 12 14:58:37 2012
@@ -0,0 +1,69 @@
+======== CAS 0 begin ==================================
+
+-------- View _InitialView begin ----------------------------------
+
+DocumentAnnotation
+   sofa: _InitialView
+   begin: 0
+   end: 89
+   language: "x-unspecified"
+
+CAS-Text:
+This sentence is not annotated. But this sentences is annotated. And here every token is.
+[But this sentences is annotated. ]
+Sentence
+   sofa: _InitialView
+   begin: 32
+   end: 65
+[And here every token is.]
+Sentence
+   sofa: _InitialView
+   begin: 65
+   end: 89
+[And]
+Token
+   sofa: _InitialView
+   begin: 65
+   end: 68
+   pos: <null>
+   stem: <null>
+[here]
+Token
+   sofa: _InitialView
+   begin: 69
+   end: 73
+   pos: <null>
+   stem: <null>
+[every]
+Token
+   sofa: _InitialView
+   begin: 74
+   end: 79
+   pos: <null>
+   stem: <null>
+[token]
+Token
+   sofa: _InitialView
+   begin: 80
+   end: 85
+   pos: <null>
+   stem: <null>
+[is]
+Token
+   sofa: _InitialView
+   begin: 86
+   end: 88
+   pos: <null>
+   stem: <null>
+[.]
+Token
+   sofa: _InitialView
+   begin: 88
+   end: 89
+   pos: <null>
+   stem: <null>
+-------- View _InitialView end ----------------------------------
+
+======== CAS 0 end ==================================
+
+

Added: uima/sandbox/trunk/uimaFIT/src/test/resources/data/reference/test.xmi.dump
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/uimaFIT/src/test/resources/data/reference/test.xmi.dump?rev=1420723&view=auto
==============================================================================
--- uima/sandbox/trunk/uimaFIT/src/test/resources/data/reference/test.xmi.dump (added)
+++ uima/sandbox/trunk/uimaFIT/src/test/resources/data/reference/test.xmi.dump Wed Dec 12 14:58:37 2012
@@ -0,0 +1,92 @@
+======== CAS 0 begin ==================================
+
+-------- View _InitialView begin ----------------------------------
+
+DocumentAnnotation
+   sofa: _InitialView
+   begin: 0
+   end: 42
+   language: "x-unspecified"
+
+CAS-Text:
+Me and all my friends are non-conformists.
+[Me and all my friends are non-conformists.]
+Sentence
+   sofa: _InitialView
+   begin: 0
+   end: 42
+[Me]
+Token
+   sofa: _InitialView
+   begin: 0
+   end: 2
+   pos: "M"
+   stem: "me"
+[and]
+Token
+   sofa: _InitialView
+   begin: 3
+   end: 6
+   pos: "A"
+   stem: "and"
+[all]
+Token
+   sofa: _InitialView
+   begin: 7
+   end: 10
+   pos: "A"
+   stem: "all"
+[my]
+Token
+   sofa: _InitialView
+   begin: 11
+   end: 13
+   pos: "M"
+   stem: "my"
+[friends]
+Token
+   sofa: _InitialView
+   begin: 14
+   end: 21
+   pos: "F"
+   stem: "friend"
+[are]
+Token
+   sofa: _InitialView
+   begin: 22
+   end: 25
+   pos: "A"
+   stem: "are"
+[non]
+Token
+   sofa: _InitialView
+   begin: 26
+   end: 29
+   pos: "N"
+   stem: "non"
+[-]
+Token
+   sofa: _InitialView
+   begin: 29
+   end: 30
+   pos: "-"
+   stem: "-"
+[conformists]
+Token
+   sofa: _InitialView
+   begin: 30
+   end: 41
+   pos: "C"
+   stem: "conformist"
+[.]
+Token
+   sofa: _InitialView
+   begin: 41
+   end: 42
+   pos: "."
+   stem: "."
+-------- View _InitialView end ----------------------------------
+
+======== CAS 0 end ==================================
+
+