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/11 00:12:37 UTC

svn commit: r1431721 [14/19] - in /uima/sandbox/uimafit/trunk: uimafit-examples/src/main/java/org/apache/uima/fit/examples/experiment/pos/ uimafit-examples/src/main/java/org/apache/uima/fit/examples/getstarted/ uimafit-examples/src/main/java/org/apache...

Modified: uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/component/ViewCreatorAnnotatorTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/component/ViewCreatorAnnotatorTest.java?rev=1431721&r1=1431720&r2=1431721&view=diff
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/component/ViewCreatorAnnotatorTest.java (original)
+++ uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/component/ViewCreatorAnnotatorTest.java Thu Jan 10 23:12:33 2013
@@ -45,136 +45,133 @@ import org.junit.Test;
  */
 public class ViewCreatorAnnotatorTest extends ComponentTestBase {
 
-	@Test
-	public void testViewCreatorAnnotator() throws ResourceInitializationException,
-			AnalysisEngineProcessException, CASException {
-		AnalysisEngine viewCreator = AnalysisEngineFactory.createPrimitive(
-				ViewCreatorAnnotator.class, typeSystemDescription,
-				ViewCreatorAnnotator.PARAM_VIEW_NAME, "myView");
-		viewCreator.process(jCas);
-		JCas myView = jCas.getView("myView");
-		assertNotNull(myView);
-		myView.setDocumentText("my view text");
-	}
-
-	/**
-	 * This test basically demonstrates that the default view does not need to be initialized
-	 * because it is done automatically.
-	 */
-	@Test
-	public void testDefaultView() throws ResourceInitializationException,
-			AnalysisEngineProcessException {
-		AnalysisEngine engine = AnalysisEngineFactory.createPrimitive(SofaAwareAnnotator.class,
-				typeSystemDescription);
-		engine.process(jCas);
-		assertEquals("some", JCasUtil.selectByIndex(jCas, Token.class, 0).getCoveredText());
-
-		engine = AnalysisEngineFactory.createPrimitive(SofaUnawareAnnotator.class,
-				typeSystemDescription);
-		jCas.reset();
-		engine.process(jCas);
-		assertEquals("some", JCasUtil.selectByIndex(jCas, Token.class, 0).getCoveredText());
-	}
-
-	/**
-	 * This test demonstrates the bad behavior that occurs when you try to map the default view to
-	 * some other view without initializing that other view first. This is the behavior that
-	 * SofaInitializerAnnotator addresses.
-	 */
-	@Test(expected = AnalysisEngineProcessException.class)
-	public void testOtherViewAware() throws ResourceInitializationException,
-			AnalysisEngineProcessException {
-		AnalysisEngineDescription description = AnalysisEngineFactory.createPrimitiveDescription(
-				SofaAwareAnnotator.class, typeSystemDescription);
-		AnalysisEngine engine = AnalysisEngineFactory.createAnalysisEngine(description, "myView");
-		HideOutput hider = new HideOutput();
-		engine.process(jCas);
-		hider.restoreOutput();
-	}
-
-	@Test(expected = AnalysisEngineProcessException.class)
-	public void testOtherViewUnaware() throws ResourceInitializationException,
-			AnalysisEngineProcessException {
-		AnalysisEngineDescription description = AnalysisEngineFactory.createPrimitiveDescription(
-				SofaUnawareAnnotator.class, typeSystemDescription);
-		AnalysisEngine engine = AnalysisEngineFactory.createAnalysisEngine(description, "myView");
-		engine.process(jCas);
-	}
-
-	/**
-	 * This test demonstrates that running the viewCreator is doing the right thing (i.e.
-	 * initializing the view "myView")
-	 */
-	@Test
-	public void testSofaInitializer() throws ResourceInitializationException,
-			AnalysisEngineProcessException, CASException {
-		AnalysisEngineDescription description = AnalysisEngineFactory.createPrimitiveDescription(
-				SofaAwareAnnotator.class, typeSystemDescription);
-		AnalysisEngine engine = AnalysisEngineFactory.createAnalysisEngine(description, "myView");
-		AnalysisEngine viewCreator = AnalysisEngineFactory.createPrimitive(
-				ViewCreatorAnnotator.class, typeSystemDescription,
-				ViewCreatorAnnotator.PARAM_VIEW_NAME, "myView");
-		viewCreator.process(jCas);
-		engine.process(jCas);
-		assertEquals("some", JCasUtil.selectByIndex(jCas.getView("myView"), Token.class, 0)
-				.getCoveredText());
-
-		// here I run again with viewCreator running twice to make sure it
-		// does the right thing when the view
-		// has already been created
-		jCas.reset();
-		viewCreator.process(jCas);
-		viewCreator.process(jCas);
-		engine.process(jCas);
-		assertEquals("some", JCasUtil.selectByIndex(jCas.getView("myView"), Token.class, 0)
-				.getCoveredText());
-
-		description = AnalysisEngineFactory.createPrimitiveDescription(SofaUnawareAnnotator.class,
-				typeSystemDescription);
-		engine = AnalysisEngineFactory.createAnalysisEngine(description, "myView");
-		jCas.reset();
-		viewCreator.process(jCas);
-		engine.process(jCas);
-		assertEquals("some", JCasUtil.selectByIndex(jCas.getView("myView"), Token.class, 0)
-				.getCoveredText());
-
-		jCas.reset();
-		viewCreator.process(jCas);
-		viewCreator.process(jCas);
-		engine.process(jCas);
-		assertEquals("some", JCasUtil.selectByIndex(jCas.getView("myView"), Token.class, 0)
-				.getCoveredText());
-	}
-
-	@SofaCapability(inputSofas = CAS.NAME_DEFAULT_SOFA)
-	public static class SofaAwareAnnotator extends JCasAnnotator_ImplBase {
-
-		@Override
-		public void process(JCas jCas) throws AnalysisEngineProcessException {
-			JCas view;
-			try {
-				view = jCas.getView(CAS.NAME_DEFAULT_SOFA);
-			}
-			catch (CASException e) {
-				throw new AnalysisEngineProcessException(e);
-			}
-
-			view.setDocumentText("some text");
-			Token token = new Token(view, 0, 4);
-			token.addToIndexes();
-		}
-
-	}
-
-	public static class SofaUnawareAnnotator extends JCasAnnotator_ImplBase {
-
-		@Override
-		public void process(JCas jCas) throws AnalysisEngineProcessException {
-			jCas.setDocumentText("some text");
-			Token token = new Token(jCas, 0, 4);
-			token.addToIndexes();
-		}
+  @Test
+  public void testViewCreatorAnnotator() throws ResourceInitializationException,
+          AnalysisEngineProcessException, CASException {
+    AnalysisEngine viewCreator = AnalysisEngineFactory.createPrimitive(ViewCreatorAnnotator.class,
+            typeSystemDescription, ViewCreatorAnnotator.PARAM_VIEW_NAME, "myView");
+    viewCreator.process(jCas);
+    JCas myView = jCas.getView("myView");
+    assertNotNull(myView);
+    myView.setDocumentText("my view text");
+  }
+
+  /**
+   * This test basically demonstrates that the default view does not need to be initialized because
+   * it is done automatically.
+   */
+  @Test
+  public void testDefaultView() throws ResourceInitializationException,
+          AnalysisEngineProcessException {
+    AnalysisEngine engine = AnalysisEngineFactory.createPrimitive(SofaAwareAnnotator.class,
+            typeSystemDescription);
+    engine.process(jCas);
+    assertEquals("some", JCasUtil.selectByIndex(jCas, Token.class, 0).getCoveredText());
+
+    engine = AnalysisEngineFactory.createPrimitive(SofaUnawareAnnotator.class,
+            typeSystemDescription);
+    jCas.reset();
+    engine.process(jCas);
+    assertEquals("some", JCasUtil.selectByIndex(jCas, Token.class, 0).getCoveredText());
+  }
+
+  /**
+   * This test demonstrates the bad behavior that occurs when you try to map the default view to
+   * some other view without initializing that other view first. This is the behavior that
+   * SofaInitializerAnnotator addresses.
+   */
+  @Test(expected = AnalysisEngineProcessException.class)
+  public void testOtherViewAware() throws ResourceInitializationException,
+          AnalysisEngineProcessException {
+    AnalysisEngineDescription description = AnalysisEngineFactory.createPrimitiveDescription(
+            SofaAwareAnnotator.class, typeSystemDescription);
+    AnalysisEngine engine = AnalysisEngineFactory.createAnalysisEngine(description, "myView");
+    HideOutput hider = new HideOutput();
+    engine.process(jCas);
+    hider.restoreOutput();
+  }
+
+  @Test(expected = AnalysisEngineProcessException.class)
+  public void testOtherViewUnaware() throws ResourceInitializationException,
+          AnalysisEngineProcessException {
+    AnalysisEngineDescription description = AnalysisEngineFactory.createPrimitiveDescription(
+            SofaUnawareAnnotator.class, typeSystemDescription);
+    AnalysisEngine engine = AnalysisEngineFactory.createAnalysisEngine(description, "myView");
+    engine.process(jCas);
+  }
+
+  /**
+   * This test demonstrates that running the viewCreator is doing the right thing (i.e. initializing
+   * the view "myView")
+   */
+  @Test
+  public void testSofaInitializer() throws ResourceInitializationException,
+          AnalysisEngineProcessException, CASException {
+    AnalysisEngineDescription description = AnalysisEngineFactory.createPrimitiveDescription(
+            SofaAwareAnnotator.class, typeSystemDescription);
+    AnalysisEngine engine = AnalysisEngineFactory.createAnalysisEngine(description, "myView");
+    AnalysisEngine viewCreator = AnalysisEngineFactory.createPrimitive(ViewCreatorAnnotator.class,
+            typeSystemDescription, ViewCreatorAnnotator.PARAM_VIEW_NAME, "myView");
+    viewCreator.process(jCas);
+    engine.process(jCas);
+    assertEquals("some", JCasUtil.selectByIndex(jCas.getView("myView"), Token.class, 0)
+            .getCoveredText());
+
+    // here I run again with viewCreator running twice to make sure it
+    // does the right thing when the view
+    // has already been created
+    jCas.reset();
+    viewCreator.process(jCas);
+    viewCreator.process(jCas);
+    engine.process(jCas);
+    assertEquals("some", JCasUtil.selectByIndex(jCas.getView("myView"), Token.class, 0)
+            .getCoveredText());
+
+    description = AnalysisEngineFactory.createPrimitiveDescription(SofaUnawareAnnotator.class,
+            typeSystemDescription);
+    engine = AnalysisEngineFactory.createAnalysisEngine(description, "myView");
+    jCas.reset();
+    viewCreator.process(jCas);
+    engine.process(jCas);
+    assertEquals("some", JCasUtil.selectByIndex(jCas.getView("myView"), Token.class, 0)
+            .getCoveredText());
+
+    jCas.reset();
+    viewCreator.process(jCas);
+    viewCreator.process(jCas);
+    engine.process(jCas);
+    assertEquals("some", JCasUtil.selectByIndex(jCas.getView("myView"), Token.class, 0)
+            .getCoveredText());
+  }
+
+  @SofaCapability(inputSofas = CAS.NAME_DEFAULT_SOFA)
+  public static class SofaAwareAnnotator extends JCasAnnotator_ImplBase {
+
+    @Override
+    public void process(JCas jCas) throws AnalysisEngineProcessException {
+      JCas view;
+      try {
+        view = jCas.getView(CAS.NAME_DEFAULT_SOFA);
+      } catch (CASException e) {
+        throw new AnalysisEngineProcessException(e);
+      }
+
+      view.setDocumentText("some text");
+      Token token = new Token(view, 0, 4);
+      token.addToIndexes();
+    }
+
+  }
+
+  public static class SofaUnawareAnnotator extends JCasAnnotator_ImplBase {
+
+    @Override
+    public void process(JCas jCas) throws AnalysisEngineProcessException {
+      jCas.setDocumentText("some text");
+      Token token = new Token(jCas, 0, 4);
+      token.addToIndexes();
+    }
 
-	}
+  }
 
 }

Modified: uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/component/ViewTextCopierAnnotatorTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/component/ViewTextCopierAnnotatorTest.java?rev=1431721&r1=1431720&r2=1431721&view=diff
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/component/ViewTextCopierAnnotatorTest.java (original)
+++ uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/component/ViewTextCopierAnnotatorTest.java Thu Jan 10 23:12:33 2013
@@ -37,57 +37,56 @@ import org.junit.Test;
  */
 public class ViewTextCopierAnnotatorTest extends ComponentTestBase {
 
-	@Test
-	public void testViewTextCopier() throws ResourceInitializationException,
-			AnalysisEngineProcessException, CASException {
-
-		String text = "sample text";
-		String sourceViewName = "SourceView";
-		String destinationViewName = "DestinationView";
-
-		jCas.setDocumentText(text);
-		AnalysisEngine viewCreator = AnalysisEngineFactory.createPrimitive(
-				ViewTextCopierAnnotator.class, typeSystemDescription,
-				ViewTextCopierAnnotator.PARAM_SOURCE_VIEW_NAME, CAS.NAME_DEFAULT_SOFA,
-				ViewTextCopierAnnotator.PARAM_DESTINATION_VIEW_NAME, destinationViewName);
-		viewCreator.process(jCas);
-		JCas destinationView = jCas.getView(destinationViewName);
-		assertNotNull(destinationView);
-		assertEquals(text, destinationView.getDocumentText());
-
-		jCas.reset();
-		jCas.setDocumentText(text);
-		jCas.createView(destinationViewName);
-		viewCreator.process(jCas);
-		destinationView = jCas.getView(destinationViewName);
-		assertNotNull(destinationView);
-		assertEquals(text, destinationView.getDocumentText());
-
-		viewCreator = AnalysisEngineFactory.createPrimitive(ViewTextCopierAnnotator.class,
-				typeSystemDescription, ViewTextCopierAnnotator.PARAM_SOURCE_VIEW_NAME,
-				sourceViewName, ViewTextCopierAnnotator.PARAM_DESTINATION_VIEW_NAME,
-				destinationViewName);
-		jCas.reset();
-		JCas sourceView = jCas.createView(sourceViewName);
-		sourceView.setDocumentText(text);
-		viewCreator.process(jCas);
-		destinationView = jCas.getView(destinationViewName);
-		assertNotNull(destinationView);
-		assertEquals(text, destinationView.getDocumentText());
-		assertNull(jCas.getDocumentText());
-	}
-
-	@Test(expected = AnalysisEngineProcessException.class)
-	public void testExceptions() throws ResourceInitializationException,
-			AnalysisEngineProcessException {
-
-		String sourceViewName = "SourceView";
-		String destinationViewName = "DestinationView";
-
-		AnalysisEngine viewCreator = AnalysisEngineFactory.createPrimitive(
-				ViewTextCopierAnnotator.class, typeSystemDescription,
-				ViewTextCopierAnnotator.PARAM_SOURCE_VIEW_NAME, sourceViewName,
-				ViewTextCopierAnnotator.PARAM_DESTINATION_VIEW_NAME, destinationViewName);
-		viewCreator.process(jCas);
-	}
+  @Test
+  public void testViewTextCopier() throws ResourceInitializationException,
+          AnalysisEngineProcessException, CASException {
+
+    String text = "sample text";
+    String sourceViewName = "SourceView";
+    String destinationViewName = "DestinationView";
+
+    jCas.setDocumentText(text);
+    AnalysisEngine viewCreator = AnalysisEngineFactory.createPrimitive(
+            ViewTextCopierAnnotator.class, typeSystemDescription,
+            ViewTextCopierAnnotator.PARAM_SOURCE_VIEW_NAME, CAS.NAME_DEFAULT_SOFA,
+            ViewTextCopierAnnotator.PARAM_DESTINATION_VIEW_NAME, destinationViewName);
+    viewCreator.process(jCas);
+    JCas destinationView = jCas.getView(destinationViewName);
+    assertNotNull(destinationView);
+    assertEquals(text, destinationView.getDocumentText());
+
+    jCas.reset();
+    jCas.setDocumentText(text);
+    jCas.createView(destinationViewName);
+    viewCreator.process(jCas);
+    destinationView = jCas.getView(destinationViewName);
+    assertNotNull(destinationView);
+    assertEquals(text, destinationView.getDocumentText());
+
+    viewCreator = AnalysisEngineFactory.createPrimitive(ViewTextCopierAnnotator.class,
+            typeSystemDescription, ViewTextCopierAnnotator.PARAM_SOURCE_VIEW_NAME, sourceViewName,
+            ViewTextCopierAnnotator.PARAM_DESTINATION_VIEW_NAME, destinationViewName);
+    jCas.reset();
+    JCas sourceView = jCas.createView(sourceViewName);
+    sourceView.setDocumentText(text);
+    viewCreator.process(jCas);
+    destinationView = jCas.getView(destinationViewName);
+    assertNotNull(destinationView);
+    assertEquals(text, destinationView.getDocumentText());
+    assertNull(jCas.getDocumentText());
+  }
+
+  @Test(expected = AnalysisEngineProcessException.class)
+  public void testExceptions() throws ResourceInitializationException,
+          AnalysisEngineProcessException {
+
+    String sourceViewName = "SourceView";
+    String destinationViewName = "DestinationView";
+
+    AnalysisEngine viewCreator = AnalysisEngineFactory.createPrimitive(
+            ViewTextCopierAnnotator.class, typeSystemDescription,
+            ViewTextCopierAnnotator.PARAM_SOURCE_VIEW_NAME, sourceViewName,
+            ViewTextCopierAnnotator.PARAM_DESTINATION_VIEW_NAME, destinationViewName);
+    viewCreator.process(jCas);
+  }
 }

Modified: uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/component/initialize/ConfigurationParameterInitializerTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/component/initialize/ConfigurationParameterInitializerTest.java?rev=1431721&r1=1431720&r2=1431721&view=diff
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/component/initialize/ConfigurationParameterInitializerTest.java (original)
+++ uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/component/initialize/ConfigurationParameterInitializerTest.java Thu Jan 10 23:12:33 2013
@@ -58,429 +58,415 @@ import org.xml.sax.SAXException;
 
 public class ConfigurationParameterInitializerTest extends ComponentTestBase {
 
-	@Test
-	public void testInitialize() throws ResourceInitializationException, SecurityException {
+  @Test
+  public void testInitialize() throws ResourceInitializationException, SecurityException {
 
-		ResourceInitializationException rie = null;
-		try {
-			AnalysisEngineFactory.createPrimitive(ParameterizedAE.class, typeSystemDescription);
-		}
-		catch (ResourceInitializationException e) {
-			rie = e;
-		}
-		assertNotNull(rie);
-		AnalysisEngine engine = AnalysisEngineFactory.createPrimitive(ParameterizedAE.class,
-				typeSystemDescription,
-				ParameterizedAE.PARAM_FLOAT_3, 1.234f,
-				ParameterizedAE.PARAM_FLOAT_6, new Float[] { 1.234f, 0.001f },
-				"file2", "foo/bar",
-				"files9", new File[] { new File("test/data/file"), new File("test/data/file2") } );
-				// Test initializing a multi-valued parameter with a single value
-				// This is supposed to be fixed as part of issue #79
-				// -- REC 2011-05-02
-//				ParameterizedAE.PARAM_STRING_9, "singleelementarray");
-
-		ParameterizedAE component = new ParameterizedAE();
-		component.initialize(engine.getUimaContext());
-		assertEquals("pineapple", component.getString1());
-		assertArrayEquals(new String[] { "coconut", "mango" }, component.getString2());
-		assertEquals(null, component.getString3());
-		assertArrayEquals(new String[] { "apple" }, component.getString4());
-		assertArrayEquals(new String[] { "" }, component.getString5());
-		assertEquals(3, component.getStrings6().size());
-		assertTrue(component.getStrings6().contains("kiwi fruit"));
-		assertTrue(component.getStrings6().contains("grape"));
-		assertTrue(component.getStrings6().contains("pear"));
-		assertNull(component.getStrings7());
-		assertEquals(1, component.getStrings8().size());
-		assertTrue(component.getStrings8().contains("cherry"));
-//		assertTrue(component.getStrings9().contains("singleelementarray"));
-
-		assertFalse(component.isBoolean1());
-
-		NullPointerException npe = null;
-		try {
-			assertFalse(component.isBoolean2());
-		}
-		catch (NullPointerException e) {
-			npe = e;
-		}
-		assertNotNull(npe);
-
-		assertFalse(component.isBoolean2b());
-
-		assertTrue(component.getBoolean3()[0]);
-		assertTrue(component.getBoolean3()[1]);
-		assertFalse(component.getBoolean3()[2]);
-		assertTrue(component.boolean4[0]);
-		assertFalse(component.boolean4[1]);
-		assertTrue(component.boolean4[2]);
-		assertFalse(component.getBoolean5()[0]);
-		assertEquals(4, component.getBooleans6().size());
-		assertTrue(component.getBooleans6().get(0));
-		assertTrue(component.getBooleans6().get(1));
-		assertTrue(component.getBooleans6().get(2));
-		assertFalse(component.getBooleans6().get(3));
-
-		assertEquals(0, component.getInt1());
-		assertEquals(42, component.getInt2());
-		assertEquals(42, component.getInt3()[0]);
-		assertEquals(111, component.getInt3()[1]);
-		assertEquals(Integer.valueOf(2), component.getInt4()[0]);
-		assertEquals(1, component.getInts5().size());
-		assertEquals(2, component.getInts5().get(0).intValue());
-		assertEquals(5, component.getInts6().size());
-		assertEquals(1, component.getInts6().get(0).intValue());
-		assertEquals(2, component.getInts6().get(1).intValue());
-		assertEquals(3, component.getInts6().get(2).intValue());
-		assertEquals(4, component.getInts6().get(3).intValue());
-		assertEquals(5, component.getInts6().get(4).intValue());
-
-		assertEquals(0.0f, component.getFloat1(), 0.001f);
-		assertEquals(3.1415f, component.getFloat2(), 0.001f);
-		assertEquals(1.234f, component.getFloat3(), 0.001f);
-		assertNull(component.getFloat4());
-		assertEquals(0f, component.getFloat5()[0], 0.001f);
-		assertEquals(3.1415f, component.getFloat5()[1], 0.001f);
-		assertEquals(2.7182818f, component.getFloat5()[2], 0.001f);
-		assertEquals(1.234f, component.getFloat6()[0], 0.001f);
-		assertEquals(0.001f, component.getFloat6()[1], 0.001f);
-		assertEquals(1.1111f, component.getFloat7()[0], 0.001f);
-		assertEquals(2.2222f, component.getFloat7()[1], 0.001f);
-		assertEquals(3.3333f, component.getFloat7()[2], 0.001f);
-
-		assertEquals(EnumValue.ENUM_1, component.getEnum1());
-		assertArrayEquals(new EnumValue[] { EnumValue.ENUM_1, EnumValue.ENUM_2 }, component.getEnum2());
-		assertEquals(asList( EnumValue.ENUM_1, EnumValue.ENUM_2 ), component.getEnum3());
-		assertEquals(new File("test/data/file"), component.getFile1());
-		assertEquals(new File("test/data/file"), component.getFile1b());
-		assertEquals(new File("foo/bar"), component.getFile2());
-		assertNull(component.getFiles3());
-		assertArrayEquals(new File[] { new File("test/data/file") }, component.getFiles4());
-		assertArrayEquals(new File[] { new File("test/data/file"), new File("test/data/file2") },
-				component.getFiles5());
-		assertNull(component.getFiles6());
-		assertEquals(1, component.getFiles7().size());
-		assertEquals(new File("test/data/file"), component.getFiles7().get(0));
-		assertEquals(2, component.getFiles8().size());
-		assertEquals(new File("test/data/file"), component.getFiles8().get(0));
-		assertEquals(new File("test/data/file2"), component.getFiles8().get(1));
-		assertEquals(2, component.getFiles9().size());
-		assertEquals(new File("test/data/file"), component.getFiles9().get(0));
-		assertEquals(new File("test/data/file2"), component.getFiles9().get(1));
-
-		engine = AnalysisEngineFactory.createPrimitive(ParameterizedAE.class,
-				typeSystemDescription, ParameterizedAE.PARAM_FLOAT_3, 1.234f,
-				ParameterizedAE.PARAM_FLOAT_6, new Float[] { 1.234f, 0.001f },
-				ParameterizedAE.PARAM_STRING_1, "lime", ParameterizedAE.PARAM_STRING_2,
-				new String[] { "banana", "strawberry" }, ParameterizedAE.PARAM_STRING_3, "cherry",
-				ParameterizedAE.PARAM_STRING_4, new String[] { "raspberry", "blueberry",
-						"blackberry" }, ParameterizedAE.PARAM_STRING_5, new String[] { "a" },
-				ParameterizedAE.PARAM_BOOLEAN_1, true, ParameterizedAE.PARAM_BOOLEAN_2, true,
-				ParameterizedAE.PARAM_BOOLEAN_3, new boolean[] { true, true, false },
-				ParameterizedAE.PARAM_BOOLEAN_4, new Boolean[] { true, false, false },
-				ParameterizedAE.PARAM_BOOLEAN_5, new Boolean[] { true },
-				ParameterizedAE.PARAM_INT_1, 0, ParameterizedAE.PARAM_INT_2, 24,
-				ParameterizedAE.PARAM_INT_3, new int[] { 5 }, "file1", "foo1/bar1", "file1b",
-				"foo1b/bar1b", "file2", "foo2/bar2", "files3", new String[] {
-						"C:\\Documents and Settings\\Philip\\My Documents\\", "/usr/local/bin" },
-				"files4", new String[0], "files5", new String[] { "foos/bars" }, "files6",
-				new String[] { "C:\\Documents and Settings\\Philip\\My Documents\\",
-						"/usr/local/bin" }, "files7", new String[0], "files8",
-				new String[] { "foos/bars" }, "files9", Arrays.asList(new File("test/data/file"), 
-						new File("test/data/file2")));
-		component = new ParameterizedAE();
-		component.initialize(engine.getUimaContext());
-		assertEquals("lime", component.getString1());
-		assertArrayEquals(new String[] { "banana", "strawberry" }, component.getString2());
-		assertEquals("cherry", component.getString3());
-		assertArrayEquals(new String[] { "raspberry", "blueberry", "blackberry" },
-				component.getString4());
-		assertArrayEquals(new String[] { "a" }, component.getString5());
-		assertTrue(component.isBoolean1());
-		assertTrue(component.isBoolean2());
-		assertTrue(component.getBoolean3()[0]);
-		assertTrue(component.getBoolean3()[1]);
-		assertFalse(component.getBoolean3()[2]);
-		assertTrue(component.boolean4[0]);
-		assertFalse(component.boolean4[1]);
-		assertFalse(component.boolean4[2]);
-		assertTrue(component.getBoolean5()[0]);
-		assertEquals(0, component.getInt1());
-		assertEquals(24, component.getInt2());
-		assertEquals(5, component.getInt3()[0]);
-
-		assertEquals(new File("foo1/bar1"), component.getFile1());
-		assertEquals(new File("foo1b/bar1b"), component.getFile1b());
-		assertEquals(new File("foo2/bar2"), component.getFile2());
-		assertArrayEquals(new File[] {
-				new File("C:\\Documents and Settings\\Philip\\My Documents\\"),
-				new File("/usr/local/bin") }, component.getFiles3());
-		assertEquals(0, component.getFiles4().length);
-		assertArrayEquals(new File[] { new File("foos/bars") }, component.getFiles5());
-		assertEquals(2, component.getFiles6().size());
-		assertEquals(new File("C:\\Documents and Settings\\Philip\\My Documents\\"), component
-				.getFiles6().get(0));
-		assertEquals(new File("/usr/local/bin"), component.getFiles6().get(1));
-		assertEquals(0, component.getFiles7().size());
-		assertEquals(1, component.getFiles8().size());
-		assertEquals(new File("foos/bars"), component.getFiles8().get(0));
-		assertEquals(2, component.getFiles9().size());
-		assertEquals(new File("test/data/file"), component.getFiles9().get(0));
-		assertEquals(new File("test/data/file2"), component.getFiles9().get(1));
-
-		engine = AnalysisEngineFactory.createPrimitive(ParameterizedAE.class,
-				typeSystemDescription, ParameterizedAE.PARAM_FLOAT_3, 1.234f,
-				ParameterizedAE.PARAM_FLOAT_6, new Float[] { 1.234f, 0.001f },
-				ParameterizedAE.PARAM_BOOLEAN_1, true, ParameterizedAE.PARAM_BOOLEAN_3,
-				new boolean[3], ParameterizedAE.PARAM_FLOAT_5, new float[] { 1.2f, 3.4f }, "file2",
-				"foo2/bar2");
-		component = new ParameterizedAE();
-		component.initialize(engine.getUimaContext());
-		assertFalse(component.getBoolean3()[0]);
-		assertFalse(component.getBoolean3()[1]);
-		assertFalse(component.getBoolean3()[2]);
-		assertEquals(component.getFloat5()[0], 1.2f, 0.001f);
-		assertEquals(component.getFloat5()[1], 3.4f, 0.001f);
-
-		rie = null;
-		try {
-			engine = AnalysisEngineFactory.createPrimitive(ParameterizedAE.class,
-					typeSystemDescription, ParameterizedAE.PARAM_FLOAT_3, 1.234f,
-					ParameterizedAE.PARAM_FLOAT_6, new Float[] { 1.234f, 0.001f },
-					ParameterizedAE.PARAM_STRING_1, true);
-		}
-		catch (ResourceInitializationException e) {
-			rie = e;
-		}
-		assertNotNull(rie);
-
-	}
-
-	@Test
-	public void testInitialize2() throws ResourceInitializationException {
-		AnalysisEngine engine = AnalysisEngineFactory.createPrimitive(Annotator1.class,
-				typeSystemDescription);
-		assertEquals(1, engine.getAnalysisEngineMetaData().getCapabilities().length);
-	}
-
-	@Test
-	public void testInitialize3() throws FileNotFoundException, IOException, UIMAException {
-		// here we test an optional parameter that is missing from the
-		// configuration to ensure that it is filled in with the default value
-		AnalysisEngine aed = AnalysisEngineFactory
-				.createAnalysisEngineFromPath("src/test/resources/data/descriptor/DefaultValueAE1.xml");
-		DefaultValueAE1 ae = new DefaultValueAE1();
-		ae.initialize(aed.getUimaContext());
-		assertEquals("green", ae.color);
-
-		// here we test a mandatory parameter that is missing from the
-		// configuration and ensure that an exception is thrown because
-		// no default value is given in the configuration parameter annotation.
-		ResourceInitializationException rie = null;
-		try {
-			aed = AnalysisEngineFactory
-					.createAnalysisEngineFromPath("src/test/resources/data/descriptor/DefaultValueAE2.xml");
-		}
-		catch (ResourceInitializationException e) {
-			rie = e;
-		}
-		assertNotNull(rie);
-	}
-
-	/**
-	 * If a parameter value is set to null, that is as good as if it was not set at all. If a
-	 * default value is specified, it should be used.
-	 */
-	@Test
-	public void testParameterSetToNull() throws Exception {
-		String paramColor = DefaultValueAE1.class.getName() + ".color";
-		AnalysisEngine aed = AnalysisEngineFactory.createPrimitive(DefaultValueAE1.class, null,
-				paramColor, null);
-		DefaultValueAE1 ae = new DefaultValueAE1();
-		ae.initialize(aed.getUimaContext());
-		assertEquals("green", ae.color);
-	}
-
-	/**
-	 * If a parameter value is set to null, that is as good as if it was not set at all. If it is
-	 * mandatory, an exception has to be thrown.
-	 */
-	@Test(expected = ResourceInitializationException.class)
-	public void testMandatoryParameterSetToNull() throws Exception {
-		String paramColor = DefaultValueAE2.class.getName() + ".color";
-		AnalysisEngine aed = AnalysisEngineFactory.createPrimitive(DefaultValueAE2.class, null,
-				paramColor, null);
-		DefaultValueAE2 ae = new DefaultValueAE2();
-		ae.initialize(aed.getUimaContext());
-
-	}
-
-	/**
-	 * Test that a parameter not supported by UIMA produces an error.
-	 */
-	@Test(expected = IllegalArgumentException.class)
-	public void testNonUimaCompatibleParameterValue() throws Exception {
-		String paramColor = DefaultValueAE2.class.getName() + ".color";
-		AnalysisEngine aed = AnalysisEngineFactory.createPrimitive(DefaultValueAE2.class, null,
-				paramColor, new Point(1, 2));
-		DefaultValueAE2 ae = new DefaultValueAE2();
-		ae.initialize(aed.getUimaContext());
-	}
-
-	/**
-	 * Check that an Analysis Engine created from a descriptor declaring optional parameters but not
-	 * setting them actually uses the default values declared in the Java annotation
-	 */
-	@Test
-	public void testUnsetOptionalParameter() throws Exception {
-		AnalysisEngineDescription aed = AnalysisEngineFactory.createPrimitiveDescription(
-				DefaultValueAE1.class, (Object[]) null);
-		// Remove the settings from the descriptor, but leave the declarations.
-		// The settings are already filled with default values by createPrimitiveDescription,
-		// but here we want to simulate loading a descriptor without settings from a file.
-		// The file of course would declare the parameters optional and thus the settings
-		// for the optional parameters would be empty. We expect that a default value from the
-		// annotation is used in this case.
-		aed.getMetaData().setConfigurationParameterSettings(
-				new ConfigurationParameterSettings_impl());
-		AnalysisEngine template = UIMAFramework.produceAnalysisEngine(aed);
-		DefaultValueAE1 ae = new DefaultValueAE1();
-		ae.initialize(template.getUimaContext());
-		assertEquals("green", ae.color);
-	}
-
-	public static class DefaultValueAE1 extends JCasAnnotator_ImplBase {
-		@ConfigurationParameter(defaultValue = "green")
-		private String color;
-
-		@Override
-		public void initialize(UimaContext aContext) throws ResourceInitializationException {
-			super.initialize(aContext);
-		}
-
-		@Override
-		public void process(JCas aJCas) throws AnalysisEngineProcessException {
-			/* do nothing */
-		}
-
-	}
-
-	public static class DefaultValueAE2 extends JCasAnnotator_ImplBase {
-		@SuppressWarnings("unused")
-		@ConfigurationParameter(mandatory = true)
-		private String color;
-
-		@Override
-		public void initialize(UimaContext aContext) throws ResourceInitializationException {
-			super.initialize(aContext);
-		}
-
-		@Override
-		public void process(JCas aJCas) throws AnalysisEngineProcessException {
-			/* do nothing */
-		}
-
-	}
-
-	@Test
-	public void testEnumDefaultValue() throws Exception {
-		try {
-			AnalysisEngine aed = AnalysisEngineFactory.createPrimitive(DefaultEnumValueAE.class,
-					(Object[]) null);
-			DefaultEnumValueAE ae = new DefaultEnumValueAE();
-			ae.initialize(aed.getUimaContext());
-			assertEquals(Color.GREEN, ae.color);
-		}
-		catch (Exception e) {
-			e.printStackTrace();
-		}
-	}
-
-	public static enum Color {
-		RED, GREEN, BLUE
-	}
-
-	public static class DefaultEnumValueAE extends JCasAnnotator_ImplBase {
-		@ConfigurationParameter(defaultValue = "GREEN")
-		private Color color;
-
-		@Override
-		public void initialize(UimaContext aContext) throws ResourceInitializationException {
-			super.initialize(aContext);
-		}
-
-		@Override
-		public void process(JCas aJCas) throws AnalysisEngineProcessException {
-			/* do nothing */
-		}
-	}
-
-	public static class DefaultLocaleValueAE extends JCasAnnotator_ImplBase {
-		@ConfigurationParameter(name = "L1", defaultValue = "US")
-		public Locale locale1;
-
-		@ConfigurationParameter(name = "L2")
-		public Locale locale2;
-
-		@ConfigurationParameter(name = "L3")
-		public Locale locale3;
-
-		@ConfigurationParameter(name = "L4")
-		public Locale locale4;
-
-		@Override
-		public void process(JCas aJCas) throws AnalysisEngineProcessException {
-			/* do nothing */
-		}
-	}
-
-	@Test
-	public void testLocaleParams() throws Exception {
-		AnalysisEngine aed = AnalysisEngineFactory.createPrimitive(DefaultLocaleValueAE.class,
-				"L2", "en-CA", "L3", "CANADA_FRENCH", "L4", "zh");
-		DefaultLocaleValueAE ae = new DefaultLocaleValueAE();
-		ae.initialize(aed.getUimaContext());
-		assertEquals(Locale.US, ae.locale1);
-		assertEquals(new Locale("en", "CA"), ae.locale2);
-		assertEquals(Locale.CANADA_FRENCH, ae.locale3);
-		assertEquals(new Locale("zh"), ae.locale4);
-
-		aed = AnalysisEngineFactory.createPrimitive(DefaultLocaleValueAE.class, "L1",
-				"es-ES-Traditional_WIN", "L2", "CHINA", "L3", "es", "L4", "en-CA");
-		ae = new DefaultLocaleValueAE();
-		ae.initialize(aed.getUimaContext());
-		assertEquals(new Locale("es", "ES", "Traditional_WIN"), ae.locale1);
-		assertEquals(Locale.CHINA, ae.locale2);
-		assertEquals(new Locale("es"), ae.locale3);
-		assertEquals(new Locale("en", "CA"), ae.locale4);
-
-		aed = AnalysisEngineFactory.createPrimitive(DefaultLocaleValueAE.class, "L1", "", "L2", "",
-				"L3", null);
-		ae = new DefaultLocaleValueAE();
-		ae.initialize(aed.getUimaContext());
-		assertEquals(Locale.getDefault(), ae.locale1);
-		assertEquals(Locale.getDefault(), ae.locale2);
-		assertEquals(null, ae.locale3);
-		assertEquals(null, ae.locale4);
-
-	}
-
-	/**
-	 * This main method creates the descriptor files used in testInitialize3. If I weren't lazy I
-	 * would figure out how to programmatically remove the configuration parameter corresponding to
-	 * 'color'. As it is, however, the parameter must be manually removed (I used the Component
-	 * Descriptor Editor to do this.) This point is moot anyways because I am checking in the
-	 * generated descriptor files and there is no reason to run this main method in the future.
-	 */
-	public static void main(String[] args) throws ResourceInitializationException,
-			FileNotFoundException, SAXException, IOException {
-		AnalysisEngineDescription aed = AnalysisEngineFactory.createPrimitiveDescription(
-				DefaultValueAE1.class, (Object[]) null);
-		aed.toXML(new FileOutputStream("src/test/resources/data/descriptor/DefaultValueAE1.xml"));
-		aed = AnalysisEngineFactory.createPrimitiveDescription(DefaultValueAE2.class,
-				(Object[]) null);
-		aed.toXML(new FileOutputStream("src/test/resources/data/descriptor/DefaultValueAE2.xml"));
-	}
+    ResourceInitializationException rie = null;
+    try {
+      AnalysisEngineFactory.createPrimitive(ParameterizedAE.class, typeSystemDescription);
+    } catch (ResourceInitializationException e) {
+      rie = e;
+    }
+    assertNotNull(rie);
+    AnalysisEngine engine = AnalysisEngineFactory.createPrimitive(ParameterizedAE.class,
+            typeSystemDescription, ParameterizedAE.PARAM_FLOAT_3, 1.234f,
+            ParameterizedAE.PARAM_FLOAT_6, new Float[] { 1.234f, 0.001f }, "file2", "foo/bar",
+            "files9", new File[] { new File("test/data/file"), new File("test/data/file2") });
+    // Test initializing a multi-valued parameter with a single value
+    // This is supposed to be fixed as part of issue #79
+    // -- REC 2011-05-02
+    // ParameterizedAE.PARAM_STRING_9, "singleelementarray");
+
+    ParameterizedAE component = new ParameterizedAE();
+    component.initialize(engine.getUimaContext());
+    assertEquals("pineapple", component.getString1());
+    assertArrayEquals(new String[] { "coconut", "mango" }, component.getString2());
+    assertEquals(null, component.getString3());
+    assertArrayEquals(new String[] { "apple" }, component.getString4());
+    assertArrayEquals(new String[] { "" }, component.getString5());
+    assertEquals(3, component.getStrings6().size());
+    assertTrue(component.getStrings6().contains("kiwi fruit"));
+    assertTrue(component.getStrings6().contains("grape"));
+    assertTrue(component.getStrings6().contains("pear"));
+    assertNull(component.getStrings7());
+    assertEquals(1, component.getStrings8().size());
+    assertTrue(component.getStrings8().contains("cherry"));
+    // assertTrue(component.getStrings9().contains("singleelementarray"));
+
+    assertFalse(component.isBoolean1());
+
+    NullPointerException npe = null;
+    try {
+      assertFalse(component.isBoolean2());
+    } catch (NullPointerException e) {
+      npe = e;
+    }
+    assertNotNull(npe);
+
+    assertFalse(component.isBoolean2b());
+
+    assertTrue(component.getBoolean3()[0]);
+    assertTrue(component.getBoolean3()[1]);
+    assertFalse(component.getBoolean3()[2]);
+    assertTrue(component.boolean4[0]);
+    assertFalse(component.boolean4[1]);
+    assertTrue(component.boolean4[2]);
+    assertFalse(component.getBoolean5()[0]);
+    assertEquals(4, component.getBooleans6().size());
+    assertTrue(component.getBooleans6().get(0));
+    assertTrue(component.getBooleans6().get(1));
+    assertTrue(component.getBooleans6().get(2));
+    assertFalse(component.getBooleans6().get(3));
+
+    assertEquals(0, component.getInt1());
+    assertEquals(42, component.getInt2());
+    assertEquals(42, component.getInt3()[0]);
+    assertEquals(111, component.getInt3()[1]);
+    assertEquals(Integer.valueOf(2), component.getInt4()[0]);
+    assertEquals(1, component.getInts5().size());
+    assertEquals(2, component.getInts5().get(0).intValue());
+    assertEquals(5, component.getInts6().size());
+    assertEquals(1, component.getInts6().get(0).intValue());
+    assertEquals(2, component.getInts6().get(1).intValue());
+    assertEquals(3, component.getInts6().get(2).intValue());
+    assertEquals(4, component.getInts6().get(3).intValue());
+    assertEquals(5, component.getInts6().get(4).intValue());
+
+    assertEquals(0.0f, component.getFloat1(), 0.001f);
+    assertEquals(3.1415f, component.getFloat2(), 0.001f);
+    assertEquals(1.234f, component.getFloat3(), 0.001f);
+    assertNull(component.getFloat4());
+    assertEquals(0f, component.getFloat5()[0], 0.001f);
+    assertEquals(3.1415f, component.getFloat5()[1], 0.001f);
+    assertEquals(2.7182818f, component.getFloat5()[2], 0.001f);
+    assertEquals(1.234f, component.getFloat6()[0], 0.001f);
+    assertEquals(0.001f, component.getFloat6()[1], 0.001f);
+    assertEquals(1.1111f, component.getFloat7()[0], 0.001f);
+    assertEquals(2.2222f, component.getFloat7()[1], 0.001f);
+    assertEquals(3.3333f, component.getFloat7()[2], 0.001f);
+
+    assertEquals(EnumValue.ENUM_1, component.getEnum1());
+    assertArrayEquals(new EnumValue[] { EnumValue.ENUM_1, EnumValue.ENUM_2 }, component.getEnum2());
+    assertEquals(asList(EnumValue.ENUM_1, EnumValue.ENUM_2), component.getEnum3());
+    assertEquals(new File("test/data/file"), component.getFile1());
+    assertEquals(new File("test/data/file"), component.getFile1b());
+    assertEquals(new File("foo/bar"), component.getFile2());
+    assertNull(component.getFiles3());
+    assertArrayEquals(new File[] { new File("test/data/file") }, component.getFiles4());
+    assertArrayEquals(new File[] { new File("test/data/file"), new File("test/data/file2") },
+            component.getFiles5());
+    assertNull(component.getFiles6());
+    assertEquals(1, component.getFiles7().size());
+    assertEquals(new File("test/data/file"), component.getFiles7().get(0));
+    assertEquals(2, component.getFiles8().size());
+    assertEquals(new File("test/data/file"), component.getFiles8().get(0));
+    assertEquals(new File("test/data/file2"), component.getFiles8().get(1));
+    assertEquals(2, component.getFiles9().size());
+    assertEquals(new File("test/data/file"), component.getFiles9().get(0));
+    assertEquals(new File("test/data/file2"), component.getFiles9().get(1));
+
+    engine = AnalysisEngineFactory.createPrimitive(ParameterizedAE.class, typeSystemDescription,
+            ParameterizedAE.PARAM_FLOAT_3, 1.234f, ParameterizedAE.PARAM_FLOAT_6, new Float[] {
+                1.234f, 0.001f }, ParameterizedAE.PARAM_STRING_1, "lime",
+            ParameterizedAE.PARAM_STRING_2, new String[] { "banana", "strawberry" },
+            ParameterizedAE.PARAM_STRING_3, "cherry", ParameterizedAE.PARAM_STRING_4, new String[] {
+                "raspberry", "blueberry", "blackberry" }, ParameterizedAE.PARAM_STRING_5,
+            new String[] { "a" }, ParameterizedAE.PARAM_BOOLEAN_1, true,
+            ParameterizedAE.PARAM_BOOLEAN_2, true, ParameterizedAE.PARAM_BOOLEAN_3, new boolean[] {
+                true, true, false }, ParameterizedAE.PARAM_BOOLEAN_4, new Boolean[] { true, false,
+                false }, ParameterizedAE.PARAM_BOOLEAN_5, new Boolean[] { true },
+            ParameterizedAE.PARAM_INT_1, 0, ParameterizedAE.PARAM_INT_2, 24,
+            ParameterizedAE.PARAM_INT_3, new int[] { 5 }, "file1", "foo1/bar1", "file1b",
+            "foo1b/bar1b", "file2", "foo2/bar2", "files3", new String[] {
+                "C:\\Documents and Settings\\Philip\\My Documents\\", "/usr/local/bin" }, "files4",
+            new String[0], "files5", new String[] { "foos/bars" }, "files6", new String[] {
+                "C:\\Documents and Settings\\Philip\\My Documents\\", "/usr/local/bin" }, "files7",
+            new String[0], "files8", new String[] { "foos/bars" }, "files9",
+            Arrays.asList(new File("test/data/file"), new File("test/data/file2")));
+    component = new ParameterizedAE();
+    component.initialize(engine.getUimaContext());
+    assertEquals("lime", component.getString1());
+    assertArrayEquals(new String[] { "banana", "strawberry" }, component.getString2());
+    assertEquals("cherry", component.getString3());
+    assertArrayEquals(new String[] { "raspberry", "blueberry", "blackberry" },
+            component.getString4());
+    assertArrayEquals(new String[] { "a" }, component.getString5());
+    assertTrue(component.isBoolean1());
+    assertTrue(component.isBoolean2());
+    assertTrue(component.getBoolean3()[0]);
+    assertTrue(component.getBoolean3()[1]);
+    assertFalse(component.getBoolean3()[2]);
+    assertTrue(component.boolean4[0]);
+    assertFalse(component.boolean4[1]);
+    assertFalse(component.boolean4[2]);
+    assertTrue(component.getBoolean5()[0]);
+    assertEquals(0, component.getInt1());
+    assertEquals(24, component.getInt2());
+    assertEquals(5, component.getInt3()[0]);
+
+    assertEquals(new File("foo1/bar1"), component.getFile1());
+    assertEquals(new File("foo1b/bar1b"), component.getFile1b());
+    assertEquals(new File("foo2/bar2"), component.getFile2());
+    assertArrayEquals(new File[] { new File("C:\\Documents and Settings\\Philip\\My Documents\\"),
+        new File("/usr/local/bin") }, component.getFiles3());
+    assertEquals(0, component.getFiles4().length);
+    assertArrayEquals(new File[] { new File("foos/bars") }, component.getFiles5());
+    assertEquals(2, component.getFiles6().size());
+    assertEquals(new File("C:\\Documents and Settings\\Philip\\My Documents\\"), component
+            .getFiles6().get(0));
+    assertEquals(new File("/usr/local/bin"), component.getFiles6().get(1));
+    assertEquals(0, component.getFiles7().size());
+    assertEquals(1, component.getFiles8().size());
+    assertEquals(new File("foos/bars"), component.getFiles8().get(0));
+    assertEquals(2, component.getFiles9().size());
+    assertEquals(new File("test/data/file"), component.getFiles9().get(0));
+    assertEquals(new File("test/data/file2"), component.getFiles9().get(1));
+
+    engine = AnalysisEngineFactory.createPrimitive(ParameterizedAE.class, typeSystemDescription,
+            ParameterizedAE.PARAM_FLOAT_3, 1.234f, ParameterizedAE.PARAM_FLOAT_6, new Float[] {
+                1.234f, 0.001f }, ParameterizedAE.PARAM_BOOLEAN_1, true,
+            ParameterizedAE.PARAM_BOOLEAN_3, new boolean[3], ParameterizedAE.PARAM_FLOAT_5,
+            new float[] { 1.2f, 3.4f }, "file2", "foo2/bar2");
+    component = new ParameterizedAE();
+    component.initialize(engine.getUimaContext());
+    assertFalse(component.getBoolean3()[0]);
+    assertFalse(component.getBoolean3()[1]);
+    assertFalse(component.getBoolean3()[2]);
+    assertEquals(component.getFloat5()[0], 1.2f, 0.001f);
+    assertEquals(component.getFloat5()[1], 3.4f, 0.001f);
+
+    rie = null;
+    try {
+      engine = AnalysisEngineFactory.createPrimitive(ParameterizedAE.class, typeSystemDescription,
+              ParameterizedAE.PARAM_FLOAT_3, 1.234f, ParameterizedAE.PARAM_FLOAT_6, new Float[] {
+                  1.234f, 0.001f }, ParameterizedAE.PARAM_STRING_1, true);
+    } catch (ResourceInitializationException e) {
+      rie = e;
+    }
+    assertNotNull(rie);
+
+  }
+
+  @Test
+  public void testInitialize2() throws ResourceInitializationException {
+    AnalysisEngine engine = AnalysisEngineFactory.createPrimitive(Annotator1.class,
+            typeSystemDescription);
+    assertEquals(1, engine.getAnalysisEngineMetaData().getCapabilities().length);
+  }
+
+  @Test
+  public void testInitialize3() throws FileNotFoundException, IOException, UIMAException {
+    // here we test an optional parameter that is missing from the
+    // configuration to ensure that it is filled in with the default value
+    AnalysisEngine aed = AnalysisEngineFactory
+            .createAnalysisEngineFromPath("src/test/resources/data/descriptor/DefaultValueAE1.xml");
+    DefaultValueAE1 ae = new DefaultValueAE1();
+    ae.initialize(aed.getUimaContext());
+    assertEquals("green", ae.color);
+
+    // here we test a mandatory parameter that is missing from the
+    // configuration and ensure that an exception is thrown because
+    // no default value is given in the configuration parameter annotation.
+    ResourceInitializationException rie = null;
+    try {
+      aed = AnalysisEngineFactory
+              .createAnalysisEngineFromPath("src/test/resources/data/descriptor/DefaultValueAE2.xml");
+    } catch (ResourceInitializationException e) {
+      rie = e;
+    }
+    assertNotNull(rie);
+  }
+
+  /**
+   * If a parameter value is set to null, that is as good as if it was not set at all. If a default
+   * value is specified, it should be used.
+   */
+  @Test
+  public void testParameterSetToNull() throws Exception {
+    String paramColor = DefaultValueAE1.class.getName() + ".color";
+    AnalysisEngine aed = AnalysisEngineFactory.createPrimitive(DefaultValueAE1.class, null,
+            paramColor, null);
+    DefaultValueAE1 ae = new DefaultValueAE1();
+    ae.initialize(aed.getUimaContext());
+    assertEquals("green", ae.color);
+  }
+
+  /**
+   * If a parameter value is set to null, that is as good as if it was not set at all. If it is
+   * mandatory, an exception has to be thrown.
+   */
+  @Test(expected = ResourceInitializationException.class)
+  public void testMandatoryParameterSetToNull() throws Exception {
+    String paramColor = DefaultValueAE2.class.getName() + ".color";
+    AnalysisEngine aed = AnalysisEngineFactory.createPrimitive(DefaultValueAE2.class, null,
+            paramColor, null);
+    DefaultValueAE2 ae = new DefaultValueAE2();
+    ae.initialize(aed.getUimaContext());
+
+  }
+
+  /**
+   * Test that a parameter not supported by UIMA produces an error.
+   */
+  @Test(expected = IllegalArgumentException.class)
+  public void testNonUimaCompatibleParameterValue() throws Exception {
+    String paramColor = DefaultValueAE2.class.getName() + ".color";
+    AnalysisEngine aed = AnalysisEngineFactory.createPrimitive(DefaultValueAE2.class, null,
+            paramColor, new Point(1, 2));
+    DefaultValueAE2 ae = new DefaultValueAE2();
+    ae.initialize(aed.getUimaContext());
+  }
+
+  /**
+   * Check that an Analysis Engine created from a descriptor declaring optional parameters but not
+   * setting them actually uses the default values declared in the Java annotation
+   */
+  @Test
+  public void testUnsetOptionalParameter() throws Exception {
+    AnalysisEngineDescription aed = AnalysisEngineFactory.createPrimitiveDescription(
+            DefaultValueAE1.class, (Object[]) null);
+    // Remove the settings from the descriptor, but leave the declarations.
+    // The settings are already filled with default values by createPrimitiveDescription,
+    // but here we want to simulate loading a descriptor without settings from a file.
+    // The file of course would declare the parameters optional and thus the settings
+    // for the optional parameters would be empty. We expect that a default value from the
+    // annotation is used in this case.
+    aed.getMetaData().setConfigurationParameterSettings(new ConfigurationParameterSettings_impl());
+    AnalysisEngine template = UIMAFramework.produceAnalysisEngine(aed);
+    DefaultValueAE1 ae = new DefaultValueAE1();
+    ae.initialize(template.getUimaContext());
+    assertEquals("green", ae.color);
+  }
+
+  public static class DefaultValueAE1 extends JCasAnnotator_ImplBase {
+    @ConfigurationParameter(defaultValue = "green")
+    private String color;
+
+    @Override
+    public void initialize(UimaContext aContext) throws ResourceInitializationException {
+      super.initialize(aContext);
+    }
+
+    @Override
+    public void process(JCas aJCas) throws AnalysisEngineProcessException {
+      /* do nothing */
+    }
+
+  }
+
+  public static class DefaultValueAE2 extends JCasAnnotator_ImplBase {
+    @SuppressWarnings("unused")
+    @ConfigurationParameter(mandatory = true)
+    private String color;
+
+    @Override
+    public void initialize(UimaContext aContext) throws ResourceInitializationException {
+      super.initialize(aContext);
+    }
+
+    @Override
+    public void process(JCas aJCas) throws AnalysisEngineProcessException {
+      /* do nothing */
+    }
+
+  }
+
+  @Test
+  public void testEnumDefaultValue() throws Exception {
+    try {
+      AnalysisEngine aed = AnalysisEngineFactory.createPrimitive(DefaultEnumValueAE.class,
+              (Object[]) null);
+      DefaultEnumValueAE ae = new DefaultEnumValueAE();
+      ae.initialize(aed.getUimaContext());
+      assertEquals(Color.GREEN, ae.color);
+    } catch (Exception e) {
+      e.printStackTrace();
+    }
+  }
+
+  public static enum Color {
+    RED, GREEN, BLUE
+  }
+
+  public static class DefaultEnumValueAE extends JCasAnnotator_ImplBase {
+    @ConfigurationParameter(defaultValue = "GREEN")
+    private Color color;
+
+    @Override
+    public void initialize(UimaContext aContext) throws ResourceInitializationException {
+      super.initialize(aContext);
+    }
+
+    @Override
+    public void process(JCas aJCas) throws AnalysisEngineProcessException {
+      /* do nothing */
+    }
+  }
+
+  public static class DefaultLocaleValueAE extends JCasAnnotator_ImplBase {
+    @ConfigurationParameter(name = "L1", defaultValue = "US")
+    public Locale locale1;
+
+    @ConfigurationParameter(name = "L2")
+    public Locale locale2;
+
+    @ConfigurationParameter(name = "L3")
+    public Locale locale3;
+
+    @ConfigurationParameter(name = "L4")
+    public Locale locale4;
+
+    @Override
+    public void process(JCas aJCas) throws AnalysisEngineProcessException {
+      /* do nothing */
+    }
+  }
+
+  @Test
+  public void testLocaleParams() throws Exception {
+    AnalysisEngine aed = AnalysisEngineFactory.createPrimitive(DefaultLocaleValueAE.class, "L2",
+            "en-CA", "L3", "CANADA_FRENCH", "L4", "zh");
+    DefaultLocaleValueAE ae = new DefaultLocaleValueAE();
+    ae.initialize(aed.getUimaContext());
+    assertEquals(Locale.US, ae.locale1);
+    assertEquals(new Locale("en", "CA"), ae.locale2);
+    assertEquals(Locale.CANADA_FRENCH, ae.locale3);
+    assertEquals(new Locale("zh"), ae.locale4);
+
+    aed = AnalysisEngineFactory.createPrimitive(DefaultLocaleValueAE.class, "L1",
+            "es-ES-Traditional_WIN", "L2", "CHINA", "L3", "es", "L4", "en-CA");
+    ae = new DefaultLocaleValueAE();
+    ae.initialize(aed.getUimaContext());
+    assertEquals(new Locale("es", "ES", "Traditional_WIN"), ae.locale1);
+    assertEquals(Locale.CHINA, ae.locale2);
+    assertEquals(new Locale("es"), ae.locale3);
+    assertEquals(new Locale("en", "CA"), ae.locale4);
+
+    aed = AnalysisEngineFactory.createPrimitive(DefaultLocaleValueAE.class, "L1", "", "L2", "",
+            "L3", null);
+    ae = new DefaultLocaleValueAE();
+    ae.initialize(aed.getUimaContext());
+    assertEquals(Locale.getDefault(), ae.locale1);
+    assertEquals(Locale.getDefault(), ae.locale2);
+    assertEquals(null, ae.locale3);
+    assertEquals(null, ae.locale4);
+
+  }
+
+  /**
+   * This main method creates the descriptor files used in testInitialize3. If I weren't lazy I
+   * would figure out how to programmatically remove the configuration parameter corresponding to
+   * 'color'. As it is, however, the parameter must be manually removed (I used the Component
+   * Descriptor Editor to do this.) This point is moot anyways because I am checking in the
+   * generated descriptor files and there is no reason to run this main method in the future.
+   */
+  public static void main(String[] args) throws ResourceInitializationException,
+          FileNotFoundException, SAXException, IOException {
+    AnalysisEngineDescription aed = AnalysisEngineFactory.createPrimitiveDescription(
+            DefaultValueAE1.class, (Object[]) null);
+    aed.toXML(new FileOutputStream("src/test/resources/data/descriptor/DefaultValueAE1.xml"));
+    aed = AnalysisEngineFactory.createPrimitiveDescription(DefaultValueAE2.class, (Object[]) null);
+    aed.toXML(new FileOutputStream("src/test/resources/data/descriptor/DefaultValueAE2.xml"));
+  }
 
 }

Modified: uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/component/xwriter/CASDumpWriterTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/component/xwriter/CASDumpWriterTest.java?rev=1431721&r1=1431720&r2=1431721&view=diff
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/component/xwriter/CASDumpWriterTest.java (original)
+++ uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/component/xwriter/CASDumpWriterTest.java Thu Jan 10 23:12:33 2013
@@ -36,25 +36,25 @@ import org.junit.rules.TemporaryFolder;
  */
 public class CASDumpWriterTest {
 
-	@Rule
-	public TemporaryFolder folder = new TemporaryFolder();
+  @Rule
+  public TemporaryFolder folder = new TemporaryFolder();
 
-	@Test
-	public void testXWriter() throws Exception {
-		File outputFile = new File(folder.getRoot(), "dump-output.txt");
+  @Test
+  public void testXWriter() throws Exception {
+    File outputFile = new File(folder.getRoot(), "dump-output.txt");
 
-		AnalysisEngine writer = AnalysisEngineFactory.createPrimitive(CASDumpWriter.class,
-				CASDumpWriter.PARAM_OUTPUT_FILE, outputFile.getPath());
-		JCas jcas = writer.newJCas();
-		JCasFactory.loadJCas(jcas, "src/test/resources/data/docs/test.xmi");
-		writer.process(jcas);
-		assertTrue(outputFile.exists());
+    AnalysisEngine writer = AnalysisEngineFactory.createPrimitive(CASDumpWriter.class,
+            CASDumpWriter.PARAM_OUTPUT_FILE, outputFile.getPath());
+    JCas jcas = writer.newJCas();
+    JCasFactory.loadJCas(jcas, "src/test/resources/data/docs/test.xmi");
+    writer.process(jcas);
+    assertTrue(outputFile.exists());
 
-		String reference = readFileToString(
-				new File("src/test/resources/data/reference/test.xmi.dump"), "UTF-8").trim();
-		String actual = readFileToString(outputFile, "UTF-8").trim();
-		actual = actual.replaceAll("\r\n", "\n");
+    String reference = readFileToString(
+            new File("src/test/resources/data/reference/test.xmi.dump"), "UTF-8").trim();
+    String actual = readFileToString(outputFile, "UTF-8").trim();
+    actual = actual.replaceAll("\r\n", "\n");
 
-		assertEquals(reference, actual);
-	}
+    assertEquals(reference, actual);
+  }
 }

Modified: uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/component/xwriter/XWriterTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/component/xwriter/XWriterTest.java?rev=1431721&r1=1431720&r2=1431721&view=diff
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/component/xwriter/XWriterTest.java (original)
+++ uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/component/xwriter/XWriterTest.java Thu Jan 10 23:12:33 2013
@@ -53,138 +53,133 @@ import org.junit.rules.TemporaryFolder;
  */
 public class XWriterTest extends ComponentTestBase {
 
-	@Rule
-	public TemporaryFolder folder = new TemporaryFolder();
+  @Rule
+  public TemporaryFolder folder = new TemporaryFolder();
 
-	private File outputDirectory;
+  private File outputDirectory;
 
-	@Before
-	public void setup() {
-		outputDirectory = folder.newFolder("test/xmi-output");
-	}
-
-	@Test
-	public void testXWriter() throws Exception {
-		addDataToCas();
-
-		AnalysisEngine xWriter = AnalysisEngineFactory.createPrimitive(XWriter.class,
-				typeSystemDescription, XWriter.PARAM_OUTPUT_DIRECTORY_NAME,
-				outputDirectory.getPath());
-
-		xWriter.process(jCas);
-
-		File xmiFile = new File(outputDirectory, "1.xmi");
-		assertTrue(xmiFile.exists());
-
-		jCas.reset();
-		JCasFactory.loadJCas(jCas, xmiFile.getPath());
-		assertEquals("Anyone up for a game of Foosball?", jCas.getDocumentText());
-		assertEquals("Any(o)n(e) (u)p f(o)r (a) g(a)m(e) (o)f F(oo)sb(a)ll?", jCas.getView("A")
-				.getDocumentText());
-		assertEquals("?AFaaabeeffgllmnnoooooprsuy", jCas.getView("B").getDocumentText());
-		assertEquals("(((((((((())))))))))?AFaaabeeffgllmnnoooooprsuy", jCas.getView("C")
-				.getDocumentText());
-		assertEquals("yusrpooooonnmllgffeebaaaFA?", jCas.getView(ViewNames.REVERSE_VIEW)
-				.getDocumentText());
-
-		jCas.reset();
-		addDataToCas();
-
-		xWriter = AnalysisEngineFactory.createPrimitive(XWriter.class, typeSystemDescription,
-				XWriter.PARAM_OUTPUT_DIRECTORY_NAME, outputDirectory.getPath(),
-				IntegerFileNamer.PARAM_PREFIX, "myprefix-");
-
-		xWriter.process(jCas);
-
-		xmiFile = new File(outputDirectory, "myprefix-1.xmi");
-		assertTrue(xmiFile.exists());
-
-	}
-
-	private void addDataToCas() throws UIMAException {
-		tokenBuilder.buildTokens(jCas, "Anyone up for a game of Foosball?");
-
-		AggregateBuilder builder = new AggregateBuilder();
-		builder.add(AnalysisEngineFactory.createPrimitiveDescription(Annotator1.class,
-				typeSystemDescription), ViewNames.PARENTHESES_VIEW, "A");
-		builder.add(AnalysisEngineFactory.createPrimitiveDescription(Annotator2.class,
-				typeSystemDescription), ViewNames.SORTED_VIEW, "B",
-				ViewNames.SORTED_PARENTHESES_VIEW, "C", ViewNames.PARENTHESES_VIEW, "A");
-		builder.add(AnalysisEngineFactory.createPrimitiveDescription(Annotator3.class,
-				typeSystemDescription), ViewNames.INITIAL_VIEW, "B");
-		AnalysisEngine aggregateEngine = builder.createAggregate();
-
-		aggregateEngine.process(jCas);
-	}
-
-	@Test
-	public void testXmi() throws Exception {
-		AnalysisEngine engine = AnalysisEngineFactory.createPrimitive(XWriter.class,
-				typeSystemDescription, XWriter.PARAM_OUTPUT_DIRECTORY_NAME,
-				this.outputDirectory.getPath());
-		tokenBuilder.buildTokens(jCas, "I like\nspam!", "I like spam !", "PRP VB NN .");
-		engine.process(jCas);
-		engine.collectionProcessComplete();
-
-		File outputFile = new File(this.outputDirectory, "1.xmi");
-
-		SAXBuilder builder = new SAXBuilder();
-		builder.setDTDHandler(null);
-		Element root = null;
-		try {
-			Document doc = builder.build(new StringReader(FileUtils.file2String(outputFile)));
-			root = doc.getRootElement();
-		}
-		catch (JDOMException e) {
-			throw new AnalysisEngineProcessException(e);
-		}
-		catch (IOException e) {
-			throw new AnalysisEngineProcessException(e);
-		}
-
-		List<?> elements = root.getChildren("Sentence", root.getNamespace("type"));
-		Assert.assertEquals(1, elements.size());
-		elements = root.getChildren("Token", root.getNamespace("type"));
-		Assert.assertEquals(4, elements.size());
-
-	}
-
-	@Test
-	public void testXcas() throws Exception {
-		AnalysisEngine engine = AnalysisEngineFactory.createPrimitive(XWriter.class,
-				typeSystemDescription, XWriter.PARAM_OUTPUT_DIRECTORY_NAME,
-				this.outputDirectory.getPath(), XWriter.PARAM_XML_SCHEME_NAME, XWriter.XCAS);
-		tokenBuilder.buildTokens(jCas, "I like\nspam!", "I like spam !", "PRP VB NN .");
-		engine.process(jCas);
-		engine.collectionProcessComplete();
-
-		File outputFile = new File(this.outputDirectory, "1.xcas");
-
-		SAXBuilder builder = new SAXBuilder();
-		builder.setDTDHandler(null);
-		Element root = null;
-		try {
-			Document doc = builder.build(new StringReader(FileUtils.file2String(outputFile)));
-			root = doc.getRootElement();
-		}
-		catch (JDOMException e) {
-			throw new AnalysisEngineProcessException(e);
-		}
-		catch (IOException e) {
-			throw new AnalysisEngineProcessException(e);
-		}
-
-		List<?> elements = root.getChildren("org.apache.uima.fit.type.Sentence");
-		Assert.assertEquals(1, elements.size());
-		elements = root.getChildren("org.apache.uima.fit.type.Token");
-		Assert.assertEquals(4, elements.size());
-
-	}
-
-	@Test(expected = ResourceInitializationException.class)
-	public void testBadXmlSchemeName() throws ResourceInitializationException {
-		AnalysisEngineFactory.createPrimitive(XWriter.class, typeSystemDescription,
-				XWriter.PARAM_XML_SCHEME_NAME, "xcas");
-	}
+  @Before
+  public void setup() {
+    outputDirectory = folder.newFolder("test/xmi-output");
+  }
+
+  @Test
+  public void testXWriter() throws Exception {
+    addDataToCas();
+
+    AnalysisEngine xWriter = AnalysisEngineFactory.createPrimitive(XWriter.class,
+            typeSystemDescription, XWriter.PARAM_OUTPUT_DIRECTORY_NAME, outputDirectory.getPath());
+
+    xWriter.process(jCas);
+
+    File xmiFile = new File(outputDirectory, "1.xmi");
+    assertTrue(xmiFile.exists());
+
+    jCas.reset();
+    JCasFactory.loadJCas(jCas, xmiFile.getPath());
+    assertEquals("Anyone up for a game of Foosball?", jCas.getDocumentText());
+    assertEquals("Any(o)n(e) (u)p f(o)r (a) g(a)m(e) (o)f F(oo)sb(a)ll?", jCas.getView("A")
+            .getDocumentText());
+    assertEquals("?AFaaabeeffgllmnnoooooprsuy", jCas.getView("B").getDocumentText());
+    assertEquals("(((((((((())))))))))?AFaaabeeffgllmnnoooooprsuy", jCas.getView("C")
+            .getDocumentText());
+    assertEquals("yusrpooooonnmllgffeebaaaFA?", jCas.getView(ViewNames.REVERSE_VIEW)
+            .getDocumentText());
+
+    jCas.reset();
+    addDataToCas();
+
+    xWriter = AnalysisEngineFactory.createPrimitive(XWriter.class, typeSystemDescription,
+            XWriter.PARAM_OUTPUT_DIRECTORY_NAME, outputDirectory.getPath(),
+            IntegerFileNamer.PARAM_PREFIX, "myprefix-");
+
+    xWriter.process(jCas);
+
+    xmiFile = new File(outputDirectory, "myprefix-1.xmi");
+    assertTrue(xmiFile.exists());
+
+  }
+
+  private void addDataToCas() throws UIMAException {
+    tokenBuilder.buildTokens(jCas, "Anyone up for a game of Foosball?");
+
+    AggregateBuilder builder = new AggregateBuilder();
+    builder.add(AnalysisEngineFactory.createPrimitiveDescription(Annotator1.class,
+            typeSystemDescription), ViewNames.PARENTHESES_VIEW, "A");
+    builder.add(AnalysisEngineFactory.createPrimitiveDescription(Annotator2.class,
+            typeSystemDescription), ViewNames.SORTED_VIEW, "B", ViewNames.SORTED_PARENTHESES_VIEW,
+            "C", ViewNames.PARENTHESES_VIEW, "A");
+    builder.add(AnalysisEngineFactory.createPrimitiveDescription(Annotator3.class,
+            typeSystemDescription), ViewNames.INITIAL_VIEW, "B");
+    AnalysisEngine aggregateEngine = builder.createAggregate();
+
+    aggregateEngine.process(jCas);
+  }
+
+  @Test
+  public void testXmi() throws Exception {
+    AnalysisEngine engine = AnalysisEngineFactory.createPrimitive(XWriter.class,
+            typeSystemDescription, XWriter.PARAM_OUTPUT_DIRECTORY_NAME,
+            this.outputDirectory.getPath());
+    tokenBuilder.buildTokens(jCas, "I like\nspam!", "I like spam !", "PRP VB NN .");
+    engine.process(jCas);
+    engine.collectionProcessComplete();
+
+    File outputFile = new File(this.outputDirectory, "1.xmi");
+
+    SAXBuilder builder = new SAXBuilder();
+    builder.setDTDHandler(null);
+    Element root = null;
+    try {
+      Document doc = builder.build(new StringReader(FileUtils.file2String(outputFile)));
+      root = doc.getRootElement();
+    } catch (JDOMException e) {
+      throw new AnalysisEngineProcessException(e);
+    } catch (IOException e) {
+      throw new AnalysisEngineProcessException(e);
+    }
+
+    List<?> elements = root.getChildren("Sentence", root.getNamespace("type"));
+    Assert.assertEquals(1, elements.size());
+    elements = root.getChildren("Token", root.getNamespace("type"));
+    Assert.assertEquals(4, elements.size());
+
+  }
+
+  @Test
+  public void testXcas() throws Exception {
+    AnalysisEngine engine = AnalysisEngineFactory.createPrimitive(XWriter.class,
+            typeSystemDescription, XWriter.PARAM_OUTPUT_DIRECTORY_NAME,
+            this.outputDirectory.getPath(), XWriter.PARAM_XML_SCHEME_NAME, XWriter.XCAS);
+    tokenBuilder.buildTokens(jCas, "I like\nspam!", "I like spam !", "PRP VB NN .");
+    engine.process(jCas);
+    engine.collectionProcessComplete();
+
+    File outputFile = new File(this.outputDirectory, "1.xcas");
+
+    SAXBuilder builder = new SAXBuilder();
+    builder.setDTDHandler(null);
+    Element root = null;
+    try {
+      Document doc = builder.build(new StringReader(FileUtils.file2String(outputFile)));
+      root = doc.getRootElement();
+    } catch (JDOMException e) {
+      throw new AnalysisEngineProcessException(e);
+    } catch (IOException e) {
+      throw new AnalysisEngineProcessException(e);
+    }
+
+    List<?> elements = root.getChildren("org.apache.uima.fit.type.Sentence");
+    Assert.assertEquals(1, elements.size());
+    elements = root.getChildren("org.apache.uima.fit.type.Token");
+    Assert.assertEquals(4, elements.size());
+
+  }
+
+  @Test(expected = ResourceInitializationException.class)
+  public void testBadXmlSchemeName() throws ResourceInitializationException {
+    AnalysisEngineFactory.createPrimitive(XWriter.class, typeSystemDescription,
+            XWriter.PARAM_XML_SCHEME_NAME, "xcas");
+  }
 
 }

Modified: uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/data/CreateSampleXCASFile.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/data/CreateSampleXCASFile.java?rev=1431721&r1=1431720&r2=1431721&view=diff
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/data/CreateSampleXCASFile.java (original)
+++ uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/data/CreateSampleXCASFile.java Thu Jan 10 23:12:33 2013
@@ -36,24 +36,24 @@ import org.xml.sax.SAXException;
 
 public class CreateSampleXCASFile {
 
-	public static void main(String[] args) throws UIMAException, SAXException, IOException {
-		TokenBuilder<Token, Sentence> tokenBuilder = new TokenBuilder<Token, Sentence>(Token.class,
-				Sentence.class, "pos", "stem");
-		JCas jCas = JCasFactory.createJCas();
-		// quote from http://www.gutenberg.org/files/20417/20417-h/20417-h.htm
-		String text = "... the more knowledge advances the more it becomes possible to condense it into little books.";
-		tokenBuilder
-				.buildTokens(
-						jCas,
-						text,
-						"... the more knowledge advances the more it becomes possible to condense it into little books . ",
-						". T M K A T M I B P T C I I L B .",
-						"... the more knowledge advance the more it become possible to condense it into little book . ");
+  public static void main(String[] args) throws UIMAException, SAXException, IOException {
+    TokenBuilder<Token, Sentence> tokenBuilder = new TokenBuilder<Token, Sentence>(Token.class,
+            Sentence.class, "pos", "stem");
+    JCas jCas = JCasFactory.createJCas();
+    // quote from http://www.gutenberg.org/files/20417/20417-h/20417-h.htm
+    String text = "... the more knowledge advances the more it becomes possible to condense it into little books.";
+    tokenBuilder
+            .buildTokens(
+                    jCas,
+                    text,
+                    "... the more knowledge advances the more it becomes possible to condense it into little books . ",
+                    ". T M K A T M I B P T C I I L B .",
+                    "... the more knowledge advance the more it become possible to condense it into little book . ");
 
-		FileOutputStream out = new FileOutputStream("src/test/resources/data/docs/test.xcas");
-		XCASSerializer ser = new XCASSerializer(jCas.getTypeSystem());
-		XMLSerializer xmlSer = new XMLSerializer(out, false);
-		ser.serialize(jCas.getCas(), xmlSer.getContentHandler());
-		out.close();
-	}
+    FileOutputStream out = new FileOutputStream("src/test/resources/data/docs/test.xcas");
+    XCASSerializer ser = new XCASSerializer(jCas.getTypeSystem());
+    XMLSerializer xmlSer = new XMLSerializer(out, false);
+    ser.serialize(jCas.getCas(), xmlSer.getContentHandler());
+    out.close();
+  }
 }

Modified: uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/data/CreateSampleXMIFile.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/data/CreateSampleXMIFile.java?rev=1431721&r1=1431720&r2=1431721&view=diff
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/data/CreateSampleXMIFile.java (original)
+++ uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/data/CreateSampleXMIFile.java Thu Jan 10 23:12:33 2013
@@ -36,19 +36,19 @@ import org.xml.sax.SAXException;
 
 public class CreateSampleXMIFile {
 
-	public static void main(String[] args) throws UIMAException, SAXException, IOException {
-		TokenBuilder<Token, Sentence> tokenBuilder = new TokenBuilder<Token, Sentence>(Token.class,
-				Sentence.class, "pos", "stem");
-		JCas jCas = JCasFactory.createJCas();
-		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 .");
+  public static void main(String[] args) throws UIMAException, SAXException, IOException {
+    TokenBuilder<Token, Sentence> tokenBuilder = new TokenBuilder<Token, Sentence>(Token.class,
+            Sentence.class, "pos", "stem");
+    JCas jCas = JCasFactory.createJCas();
+    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 .");
 
-		FileOutputStream out = new FileOutputStream("src/test/resources/data/docs/test.xmi");
-		XmiCasSerializer ser = new XmiCasSerializer(jCas.getTypeSystem());
-		XMLSerializer xmlSer = new XMLSerializer(out, false);
-		ser.serialize(jCas.getCas(), xmlSer.getContentHandler());
-		out.close();
+    FileOutputStream out = new FileOutputStream("src/test/resources/data/docs/test.xmi");
+    XmiCasSerializer ser = new XmiCasSerializer(jCas.getTypeSystem());
+    XMLSerializer xmlSer = new XMLSerializer(out, false);
+    ser.serialize(jCas.getCas(), xmlSer.getContentHandler());
+    out.close();
 
-	}
+  }
 }

Modified: uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/descriptor/TypeCapabilityTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/descriptor/TypeCapabilityTest.java?rev=1431721&r1=1431720&r2=1431721&view=diff
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/descriptor/TypeCapabilityTest.java (original)
+++ uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/descriptor/TypeCapabilityTest.java Thu Jan 10 23:12:33 2013
@@ -36,22 +36,22 @@ import org.junit.Test;
 
 public class TypeCapabilityTest extends ComponentTestBase {
 
-	@Test
-	public void testTC() throws ResourceInitializationException {
-		AnalysisEngineDescription aed = AnalysisEngineFactory.createPrimitiveDescription(
-				Annotator4.class, typeSystemDescription);
-		Capability[] capabilities = aed.getAnalysisEngineMetaData().getCapabilities();
-		assertEquals(1, capabilities.length);
-		Capability capability = capabilities[0];
-		TypeOrFeature[] inputs = capability.getInputs();
-		assertEquals(1, inputs.length);
-		assertEquals("org.apache.uima.fit.type.Token", inputs[0].getName());
-		assertTrue(inputs[0].isType());
+  @Test
+  public void testTC() throws ResourceInitializationException {
+    AnalysisEngineDescription aed = AnalysisEngineFactory.createPrimitiveDescription(
+            Annotator4.class, typeSystemDescription);
+    Capability[] capabilities = aed.getAnalysisEngineMetaData().getCapabilities();
+    assertEquals(1, capabilities.length);
+    Capability capability = capabilities[0];
+    TypeOrFeature[] inputs = capability.getInputs();
+    assertEquals(1, inputs.length);
+    assertEquals("org.apache.uima.fit.type.Token", inputs[0].getName());
+    assertTrue(inputs[0].isType());
 
-		TypeOrFeature[] outputs = capability.getOutputs();
-		assertEquals(1, outputs.length);
-		assertEquals("org.apache.uima.fit.type.Token:pos", outputs[0].getName());
-		assertFalse(outputs[0].isType());
+    TypeOrFeature[] outputs = capability.getOutputs();
+    assertEquals(1, outputs.length);
+    assertEquals("org.apache.uima.fit.type.Token:pos", outputs[0].getName());
+    assertFalse(outputs[0].isType());
 
-	}
+  }
 }