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 [16/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/factory/AnalysisEngineFactoryTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/factory/AnalysisEngineFactoryTest.java?rev=1431721&r1=1431720&r2=1431721&view=diff
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/factory/AnalysisEngineFactoryTest.java (original)
+++ uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/factory/AnalysisEngineFactoryTest.java Thu Jan 10 23:12:33 2013
@@ -70,433 +70,411 @@ import org.junit.Test;
 
 public class AnalysisEngineFactoryTest extends ComponentTestBase {
 
-	@Test
-	public void testViewAE() throws Exception {
-		AnalysisEngineDescription aed = AnalysisEngineFactory.createPrimitiveDescription(
-				Annotator4.class, typeSystemDescription);
-		AnalysisEngine ae = AnalysisEngineFactory.createAnalysisEngine(aed, "A");
-
-		JCas aView = jCas.createView("A");
-		tokenBuilder.buildTokens(aView, "'Verb' is a noun!?");
-		ae.process(jCas);
-		assertEquals("'Verb' is a noun!?", jCas.getView("A").getDocumentText());
-		assertEquals("NN", JCasUtil.selectByIndex(aView, Token.class, 0).getPos());
-	}
-
-	@Test
-	public void testCreateAnalysisEngineFromPath() throws UIMAException, IOException {
-		AnalysisEngine engine = AnalysisEngineFactory
-				.createAnalysisEngineFromPath("src/main/resources/org/apache/uima/fit/component/NoOpAnnotator.xml");
-		assertNotNull(engine);
-	}
-
-	@Test
-	public void testProcess1() throws UIMAException, IOException {
-		jCas = AnalysisEngineFactory.process(NoOpAnnotator.class.getName(), "There is no excuse!");
-
-		assertEquals("There is no excuse!", jCas.getDocumentText());
-	}
-
-	@Test
-	public void testProcess2() throws UIMAException, IOException {
-		jCas = AnalysisEngineFactory.process(NoOpAnnotator.class.getName(),
-				"src/test/resources/data/docs/A.txt");
-
-		assertEquals("Aaa Bbbb Cc Dddd eeee ff .", jCas.getDocumentText());
-	}
-
-	@Test
-	public void testCreateAnalysisEngineWithPrioritizedTypes() throws UIMAException {
-		String[] prioritizedTypeNames = new String[] { "org.apache.uima.fit.type.Token",
-				"org.apache.uima.fit.type.Sentence" };
-		AnalysisEngine engine = AnalysisEngineFactory.createPrimitive(
-				org.apache.uima.fit.component.NoOpAnnotator.class, typeSystemDescription,
-				prioritizedTypeNames, (Object[]) null);
-
-		typePriorities = engine.getAnalysisEngineMetaData().getTypePriorities();
-		assertEquals(1, typePriorities.getPriorityLists().length);
-		TypePriorityList typePriorityList = typePriorities.getPriorityLists()[0];
-		assertEquals(2, typePriorityList.getTypes().length);
-		assertEquals("org.apache.uima.fit.type.Token", typePriorityList.getTypes()[0]);
-		assertEquals("org.apache.uima.fit.type.Sentence", typePriorityList.getTypes()[1]);
-
-		jCas = engine.newJCas();
-		tokenBuilder.buildTokens(jCas, "word");
-		FSIterator<Annotation> tokensInSentence = jCas.getAnnotationIndex().subiterator(
-				JCasUtil.selectByIndex(jCas, Sentence.class, 0));
-		assertFalse(tokensInSentence.hasNext());
-
-		prioritizedTypeNames = new String[] { "org.apache.uima.fit.type.Sentence", "org.apache.uima.fit.type.Token" };
-		engine = AnalysisEngineFactory.createPrimitive(
-				org.apache.uima.fit.component.NoOpAnnotator.class, typeSystemDescription,
-				prioritizedTypeNames, (Object[]) null);
-		jCas = engine.newJCas();
-		tokenBuilder.buildTokens(jCas, "word");
-		tokensInSentence = jCas.getAnnotationIndex().subiterator(
-				JCasUtil.selectByIndex(jCas, Sentence.class, 0));
-		assertTrue(tokensInSentence.hasNext());
-
-	}
-
-	@Test
-	public void testAggregate() throws UIMAException {
-		tokenBuilder.buildTokens(jCas, "Anyone up for a game of Foosball?");
-
-		SofaMapping[] sofaMappings = new SofaMapping[] {
-				SofaMappingFactory.createSofaMapping(Annotator1.class, ViewNames.PARENTHESES_VIEW,
-						"A"),
-				SofaMappingFactory.createSofaMapping(Annotator2.class, ViewNames.SORTED_VIEW, "B"),
-				SofaMappingFactory.createSofaMapping(Annotator2.class,
-						ViewNames.SORTED_PARENTHESES_VIEW, "C"),
-				SofaMappingFactory.createSofaMapping(Annotator2.class, ViewNames.PARENTHESES_VIEW,
-						"A"),
-				SofaMappingFactory.createSofaMapping(Annotator3.class, ViewNames.INITIAL_VIEW, "B") };
-
-		List<Class<? extends AnalysisComponent>> primitiveAEClasses = new ArrayList<Class<? extends AnalysisComponent>>();
-		primitiveAEClasses.add(Annotator1.class);
-		primitiveAEClasses.add(Annotator2.class);
-		primitiveAEClasses.add(Annotator3.class);
-
-		AnalysisEngine aggregateEngine = AnalysisEngineFactory.createAggregate(primitiveAEClasses,
-				typeSystemDescription, null, sofaMappings);
-
-		aggregateEngine.process(jCas);
-
-		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());
-
-	}
-
-	@Test
-	public void testAggregate2() throws UIMAException, IOException {
-		tokenBuilder.buildTokens(jCas, "Anyone up for a game of Foosball?");
-
-		SofaMapping[] sofaMappings = new SofaMapping[] {
-				SofaMappingFactory.createSofaMapping("ann1", ViewNames.PARENTHESES_VIEW, "A"),
-				SofaMappingFactory.createSofaMapping("ann2", ViewNames.SORTED_VIEW, "B"),
-				SofaMappingFactory
-						.createSofaMapping("ann2", ViewNames.SORTED_PARENTHESES_VIEW, "C"),
-				SofaMappingFactory.createSofaMapping("ann2", ViewNames.PARENTHESES_VIEW, "A"),
-				SofaMappingFactory.createSofaMapping("ann3", ViewNames.INITIAL_VIEW, "B") };
-
-		List<AnalysisEngineDescription> primitiveDescriptors = new ArrayList<AnalysisEngineDescription>();
-		primitiveDescriptors.add(AnalysisEngineFactory.createPrimitiveDescription(Annotator1.class,
-				typeSystemDescription, (TypePriorities) null));
-		primitiveDescriptors.add(AnalysisEngineFactory.createPrimitiveDescription(Annotator2.class,
-				typeSystemDescription, (TypePriorities) null));
-		primitiveDescriptors.add(AnalysisEngineFactory.createPrimitiveDescription(Annotator3.class,
-				typeSystemDescription, (TypePriorities) null));
-
-		List<String> componentNames = Arrays.asList("ann1", "ann2", "ann3");
-
-		AnalysisEngine aggregateEngine = AnalysisEngineFactory.createAggregate(
-				primitiveDescriptors, componentNames, typeSystemDescription, null, sofaMappings);
-
-		aggregateEngine.process(jCas);
-
-		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());
-
-		JCasFactory.loadJCas(jCas, "src/test/resources/data/docs/test.xmi");
-		AnalysisEngine ae1 = AnalysisEngineFactory.createPrimitive(NoOpAnnotator.class,
-				typeSystemDescription);
-
-		SimplePipeline.runPipeline(jCas, ae1, aggregateEngine);
-
-	}
-
-	@Test
-	public void testReflectPrimitiveDescription() throws ResourceInitializationException {
-		AnalysisEngineDescription aed = AnalysisEngineFactory.createPrimitiveDescription(
-				Annotator2.class, typeSystemDescription, typePriorities);
-		Capability[] capabilities = aed.getAnalysisEngineMetaData().getCapabilities();
-		assertEquals(1, capabilities.length);
-		String[] inputSofas = capabilities[0].getInputSofas();
-		assertArrayEquals(new String[] { CAS.NAME_DEFAULT_SOFA, ViewNames.PARENTHESES_VIEW },
-				inputSofas);
-		String[] outputSofas = capabilities[0].getOutputSofas();
-		assertArrayEquals(
-				new String[] { ViewNames.SORTED_VIEW, ViewNames.SORTED_PARENTHESES_VIEW },
-				outputSofas);
-
-		aed = AnalysisEngineFactory.createPrimitiveDescription(ParameterizedAE.class,
-				typeSystemDescription, typePriorities);
-		capabilities = aed.getAnalysisEngineMetaData().getCapabilities();
-		assertEquals(1, capabilities.length);
-		inputSofas = capabilities[0].getInputSofas();
-		assertArrayEquals(new String[] { CAS.NAME_DEFAULT_SOFA }, inputSofas);
-		outputSofas = capabilities[0].getOutputSofas();
-		assertArrayEquals(new String[] {}, outputSofas);
-
-		testConfigurationParameter(aed, ParameterizedAE.PARAM_STRING_1,
-				ConfigurationParameter.TYPE_STRING, true, false, "pineapple");
-		testConfigurationParameter(aed, ParameterizedAE.PARAM_STRING_2,
-				ConfigurationParameter.TYPE_STRING, false, true,
-				new String[] { "coconut", "mango" });
-		testConfigurationParameter(aed, ParameterizedAE.PARAM_STRING_3,
-				ConfigurationParameter.TYPE_STRING, false, false, null);
-		testConfigurationParameter(aed, ParameterizedAE.PARAM_STRING_4,
-				ConfigurationParameter.TYPE_STRING, true, true, new String[] { "apple" });
-		testConfigurationParameter(aed, ParameterizedAE.PARAM_STRING_5,
-				ConfigurationParameter.TYPE_STRING, false, true, new String[] { "" });
-
-		testConfigurationParameter(aed, ParameterizedAE.PARAM_BOOLEAN_1,
-				ConfigurationParameter.TYPE_BOOLEAN, true, false, Boolean.FALSE);
-		testConfigurationParameter(aed, ParameterizedAE.PARAM_BOOLEAN_2,
-				ConfigurationParameter.TYPE_BOOLEAN, false, false, null);
-		testConfigurationParameter(aed, ParameterizedAE.PARAM_BOOLEAN_3,
-				ConfigurationParameter.TYPE_BOOLEAN, true, true,
-				new Boolean[] { true, true, false });
-		testConfigurationParameter(aed, ParameterizedAE.PARAM_BOOLEAN_4,
-				ConfigurationParameter.TYPE_BOOLEAN, true, true,
-				new Boolean[] { true, false, true });
-		testConfigurationParameter(aed, ParameterizedAE.PARAM_BOOLEAN_5,
-				ConfigurationParameter.TYPE_BOOLEAN, true, true, new Boolean[] { false });
-
-		testConfigurationParameter(aed, ParameterizedAE.PARAM_INT_1,
-				ConfigurationParameter.TYPE_INTEGER, true, false, 0);
-		testConfigurationParameter(aed, ParameterizedAE.PARAM_INT_2,
-				ConfigurationParameter.TYPE_INTEGER, false, false, 42);
-		testConfigurationParameter(aed, ParameterizedAE.PARAM_INT_3,
-				ConfigurationParameter.TYPE_INTEGER, false, true, new Integer[] { 42, 111 });
-		testConfigurationParameter(aed, ParameterizedAE.PARAM_INT_4,
-				ConfigurationParameter.TYPE_INTEGER, true, true, new Integer[] { 2 });
-
-		testConfigurationParameter(aed, ParameterizedAE.PARAM_FLOAT_1,
-				ConfigurationParameter.TYPE_FLOAT, true, false, 0.0f);
-		testConfigurationParameter(aed, ParameterizedAE.PARAM_FLOAT_2,
-				ConfigurationParameter.TYPE_FLOAT, false, false, 3.1415f);
-		testConfigurationParameter(aed, ParameterizedAE.PARAM_FLOAT_3,
-				ConfigurationParameter.TYPE_FLOAT, true, false, null);
-		testConfigurationParameter(aed, ParameterizedAE.PARAM_FLOAT_4,
-				ConfigurationParameter.TYPE_FLOAT, false, true, null);
-		testConfigurationParameter(aed, ParameterizedAE.PARAM_FLOAT_5,
-				ConfigurationParameter.TYPE_FLOAT, false, true, new Float[] { 0.0f, 3.1415f,
-						2.7182818f });
-		testConfigurationParameter(aed, ParameterizedAE.PARAM_FLOAT_6,
-				ConfigurationParameter.TYPE_FLOAT, true, true, null);
-		testConfigurationParameter(aed, ParameterizedAE.PARAM_FLOAT_7,
-				ConfigurationParameter.TYPE_FLOAT, true, true, new Float[] { 1.1111f, 2.2222f,
-						3.333f });
-
-		AnalysisEngine ae = AnalysisEngineFactory.createPrimitive(aed,
-				ParameterizedAE.PARAM_FLOAT_3, 3.1415f, ParameterizedAE.PARAM_FLOAT_6,
-				new Float[] { 2.71828183f }, "file2", "foo/bar");
-		Object paramValue = ae.getAnalysisEngineMetaData().getConfigurationParameterSettings()
-				.getParameterValue(ParameterizedAE.PARAM_FLOAT_3);
-		assertEquals(paramValue, 3.1415f);
-		paramValue = ae.getAnalysisEngineMetaData().getConfigurationParameterSettings()
-				.getParameterValue(ParameterizedAE.PARAM_FLOAT_6);
-		assertEquals(((Float[]) paramValue)[0].floatValue(), 2.71828183f, 0.00001f);
-
-	}
-
-	private void testConfigurationParameter(AnalysisEngineDescription aed, String parameterName,
-			String parameterType, boolean mandatory, boolean multiValued, Object parameterValue) {
-		ConfigurationParameterDeclarations cpd = aed.getMetaData()
-				.getConfigurationParameterDeclarations();
-		ConfigurationParameter cp = cpd.getConfigurationParameter(null, parameterName);
-		assertNotNull("Parameter [" + parameterName + "] does not exist!", cp);
-		assertEquals("Parameter [" + parameterName + "] has wrong name", parameterName,
-				cp.getName());
-		assertEquals("Parameter [" + parameterName + "] has wrong type", parameterType,
-				cp.getType());
-		assertEquals("Parameter [" + parameterName + "] has wrong mandatory flag", mandatory,
-				cp.isMandatory());
-		assertEquals("Parameter [" + parameterName + "] has wrong multi-value flag", multiValued,
-				cp.isMultiValued());
-		ConfigurationParameterSettings cps = aed.getMetaData().getConfigurationParameterSettings();
-		Object actualValue = cps.getParameterValue(parameterName);
-		if (parameterValue == null) {
-			assertNull(actualValue);
-		}
-		else if (!multiValued) {
-			if (parameterType.equals(ConfigurationParameter.TYPE_FLOAT)) {
-				assertEquals(((Float) parameterValue).floatValue(),
-						((Float) actualValue).floatValue(), .001f);
-			}
-			else {
-				assertEquals(parameterValue, actualValue);
-			}
-		}
-		else {
-			assertEquals(Array.getLength(parameterValue), Array.getLength(actualValue));
-			for (int i = 0; i < Array.getLength(parameterValue); ++i) {
-				assertEquals(Array.get(parameterValue, i), Array.get(actualValue, i));
-			}
-		}
-
-	}
-
-	@Test
-	public void testPrimitiveDescription() throws ResourceInitializationException {
-
-		AnalysisEngineDescription aed = AnalysisEngineFactory.createPrimitiveDescription(
-				NoOpAnnotator.class, typeSystemDescription);
-		assertNotNull(aed);
-		// assertEquals("org.apache.uima.fit.type.TypeSystem",
-		// aed.getAnalysisEngineMetaData().getTypeSystem().getImports()[0].getName());
-	}
-
-	/**
-	 * Test that a {@link OperationalProperties} annotation on an ancestor of a analysis engine
-	 * class is found and taken into account.
-	 */
-	@Test
-	public void testComponentAnnotationOnAncestor() throws Exception {
-		AnalysisEngineDescription desc1 = AnalysisEngineFactory.createPrimitiveDescription(
-				PristineAnnotatorClass.class, (Object[]) null);
-		assertTrue(
-				"Multiple deployment should be allowed on "
-						+ desc1.getAnnotatorImplementationName(), desc1.getAnalysisEngineMetaData()
-						.getOperationalProperties().isMultipleDeploymentAllowed());
-
-		AnalysisEngineDescription desc2 = AnalysisEngineFactory.createPrimitiveDescription(
-				UnannotatedAnnotatorClass.class, (Object[]) null);
-		assertFalse(
-				"Multiple deployment should be prohibited on "
-						+ desc2.getAnnotatorImplementationName(), desc2.getAnalysisEngineMetaData()
-						.getOperationalProperties().isMultipleDeploymentAllowed());
-
-		AnalysisEngineDescription desc3 = AnalysisEngineFactory.createPrimitiveDescription(
-				AnnotatedAnnotatorClass.class, (Object[]) null);
-		assertTrue(
-				"Multiple deployment should be allowed  on "
-						+ desc3.getAnnotatorImplementationName(), desc3.getAnalysisEngineMetaData()
-						.getOperationalProperties().isMultipleDeploymentAllowed());
-	}
-
-	/*
-	 * This test case illustrates that UIMA throws an exception unless the multipleDeploymentAllowed
-	 * flag is properly set to false when mixing multi-deployment and non-multi-deployment AEs.
-	 */
-	@Test(expected = ResourceInitializationException.class)
-	public void testAAEMultipleDeploymentPolicyProblem() throws Exception {
-		{
-			AnalysisEngineDescription desc1 = AnalysisEngineFactory.createPrimitiveDescription(
-					PristineAnnotatorClass.class, (Object[]) null);
-			assertTrue(
-					"Multiple deployment should be allowed on "
-							+ desc1.getAnnotatorImplementationName(), desc1
-							.getAnalysisEngineMetaData().getOperationalProperties()
-							.isMultipleDeploymentAllowed());
-
-			AnalysisEngineDescription desc2 = AnalysisEngineFactory.createPrimitiveDescription(
-					UnannotatedAnnotatorClass.class, (Object[]) null);
-			assertFalse(
-					"Multiple deployment should be prohibited on "
-							+ desc2.getAnnotatorImplementationName(), desc2
-							.getAnalysisEngineMetaData().getOperationalProperties()
-							.isMultipleDeploymentAllowed());
-
-			AnalysisEngineDescription aae = AnalysisEngineFactory.createAggregateDescription(desc1,
-					desc2);
-			aae.getAnalysisEngineMetaData().getOperationalProperties()
-					.setMultipleDeploymentAllowed(true);
-			UIMAFramework.produceAnalysisEngine(aae);
-		}
-	}
-
-	@Test
-	public void testAAEMultipleDeploymentPolicy() throws Exception {
-		{
-			AnalysisEngineDescription desc1 = AnalysisEngineFactory.createPrimitiveDescription(
-					PristineAnnotatorClass.class, (Object[]) null);
-			assertTrue(
-					"Multiple deployment should be allowed on "
-							+ desc1.getAnnotatorImplementationName(), desc1
-							.getAnalysisEngineMetaData().getOperationalProperties()
-							.isMultipleDeploymentAllowed());
-
-			AnalysisEngineDescription desc2 = AnalysisEngineFactory.createPrimitiveDescription(
-					UnannotatedAnnotatorClass.class, (Object[]) null);
-			assertFalse(
-					"Multiple deployment should be prohibited on "
-							+ desc2.getAnnotatorImplementationName(), desc2
-							.getAnalysisEngineMetaData().getOperationalProperties()
-							.isMultipleDeploymentAllowed());
-
-			AnalysisEngineDescription aae = AnalysisEngineFactory.createAggregateDescription(desc1,
-					desc2);
-			UIMAFramework.produceAnalysisEngine(aae);
-
-			assertFalse("Multiple deployment should be prohibited on AAE", aae
-					.getAnalysisEngineMetaData().getOperationalProperties()
-					.isMultipleDeploymentAllowed());
-		}
-
-		{
-			AnalysisEngineDescription desc1 = AnalysisEngineFactory.createPrimitiveDescription(
-					PristineAnnotatorClass.class, (Object[]) null);
-			assertTrue(
-					"Multiple deployment should be allowed on "
-							+ desc1.getAnnotatorImplementationName(), desc1
-							.getAnalysisEngineMetaData().getOperationalProperties()
-							.isMultipleDeploymentAllowed());
-
-			AnalysisEngineDescription desc3 = AnalysisEngineFactory.createPrimitiveDescription(
-					AnnotatedAnnotatorClass.class, (Object[]) null);
-			assertTrue(
-					"Multiple deployment should be allowed  on "
-							+ desc3.getAnnotatorImplementationName(), desc3
-							.getAnalysisEngineMetaData().getOperationalProperties()
-							.isMultipleDeploymentAllowed());
-
-			AnalysisEngineDescription aae = AnalysisEngineFactory.createAggregateDescription(desc1,
-					desc3);
-			UIMAFramework.produceAnalysisEngine(aae);
-
-			assertTrue("Multiple deployment should be prohibited on AAE", aae
-					.getAnalysisEngineMetaData().getOperationalProperties()
-					.isMultipleDeploymentAllowed());
-		}
-	}
-
-	public static class PristineAnnotatorClass extends JCasAnnotator_ImplBase {
-		@Override
-		public void process(JCas aJCas) throws AnalysisEngineProcessException {
-			// Dummy
-		}
-	}
-
-	@org.apache.uima.fit.descriptor.OperationalProperties(multipleDeploymentAllowed = false)
-	public static class AncestorClass extends JCasAnnotator_ImplBase {
-		@Override
-		public void process(JCas aJCas) throws AnalysisEngineProcessException {
-			// Dummy
-		}
-	}
-
-	public static class UnannotatedAnnotatorClass extends AncestorClass {
-		// Dummy
-	}
-
-	@org.apache.uima.fit.descriptor.OperationalProperties(multipleDeploymentAllowed = true)
-	public static class AnnotatedAnnotatorClass extends UnannotatedAnnotatorClass {
-		// Vessel for the annotation
-	}
-
-	@Test
-	public void testIssue5a() throws ResourceInitializationException {
-		AnalysisEngineFactory.createPrimitiveDescription(ParameterizedAE.class,
-				typeSystemDescription);
-	}
-
-	@Test(expected = ResourceInitializationException.class)
-	public void testIssue5b() throws ResourceInitializationException {
-		AnalysisEngineFactory.createPrimitive(ParameterizedAE.class, typeSystemDescription);
-	}
+  @Test
+  public void testViewAE() throws Exception {
+    AnalysisEngineDescription aed = AnalysisEngineFactory.createPrimitiveDescription(
+            Annotator4.class, typeSystemDescription);
+    AnalysisEngine ae = AnalysisEngineFactory.createAnalysisEngine(aed, "A");
+
+    JCas aView = jCas.createView("A");
+    tokenBuilder.buildTokens(aView, "'Verb' is a noun!?");
+    ae.process(jCas);
+    assertEquals("'Verb' is a noun!?", jCas.getView("A").getDocumentText());
+    assertEquals("NN", JCasUtil.selectByIndex(aView, Token.class, 0).getPos());
+  }
+
+  @Test
+  public void testCreateAnalysisEngineFromPath() throws UIMAException, IOException {
+    AnalysisEngine engine = AnalysisEngineFactory
+            .createAnalysisEngineFromPath("src/main/resources/org/apache/uima/fit/component/NoOpAnnotator.xml");
+    assertNotNull(engine);
+  }
+
+  @Test
+  public void testProcess1() throws UIMAException, IOException {
+    jCas = AnalysisEngineFactory.process(NoOpAnnotator.class.getName(), "There is no excuse!");
+
+    assertEquals("There is no excuse!", jCas.getDocumentText());
+  }
+
+  @Test
+  public void testProcess2() throws UIMAException, IOException {
+    jCas = AnalysisEngineFactory.process(NoOpAnnotator.class.getName(),
+            "src/test/resources/data/docs/A.txt");
+
+    assertEquals("Aaa Bbbb Cc Dddd eeee ff .", jCas.getDocumentText());
+  }
+
+  @Test
+  public void testCreateAnalysisEngineWithPrioritizedTypes() throws UIMAException {
+    String[] prioritizedTypeNames = new String[] { "org.apache.uima.fit.type.Token",
+        "org.apache.uima.fit.type.Sentence" };
+    AnalysisEngine engine = AnalysisEngineFactory.createPrimitive(
+            org.apache.uima.fit.component.NoOpAnnotator.class, typeSystemDescription,
+            prioritizedTypeNames, (Object[]) null);
+
+    typePriorities = engine.getAnalysisEngineMetaData().getTypePriorities();
+    assertEquals(1, typePriorities.getPriorityLists().length);
+    TypePriorityList typePriorityList = typePriorities.getPriorityLists()[0];
+    assertEquals(2, typePriorityList.getTypes().length);
+    assertEquals("org.apache.uima.fit.type.Token", typePriorityList.getTypes()[0]);
+    assertEquals("org.apache.uima.fit.type.Sentence", typePriorityList.getTypes()[1]);
+
+    jCas = engine.newJCas();
+    tokenBuilder.buildTokens(jCas, "word");
+    FSIterator<Annotation> tokensInSentence = jCas.getAnnotationIndex().subiterator(
+            JCasUtil.selectByIndex(jCas, Sentence.class, 0));
+    assertFalse(tokensInSentence.hasNext());
+
+    prioritizedTypeNames = new String[] { "org.apache.uima.fit.type.Sentence",
+        "org.apache.uima.fit.type.Token" };
+    engine = AnalysisEngineFactory.createPrimitive(
+            org.apache.uima.fit.component.NoOpAnnotator.class, typeSystemDescription,
+            prioritizedTypeNames, (Object[]) null);
+    jCas = engine.newJCas();
+    tokenBuilder.buildTokens(jCas, "word");
+    tokensInSentence = jCas.getAnnotationIndex().subiterator(
+            JCasUtil.selectByIndex(jCas, Sentence.class, 0));
+    assertTrue(tokensInSentence.hasNext());
+
+  }
+
+  @Test
+  public void testAggregate() throws UIMAException {
+    tokenBuilder.buildTokens(jCas, "Anyone up for a game of Foosball?");
+
+    SofaMapping[] sofaMappings = new SofaMapping[] {
+        SofaMappingFactory.createSofaMapping(Annotator1.class, ViewNames.PARENTHESES_VIEW, "A"),
+        SofaMappingFactory.createSofaMapping(Annotator2.class, ViewNames.SORTED_VIEW, "B"),
+        SofaMappingFactory.createSofaMapping(Annotator2.class, ViewNames.SORTED_PARENTHESES_VIEW,
+                "C"),
+        SofaMappingFactory.createSofaMapping(Annotator2.class, ViewNames.PARENTHESES_VIEW, "A"),
+        SofaMappingFactory.createSofaMapping(Annotator3.class, ViewNames.INITIAL_VIEW, "B") };
+
+    List<Class<? extends AnalysisComponent>> primitiveAEClasses = new ArrayList<Class<? extends AnalysisComponent>>();
+    primitiveAEClasses.add(Annotator1.class);
+    primitiveAEClasses.add(Annotator2.class);
+    primitiveAEClasses.add(Annotator3.class);
+
+    AnalysisEngine aggregateEngine = AnalysisEngineFactory.createAggregate(primitiveAEClasses,
+            typeSystemDescription, null, sofaMappings);
+
+    aggregateEngine.process(jCas);
+
+    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());
+
+  }
+
+  @Test
+  public void testAggregate2() throws UIMAException, IOException {
+    tokenBuilder.buildTokens(jCas, "Anyone up for a game of Foosball?");
+
+    SofaMapping[] sofaMappings = new SofaMapping[] {
+        SofaMappingFactory.createSofaMapping("ann1", ViewNames.PARENTHESES_VIEW, "A"),
+        SofaMappingFactory.createSofaMapping("ann2", ViewNames.SORTED_VIEW, "B"),
+        SofaMappingFactory.createSofaMapping("ann2", ViewNames.SORTED_PARENTHESES_VIEW, "C"),
+        SofaMappingFactory.createSofaMapping("ann2", ViewNames.PARENTHESES_VIEW, "A"),
+        SofaMappingFactory.createSofaMapping("ann3", ViewNames.INITIAL_VIEW, "B") };
+
+    List<AnalysisEngineDescription> primitiveDescriptors = new ArrayList<AnalysisEngineDescription>();
+    primitiveDescriptors.add(AnalysisEngineFactory.createPrimitiveDescription(Annotator1.class,
+            typeSystemDescription, (TypePriorities) null));
+    primitiveDescriptors.add(AnalysisEngineFactory.createPrimitiveDescription(Annotator2.class,
+            typeSystemDescription, (TypePriorities) null));
+    primitiveDescriptors.add(AnalysisEngineFactory.createPrimitiveDescription(Annotator3.class,
+            typeSystemDescription, (TypePriorities) null));
+
+    List<String> componentNames = Arrays.asList("ann1", "ann2", "ann3");
+
+    AnalysisEngine aggregateEngine = AnalysisEngineFactory.createAggregate(primitiveDescriptors,
+            componentNames, typeSystemDescription, null, sofaMappings);
+
+    aggregateEngine.process(jCas);
+
+    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());
+
+    JCasFactory.loadJCas(jCas, "src/test/resources/data/docs/test.xmi");
+    AnalysisEngine ae1 = AnalysisEngineFactory.createPrimitive(NoOpAnnotator.class,
+            typeSystemDescription);
+
+    SimplePipeline.runPipeline(jCas, ae1, aggregateEngine);
+
+  }
+
+  @Test
+  public void testReflectPrimitiveDescription() throws ResourceInitializationException {
+    AnalysisEngineDescription aed = AnalysisEngineFactory.createPrimitiveDescription(
+            Annotator2.class, typeSystemDescription, typePriorities);
+    Capability[] capabilities = aed.getAnalysisEngineMetaData().getCapabilities();
+    assertEquals(1, capabilities.length);
+    String[] inputSofas = capabilities[0].getInputSofas();
+    assertArrayEquals(new String[] { CAS.NAME_DEFAULT_SOFA, ViewNames.PARENTHESES_VIEW },
+            inputSofas);
+    String[] outputSofas = capabilities[0].getOutputSofas();
+    assertArrayEquals(new String[] { ViewNames.SORTED_VIEW, ViewNames.SORTED_PARENTHESES_VIEW },
+            outputSofas);
+
+    aed = AnalysisEngineFactory.createPrimitiveDescription(ParameterizedAE.class,
+            typeSystemDescription, typePriorities);
+    capabilities = aed.getAnalysisEngineMetaData().getCapabilities();
+    assertEquals(1, capabilities.length);
+    inputSofas = capabilities[0].getInputSofas();
+    assertArrayEquals(new String[] { CAS.NAME_DEFAULT_SOFA }, inputSofas);
+    outputSofas = capabilities[0].getOutputSofas();
+    assertArrayEquals(new String[] {}, outputSofas);
+
+    testConfigurationParameter(aed, ParameterizedAE.PARAM_STRING_1,
+            ConfigurationParameter.TYPE_STRING, true, false, "pineapple");
+    testConfigurationParameter(aed, ParameterizedAE.PARAM_STRING_2,
+            ConfigurationParameter.TYPE_STRING, false, true, new String[] { "coconut", "mango" });
+    testConfigurationParameter(aed, ParameterizedAE.PARAM_STRING_3,
+            ConfigurationParameter.TYPE_STRING, false, false, null);
+    testConfigurationParameter(aed, ParameterizedAE.PARAM_STRING_4,
+            ConfigurationParameter.TYPE_STRING, true, true, new String[] { "apple" });
+    testConfigurationParameter(aed, ParameterizedAE.PARAM_STRING_5,
+            ConfigurationParameter.TYPE_STRING, false, true, new String[] { "" });
+
+    testConfigurationParameter(aed, ParameterizedAE.PARAM_BOOLEAN_1,
+            ConfigurationParameter.TYPE_BOOLEAN, true, false, Boolean.FALSE);
+    testConfigurationParameter(aed, ParameterizedAE.PARAM_BOOLEAN_2,
+            ConfigurationParameter.TYPE_BOOLEAN, false, false, null);
+    testConfigurationParameter(aed, ParameterizedAE.PARAM_BOOLEAN_3,
+            ConfigurationParameter.TYPE_BOOLEAN, true, true, new Boolean[] { true, true, false });
+    testConfigurationParameter(aed, ParameterizedAE.PARAM_BOOLEAN_4,
+            ConfigurationParameter.TYPE_BOOLEAN, true, true, new Boolean[] { true, false, true });
+    testConfigurationParameter(aed, ParameterizedAE.PARAM_BOOLEAN_5,
+            ConfigurationParameter.TYPE_BOOLEAN, true, true, new Boolean[] { false });
+
+    testConfigurationParameter(aed, ParameterizedAE.PARAM_INT_1,
+            ConfigurationParameter.TYPE_INTEGER, true, false, 0);
+    testConfigurationParameter(aed, ParameterizedAE.PARAM_INT_2,
+            ConfigurationParameter.TYPE_INTEGER, false, false, 42);
+    testConfigurationParameter(aed, ParameterizedAE.PARAM_INT_3,
+            ConfigurationParameter.TYPE_INTEGER, false, true, new Integer[] { 42, 111 });
+    testConfigurationParameter(aed, ParameterizedAE.PARAM_INT_4,
+            ConfigurationParameter.TYPE_INTEGER, true, true, new Integer[] { 2 });
+
+    testConfigurationParameter(aed, ParameterizedAE.PARAM_FLOAT_1,
+            ConfigurationParameter.TYPE_FLOAT, true, false, 0.0f);
+    testConfigurationParameter(aed, ParameterizedAE.PARAM_FLOAT_2,
+            ConfigurationParameter.TYPE_FLOAT, false, false, 3.1415f);
+    testConfigurationParameter(aed, ParameterizedAE.PARAM_FLOAT_3,
+            ConfigurationParameter.TYPE_FLOAT, true, false, null);
+    testConfigurationParameter(aed, ParameterizedAE.PARAM_FLOAT_4,
+            ConfigurationParameter.TYPE_FLOAT, false, true, null);
+    testConfigurationParameter(aed, ParameterizedAE.PARAM_FLOAT_5,
+            ConfigurationParameter.TYPE_FLOAT, false, true,
+            new Float[] { 0.0f, 3.1415f, 2.7182818f });
+    testConfigurationParameter(aed, ParameterizedAE.PARAM_FLOAT_6,
+            ConfigurationParameter.TYPE_FLOAT, true, true, null);
+    testConfigurationParameter(aed, ParameterizedAE.PARAM_FLOAT_7,
+            ConfigurationParameter.TYPE_FLOAT, true, true, new Float[] { 1.1111f, 2.2222f, 3.333f });
+
+    AnalysisEngine ae = AnalysisEngineFactory
+            .createPrimitive(aed, ParameterizedAE.PARAM_FLOAT_3, 3.1415f,
+                    ParameterizedAE.PARAM_FLOAT_6, new Float[] { 2.71828183f }, "file2", "foo/bar");
+    Object paramValue = ae.getAnalysisEngineMetaData().getConfigurationParameterSettings()
+            .getParameterValue(ParameterizedAE.PARAM_FLOAT_3);
+    assertEquals(paramValue, 3.1415f);
+    paramValue = ae.getAnalysisEngineMetaData().getConfigurationParameterSettings()
+            .getParameterValue(ParameterizedAE.PARAM_FLOAT_6);
+    assertEquals(((Float[]) paramValue)[0].floatValue(), 2.71828183f, 0.00001f);
+
+  }
+
+  private void testConfigurationParameter(AnalysisEngineDescription aed, String parameterName,
+          String parameterType, boolean mandatory, boolean multiValued, Object parameterValue) {
+    ConfigurationParameterDeclarations cpd = aed.getMetaData()
+            .getConfigurationParameterDeclarations();
+    ConfigurationParameter cp = cpd.getConfigurationParameter(null, parameterName);
+    assertNotNull("Parameter [" + parameterName + "] does not exist!", cp);
+    assertEquals("Parameter [" + parameterName + "] has wrong name", parameterName, cp.getName());
+    assertEquals("Parameter [" + parameterName + "] has wrong type", parameterType, cp.getType());
+    assertEquals("Parameter [" + parameterName + "] has wrong mandatory flag", mandatory,
+            cp.isMandatory());
+    assertEquals("Parameter [" + parameterName + "] has wrong multi-value flag", multiValued,
+            cp.isMultiValued());
+    ConfigurationParameterSettings cps = aed.getMetaData().getConfigurationParameterSettings();
+    Object actualValue = cps.getParameterValue(parameterName);
+    if (parameterValue == null) {
+      assertNull(actualValue);
+    } else if (!multiValued) {
+      if (parameterType.equals(ConfigurationParameter.TYPE_FLOAT)) {
+        assertEquals(((Float) parameterValue).floatValue(), ((Float) actualValue).floatValue(),
+                .001f);
+      } else {
+        assertEquals(parameterValue, actualValue);
+      }
+    } else {
+      assertEquals(Array.getLength(parameterValue), Array.getLength(actualValue));
+      for (int i = 0; i < Array.getLength(parameterValue); ++i) {
+        assertEquals(Array.get(parameterValue, i), Array.get(actualValue, i));
+      }
+    }
+
+  }
+
+  @Test
+  public void testPrimitiveDescription() throws ResourceInitializationException {
+
+    AnalysisEngineDescription aed = AnalysisEngineFactory.createPrimitiveDescription(
+            NoOpAnnotator.class, typeSystemDescription);
+    assertNotNull(aed);
+    // assertEquals("org.apache.uima.fit.type.TypeSystem",
+    // aed.getAnalysisEngineMetaData().getTypeSystem().getImports()[0].getName());
+  }
+
+  /**
+   * Test that a {@link OperationalProperties} annotation on an ancestor of a analysis engine class
+   * is found and taken into account.
+   */
+  @Test
+  public void testComponentAnnotationOnAncestor() throws Exception {
+    AnalysisEngineDescription desc1 = AnalysisEngineFactory.createPrimitiveDescription(
+            PristineAnnotatorClass.class, (Object[]) null);
+    assertTrue(
+            "Multiple deployment should be allowed on " + desc1.getAnnotatorImplementationName(),
+            desc1.getAnalysisEngineMetaData().getOperationalProperties()
+                    .isMultipleDeploymentAllowed());
+
+    AnalysisEngineDescription desc2 = AnalysisEngineFactory.createPrimitiveDescription(
+            UnannotatedAnnotatorClass.class, (Object[]) null);
+    assertFalse(
+            "Multiple deployment should be prohibited on " + desc2.getAnnotatorImplementationName(),
+            desc2.getAnalysisEngineMetaData().getOperationalProperties()
+                    .isMultipleDeploymentAllowed());
+
+    AnalysisEngineDescription desc3 = AnalysisEngineFactory.createPrimitiveDescription(
+            AnnotatedAnnotatorClass.class, (Object[]) null);
+    assertTrue(
+            "Multiple deployment should be allowed  on " + desc3.getAnnotatorImplementationName(),
+            desc3.getAnalysisEngineMetaData().getOperationalProperties()
+                    .isMultipleDeploymentAllowed());
+  }
+
+  /*
+   * This test case illustrates that UIMA throws an exception unless the multipleDeploymentAllowed
+   * flag is properly set to false when mixing multi-deployment and non-multi-deployment AEs.
+   */
+  @Test(expected = ResourceInitializationException.class)
+  public void testAAEMultipleDeploymentPolicyProblem() throws Exception {
+    {
+      AnalysisEngineDescription desc1 = AnalysisEngineFactory.createPrimitiveDescription(
+              PristineAnnotatorClass.class, (Object[]) null);
+      assertTrue(
+              "Multiple deployment should be allowed on " + desc1.getAnnotatorImplementationName(),
+              desc1.getAnalysisEngineMetaData().getOperationalProperties()
+                      .isMultipleDeploymentAllowed());
+
+      AnalysisEngineDescription desc2 = AnalysisEngineFactory.createPrimitiveDescription(
+              UnannotatedAnnotatorClass.class, (Object[]) null);
+      assertFalse(
+              "Multiple deployment should be prohibited on "
+                      + desc2.getAnnotatorImplementationName(), desc2.getAnalysisEngineMetaData()
+                      .getOperationalProperties().isMultipleDeploymentAllowed());
+
+      AnalysisEngineDescription aae = AnalysisEngineFactory
+              .createAggregateDescription(desc1, desc2);
+      aae.getAnalysisEngineMetaData().getOperationalProperties().setMultipleDeploymentAllowed(true);
+      UIMAFramework.produceAnalysisEngine(aae);
+    }
+  }
+
+  @Test
+  public void testAAEMultipleDeploymentPolicy() throws Exception {
+    {
+      AnalysisEngineDescription desc1 = AnalysisEngineFactory.createPrimitiveDescription(
+              PristineAnnotatorClass.class, (Object[]) null);
+      assertTrue(
+              "Multiple deployment should be allowed on " + desc1.getAnnotatorImplementationName(),
+              desc1.getAnalysisEngineMetaData().getOperationalProperties()
+                      .isMultipleDeploymentAllowed());
+
+      AnalysisEngineDescription desc2 = AnalysisEngineFactory.createPrimitiveDescription(
+              UnannotatedAnnotatorClass.class, (Object[]) null);
+      assertFalse(
+              "Multiple deployment should be prohibited on "
+                      + desc2.getAnnotatorImplementationName(), desc2.getAnalysisEngineMetaData()
+                      .getOperationalProperties().isMultipleDeploymentAllowed());
+
+      AnalysisEngineDescription aae = AnalysisEngineFactory
+              .createAggregateDescription(desc1, desc2);
+      UIMAFramework.produceAnalysisEngine(aae);
+
+      assertFalse("Multiple deployment should be prohibited on AAE", aae
+              .getAnalysisEngineMetaData().getOperationalProperties().isMultipleDeploymentAllowed());
+    }
+
+    {
+      AnalysisEngineDescription desc1 = AnalysisEngineFactory.createPrimitiveDescription(
+              PristineAnnotatorClass.class, (Object[]) null);
+      assertTrue(
+              "Multiple deployment should be allowed on " + desc1.getAnnotatorImplementationName(),
+              desc1.getAnalysisEngineMetaData().getOperationalProperties()
+                      .isMultipleDeploymentAllowed());
+
+      AnalysisEngineDescription desc3 = AnalysisEngineFactory.createPrimitiveDescription(
+              AnnotatedAnnotatorClass.class, (Object[]) null);
+      assertTrue(
+              "Multiple deployment should be allowed  on " + desc3.getAnnotatorImplementationName(),
+              desc3.getAnalysisEngineMetaData().getOperationalProperties()
+                      .isMultipleDeploymentAllowed());
+
+      AnalysisEngineDescription aae = AnalysisEngineFactory
+              .createAggregateDescription(desc1, desc3);
+      UIMAFramework.produceAnalysisEngine(aae);
+
+      assertTrue("Multiple deployment should be prohibited on AAE", aae.getAnalysisEngineMetaData()
+              .getOperationalProperties().isMultipleDeploymentAllowed());
+    }
+  }
+
+  public static class PristineAnnotatorClass extends JCasAnnotator_ImplBase {
+    @Override
+    public void process(JCas aJCas) throws AnalysisEngineProcessException {
+      // Dummy
+    }
+  }
+
+  @org.apache.uima.fit.descriptor.OperationalProperties(multipleDeploymentAllowed = false)
+  public static class AncestorClass extends JCasAnnotator_ImplBase {
+    @Override
+    public void process(JCas aJCas) throws AnalysisEngineProcessException {
+      // Dummy
+    }
+  }
+
+  public static class UnannotatedAnnotatorClass extends AncestorClass {
+    // Dummy
+  }
+
+  @org.apache.uima.fit.descriptor.OperationalProperties(multipleDeploymentAllowed = true)
+  public static class AnnotatedAnnotatorClass extends UnannotatedAnnotatorClass {
+    // Vessel for the annotation
+  }
+
+  @Test
+  public void testIssue5a() throws ResourceInitializationException {
+    AnalysisEngineFactory.createPrimitiveDescription(ParameterizedAE.class, typeSystemDescription);
+  }
+
+  @Test(expected = ResourceInitializationException.class)
+  public void testIssue5b() throws ResourceInitializationException {
+    AnalysisEngineFactory.createPrimitive(ParameterizedAE.class, typeSystemDescription);
+  }
 
 }

Modified: uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/factory/AnnotationFactoryTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/factory/AnnotationFactoryTest.java?rev=1431721&r1=1431720&r2=1431721&view=diff
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/factory/AnnotationFactoryTest.java (original)
+++ uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/factory/AnnotationFactoryTest.java Thu Jan 10 23:12:33 2013
@@ -32,24 +32,23 @@ import org.junit.Test;
 
 public class AnnotationFactoryTest extends ComponentTestBase {
 
-	@Test
-	public void testCreateAnnotation() throws UIMAException {
-		Token token = AnnotationFactory.createAnnotation(jCas, 0, 10, Token.class);
-		assertEquals(0, token.getBegin());
-		assertEquals(10, token.getEnd());
+  @Test
+  public void testCreateAnnotation() throws UIMAException {
+    Token token = AnnotationFactory.createAnnotation(jCas, 0, 10, Token.class);
+    assertEquals(0, token.getBegin());
+    assertEquals(10, token.getEnd());
 
-		Sentence sentence = AnnotationFactory.createAnnotation(jCas, 0, 10, Sentence.class);
-		assertEquals(0, sentence.getBegin());
-		assertEquals(10, sentence.getEnd());
+    Sentence sentence = AnnotationFactory.createAnnotation(jCas, 0, 10, Sentence.class);
+    assertEquals(0, sentence.getBegin());
+    assertEquals(10, sentence.getEnd());
 
-		UIMAException ue = null;
-		try {
-			AnnotationFactory.createAnnotation(null, 0, 10, Sentence.class);
-		}
-		catch (UIMAException e) {
-			ue = e;
-		}
-		assertNotNull(ue);
+    UIMAException ue = null;
+    try {
+      AnnotationFactory.createAnnotation(null, 0, 10, Sentence.class);
+    } catch (UIMAException e) {
+      ue = e;
+    }
+    assertNotNull(ue);
 
-	}
+  }
 }

Modified: uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/factory/CollectionReaderFactoryExternalResourceTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/factory/CollectionReaderFactoryExternalResourceTest.java?rev=1431721&r1=1431720&r2=1431721&view=diff
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/factory/CollectionReaderFactoryExternalResourceTest.java (original)
+++ uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/factory/CollectionReaderFactoryExternalResourceTest.java Thu Jan 10 23:12:33 2013
@@ -36,7 +36,6 @@
  * under the License.
  */
 
-
 package org.apache.uima.fit.factory;
 
 import static org.apache.uima.fit.factory.CollectionReaderFactory.createCollectionReader;
@@ -58,34 +57,35 @@ import org.junit.Test;
 /**
  */
 public class CollectionReaderFactoryExternalResourceTest {
-	@Test
-	public void testAutoExternalResourceBinding() throws UIMAException, IOException {
-		CollectionReader reader = createCollectionReader(
-				TestReader.class,
-				TestReader.PARAM_RESOURCE,
-				createExternalResourceDescription(TestExternalResource.class,
-						TestExternalResource.PARAM_VALUE, TestExternalResource.EXPECTED_VALUE));
-
-		reader.hasNext();
-	}
-
-	public static class TestReader extends CasCollectionReader_ImplBase {
-		public final static String PARAM_RESOURCE = "resource";
-		@ExternalResource(key = PARAM_RESOURCE)
-		private TestExternalResource resource;
-
-		public boolean hasNext() throws IOException, CollectionException {
-			assertNotNull(resource);
-			resource.assertConfiguredOk();
-			return false;
-		}
-		
-		public void getNext(CAS aCAS) throws IOException, CollectionException {
-			// This is never called
-		}
-		
-		public Progress[] getProgress() {
-			return new Progress[0];
-		}
-	}
+  @Test
+  public void testAutoExternalResourceBinding() throws UIMAException, IOException {
+    CollectionReader reader = createCollectionReader(
+            TestReader.class,
+            TestReader.PARAM_RESOURCE,
+            createExternalResourceDescription(TestExternalResource.class,
+                    TestExternalResource.PARAM_VALUE, TestExternalResource.EXPECTED_VALUE));
+
+    reader.hasNext();
+  }
+
+  public static class TestReader extends CasCollectionReader_ImplBase {
+    public final static String PARAM_RESOURCE = "resource";
+
+    @ExternalResource(key = PARAM_RESOURCE)
+    private TestExternalResource resource;
+
+    public boolean hasNext() throws IOException, CollectionException {
+      assertNotNull(resource);
+      resource.assertConfiguredOk();
+      return false;
+    }
+
+    public void getNext(CAS aCAS) throws IOException, CollectionException {
+      // This is never called
+    }
+
+    public Progress[] getProgress() {
+      return new Progress[0];
+    }
+  }
 }

Modified: uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/factory/CollectionReaderFactoryTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/factory/CollectionReaderFactoryTest.java?rev=1431721&r1=1431720&r2=1431721&view=diff
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/factory/CollectionReaderFactoryTest.java (original)
+++ uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/factory/CollectionReaderFactoryTest.java Thu Jan 10 23:12:33 2013
@@ -42,87 +42,86 @@ import org.junit.Test;
 
 public class CollectionReaderFactoryTest extends ComponentTestBase {
 
-	@Test
-	public void testCreateCollectionReader() throws UIMAException, IOException {
+  @Test
+  public void testCreateCollectionReader() throws UIMAException, IOException {
 
-		CollectionReader reader = CollectionReaderFactory.createCollectionReader(
-				SingleFileXReader.class, typeSystemDescription, SingleFileXReader.PARAM_FILE_NAME,
-				"src/test/resources/data/docs/test.xmi", SingleFileXReader.PARAM_XML_SCHEME,
-				SingleFileXReader.XMI);
-
-		JCasIterable jCasIterable = new JCasIterable(reader, typeSystemDescription);
-		jCas = jCasIterable.next();
-		assertNotNull(jCas);
-		assertEquals("Me and all my friends are non-conformists.", jCas.getDocumentText());
-		Token token = JCasUtil.selectByIndex(jCas, Token.class, 2);
-		assertEquals("all", token.getCoveredText());
-		assertEquals("A", token.getPos());
-		assertEquals("all", token.getStem());
-
-		reader = CollectionReaderFactory.createCollectionReader(
-				"org.apache.uima.fit.factory.testCrs.SingleFileXReader", SingleFileXReader.PARAM_FILE_NAME,
-				"src/test/resources/data/docs/test.xmi", SingleFileXReader.PARAM_XML_SCHEME,
-				SingleFileXReader.XMI);
-
-		jCasIterable = new JCasIterable(reader, typeSystemDescription);
-		jCas = jCasIterable.next();
-		assertNotNull(jCas);
-		assertEquals("Me and all my friends are non-conformists.", jCas.getDocumentText());
-		token = JCasUtil.selectByIndex(jCas, Token.class, 9);
-		assertEquals(".", token.getCoveredText());
-		assertEquals(".", token.getPos());
-		assertEquals(".", token.getStem());
-
-		reader = CollectionReaderFactory.createCollectionReaderFromPath(
-				"src/test/resources/org/apache/uima/fit/factory/testCrs/SingleFileXReader.xml",
-				SingleFileXReader.PARAM_FILE_NAME, "src/test/resources/data/docs/test.xmi",
-				SingleFileXReader.PARAM_XML_SCHEME, SingleFileXReader.XMI);
-
-		jCasIterable = new JCasIterable(reader, typeSystemDescription);
-		jCas = jCasIterable.next();
-		assertNotNull(jCas);
-		assertEquals("Me and all my friends are non-conformists.", jCas.getDocumentText());
-		token = JCasUtil.selectByIndex(jCas, Token.class, 4);
-		assertEquals("friends", token.getCoveredText());
-		assertEquals("F", token.getPos());
-		assertEquals("friend", token.getStem());
-
-	}
-
-	@Test
-	public void testExceptions() {
-		ResourceInitializationException rie = null;
-		try {
-			CollectionReaderFactory.createCollectionReader(TestCR.class, (Object[]) null);
-		}
-		catch (ResourceInitializationException e) {
-			rie = e;
-		}
-		assertNotNull(rie);
-	}
-
-	private class TestCR extends CollectionReader_ImplBase {
-
-		private TestCR() {
-			// do not instantiate
-		}
-
-		public void getNext(CAS acas) throws IOException, CollectionException {
-			// TODO Auto-generated method stub
-		}
-
-		public void close() throws IOException {
-			// TODO Auto-generated method stub
-		}
-
-		public Progress[] getProgress() {
-			// TODO Auto-generated method stub
-			return null;
-		}
-
-		public boolean hasNext() throws IOException, CollectionException {
-			// TODO Auto-generated method stub
-			return false;
-		}
-	}
+    CollectionReader reader = CollectionReaderFactory.createCollectionReader(
+            SingleFileXReader.class, typeSystemDescription, SingleFileXReader.PARAM_FILE_NAME,
+            "src/test/resources/data/docs/test.xmi", SingleFileXReader.PARAM_XML_SCHEME,
+            SingleFileXReader.XMI);
+
+    JCasIterable jCasIterable = new JCasIterable(reader, typeSystemDescription);
+    jCas = jCasIterable.next();
+    assertNotNull(jCas);
+    assertEquals("Me and all my friends are non-conformists.", jCas.getDocumentText());
+    Token token = JCasUtil.selectByIndex(jCas, Token.class, 2);
+    assertEquals("all", token.getCoveredText());
+    assertEquals("A", token.getPos());
+    assertEquals("all", token.getStem());
+
+    reader = CollectionReaderFactory.createCollectionReader(
+            "org.apache.uima.fit.factory.testCrs.SingleFileXReader",
+            SingleFileXReader.PARAM_FILE_NAME, "src/test/resources/data/docs/test.xmi",
+            SingleFileXReader.PARAM_XML_SCHEME, SingleFileXReader.XMI);
+
+    jCasIterable = new JCasIterable(reader, typeSystemDescription);
+    jCas = jCasIterable.next();
+    assertNotNull(jCas);
+    assertEquals("Me and all my friends are non-conformists.", jCas.getDocumentText());
+    token = JCasUtil.selectByIndex(jCas, Token.class, 9);
+    assertEquals(".", token.getCoveredText());
+    assertEquals(".", token.getPos());
+    assertEquals(".", token.getStem());
+
+    reader = CollectionReaderFactory.createCollectionReaderFromPath(
+            "src/test/resources/org/apache/uima/fit/factory/testCrs/SingleFileXReader.xml",
+            SingleFileXReader.PARAM_FILE_NAME, "src/test/resources/data/docs/test.xmi",
+            SingleFileXReader.PARAM_XML_SCHEME, SingleFileXReader.XMI);
+
+    jCasIterable = new JCasIterable(reader, typeSystemDescription);
+    jCas = jCasIterable.next();
+    assertNotNull(jCas);
+    assertEquals("Me and all my friends are non-conformists.", jCas.getDocumentText());
+    token = JCasUtil.selectByIndex(jCas, Token.class, 4);
+    assertEquals("friends", token.getCoveredText());
+    assertEquals("F", token.getPos());
+    assertEquals("friend", token.getStem());
+
+  }
+
+  @Test
+  public void testExceptions() {
+    ResourceInitializationException rie = null;
+    try {
+      CollectionReaderFactory.createCollectionReader(TestCR.class, (Object[]) null);
+    } catch (ResourceInitializationException e) {
+      rie = e;
+    }
+    assertNotNull(rie);
+  }
+
+  private class TestCR extends CollectionReader_ImplBase {
+
+    private TestCR() {
+      // do not instantiate
+    }
+
+    public void getNext(CAS acas) throws IOException, CollectionException {
+      // TODO Auto-generated method stub
+    }
+
+    public void close() throws IOException {
+      // TODO Auto-generated method stub
+    }
+
+    public Progress[] getProgress() {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    public boolean hasNext() throws IOException, CollectionException {
+      // TODO Auto-generated method stub
+      return false;
+    }
+  }
 }

Modified: uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/factory/ConfigurationParameterFactoryTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/factory/ConfigurationParameterFactoryTest.java?rev=1431721&r1=1431720&r2=1431721&view=diff
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/factory/ConfigurationParameterFactoryTest.java (original)
+++ uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/factory/ConfigurationParameterFactoryTest.java Thu Jan 10 23:12:33 2013
@@ -38,185 +38,184 @@ import org.junit.Test;
 
 public class ConfigurationParameterFactoryTest {
 
-	public static final String PARAM_DOUBLE_1 = "org.uimafit.factory.ConfigurationParameterFactoryTest.PARAM_STRING_1";
-	@ConfigurationParameter(name = PARAM_DOUBLE_1, mandatory = true, defaultValue = "3.1415")
-	private Double double1;
-
-	public static final String PARAM_DOUBLE_2 = "org.uimafit.factory.ConfigurationParameterFactoryTest.PARAM_DOUBLE_2";
-	@ConfigurationParameter(name = PARAM_DOUBLE_2, mandatory = true, defaultValue = "3.3333")
-	private Double[] double2;
-	private Double[] double3;
-
-	public Double[] getDouble2() {
-		return double2;
-	}
-
-	public void setDouble2(Double[] double2) {
-		this.double2 = double2;
-	}
-
-	public Double[] getDouble3() {
-		return double3;
-	}
-
-	public void setDouble3(Double[] double3) {
-		this.double3 = double3;
-	}
-
-	public Double getDouble1() {
-		return double1;
-	}
-
-	public void setDouble1(Double double1) {
-		this.double1 = double1;
-	}
-
-	@Test
-	public void test1() throws SecurityException, NoSuchFieldException {
-		Float value = (Float) ConfigurationParameterFactory
-				.getDefaultValue(ConfigurationParameterFactoryTest.class
-						.getDeclaredField("double1"));
-		assertEquals(3.1415, value, 1e-4);
-
-		Float[] values = (Float[]) ConfigurationParameterFactory
-				.getDefaultValue(ConfigurationParameterFactoryTest.class
-						.getDeclaredField("double2"));
-		assertEquals(1, values.length);
-		assertEquals(3.3333, values[0], 1e-4);
-
-		IllegalArgumentException iae = null;
-		try {
-			ConfigurationParameterFactory.getDefaultValue(ConfigurationParameterFactoryTest.class
-					.getDeclaredField("double3"));
-		}
-		catch (IllegalArgumentException e) {
-			iae = e;
-		}
-		assertNotNull(iae);
-
-	}
-
-	@Test(expected = IllegalArgumentException.class)
-	public void test2() throws Exception {
-		ConfigurationParameterFactory
-				.createPrimitiveParameter(ConfigurationParameterFactoryTest.class
-						.getDeclaredField("double3"));
-	}
-
-	@ConfigurationParameter
-	public String param1;
-
-	@Test
-	public void testParam1() throws Exception, NoSuchFieldException {
-		Field field1 = ConfigurationParameterFactoryTest.class.getDeclaredField("param1");
-		org.apache.uima.resource.metadata.ConfigurationParameter cp = ConfigurationParameterFactory
-				.createPrimitiveParameter(field1);
-		assertEquals("org.apache.uima.fit.factory.ConfigurationParameterFactoryTest.param1", cp.getName());
-		assertEquals(org.apache.uima.resource.metadata.ConfigurationParameter.TYPE_STRING,
-				cp.getType());
-		assertEquals("", cp.getDescription());
-		assertFalse(cp.isMandatory());
-		assertFalse(cp.isMultiValued());
-		assertNull(ConfigurationParameterFactory.getDefaultValue(field1));
-	}
-
-	@SuppressWarnings("unused")
-	@ConfigurationParameter(name = "my-boolean-param", mandatory = true, description = "my description", defaultValue = {
-			"false", "false", "true" })
-	private boolean[] param2;
-
-	@Test
-	public void testParam2() throws Exception, NoSuchFieldException {
-		Field field2 = ConfigurationParameterFactoryTest.class.getDeclaredField("param2");
-		org.apache.uima.resource.metadata.ConfigurationParameter cp = ConfigurationParameterFactory
-				.createPrimitiveParameter(field2);
-		assertEquals("my-boolean-param", cp.getName());
-		assertEquals(org.apache.uima.resource.metadata.ConfigurationParameter.TYPE_BOOLEAN,
-				cp.getType());
-		assertEquals("my description", cp.getDescription());
-		assertTrue(cp.isMandatory());
-		assertTrue(cp.isMultiValued());
-		Boolean[] defaultValue = (Boolean[]) ConfigurationParameterFactory.getDefaultValue(field2);
-		assertFalse(defaultValue[0]);
-		assertFalse(defaultValue[1]);
-		assertTrue(defaultValue[2]);
-	}
-
-	@SuppressWarnings("unused")
-	@ConfigurationParameter
-	private Integer param3;
-
-	@Test
-	public void testParam3() throws Exception, NoSuchFieldException {
-		Field field3 = ConfigurationParameterFactoryTest.class.getDeclaredField("param3");
-		org.apache.uima.resource.metadata.ConfigurationParameter cp = ConfigurationParameterFactory
-				.createPrimitiveParameter(field3);
-		assertEquals("org.apache.uima.fit.factory.ConfigurationParameterFactoryTest.param3", cp.getName());
-		assertEquals(org.apache.uima.resource.metadata.ConfigurationParameter.TYPE_INTEGER,
-				cp.getType());
-		assertEquals("", cp.getDescription());
-		assertFalse(cp.isMandatory());
-		assertFalse(cp.isMultiValued());
-		assertNull(ConfigurationParameterFactory.getDefaultValue(field3));
-	}
-
-	private static class CPFT {
-		@SuppressWarnings("unused")
-		@ConfigurationParameter(defaultValue = { "a", "b", "c" })
-		private String[] param4;
-	}
-
-	@Test
-	public void testParam4() throws Exception, NoSuchFieldException {
-		Field field4 = CPFT.class.getDeclaredField("param4");
-		org.apache.uima.resource.metadata.ConfigurationParameter cp = ConfigurationParameterFactory
-				.createPrimitiveParameter(field4);
-		assertEquals("org.apache.uima.fit.factory.ConfigurationParameterFactoryTest$CPFT.param4",
-				cp.getName());
-		assertEquals(org.apache.uima.resource.metadata.ConfigurationParameter.TYPE_STRING,
-				cp.getType());
-		assertEquals("", cp.getDescription());
-		assertFalse(cp.isMandatory());
-		assertTrue(cp.isMultiValued());
-		assertArrayEquals(new String[] { "a", "b", "c" },
-				(String[]) ConfigurationParameterFactory.getDefaultValue(field4));
-	}
-
-	@SuppressWarnings("unused")
-	@ConfigurationParameter(defaultValue = { "data/foo", "bar" })
-	private List<File> fileList;
-
-	@Test
-	public void testFileList() throws Exception {
-		Field field = this.getClass().getDeclaredField("fileList");
-		org.apache.uima.resource.metadata.ConfigurationParameter param;
-		param = ConfigurationParameterFactory.createPrimitiveParameter(field);
-		assertEquals(this.getClass().getName() + ".fileList", param.getName());
-		assertEquals(org.apache.uima.resource.metadata.ConfigurationParameter.TYPE_STRING,
-				param.getType());
-		assertEquals("", param.getDescription());
-		assertFalse(param.isMandatory());
-		String[] expected = new String[] { "data/foo", "bar" };
-		String[] actual = (String[]) ConfigurationParameterFactory.getDefaultValue(field);
-		assertArrayEquals(expected, actual);
-	}
-
-	@SuppressWarnings("unused")
-	@ConfigurationParameter(defaultValue = { "5", "5", "4", "3" })
-	private Set<String> stringSet;
-
-	@Test
-	public void testStringSet() throws Exception {
-		Field field = this.getClass().getDeclaredField("stringSet");
-		org.apache.uima.resource.metadata.ConfigurationParameter param;
-		param = ConfigurationParameterFactory.createPrimitiveParameter(field);
-		assertEquals(this.getClass().getName() + ".stringSet", param.getName());
-		assertEquals(org.apache.uima.resource.metadata.ConfigurationParameter.TYPE_STRING,
-				param.getType());
-		assertFalse(param.isMandatory());
-		String[] expected = new String[] { "5", "5", "4", "3" };
-		String[] actual = (String[]) ConfigurationParameterFactory.getDefaultValue(field);
-		assertArrayEquals(expected, actual);
-	}
+  public static final String PARAM_DOUBLE_1 = "org.uimafit.factory.ConfigurationParameterFactoryTest.PARAM_STRING_1";
+
+  @ConfigurationParameter(name = PARAM_DOUBLE_1, mandatory = true, defaultValue = "3.1415")
+  private Double double1;
+
+  public static final String PARAM_DOUBLE_2 = "org.uimafit.factory.ConfigurationParameterFactoryTest.PARAM_DOUBLE_2";
+
+  @ConfigurationParameter(name = PARAM_DOUBLE_2, mandatory = true, defaultValue = "3.3333")
+  private Double[] double2;
+
+  private Double[] double3;
+
+  public Double[] getDouble2() {
+    return double2;
+  }
+
+  public void setDouble2(Double[] double2) {
+    this.double2 = double2;
+  }
+
+  public Double[] getDouble3() {
+    return double3;
+  }
+
+  public void setDouble3(Double[] double3) {
+    this.double3 = double3;
+  }
+
+  public Double getDouble1() {
+    return double1;
+  }
+
+  public void setDouble1(Double double1) {
+    this.double1 = double1;
+  }
+
+  @Test
+  public void test1() throws SecurityException, NoSuchFieldException {
+    Float value = (Float) ConfigurationParameterFactory
+            .getDefaultValue(ConfigurationParameterFactoryTest.class.getDeclaredField("double1"));
+    assertEquals(3.1415, value, 1e-4);
+
+    Float[] values = (Float[]) ConfigurationParameterFactory
+            .getDefaultValue(ConfigurationParameterFactoryTest.class.getDeclaredField("double2"));
+    assertEquals(1, values.length);
+    assertEquals(3.3333, values[0], 1e-4);
+
+    IllegalArgumentException iae = null;
+    try {
+      ConfigurationParameterFactory.getDefaultValue(ConfigurationParameterFactoryTest.class
+              .getDeclaredField("double3"));
+    } catch (IllegalArgumentException e) {
+      iae = e;
+    }
+    assertNotNull(iae);
+
+  }
+
+  @Test(expected = IllegalArgumentException.class)
+  public void test2() throws Exception {
+    ConfigurationParameterFactory.createPrimitiveParameter(ConfigurationParameterFactoryTest.class
+            .getDeclaredField("double3"));
+  }
+
+  @ConfigurationParameter
+  public String param1;
+
+  @Test
+  public void testParam1() throws Exception, NoSuchFieldException {
+    Field field1 = ConfigurationParameterFactoryTest.class.getDeclaredField("param1");
+    org.apache.uima.resource.metadata.ConfigurationParameter cp = ConfigurationParameterFactory
+            .createPrimitiveParameter(field1);
+    assertEquals("org.apache.uima.fit.factory.ConfigurationParameterFactoryTest.param1",
+            cp.getName());
+    assertEquals(org.apache.uima.resource.metadata.ConfigurationParameter.TYPE_STRING, cp.getType());
+    assertEquals("", cp.getDescription());
+    assertFalse(cp.isMandatory());
+    assertFalse(cp.isMultiValued());
+    assertNull(ConfigurationParameterFactory.getDefaultValue(field1));
+  }
+
+  @SuppressWarnings("unused")
+  @ConfigurationParameter(name = "my-boolean-param", mandatory = true, description = "my description", defaultValue = {
+      "false", "false", "true" })
+  private boolean[] param2;
+
+  @Test
+  public void testParam2() throws Exception, NoSuchFieldException {
+    Field field2 = ConfigurationParameterFactoryTest.class.getDeclaredField("param2");
+    org.apache.uima.resource.metadata.ConfigurationParameter cp = ConfigurationParameterFactory
+            .createPrimitiveParameter(field2);
+    assertEquals("my-boolean-param", cp.getName());
+    assertEquals(org.apache.uima.resource.metadata.ConfigurationParameter.TYPE_BOOLEAN,
+            cp.getType());
+    assertEquals("my description", cp.getDescription());
+    assertTrue(cp.isMandatory());
+    assertTrue(cp.isMultiValued());
+    Boolean[] defaultValue = (Boolean[]) ConfigurationParameterFactory.getDefaultValue(field2);
+    assertFalse(defaultValue[0]);
+    assertFalse(defaultValue[1]);
+    assertTrue(defaultValue[2]);
+  }
+
+  @SuppressWarnings("unused")
+  @ConfigurationParameter
+  private Integer param3;
+
+  @Test
+  public void testParam3() throws Exception, NoSuchFieldException {
+    Field field3 = ConfigurationParameterFactoryTest.class.getDeclaredField("param3");
+    org.apache.uima.resource.metadata.ConfigurationParameter cp = ConfigurationParameterFactory
+            .createPrimitiveParameter(field3);
+    assertEquals("org.apache.uima.fit.factory.ConfigurationParameterFactoryTest.param3",
+            cp.getName());
+    assertEquals(org.apache.uima.resource.metadata.ConfigurationParameter.TYPE_INTEGER,
+            cp.getType());
+    assertEquals("", cp.getDescription());
+    assertFalse(cp.isMandatory());
+    assertFalse(cp.isMultiValued());
+    assertNull(ConfigurationParameterFactory.getDefaultValue(field3));
+  }
+
+  private static class CPFT {
+    @SuppressWarnings("unused")
+    @ConfigurationParameter(defaultValue = { "a", "b", "c" })
+    private String[] param4;
+  }
+
+  @Test
+  public void testParam4() throws Exception, NoSuchFieldException {
+    Field field4 = CPFT.class.getDeclaredField("param4");
+    org.apache.uima.resource.metadata.ConfigurationParameter cp = ConfigurationParameterFactory
+            .createPrimitiveParameter(field4);
+    assertEquals("org.apache.uima.fit.factory.ConfigurationParameterFactoryTest$CPFT.param4",
+            cp.getName());
+    assertEquals(org.apache.uima.resource.metadata.ConfigurationParameter.TYPE_STRING, cp.getType());
+    assertEquals("", cp.getDescription());
+    assertFalse(cp.isMandatory());
+    assertTrue(cp.isMultiValued());
+    assertArrayEquals(new String[] { "a", "b", "c" },
+            (String[]) ConfigurationParameterFactory.getDefaultValue(field4));
+  }
+
+  @SuppressWarnings("unused")
+  @ConfigurationParameter(defaultValue = { "data/foo", "bar" })
+  private List<File> fileList;
+
+  @Test
+  public void testFileList() throws Exception {
+    Field field = this.getClass().getDeclaredField("fileList");
+    org.apache.uima.resource.metadata.ConfigurationParameter param;
+    param = ConfigurationParameterFactory.createPrimitiveParameter(field);
+    assertEquals(this.getClass().getName() + ".fileList", param.getName());
+    assertEquals(org.apache.uima.resource.metadata.ConfigurationParameter.TYPE_STRING,
+            param.getType());
+    assertEquals("", param.getDescription());
+    assertFalse(param.isMandatory());
+    String[] expected = new String[] { "data/foo", "bar" };
+    String[] actual = (String[]) ConfigurationParameterFactory.getDefaultValue(field);
+    assertArrayEquals(expected, actual);
+  }
+
+  @SuppressWarnings("unused")
+  @ConfigurationParameter(defaultValue = { "5", "5", "4", "3" })
+  private Set<String> stringSet;
+
+  @Test
+  public void testStringSet() throws Exception {
+    Field field = this.getClass().getDeclaredField("stringSet");
+    org.apache.uima.resource.metadata.ConfigurationParameter param;
+    param = ConfigurationParameterFactory.createPrimitiveParameter(field);
+    assertEquals(this.getClass().getName() + ".stringSet", param.getName());
+    assertEquals(org.apache.uima.resource.metadata.ConfigurationParameter.TYPE_STRING,
+            param.getType());
+    assertFalse(param.isMandatory());
+    String[] expected = new String[] { "5", "5", "4", "3" };
+    String[] actual = (String[]) ConfigurationParameterFactory.getDefaultValue(field);
+    assertArrayEquals(expected, actual);
+  }
 
 }

Modified: uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/factory/ExternalResourceConfiguratorTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/factory/ExternalResourceConfiguratorTest.java?rev=1431721&r1=1431720&r2=1431721&view=diff
==============================================================================
--- uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/factory/ExternalResourceConfiguratorTest.java (original)
+++ uima/sandbox/uimafit/trunk/uimafit/src/test/java/org/apache/uima/fit/factory/ExternalResourceConfiguratorTest.java Thu Jan 10 23:12:33 2013
@@ -17,7 +17,6 @@
  * under the License.
  */
 
-
 package org.apache.uima.fit.factory;
 
 import static org.apache.uima.fit.component.initialize.ExternalResourceInitializer.getResourceDeclarations;
@@ -39,46 +38,46 @@ import org.junit.Test;
  * 
  */
 public class ExternalResourceConfiguratorTest extends ComponentTestBase {
-	@Test
-	public void testAnalyze() throws Exception {
-		Map<String, ExternalResourceDependency> deps = getResourceDeclarations(ParameterizedAE2.class);
-
-		verify(deps);
-	}
-
-	@Test
-	public void testDescriptor() throws Exception {
-		AnalysisEngineDescription desc = createPrimitiveDescription(ParameterizedAE2.class,
-				typeSystemDescription);
-
-		Map<String, ExternalResourceDependency> deps = new HashMap<String, ExternalResourceDependency>();
-		for (ExternalResourceDependency dep : desc.getExternalResourceDependencies()) {
-			deps.put(dep.getKey(), dep);
-		}
-
-		verify(deps);
-	}
-
-	private void verify(Map<String, ExternalResourceDependency> deps) {
-		assertEquals(3, deps.size());
-
-		String key = ParameterizedAE2.DummyResource.class.getName();
-		String api = ParameterizedAE2.DummyResource.class.getName();
-		ExternalResourceDependency d = deps.get(key);
-		assertEquals(key, d.getKey());
-		assertEquals(api, d.getInterfaceName());
-		assertEquals(false, d.isOptional());
-
-		key = ParameterizedAE2.RES_OTHER;
-		d = deps.get(key);
-		assertEquals(key, d.getKey());
-		assertEquals(api, d.getInterfaceName());
-		assertEquals(false, d.isOptional());
-
-		key = ParameterizedAE2.RES_OPTIONAL;
-		d = deps.get(key);
-		assertEquals(key, d.getKey());
-		assertEquals(api, d.getInterfaceName());
-		assertEquals(true, d.isOptional());
-	}
+  @Test
+  public void testAnalyze() throws Exception {
+    Map<String, ExternalResourceDependency> deps = getResourceDeclarations(ParameterizedAE2.class);
+
+    verify(deps);
+  }
+
+  @Test
+  public void testDescriptor() throws Exception {
+    AnalysisEngineDescription desc = createPrimitiveDescription(ParameterizedAE2.class,
+            typeSystemDescription);
+
+    Map<String, ExternalResourceDependency> deps = new HashMap<String, ExternalResourceDependency>();
+    for (ExternalResourceDependency dep : desc.getExternalResourceDependencies()) {
+      deps.put(dep.getKey(), dep);
+    }
+
+    verify(deps);
+  }
+
+  private void verify(Map<String, ExternalResourceDependency> deps) {
+    assertEquals(3, deps.size());
+
+    String key = ParameterizedAE2.DummyResource.class.getName();
+    String api = ParameterizedAE2.DummyResource.class.getName();
+    ExternalResourceDependency d = deps.get(key);
+    assertEquals(key, d.getKey());
+    assertEquals(api, d.getInterfaceName());
+    assertEquals(false, d.isOptional());
+
+    key = ParameterizedAE2.RES_OTHER;
+    d = deps.get(key);
+    assertEquals(key, d.getKey());
+    assertEquals(api, d.getInterfaceName());
+    assertEquals(false, d.isOptional());
+
+    key = ParameterizedAE2.RES_OPTIONAL;
+    d = deps.get(key);
+    assertEquals(key, d.getKey());
+    assertEquals(api, d.getInterfaceName());
+    assertEquals(true, d.isOptional());
+  }
 }