You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by re...@apache.org on 2013/01/18 01:26:27 UTC

svn commit: r1434987 [5/7] - in /uima/sandbox/uimafit/trunk: ./ uimafit-examples/ uimafit-legacy-support/ uimafit-legacy-support/.settings/ uimafit-legacy-support/src/ uimafit-legacy-support/src/main/ uimafit-legacy-support/src/main/java/ uimafit-legac...

Added: uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testAes/ReversableTestFlowController.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testAes/ReversableTestFlowController.java?rev=1434987&view=auto
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testAes/ReversableTestFlowController.java (added)
+++ uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testAes/ReversableTestFlowController.java Fri Jan 18 00:26:25 2013
@@ -0,0 +1,86 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.uima.fit.factory.testAes;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.analysis_engine.metadata.AnalysisEngineMetaData;
+import org.uimafit.descriptor.ConfigurationParameter;
+import org.apache.uima.fit.factory.ConfigurationParameterFactory;
+import org.apache.uima.flow.FinalStep;
+import org.apache.uima.flow.Flow;
+import org.apache.uima.flow.FlowControllerContext;
+import org.apache.uima.flow.JCasFlow_ImplBase;
+import org.apache.uima.flow.SimpleStep;
+import org.apache.uima.flow.Step;
+import org.apache.uima.jcas.JCas;
+
+/**
+ * 
+ * NOTE: this class extends org.uimafit.component.JCasFlowController_ImplBase
+ */
+
+public class ReversableTestFlowController extends
+        org.apache.uima.fit.component.JCasFlowController_ImplBase {
+
+  public static final String PARAM_REVERSE_ORDER = ConfigurationParameterFactory
+          .createConfigurationParameterName(ReversableTestFlowController.class, "reverseOrder");
+
+  @ConfigurationParameter
+  private boolean reverseOrder = false;
+
+  @Override
+  public Flow computeFlow(JCas jCas) throws AnalysisEngineProcessException {
+    return new ReversableFlow(getContext(), reverseOrder);
+  }
+
+  private static class ReversableFlow extends JCasFlow_ImplBase {
+    private List<String> keys = new ArrayList<String>();
+
+    private int i = 0;
+
+    public ReversableFlow(FlowControllerContext context, boolean reverseOrder) {
+      Iterator<Map.Entry<String, AnalysisEngineMetaData>> iterator = context
+              .getAnalysisEngineMetaDataMap().entrySet().iterator();
+      while (iterator.hasNext()) {
+        Map.Entry<String, AnalysisEngineMetaData> entry = iterator.next();
+        String key = entry.getKey();
+        keys.add(key);
+      }
+      Collections.sort(keys);
+      if (reverseOrder) {
+        Collections.reverse(keys);
+      }
+    }
+
+    public Step next() throws AnalysisEngineProcessException {
+      if (i < keys.size()) {
+        return new SimpleStep(keys.get(i++));
+      }
+
+      return new FinalStep();
+    }
+  }
+
+}

Propchange: uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testAes/ReversableTestFlowController.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testAes/ViewNames.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testAes/ViewNames.java?rev=1434987&view=auto
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testAes/ViewNames.java (added)
+++ uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testAes/ViewNames.java Fri Jan 18 00:26:25 2013
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.uima.fit.factory.testAes;
+
+import org.apache.uima.cas.CAS;
+
+/**
+ */
+
+public class ViewNames {
+
+  public static final String INITIAL_VIEW = CAS.NAME_DEFAULT_SOFA;
+
+  public static final String PARENTHESES_VIEW = "ParenthesesView";
+
+  public static final String SORTED_VIEW = "SortedView";
+
+  public static final String SORTED_PARENTHESES_VIEW = "SortedParenthesesView";
+
+  public static final String REVERSE_VIEW = "ReverseView";
+
+}

Propchange: uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testAes/ViewNames.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testCrs/SingleFileXReader.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testCrs/SingleFileXReader.java?rev=1434987&view=auto
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testCrs/SingleFileXReader.java (added)
+++ uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testCrs/SingleFileXReader.java Fri Jan 18 00:26:25 2013
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.uima.fit.factory.testCrs;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import org.apache.uima.UimaContext;
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.impl.XCASDeserializer;
+import org.apache.uima.cas.impl.XmiCasDeserializer;
+import org.apache.uima.collection.CollectionException;
+import org.apache.uima.fit.component.CasCollectionReader_ImplBase;
+import org.uimafit.descriptor.ConfigurationParameter;
+import org.apache.uima.fit.factory.ConfigurationParameterFactory;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.util.Progress;
+import org.apache.uima.util.ProgressImpl;
+import org.xml.sax.SAXException;
+
+/**
+ * <br>
+ * 
+ * This collection reader allows one to read in a single XMI or XCAS file. It's primary purpose is
+ * to help out a couple JCasFactory create methods. However, it is also used for this project unit
+ * tests as an example collection reader.
+ * 
+ */
+
+public class SingleFileXReader extends CasCollectionReader_ImplBase {
+
+  public static final String PARAM_FILE_NAME = ConfigurationParameterFactory
+          .createConfigurationParameterName(SingleFileXReader.class, "fileName");
+
+  @ConfigurationParameter(mandatory = true, description = "takes the name of a single xmi or xcas file to be processed.")
+  private String fileName;
+
+  public static final String XMI = "XMI";
+
+  public static final String XCAS = "XCAS";
+
+  public static final String PARAM_XML_SCHEME = ConfigurationParameterFactory
+          .createConfigurationParameterName(SingleFileXReader.class, "xmlScheme");
+
+  @ConfigurationParameter(mandatory = true, description = "specifies the UIMA XML serialization scheme that should be usedValid values for this parameter are 'XMI' and 'XCAS'. See XmiCasSerializer or XCASSerializer", defaultValue = XMI)
+  private String xmlScheme;
+
+  private boolean useXMI = true;
+
+  private boolean hasNext = true;
+
+  private File file;
+
+  @Override
+  public void initialize(UimaContext context) throws ResourceInitializationException {
+    super.initialize(context);
+
+    file = new File(fileName);
+
+    if (xmlScheme.equals(XMI)) {
+      useXMI = true;
+    } else if (xmlScheme.equals(XCAS)) {
+      useXMI = false;
+    } else {
+      throw new ResourceInitializationException(String.format(
+              "parameter '%1$s' must be either '%2$s' or '%3$s' or left empty.", PARAM_XML_SCHEME,
+              XMI, XCAS), null);
+    }
+
+  }
+
+  public void getNext(CAS cas) throws IOException, CollectionException {
+
+    FileInputStream inputStream = new FileInputStream(file);
+
+    try {
+      if (useXMI) {
+        XmiCasDeserializer.deserialize(inputStream, cas);
+      } else {
+        XCASDeserializer.deserialize(inputStream, cas);
+      }
+    } catch (SAXException e) {
+      throw new CollectionException(e);
+    } finally {
+      inputStream.close();
+    }
+
+    inputStream.close();
+    hasNext = false;
+  }
+
+  @Override
+  public void close() throws IOException {
+    // do nothing
+  }
+
+  public Progress[] getProgress() {
+    if (hasNext) {
+      return new Progress[] { new ProgressImpl(0, 1, Progress.ENTITIES) };
+    }
+    return new Progress[] { new ProgressImpl(1, 1, Progress.ENTITIES) };
+  }
+
+  public boolean hasNext() throws IOException, CollectionException {
+    return hasNext;
+  }
+
+}

Propchange: uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testCrs/SingleFileXReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testCrs/SingleFileXReaderTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testCrs/SingleFileXReaderTest.java?rev=1434987&view=auto
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testCrs/SingleFileXReaderTest.java (added)
+++ uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testCrs/SingleFileXReaderTest.java Fri Jan 18 00:26:25 2013
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.uima.fit.factory.testCrs;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+
+import org.apache.uima.UIMAException;
+import org.apache.uima.collection.CollectionReader;
+import org.apache.uima.fit.ComponentTestBase;
+import org.apache.uima.fit.factory.CollectionReaderFactory;
+import org.apache.uima.fit.pipeline.JCasIterable;
+import org.apache.uima.fit.testing.util.HideOutput;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.util.Progress;
+import org.junit.Test;
+
+/**
+ */
+
+public class SingleFileXReaderTest extends ComponentTestBase {
+
+  @Test
+  public void testXReader() throws UIMAException, IOException {
+    ResourceInitializationException rie = null;
+    try {
+      CollectionReaderFactory.createCollectionReader(SingleFileXReader.class, null,
+              SingleFileXReader.PARAM_XML_SCHEME, "XML");
+    } catch (ResourceInitializationException e) {
+      rie = e;
+    }
+    assertNotNull(rie);
+
+    rie = null;
+    try {
+      CollectionReaderFactory.createCollectionReader(SingleFileXReader.class, null,
+              SingleFileXReader.PARAM_XML_SCHEME, "XML", SingleFileXReader.PARAM_FILE_NAME,
+              "myxslt.xml");
+    } catch (ResourceInitializationException e) {
+      rie = e;
+    }
+    assertNotNull(rie);
+
+    CollectionReader cr = CollectionReaderFactory.createCollectionReader(SingleFileXReader.class,
+            typeSystemDescription, SingleFileXReader.PARAM_XML_SCHEME, "XCAS",
+            SingleFileXReader.PARAM_FILE_NAME, "src/test/resources/data/docs/test.xcas");
+    Progress[] progress = cr.getProgress();
+    assertEquals(1, progress.length);
+    assertEquals(0, progress[0].getCompleted());
+    assertTrue(cr.hasNext());
+
+    new JCasIterable(cr).next();
+    progress = cr.getProgress();
+    assertEquals(1, progress.length);
+    assertEquals(1, progress[0].getCompleted());
+
+    cr.close();
+
+    cr = CollectionReaderFactory.createCollectionReader(SingleFileXReader.class,
+            typeSystemDescription, SingleFileXReader.PARAM_XML_SCHEME, "XCAS",
+            SingleFileXReader.PARAM_FILE_NAME, "test/data/docs/test.xcas");
+    UnsupportedOperationException uoe = null;
+    try {
+      new JCasIterable(cr).iterator().remove();
+    } catch (UnsupportedOperationException e) {
+      uoe = e;
+    }
+    assertNotNull(uoe);
+    cr.close();
+
+    HideOutput hideOutput = new HideOutput();
+    cr = CollectionReaderFactory.createCollectionReader(SingleFileXReader.class,
+            typeSystemDescription, SingleFileXReader.PARAM_XML_SCHEME, "XCAS",
+            SingleFileXReader.PARAM_FILE_NAME, "test/data/docs/bad.xcas");
+    RuntimeException re = null;
+    try {
+      new JCasIterable(cr).next();
+    } catch (RuntimeException e) {
+      re = e;
+    }
+    assertNotNull(re);
+    hideOutput.restoreOutput();
+
+    cr = CollectionReaderFactory.createCollectionReader(SingleFileXReader.class,
+            typeSystemDescription, SingleFileXReader.PARAM_XML_SCHEME, "XMI",
+            SingleFileXReader.PARAM_FILE_NAME, "test/data/docs/dne.xmi");
+    re = null;
+    try {
+      JCasIterable jCases = new JCasIterable(cr);
+      assertTrue(jCases.hasNext());
+      jCases.next();
+    } catch (RuntimeException e) {
+      re = e;
+    }
+    assertNotNull(re);
+
+  }
+}

Propchange: uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testCrs/SingleFileXReaderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testRes/TestExternalResource.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testRes/TestExternalResource.java?rev=1434987&view=auto
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testRes/TestExternalResource.java (added)
+++ uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testRes/TestExternalResource.java Fri Jan 18 00:26:25 2013
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.uima.fit.factory.testRes;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.uima.fit.component.Resource_ImplBase;
+import org.uimafit.descriptor.ConfigurationParameter;
+
+/**
+ */
+public class TestExternalResource extends Resource_ImplBase {
+  public static final String EXPECTED_VALUE = "expected value";
+
+  public final static String PARAM_VALUE = "value";
+
+  @ConfigurationParameter(name = PARAM_VALUE)
+  private String value;
+
+  public void assertConfiguredOk() {
+    System.out.println(getClass().getSimpleName() + ".assertConfiguredOk()");
+    // Ensure normal parameters get passed to External Resource
+    assertEquals(EXPECTED_VALUE, value);
+  }
+}
\ No newline at end of file

Propchange: uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testRes/TestExternalResource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testRes/TestSharedResourceObject.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testRes/TestSharedResourceObject.java?rev=1434987&view=auto
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testRes/TestSharedResourceObject.java (added)
+++ uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testRes/TestSharedResourceObject.java Fri Jan 18 00:26:25 2013
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.uima.fit.factory.testRes;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.uima.fit.component.initialize.ConfigurationParameterInitializer;
+import org.uimafit.descriptor.ConfigurationParameter;
+import org.apache.uima.resource.DataResource;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.resource.SharedResourceObject;
+
+/**
+ */
+public class TestSharedResourceObject implements SharedResourceObject {
+  public static final String EXPECTED_VALUE = "expected value";
+
+  public final static String PARAM_VALUE = "value";
+
+  @ConfigurationParameter(name = PARAM_VALUE)
+  private String value;
+
+  public void assertConfiguredOk() {
+    System.out.println(getClass().getSimpleName() + ".assertConfiguredOk()");
+    // Ensure normal parameters get passed to External Resource
+    assertEquals(EXPECTED_VALUE, value);
+  }
+
+  public void load(DataResource aData) throws ResourceInitializationException {
+    ConfigurationParameterInitializer.initialize(this, aData);
+  }
+}
\ No newline at end of file

Propchange: uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/factory/testRes/TestSharedResourceObject.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/pipeline/CpePipelineTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/pipeline/CpePipelineTest.java?rev=1434987&view=auto
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/pipeline/CpePipelineTest.java (added)
+++ uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/pipeline/CpePipelineTest.java Fri Jan 18 00:26:25 2013
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.uima.fit.pipeline;
+
+import static org.apache.uima.fit.pipeline.SimplePipelineTest.SENTENCE_TEXT;
+
+import java.util.Arrays;
+
+import junit.framework.Assert;
+
+import org.apache.uima.fit.factory.AnalysisEngineFactory;
+import org.apache.uima.fit.factory.CollectionReaderFactory;
+import org.apache.uima.fit.pipeline.SimplePipelineTest.Annotator;
+import org.apache.uima.fit.pipeline.SimplePipelineTest.Reader;
+import org.apache.uima.fit.pipeline.SimplePipelineTest.Writer;
+import org.junit.Test;
+
+/**
+ */
+public class CpePipelineTest {
+  @Test
+  public void test() throws Exception {
+    CpePipeline.runPipeline(CollectionReaderFactory.createDescription(Reader.class),
+            AnalysisEngineFactory.createPrimitiveDescription(Annotator.class),
+            AnalysisEngineFactory.createPrimitiveDescription(Writer.class));
+    Assert.assertEquals(Arrays.asList(SENTENCE_TEXT), Writer.SENTENCES);
+  }
+}

Propchange: uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/pipeline/CpePipelineTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/pipeline/SimplePipelineTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/pipeline/SimplePipelineTest.java?rev=1434987&view=auto
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/pipeline/SimplePipelineTest.java (added)
+++ uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/pipeline/SimplePipelineTest.java Fri Jan 18 00:26:25 2013
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.uima.fit.pipeline;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.apache.uima.UimaContext;
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.collection.CollectionException;
+import org.apache.uima.fit.component.JCasAnnotator_ImplBase;
+import org.apache.uima.fit.component.JCasCollectionReader_ImplBase;
+import org.apache.uima.fit.factory.AnalysisEngineFactory;
+import org.apache.uima.fit.factory.CollectionReaderFactory;
+import org.apache.uima.fit.type.Sentence;
+import org.apache.uima.fit.util.JCasUtil;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.util.Progress;
+import org.junit.Test;
+
+/**
+ */
+public class SimplePipelineTest {
+
+  public static final String SENTENCE_TEXT = "Some text";
+
+  public static class Reader extends JCasCollectionReader_ImplBase {
+
+    private int size = 1;
+
+    private int current = 0;
+
+    public Progress[] getProgress() {
+      return null;
+    }
+
+    public boolean hasNext() throws IOException, CollectionException {
+      return this.current < this.size;
+    }
+
+    @Override
+    public void getNext(JCas jCas) throws IOException, CollectionException {
+      jCas.setDocumentText(SENTENCE_TEXT);
+      this.current += 1;
+    }
+
+  }
+
+  public static class Annotator extends JCasAnnotator_ImplBase {
+
+    @Override
+    public void process(JCas jCas) throws AnalysisEngineProcessException {
+      String text = jCas.getDocumentText();
+      Sentence sentence = new Sentence(jCas, 0, text.length());
+      sentence.addToIndexes();
+    }
+
+  }
+
+  public static class Writer extends JCasAnnotator_ImplBase {
+
+    public static List<String> SENTENCES = new ArrayList<String>();
+
+    @Override
+    public void initialize(UimaContext context) throws ResourceInitializationException {
+      super.initialize(context);
+      SENTENCES = new ArrayList<String>();
+    }
+
+    @Override
+    public void process(JCas jCas) throws AnalysisEngineProcessException {
+      for (Sentence sentence : JCasUtil.select(jCas, Sentence.class)) {
+        SENTENCES.add(sentence.getCoveredText());
+      }
+    }
+
+  }
+
+  @Test
+  public void test() throws Exception {
+    SimplePipeline.runPipeline(CollectionReaderFactory.createCollectionReader(Reader.class),
+            AnalysisEngineFactory.createPrimitive(Annotator.class),
+            AnalysisEngineFactory.createPrimitive(Writer.class));
+    Assert.assertEquals(Arrays.asList(SENTENCE_TEXT), Writer.SENTENCES);
+  }
+}

Propchange: uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/pipeline/SimplePipelineTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/testing/factory/TokenBuilderTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/testing/factory/TokenBuilderTest.java?rev=1434987&view=auto
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/testing/factory/TokenBuilderTest.java (added)
+++ uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/testing/factory/TokenBuilderTest.java Fri Jan 18 00:26:25 2013
@@ -0,0 +1,230 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.uima.fit.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.fit.ComponentTestBase;
+import org.apache.uima.fit.type.Sentence;
+import org.apache.uima.fit.type.Token;
+import org.apache.uima.fit.util.JCasUtil;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.tcas.Annotation;
+import org.apache.uima.pear.util.FileUtil;
+import org.junit.Test;
+
+/**
+ */
+
+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/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/testing/factory/TokenBuilderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/CasUtilTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/CasUtilTest.java?rev=1434987&view=auto
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/CasUtilTest.java (added)
+++ uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/CasUtilTest.java Fri Jan 18 00:26:25 2013
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.uima.fit.util;
+
+import static java.util.Arrays.asList;
+import static org.apache.uima.fit.util.CasUtil.getAnnotationType;
+import static org.apache.uima.fit.util.CasUtil.getType;
+import static org.apache.uima.fit.util.CasUtil.iterator;
+import static org.apache.uima.fit.util.CasUtil.iteratorFS;
+import static org.apache.uima.fit.util.CasUtil.select;
+import static org.apache.uima.fit.util.CasUtil.selectByIndex;
+import static org.apache.uima.fit.util.CasUtil.selectFS;
+import static org.apache.uima.fit.util.CasUtil.toText;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+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.fit.ComponentTestBase;
+import org.apache.uima.fit.type.Token;
+import org.apache.uima.jcas.cas.TOP;
+import org.apache.uima.jcas.tcas.Annotation;
+import org.junit.Test;
+
+/**
+ * Test cases for {@link JCasUtil}.
+ * 
+ */
+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/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/CasUtilTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/ContainmentIndexTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/ContainmentIndexTest.java?rev=1434987&view=auto
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/ContainmentIndexTest.java (added)
+++ uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/ContainmentIndexTest.java Fri Jan 18 00:26:25 2013
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.uima.fit.util;
+
+import static java.util.Arrays.asList;
+import static org.apache.uima.fit.util.JCasUtil.select;
+import static org.apache.uima.fit.util.JCasUtil.selectCovered;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.uima.fit.ComponentTestBase;
+import org.apache.uima.fit.type.Sentence;
+import org.apache.uima.fit.type.Token;
+import org.apache.uima.fit.util.ContainmentIndex.Type;
+import org.junit.Test;
+
+/**
+ * Unit test for {@link ContainmentIndex}.
+ * 
+ */
+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/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/ContainmentIndexTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/DisableLoggingTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/DisableLoggingTest.java?rev=1434987&view=auto
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/DisableLoggingTest.java (added)
+++ uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/DisableLoggingTest.java Fri Jan 18 00:26:25 2013
@@ -0,0 +1,106 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.uima.fit.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.apache.uima.fit.testing.util.DisableLogging;
+import org.junit.Test;
+
+/**
+ */
+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/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/DisableLoggingTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/FSCollectionFactoryTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/FSCollectionFactoryTest.java?rev=1434987&view=auto
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/FSCollectionFactoryTest.java (added)
+++ uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/FSCollectionFactoryTest.java Fri Jan 18 00:26:25 2013
@@ -0,0 +1,210 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.uima.fit.util;
+
+import static java.util.Arrays.asList;
+import static org.apache.commons.lang.ArrayUtils.toObject;
+import static org.apache.uima.fit.util.FSCollectionFactory.create;
+import static org.apache.uima.fit.util.FSCollectionFactory.createBooleanArray;
+import static org.apache.uima.fit.util.FSCollectionFactory.createByteArray;
+import static org.apache.uima.fit.util.FSCollectionFactory.createDoubleArray;
+import static org.apache.uima.fit.util.FSCollectionFactory.createFSArray;
+import static org.apache.uima.fit.util.FSCollectionFactory.createFSList;
+import static org.apache.uima.fit.util.FSCollectionFactory.createFloatArray;
+import static org.apache.uima.fit.util.FSCollectionFactory.createFloatList;
+import static org.apache.uima.fit.util.FSCollectionFactory.createIntArray;
+import static org.apache.uima.fit.util.FSCollectionFactory.createIntegerList;
+import static org.apache.uima.fit.util.FSCollectionFactory.createLongArray;
+import static org.apache.uima.fit.util.FSCollectionFactory.createShortArray;
+import static org.apache.uima.fit.util.FSCollectionFactory.createStringArray;
+import static org.apache.uima.fit.util.FSCollectionFactory.createStringList;
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.fit.factory.JCasFactory;
+import org.apache.uima.fit.type.Token;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.tcas.Annotation;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ */
+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/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/FSCollectionFactoryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/HideOutputTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/HideOutputTest.java?rev=1434987&view=auto
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/HideOutputTest.java (added)
+++ uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/HideOutputTest.java Fri Jan 18 00:26:25 2013
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.uima.fit.util;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+
+import junit.framework.Assert;
+
+import org.apache.uima.fit.testing.util.HideOutput;
+import org.junit.Test;
+
+/**
+ */
+
+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/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/HideOutputTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/JCasIterableTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/JCasIterableTest.java?rev=1434987&view=auto
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/JCasIterableTest.java (added)
+++ uima/sandbox/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/JCasIterableTest.java Fri Jan 18 00:26:25 2013
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.uima.fit.util;
+
+/**
+ */
+
+import java.util.Iterator;
+
+import org.apache.uima.cas.CASException;
+import org.apache.uima.fit.ComponentTestBase;
+import org.junit.Test;
+
+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/uimafit/trunk/uimafit-legacy-support/src/test/java/org/apache/uima/fit/util/JCasIterableTest.java
------------------------------------------------------------------------------
    svn:eol-style = native