You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2008/08/30 00:11:30 UTC
svn commit: r690405 [25/26] - in /incubator/uima/uimaj/trunk/uimaj-core: ./
src/main/java/org/apache/uima/
src/main/java/org/apache/uima/analysis_component/
src/main/java/org/apache/uima/analysis_engine/
src/main/java/org/apache/uima/analysis_engine/an...
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/StringSubtypeTest.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/StringSubtypeTest.java?rev=690405&r1=690404&r2=690405&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/StringSubtypeTest.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/StringSubtypeTest.java Fri Aug 29 15:10:52 2008
@@ -1,142 +1,142 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.uima.cas.test;
-
-import java.io.File;
-
-import junit.framework.TestCase;
-
-import org.apache.uima.UIMAFramework;
-import org.apache.uima.analysis_engine.AnalysisEngine;
-import org.apache.uima.analysis_engine.ResultSpecification;
-import org.apache.uima.analysis_engine.annotator.JTextAnnotator_ImplBase;
-import org.apache.uima.cas.CAS;
-import org.apache.uima.cas.CASRuntimeException;
-import org.apache.uima.cas.Feature;
-import org.apache.uima.cas.FeatureStructure;
-import org.apache.uima.cas.Type;
-import org.apache.uima.cas.TypeSystem;
-import org.apache.uima.cas.impl.LowLevelCAS;
-import org.apache.uima.cas.impl.LowLevelTypeSystem;
-import org.apache.uima.jcas.JCas;
-import org.apache.uima.resource.ResourceSpecifier;
-import org.apache.uima.test.junit_extension.JUnitExtension;
-import org.apache.uima.util.XMLInputSource;
-
-public class StringSubtypeTest extends TestCase {
-
- private static final String specifier = "./CASTests/desc/StringSubtypeTest.xml";
-
- private static final String definedValue1 = "aa";
-
- private static final String definedValue2 = "bb";
-
- private static final String definedValue3 = "cc";
-
- private static final String undefinedValue = "dd";
-
- private static final String annotationTypeName = "org.apache.uima.cas.test.StringSubtypeAnnotation";
-
- private static final String stringSetFeatureName = "stringSetFeature";
-
- private JCas jcas;
-
- private AnalysisEngine ae;
-
- public static class Annotator extends JTextAnnotator_ImplBase {
-
- public void process(JCas aJCas, ResultSpecification aResultSpec) {
- // Does nothing, not used in this test.
- }
-
- }
-
- public StringSubtypeTest(String arg0) {
- super(arg0);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- File specifierFile = JUnitExtension.getFile(specifier);
- XMLInputSource in = new XMLInputSource(specifierFile);
- ResourceSpecifier resourceSpecifier = UIMAFramework.getXMLParser().parseResourceSpecifier(in);
- this.ae = UIMAFramework.produceAnalysisEngine(resourceSpecifier);
- this.jcas = this.ae.newJCas();
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- this.ae.destroy();
- this.jcas = null;
- }
-
- public void testJcas() {
- StringSubtypeAnnotation annot = new StringSubtypeAnnotation(this.jcas);
- annot.setStringSetFeature(definedValue1);
- annot.setStringSetFeature(definedValue2);
- annot.setStringSetFeature(definedValue3);
- boolean exCaught = false;
- try {
- annot.setStringSetFeature(undefinedValue);
- } catch (CASRuntimeException e) {
- exCaught = true;
- }
- assertTrue(exCaught);
- }
-
- public void testLowLevelCas() {
- LowLevelCAS cas = this.jcas.getLowLevelCas();
- LowLevelTypeSystem ts = cas.ll_getTypeSystem();
- final int annotType = ts.ll_getCodeForTypeName(annotationTypeName);
- final int addr = cas.ll_createFS(annotType);
- final int stringSetFeat = ts.ll_getCodeForFeatureName(annotationTypeName
- + TypeSystem.FEATURE_SEPARATOR + stringSetFeatureName);
- cas.ll_setStringValue(addr, stringSetFeat, definedValue1);
- cas.ll_setStringValue(addr, stringSetFeat, definedValue2);
- cas.ll_setStringValue(addr, stringSetFeat, definedValue3);
- boolean exCaught = false;
- try {
- cas.ll_setStringValue(addr, stringSetFeat, undefinedValue);
- } catch (CASRuntimeException e) {
- exCaught = true;
- }
- assertTrue(exCaught);
- }
-
- public void testCas() {
- CAS cas = this.jcas.getCas();
- TypeSystem ts = cas.getTypeSystem();
- Type annotType = ts.getType(annotationTypeName);
- FeatureStructure fs = cas.createFS(annotType);
- Feature stringSetFeat = ts.getFeatureByFullName(annotationTypeName
- + TypeSystem.FEATURE_SEPARATOR + stringSetFeatureName);
- fs.setStringValue(stringSetFeat, definedValue1);
- fs.setStringValue(stringSetFeat, definedValue2);
- fs.setStringValue(stringSetFeat, definedValue3);
- boolean exCaught = false;
- try {
- fs.setStringValue(stringSetFeat, undefinedValue);
- } catch (CASRuntimeException e) {
- exCaught = true;
- }
- assertTrue(exCaught);
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.cas.test;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.uima.UIMAFramework;
+import org.apache.uima.analysis_engine.AnalysisEngine;
+import org.apache.uima.analysis_engine.ResultSpecification;
+import org.apache.uima.analysis_engine.annotator.JTextAnnotator_ImplBase;
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.CASRuntimeException;
+import org.apache.uima.cas.Feature;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.TypeSystem;
+import org.apache.uima.cas.impl.LowLevelCAS;
+import org.apache.uima.cas.impl.LowLevelTypeSystem;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.resource.ResourceSpecifier;
+import org.apache.uima.test.junit_extension.JUnitExtension;
+import org.apache.uima.util.XMLInputSource;
+
+public class StringSubtypeTest extends TestCase {
+
+ private static final String specifier = "./CASTests/desc/StringSubtypeTest.xml";
+
+ private static final String definedValue1 = "aa";
+
+ private static final String definedValue2 = "bb";
+
+ private static final String definedValue3 = "cc";
+
+ private static final String undefinedValue = "dd";
+
+ private static final String annotationTypeName = "org.apache.uima.cas.test.StringSubtypeAnnotation";
+
+ private static final String stringSetFeatureName = "stringSetFeature";
+
+ private JCas jcas;
+
+ private AnalysisEngine ae;
+
+ public static class Annotator extends JTextAnnotator_ImplBase {
+
+ public void process(JCas aJCas, ResultSpecification aResultSpec) {
+ // Does nothing, not used in this test.
+ }
+
+ }
+
+ public StringSubtypeTest(String arg0) {
+ super(arg0);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ File specifierFile = JUnitExtension.getFile(specifier);
+ XMLInputSource in = new XMLInputSource(specifierFile);
+ ResourceSpecifier resourceSpecifier = UIMAFramework.getXMLParser().parseResourceSpecifier(in);
+ this.ae = UIMAFramework.produceAnalysisEngine(resourceSpecifier);
+ this.jcas = this.ae.newJCas();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ this.ae.destroy();
+ this.jcas = null;
+ }
+
+ public void testJcas() {
+ StringSubtypeAnnotation annot = new StringSubtypeAnnotation(this.jcas);
+ annot.setStringSetFeature(definedValue1);
+ annot.setStringSetFeature(definedValue2);
+ annot.setStringSetFeature(definedValue3);
+ boolean exCaught = false;
+ try {
+ annot.setStringSetFeature(undefinedValue);
+ } catch (CASRuntimeException e) {
+ exCaught = true;
+ }
+ assertTrue(exCaught);
+ }
+
+ public void testLowLevelCas() {
+ LowLevelCAS cas = this.jcas.getLowLevelCas();
+ LowLevelTypeSystem ts = cas.ll_getTypeSystem();
+ final int annotType = ts.ll_getCodeForTypeName(annotationTypeName);
+ final int addr = cas.ll_createFS(annotType);
+ final int stringSetFeat = ts.ll_getCodeForFeatureName(annotationTypeName
+ + TypeSystem.FEATURE_SEPARATOR + stringSetFeatureName);
+ cas.ll_setStringValue(addr, stringSetFeat, definedValue1);
+ cas.ll_setStringValue(addr, stringSetFeat, definedValue2);
+ cas.ll_setStringValue(addr, stringSetFeat, definedValue3);
+ boolean exCaught = false;
+ try {
+ cas.ll_setStringValue(addr, stringSetFeat, undefinedValue);
+ } catch (CASRuntimeException e) {
+ exCaught = true;
+ }
+ assertTrue(exCaught);
+ }
+
+ public void testCas() {
+ CAS cas = this.jcas.getCas();
+ TypeSystem ts = cas.getTypeSystem();
+ Type annotType = ts.getType(annotationTypeName);
+ FeatureStructure fs = cas.createFS(annotType);
+ Feature stringSetFeat = ts.getFeatureByFullName(annotationTypeName
+ + TypeSystem.FEATURE_SEPARATOR + stringSetFeatureName);
+ fs.setStringValue(stringSetFeat, definedValue1);
+ fs.setStringValue(stringSetFeat, definedValue2);
+ fs.setStringValue(stringSetFeat, definedValue3);
+ boolean exCaught = false;
+ try {
+ fs.setStringValue(stringSetFeat, undefinedValue);
+ } catch (CASRuntimeException e) {
+ exCaught = true;
+ }
+ assertTrue(exCaught);
+ }
+
+}
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/StringSubtypeTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/SubiteratorAnnotator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/SubiteratorTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TestAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TestAnnotator.java?rev=690405&r1=690404&r2=690405&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TestAnnotator.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TestAnnotator.java Fri Aug 29 15:10:52 2008
@@ -1,45 +1,45 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.uima.cas.test;
-
-import org.apache.uima.analysis_component.CasAnnotator_ImplBase;
-import org.apache.uima.cas.CAS;
-import org.apache.uima.cas.FeatureStructure;
-
-/**
- * Annotator for CAS test cases. Does nothing. Its only purpose is to load a type system and
- * provide a CAS for testing.
- */
-public class TestAnnotator extends CasAnnotator_ImplBase {
-
- public TestAnnotator() {
- super();
- }
-
- public void process(CAS cas) {
- FeatureStructure fs = cas.createFS(cas.getTypeSystem().getType(CAS.TYPE_NAME_ANNOTATION_BASE));
- cas.addFsToIndexes(fs);
- fs = cas.createFS(cas.getTypeSystem().getType("OtherAnnotation"));
- cas.addFsToIndexes(fs);
- }
-
-
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.cas.test;
+
+import org.apache.uima.analysis_component.CasAnnotator_ImplBase;
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.FeatureStructure;
+
+/**
+ * Annotator for CAS test cases. Does nothing. Its only purpose is to load a type system and
+ * provide a CAS for testing.
+ */
+public class TestAnnotator extends CasAnnotator_ImplBase {
+
+ public TestAnnotator() {
+ super();
+ }
+
+ public void process(CAS cas) {
+ FeatureStructure fs = cas.createFS(cas.getTypeSystem().getType(CAS.TYPE_NAME_ANNOTATION_BASE));
+ cas.addFsToIndexes(fs);
+ fs = cas.createFS(cas.getTypeSystem().getType("OtherAnnotation"));
+ cas.addFsToIndexes(fs);
+ }
+
+
+
+}
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TestAnnotator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/Token.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/Token_Type.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TypeOrderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TypePriorityTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TypeSystemReinitTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TypeSystemTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/TypeSystemUtilsTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/UimacppDeserializationTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas_data/impl/CasComparer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas_data/impl/CasDataToXCasTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas_data/impl/XCasToCasDataSaxHandlerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/collection/impl/CasConsumerDescription_implTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/collection/impl/CasInitializerDescription_implTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/collection/impl/CollectionReaderDescription_implTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/examples/cpm/sofa/TransAnnotator.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/flow/impl/FixedFlowControllerTest.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/flow/impl/FixedFlowControllerTest.java?rev=690405&r1=690404&r2=690405&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/flow/impl/FixedFlowControllerTest.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/flow/impl/FixedFlowControllerTest.java Fri Aug 29 15:10:52 2008
@@ -1,212 +1,212 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.uima.flow.impl;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-import org.apache.uima.UIMAFramework;
-import org.apache.uima.UimaContextAdmin;
-import org.apache.uima.analysis_engine.metadata.AnalysisEngineMetaData;
-import org.apache.uima.analysis_engine.metadata.FixedFlow;
-import org.apache.uima.analysis_engine.metadata.impl.AnalysisEngineMetaData_impl;
-import org.apache.uima.analysis_engine.metadata.impl.FixedFlow_impl;
-import org.apache.uima.cas.CAS;
-import org.apache.uima.flow.FinalStep;
-import org.apache.uima.flow.Flow;
-import org.apache.uima.flow.FlowControllerContext;
-import org.apache.uima.flow.SimpleStep;
-import org.apache.uima.flow.Step;
-import org.apache.uima.resource.metadata.OperationalProperties;
-import org.apache.uima.resource.metadata.impl.OperationalProperties_impl;
-import org.apache.uima.resource.metadata.impl.TypeSystemDescription_impl;
-import org.apache.uima.util.CasCreationUtils;
-
-/**
- *
- */
-public class FixedFlowControllerTest extends TestCase {
-
- private Map analysisEngineMetaDataMap;
- private FixedFlowController fixedFlowController;
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- analysisEngineMetaDataMap = new HashMap();
- AnalysisEngineMetaData delegateMd = new AnalysisEngineMetaData_impl();
- delegateMd.setOperationalProperties(new OperationalProperties_impl());
- analysisEngineMetaDataMap.put("key1", delegateMd);
- analysisEngineMetaDataMap.put("key2", delegateMd);
- analysisEngineMetaDataMap.put("key3", delegateMd);
-
- AnalysisEngineMetaData aggregateMd = new AnalysisEngineMetaData_impl();
- FixedFlow fixedFlow = new FixedFlow_impl();
- fixedFlow.setFixedFlow(new String[]{"key1", "key2", "key3"});
- aggregateMd.setFlowConstraints(fixedFlow);
- OperationalProperties opProps = new OperationalProperties_impl();
- aggregateMd.setOperationalProperties(opProps);
-
- UimaContextAdmin rootContext = UIMAFramework.newUimaContext(
- UIMAFramework.getLogger(), UIMAFramework.newDefaultResourceManager(),
- UIMAFramework.newConfigurationManager());
- FlowControllerContext fcContext = new FlowControllerContext_impl(
- rootContext, "_FlowController", Collections.EMPTY_MAP,
- analysisEngineMetaDataMap, aggregateMd);
- fixedFlowController = new FixedFlowController();
- fixedFlowController.initialize(fcContext);
- }
-
- public void testComputeFlow() throws Exception {
- CAS cas1 = CasCreationUtils.createCas(new TypeSystemDescription_impl(), null, null);
- CAS cas2 = CasCreationUtils.createCas(new TypeSystemDescription_impl(), null, null);
- Flow flow1 = fixedFlowController.computeFlow(cas1);
- Flow flow2 = fixedFlowController.computeFlow(cas2);
- //two steps in flow 1
- Step step = flow1.next();
- assertTrue(step instanceof SimpleStep);
- assertEquals("key1", ((SimpleStep)step).getAnalysisEngineKey());
- step = flow1.next();
- assertTrue(step instanceof SimpleStep);
- assertEquals("key2", ((SimpleStep)step).getAnalysisEngineKey());
-
- //one step in flow 2
- step = flow2.next();
- assertTrue(step instanceof SimpleStep);
- assertEquals("key1", ((SimpleStep)step).getAnalysisEngineKey());
-
- //third step in flow 1
- step = flow1.next();
- assertTrue(step instanceof SimpleStep);
- assertEquals("key3", ((SimpleStep)step).getAnalysisEngineKey());
-
- //one step in flow 2
- step = flow2.next();
- assertTrue(step instanceof SimpleStep);
- assertEquals("key2", ((SimpleStep)step).getAnalysisEngineKey());
-
- //finish flow 1
- step = flow1.next();
- assertTrue(step instanceof FinalStep);
-
- //finish flow 2
- step = flow2.next();
- assertTrue(step instanceof SimpleStep);
- assertEquals("key3", ((SimpleStep)step).getAnalysisEngineKey());
- step = flow2.next();
- assertTrue(step instanceof FinalStep);
- }
-
- public void testAddAnalysisEngines() throws Exception {
- CAS cas = CasCreationUtils.createCas(new TypeSystemDescription_impl(), null, null);
- Flow flow = fixedFlowController.computeFlow(cas);
- //two steps in flow
- Step step = flow.next();
- assertTrue(step instanceof SimpleStep);
- assertEquals("key1", ((SimpleStep)step).getAnalysisEngineKey());
- step = flow.next();
- assertTrue(step instanceof SimpleStep);
- assertEquals("key2", ((SimpleStep)step).getAnalysisEngineKey());
-
- //now add two new AEs
- //first update AE metadata map
- AnalysisEngineMetaData delegateMd = new AnalysisEngineMetaData_impl();
- delegateMd.setOperationalProperties(new OperationalProperties_impl());
- analysisEngineMetaDataMap.put("key4", delegateMd);
- analysisEngineMetaDataMap.put("key5", delegateMd);
- //then notify FC
- List newAeKeys = new ArrayList();
- newAeKeys.add("key4");
- newAeKeys.add("key5");
- fixedFlowController.addAnalysisEngines(newAeKeys);
-
- //finish flow
- step = flow.next();
- assertTrue(step instanceof SimpleStep);
- assertEquals("key3", ((SimpleStep)step).getAnalysisEngineKey());
- step = flow.next();
- assertTrue(step instanceof SimpleStep);
- assertEquals("key4", ((SimpleStep)step).getAnalysisEngineKey());
- step = flow.next();
- assertTrue(step instanceof SimpleStep);
- assertEquals("key5", ((SimpleStep)step).getAnalysisEngineKey());
- step = flow.next();
- assertTrue(step instanceof FinalStep);
-
- //test new flow
- flow = fixedFlowController.computeFlow(cas);
- step = flow.next();
- assertTrue(step instanceof SimpleStep);
- assertEquals("key1", ((SimpleStep)step).getAnalysisEngineKey());
- step = flow.next();
- assertTrue(step instanceof SimpleStep);
- assertEquals("key2", ((SimpleStep)step).getAnalysisEngineKey());
- step = flow.next();
- assertTrue(step instanceof SimpleStep);
- assertEquals("key3", ((SimpleStep)step).getAnalysisEngineKey());
- step = flow.next();
- assertTrue(step instanceof SimpleStep);
- assertEquals("key4", ((SimpleStep)step).getAnalysisEngineKey());
- step = flow.next();
- assertTrue(step instanceof SimpleStep);
- assertEquals("key5", ((SimpleStep)step).getAnalysisEngineKey());
- step = flow.next();
- assertTrue(step instanceof FinalStep);
- }
-
- public void testRemoveAnalysisEngines() throws Exception {
- CAS cas = CasCreationUtils.createCas(new TypeSystemDescription_impl(), null, null);
- Flow flow = fixedFlowController.computeFlow(cas);
- //one step in flow
- Step step = flow.next();
- assertTrue(step instanceof SimpleStep);
- assertEquals("key1", ((SimpleStep)step).getAnalysisEngineKey());
-
- //remove "key2"
- analysisEngineMetaDataMap.remove("key2");
- List removedKeys = new ArrayList();
- removedKeys.add("key2");
- fixedFlowController.removeAnalysisEngines(removedKeys);
-
- //finish flow
- step = flow.next();
- assertTrue(step instanceof SimpleStep);
- assertEquals("key3", ((SimpleStep)step).getAnalysisEngineKey());
- step = flow.next();
- assertTrue(step instanceof FinalStep);
-
- //test new flow
- flow = fixedFlowController.computeFlow(cas);
- step = flow.next();
- assertTrue(step instanceof SimpleStep);
- assertEquals("key1", ((SimpleStep)step).getAnalysisEngineKey());
- step = flow.next();
- assertTrue(step instanceof SimpleStep);
- assertEquals("key3", ((SimpleStep)step).getAnalysisEngineKey());
- step = flow.next();
- assertTrue(step instanceof FinalStep);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.flow.impl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.apache.uima.UIMAFramework;
+import org.apache.uima.UimaContextAdmin;
+import org.apache.uima.analysis_engine.metadata.AnalysisEngineMetaData;
+import org.apache.uima.analysis_engine.metadata.FixedFlow;
+import org.apache.uima.analysis_engine.metadata.impl.AnalysisEngineMetaData_impl;
+import org.apache.uima.analysis_engine.metadata.impl.FixedFlow_impl;
+import org.apache.uima.cas.CAS;
+import org.apache.uima.flow.FinalStep;
+import org.apache.uima.flow.Flow;
+import org.apache.uima.flow.FlowControllerContext;
+import org.apache.uima.flow.SimpleStep;
+import org.apache.uima.flow.Step;
+import org.apache.uima.resource.metadata.OperationalProperties;
+import org.apache.uima.resource.metadata.impl.OperationalProperties_impl;
+import org.apache.uima.resource.metadata.impl.TypeSystemDescription_impl;
+import org.apache.uima.util.CasCreationUtils;
+
+/**
+ *
+ */
+public class FixedFlowControllerTest extends TestCase {
+
+ private Map analysisEngineMetaDataMap;
+ private FixedFlowController fixedFlowController;
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ analysisEngineMetaDataMap = new HashMap();
+ AnalysisEngineMetaData delegateMd = new AnalysisEngineMetaData_impl();
+ delegateMd.setOperationalProperties(new OperationalProperties_impl());
+ analysisEngineMetaDataMap.put("key1", delegateMd);
+ analysisEngineMetaDataMap.put("key2", delegateMd);
+ analysisEngineMetaDataMap.put("key3", delegateMd);
+
+ AnalysisEngineMetaData aggregateMd = new AnalysisEngineMetaData_impl();
+ FixedFlow fixedFlow = new FixedFlow_impl();
+ fixedFlow.setFixedFlow(new String[]{"key1", "key2", "key3"});
+ aggregateMd.setFlowConstraints(fixedFlow);
+ OperationalProperties opProps = new OperationalProperties_impl();
+ aggregateMd.setOperationalProperties(opProps);
+
+ UimaContextAdmin rootContext = UIMAFramework.newUimaContext(
+ UIMAFramework.getLogger(), UIMAFramework.newDefaultResourceManager(),
+ UIMAFramework.newConfigurationManager());
+ FlowControllerContext fcContext = new FlowControllerContext_impl(
+ rootContext, "_FlowController", Collections.EMPTY_MAP,
+ analysisEngineMetaDataMap, aggregateMd);
+ fixedFlowController = new FixedFlowController();
+ fixedFlowController.initialize(fcContext);
+ }
+
+ public void testComputeFlow() throws Exception {
+ CAS cas1 = CasCreationUtils.createCas(new TypeSystemDescription_impl(), null, null);
+ CAS cas2 = CasCreationUtils.createCas(new TypeSystemDescription_impl(), null, null);
+ Flow flow1 = fixedFlowController.computeFlow(cas1);
+ Flow flow2 = fixedFlowController.computeFlow(cas2);
+ //two steps in flow 1
+ Step step = flow1.next();
+ assertTrue(step instanceof SimpleStep);
+ assertEquals("key1", ((SimpleStep)step).getAnalysisEngineKey());
+ step = flow1.next();
+ assertTrue(step instanceof SimpleStep);
+ assertEquals("key2", ((SimpleStep)step).getAnalysisEngineKey());
+
+ //one step in flow 2
+ step = flow2.next();
+ assertTrue(step instanceof SimpleStep);
+ assertEquals("key1", ((SimpleStep)step).getAnalysisEngineKey());
+
+ //third step in flow 1
+ step = flow1.next();
+ assertTrue(step instanceof SimpleStep);
+ assertEquals("key3", ((SimpleStep)step).getAnalysisEngineKey());
+
+ //one step in flow 2
+ step = flow2.next();
+ assertTrue(step instanceof SimpleStep);
+ assertEquals("key2", ((SimpleStep)step).getAnalysisEngineKey());
+
+ //finish flow 1
+ step = flow1.next();
+ assertTrue(step instanceof FinalStep);
+
+ //finish flow 2
+ step = flow2.next();
+ assertTrue(step instanceof SimpleStep);
+ assertEquals("key3", ((SimpleStep)step).getAnalysisEngineKey());
+ step = flow2.next();
+ assertTrue(step instanceof FinalStep);
+ }
+
+ public void testAddAnalysisEngines() throws Exception {
+ CAS cas = CasCreationUtils.createCas(new TypeSystemDescription_impl(), null, null);
+ Flow flow = fixedFlowController.computeFlow(cas);
+ //two steps in flow
+ Step step = flow.next();
+ assertTrue(step instanceof SimpleStep);
+ assertEquals("key1", ((SimpleStep)step).getAnalysisEngineKey());
+ step = flow.next();
+ assertTrue(step instanceof SimpleStep);
+ assertEquals("key2", ((SimpleStep)step).getAnalysisEngineKey());
+
+ //now add two new AEs
+ //first update AE metadata map
+ AnalysisEngineMetaData delegateMd = new AnalysisEngineMetaData_impl();
+ delegateMd.setOperationalProperties(new OperationalProperties_impl());
+ analysisEngineMetaDataMap.put("key4", delegateMd);
+ analysisEngineMetaDataMap.put("key5", delegateMd);
+ //then notify FC
+ List newAeKeys = new ArrayList();
+ newAeKeys.add("key4");
+ newAeKeys.add("key5");
+ fixedFlowController.addAnalysisEngines(newAeKeys);
+
+ //finish flow
+ step = flow.next();
+ assertTrue(step instanceof SimpleStep);
+ assertEquals("key3", ((SimpleStep)step).getAnalysisEngineKey());
+ step = flow.next();
+ assertTrue(step instanceof SimpleStep);
+ assertEquals("key4", ((SimpleStep)step).getAnalysisEngineKey());
+ step = flow.next();
+ assertTrue(step instanceof SimpleStep);
+ assertEquals("key5", ((SimpleStep)step).getAnalysisEngineKey());
+ step = flow.next();
+ assertTrue(step instanceof FinalStep);
+
+ //test new flow
+ flow = fixedFlowController.computeFlow(cas);
+ step = flow.next();
+ assertTrue(step instanceof SimpleStep);
+ assertEquals("key1", ((SimpleStep)step).getAnalysisEngineKey());
+ step = flow.next();
+ assertTrue(step instanceof SimpleStep);
+ assertEquals("key2", ((SimpleStep)step).getAnalysisEngineKey());
+ step = flow.next();
+ assertTrue(step instanceof SimpleStep);
+ assertEquals("key3", ((SimpleStep)step).getAnalysisEngineKey());
+ step = flow.next();
+ assertTrue(step instanceof SimpleStep);
+ assertEquals("key4", ((SimpleStep)step).getAnalysisEngineKey());
+ step = flow.next();
+ assertTrue(step instanceof SimpleStep);
+ assertEquals("key5", ((SimpleStep)step).getAnalysisEngineKey());
+ step = flow.next();
+ assertTrue(step instanceof FinalStep);
+ }
+
+ public void testRemoveAnalysisEngines() throws Exception {
+ CAS cas = CasCreationUtils.createCas(new TypeSystemDescription_impl(), null, null);
+ Flow flow = fixedFlowController.computeFlow(cas);
+ //one step in flow
+ Step step = flow.next();
+ assertTrue(step instanceof SimpleStep);
+ assertEquals("key1", ((SimpleStep)step).getAnalysisEngineKey());
+
+ //remove "key2"
+ analysisEngineMetaDataMap.remove("key2");
+ List removedKeys = new ArrayList();
+ removedKeys.add("key2");
+ fixedFlowController.removeAnalysisEngines(removedKeys);
+
+ //finish flow
+ step = flow.next();
+ assertTrue(step instanceof SimpleStep);
+ assertEquals("key3", ((SimpleStep)step).getAnalysisEngineKey());
+ step = flow.next();
+ assertTrue(step instanceof FinalStep);
+
+ //test new flow
+ flow = fixedFlowController.computeFlow(cas);
+ step = flow.next();
+ assertTrue(step instanceof SimpleStep);
+ assertEquals("key1", ((SimpleStep)step).getAnalysisEngineKey());
+ step = flow.next();
+ assertTrue(step instanceof SimpleStep);
+ assertEquals("key3", ((SimpleStep)step).getAnalysisEngineKey());
+ step = flow.next();
+ assertTrue(step instanceof FinalStep);
+ }
+}
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/flow/impl/FixedFlowControllerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/AnalysisEngineFactory_implTest.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/AnalysisEngineFactory_implTest.java?rev=690405&r1=690404&r2=690405&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/AnalysisEngineFactory_implTest.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/AnalysisEngineFactory_implTest.java Fri Aug 29 15:10:52 2008
@@ -1,54 +1,54 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.uima.impl;
-
-import java.util.Collections;
-
-import junit.framework.TestCase;
-
-import org.apache.uima.analysis_engine.AnalysisEngine;
-import org.apache.uima.analysis_engine.AnalysisEngineDescription;
-import org.apache.uima.analysis_engine.impl.AnalysisEngineDescription_impl;
-import org.apache.uima.resource.ResourceInitializationException;
-
-/**
- *
- */
-public class AnalysisEngineFactory_implTest extends TestCase {
-
- private AnalysisEngineFactory_impl aeFactory;
-
- protected void setUp() throws Exception {
- aeFactory = new AnalysisEngineFactory_impl();
- }
-
- public void testInvalidFrameworkImplementation() {
- AnalysisEngineDescription desc = new AnalysisEngineDescription_impl();
- desc.setFrameworkImplementation("foo");
- try {
- aeFactory.produceResource(AnalysisEngine.class, desc, Collections.EMPTY_MAP);
- fail();
- } catch (ResourceInitializationException e) {
- assertNotNull(e.getMessage());
- assertFalse(e.getMessage().startsWith("EXCEPTION MESSAGE LOCALIZATION FAILED"));
- assertEquals(e.getMessageKey(), ResourceInitializationException.UNSUPPORTED_FRAMEWORK_IMPLEMENTATION);
- }
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.impl;
+
+import java.util.Collections;
+
+import junit.framework.TestCase;
+
+import org.apache.uima.analysis_engine.AnalysisEngine;
+import org.apache.uima.analysis_engine.AnalysisEngineDescription;
+import org.apache.uima.analysis_engine.impl.AnalysisEngineDescription_impl;
+import org.apache.uima.resource.ResourceInitializationException;
+
+/**
+ *
+ */
+public class AnalysisEngineFactory_implTest extends TestCase {
+
+ private AnalysisEngineFactory_impl aeFactory;
+
+ protected void setUp() throws Exception {
+ aeFactory = new AnalysisEngineFactory_impl();
+ }
+
+ public void testInvalidFrameworkImplementation() {
+ AnalysisEngineDescription desc = new AnalysisEngineDescription_impl();
+ desc.setFrameworkImplementation("foo");
+ try {
+ aeFactory.produceResource(AnalysisEngine.class, desc, Collections.EMPTY_MAP);
+ fail();
+ } catch (ResourceInitializationException e) {
+ assertNotNull(e.getMessage());
+ assertFalse(e.getMessage().startsWith("EXCEPTION MESSAGE LOCALIZATION FAILED"));
+ assertEquals(e.getMessageKey(), ResourceInitializationException.UNSUPPORTED_FRAMEWORK_IMPLEMENTATION);
+ }
+ }
+
+}
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/AnalysisEngineFactory_implTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/CasConsumerFactory_implTest.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/CasConsumerFactory_implTest.java?rev=690405&r1=690404&r2=690405&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/CasConsumerFactory_implTest.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/CasConsumerFactory_implTest.java Fri Aug 29 15:10:52 2008
@@ -1,54 +1,54 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.uima.impl;
-
-import java.util.Collections;
-
-import junit.framework.TestCase;
-
-import org.apache.uima.collection.CasConsumer;
-import org.apache.uima.collection.CasConsumerDescription;
-import org.apache.uima.collection.impl.CasConsumerDescription_impl;
-import org.apache.uima.resource.ResourceInitializationException;
-
-/**
- *
- */
-public class CasConsumerFactory_implTest extends TestCase {
-
- private CasConsumerFactory_impl ccFactory;
-
- protected void setUp() throws Exception {
- ccFactory = new CasConsumerFactory_impl();
- }
-
- public void testInvalidFrameworkImplementation() {
- CasConsumerDescription desc = new CasConsumerDescription_impl();
- desc.setFrameworkImplementation("foo");
- try {
- ccFactory.produceResource(CasConsumer.class, desc, Collections.EMPTY_MAP);
- fail();
- } catch (ResourceInitializationException e) {
- assertNotNull(e.getMessage());
- assertFalse(e.getMessage().startsWith("EXCEPTION MESSAGE LOCALIZATION FAILED"));
- assertEquals(e.getMessageKey(), ResourceInitializationException.UNSUPPORTED_FRAMEWORK_IMPLEMENTATION);
- }
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.impl;
+
+import java.util.Collections;
+
+import junit.framework.TestCase;
+
+import org.apache.uima.collection.CasConsumer;
+import org.apache.uima.collection.CasConsumerDescription;
+import org.apache.uima.collection.impl.CasConsumerDescription_impl;
+import org.apache.uima.resource.ResourceInitializationException;
+
+/**
+ *
+ */
+public class CasConsumerFactory_implTest extends TestCase {
+
+ private CasConsumerFactory_impl ccFactory;
+
+ protected void setUp() throws Exception {
+ ccFactory = new CasConsumerFactory_impl();
+ }
+
+ public void testInvalidFrameworkImplementation() {
+ CasConsumerDescription desc = new CasConsumerDescription_impl();
+ desc.setFrameworkImplementation("foo");
+ try {
+ ccFactory.produceResource(CasConsumer.class, desc, Collections.EMPTY_MAP);
+ fail();
+ } catch (ResourceInitializationException e) {
+ assertNotNull(e.getMessage());
+ assertFalse(e.getMessage().startsWith("EXCEPTION MESSAGE LOCALIZATION FAILED"));
+ assertEquals(e.getMessageKey(), ResourceInitializationException.UNSUPPORTED_FRAMEWORK_IMPLEMENTATION);
+ }
+ }
+
+}
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/CasConsumerFactory_implTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/CollectionReaderFactory_implTest.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/CollectionReaderFactory_implTest.java?rev=690405&r1=690404&r2=690405&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/CollectionReaderFactory_implTest.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/CollectionReaderFactory_implTest.java Fri Aug 29 15:10:52 2008
@@ -1,54 +1,54 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.uima.impl;
-
-import java.util.Collections;
-
-import junit.framework.TestCase;
-
-import org.apache.uima.collection.CollectionReader;
-import org.apache.uima.collection.CollectionReaderDescription;
-import org.apache.uima.collection.impl.CollectionReaderDescription_impl;
-import org.apache.uima.resource.ResourceInitializationException;
-
-/**
- *
- */
-public class CollectionReaderFactory_implTest extends TestCase {
-
- private CollectionReaderFactory_impl ccFactory;
-
- protected void setUp() throws Exception {
- ccFactory = new CollectionReaderFactory_impl();
- }
-
- public void testInvalidFrameworkImplementation() {
- CollectionReaderDescription desc = new CollectionReaderDescription_impl();
- desc.setFrameworkImplementation("foo");
- try {
- ccFactory.produceResource(CollectionReader.class, desc, Collections.EMPTY_MAP);
- fail();
- } catch (ResourceInitializationException e) {
- assertNotNull(e.getMessage());
- assertFalse(e.getMessage().startsWith("EXCEPTION MESSAGE LOCALIZATION FAILED"));
- assertEquals(e.getMessageKey(), ResourceInitializationException.UNSUPPORTED_FRAMEWORK_IMPLEMENTATION);
- }
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.impl;
+
+import java.util.Collections;
+
+import junit.framework.TestCase;
+
+import org.apache.uima.collection.CollectionReader;
+import org.apache.uima.collection.CollectionReaderDescription;
+import org.apache.uima.collection.impl.CollectionReaderDescription_impl;
+import org.apache.uima.resource.ResourceInitializationException;
+
+/**
+ *
+ */
+public class CollectionReaderFactory_implTest extends TestCase {
+
+ private CollectionReaderFactory_impl ccFactory;
+
+ protected void setUp() throws Exception {
+ ccFactory = new CollectionReaderFactory_impl();
+ }
+
+ public void testInvalidFrameworkImplementation() {
+ CollectionReaderDescription desc = new CollectionReaderDescription_impl();
+ desc.setFrameworkImplementation("foo");
+ try {
+ ccFactory.produceResource(CollectionReader.class, desc, Collections.EMPTY_MAP);
+ fail();
+ } catch (ResourceInitializationException e) {
+ assertNotNull(e.getMessage());
+ assertFalse(e.getMessage().startsWith("EXCEPTION MESSAGE LOCALIZATION FAILED"));
+ assertEquals(e.getMessageKey(), ResourceInitializationException.UNSUPPORTED_FRAMEWORK_IMPLEMENTATION);
+ }
+ }
+
+}
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/CollectionReaderFactory_implTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/CustomResourceSpecifierFactory_implTest.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/CustomResourceSpecifierFactory_implTest.java?rev=690405&r1=690404&r2=690405&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/CustomResourceSpecifierFactory_implTest.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/CustomResourceSpecifierFactory_implTest.java Fri Aug 29 15:10:52 2008
@@ -1,65 +1,65 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.uima.impl;
-
-import java.util.Collections;
-
-import junit.framework.TestCase;
-
-import org.apache.uima.UIMAFramework;
-import org.apache.uima.resource.CustomResourceSpecifier;
-import org.apache.uima.resource.Parameter;
-import org.apache.uima.resource.Resource;
-
-/**
- *
- */
-public class CustomResourceSpecifierFactory_implTest extends TestCase {
-
- private CustomResourceFactory_impl crFactory;
-
- protected void setUp() throws Exception {
- crFactory = new CustomResourceFactory_impl();
- }
-
- public void testProduceResource() throws Exception {
- CustomResourceSpecifier specifier = UIMAFramework.getResourceSpecifierFactory().createCustomResourceSpecifier();
- specifier.setResourceClassName("org.apache.uima.impl.SomeCustomResource");
- Parameter[] parameters = new Parameter[2];
- parameters[0] = UIMAFramework.getResourceSpecifierFactory().createParameter();
- parameters[0].setName("param1");
- parameters[0].setValue("val1");
- parameters[1] = UIMAFramework.getResourceSpecifierFactory().createParameter();
- parameters[1].setName("param2");
- parameters[1].setValue("val2");
- specifier.setParameters(parameters);
-
- Resource res = crFactory.produceResource(Resource.class, specifier, Collections.EMPTY_MAP);
- assertTrue(res instanceof SomeCustomResource);
- assertEquals("val1", ((SomeCustomResource)res).paramMap.get("param1"));
- assertEquals("val2", ((SomeCustomResource)res).paramMap.get("param2"));
-
- //also UIMAFramework.produceResource should do the same thing
- res = UIMAFramework.produceResource(specifier, Collections.EMPTY_MAP);
- assertTrue(res instanceof SomeCustomResource);
- assertEquals("val1", ((SomeCustomResource)res).paramMap.get("param1"));
- assertEquals("val2", ((SomeCustomResource)res).paramMap.get("param2"));
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.impl;
+
+import java.util.Collections;
+
+import junit.framework.TestCase;
+
+import org.apache.uima.UIMAFramework;
+import org.apache.uima.resource.CustomResourceSpecifier;
+import org.apache.uima.resource.Parameter;
+import org.apache.uima.resource.Resource;
+
+/**
+ *
+ */
+public class CustomResourceSpecifierFactory_implTest extends TestCase {
+
+ private CustomResourceFactory_impl crFactory;
+
+ protected void setUp() throws Exception {
+ crFactory = new CustomResourceFactory_impl();
+ }
+
+ public void testProduceResource() throws Exception {
+ CustomResourceSpecifier specifier = UIMAFramework.getResourceSpecifierFactory().createCustomResourceSpecifier();
+ specifier.setResourceClassName("org.apache.uima.impl.SomeCustomResource");
+ Parameter[] parameters = new Parameter[2];
+ parameters[0] = UIMAFramework.getResourceSpecifierFactory().createParameter();
+ parameters[0].setName("param1");
+ parameters[0].setValue("val1");
+ parameters[1] = UIMAFramework.getResourceSpecifierFactory().createParameter();
+ parameters[1].setName("param2");
+ parameters[1].setValue("val2");
+ specifier.setParameters(parameters);
+
+ Resource res = crFactory.produceResource(Resource.class, specifier, Collections.EMPTY_MAP);
+ assertTrue(res instanceof SomeCustomResource);
+ assertEquals("val1", ((SomeCustomResource)res).paramMap.get("param1"));
+ assertEquals("val2", ((SomeCustomResource)res).paramMap.get("param2"));
+
+ //also UIMAFramework.produceResource should do the same thing
+ res = UIMAFramework.produceResource(specifier, Collections.EMPTY_MAP);
+ assertTrue(res instanceof SomeCustomResource);
+ assertEquals("val1", ((SomeCustomResource)res).paramMap.get("param1"));
+ assertEquals("val2", ((SomeCustomResource)res).paramMap.get("param2"));
+ }
+
+}
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/CustomResourceSpecifierFactory_implTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/SomeCustomResource.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/SomeCustomResource.java?rev=690405&r1=690404&r2=690405&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/SomeCustomResource.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/SomeCustomResource.java Fri Aug 29 15:10:52 2008
@@ -1,51 +1,51 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.uima.impl;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import junit.framework.Assert;
-
-import org.apache.uima.resource.CustomResourceSpecifier;
-import org.apache.uima.resource.Parameter;
-import org.apache.uima.resource.ResourceInitializationException;
-import org.apache.uima.resource.ResourceSpecifier;
-import org.apache.uima.resource.Resource_ImplBase;
-
-/**
- *
- */
-public class SomeCustomResource extends Resource_ImplBase {
-
- public Map paramMap = new HashMap();
-
- /* (non-Javadoc)
- * @see org.apache.uima.resource.Resource_ImplBase#initialize(org.apache.uima.resource.ResourceSpecifier, java.util.Map)
- */
- public boolean initialize(ResourceSpecifier aSpecifier, Map aAdditionalParams) throws ResourceInitializationException {
- Assert.assertTrue(aSpecifier instanceof CustomResourceSpecifier);
- Parameter[] params = ((CustomResourceSpecifier)aSpecifier).getParameters();
- for (int i = 0; i < params.length; i++) {
- paramMap.put(params[i].getName(), params[i].getValue());
- }
- return true;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.Assert;
+
+import org.apache.uima.resource.CustomResourceSpecifier;
+import org.apache.uima.resource.Parameter;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.resource.ResourceSpecifier;
+import org.apache.uima.resource.Resource_ImplBase;
+
+/**
+ *
+ */
+public class SomeCustomResource extends Resource_ImplBase {
+
+ public Map paramMap = new HashMap();
+
+ /* (non-Javadoc)
+ * @see org.apache.uima.resource.Resource_ImplBase#initialize(org.apache.uima.resource.ResourceSpecifier, java.util.Map)
+ */
+ public boolean initialize(ResourceSpecifier aSpecifier, Map aAdditionalParams) throws ResourceInitializationException {
+ Assert.assertTrue(aSpecifier instanceof CustomResourceSpecifier);
+ Parameter[] params = ((CustomResourceSpecifier)aSpecifier).getParameters();
+ for (int i = 0; i < params.length; i++) {
+ paramMap.put(params[i].getName(), params[i].getValue());
+ }
+ return true;
+ }
+
+}
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/SomeCustomResource.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/impl/UimaContext_implTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/internal/util/AnalysisEnginePoolTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/internal/util/ClassloadingTestClass.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/internal/util/ResourcePoolTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/internal/util/UIMAClassLoaderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/internal/util/XmlUtilsTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/jcas/test/AnnotatorInitializer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/jcas/test/CASInitializer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/jcas/test/CASTestSetup.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/jcas/test/JCasTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/jcas/test/generatedx.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/pear/util/ComponentCategoryTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/pear/util/PearEncodingTest.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/pear/util/PearEncodingTest.java?rev=690405&r1=690404&r2=690405&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/pear/util/PearEncodingTest.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/pear/util/PearEncodingTest.java Fri Aug 29 15:10:52 2008
@@ -1,99 +1,99 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.uima.pear.util;
-
-import java.io.File;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.uima.test.junit_extension.JUnitExtension;
-
-/**
- * Pear encoding tests
- *
- */
-public class PearEncodingTest extends TestCase {
-
- public void testUTF8NoSignature() throws Exception {
- // get XML file
- File xmlFile = JUnitExtension.getFile("pearTests/encodingTests/UTF8_no_signature.xml");
- // get encoding
- String encoding = XMLUtil.detectXmlFileEncoding(xmlFile);
-
- // normalize encoding
- encoding = encoding.toUpperCase();
-
- Assert.assertTrue(encoding.equals("UTF-8"));
- }
-
- public void testUTF8WithSignature() throws Exception {
- // cancel this test for Sun's Java 1.3.x or 1.4.x - it does not support BOM
- String javaVendor = System.getProperty("java.vendor");
- if( javaVendor.startsWith("Sun") ) {
- String javaVersion = System.getProperty("java.version");
- if( javaVersion.startsWith("1.3") || javaVersion.startsWith("1.4") )
- return;
- }
- // get XML file
- File xmlFile = JUnitExtension.getFile("pearTests/encodingTests/UTF8_with_signature.xml");
- // get encoding
- String encoding = XMLUtil.detectXmlFileEncoding(xmlFile);
-
- // normalize encoding
- encoding = encoding.toUpperCase();
-
- Assert.assertTrue(encoding.equals("UTF-8"));
- }
-
- public void testUTF16NoSignature() throws Exception {
-
- //NOTE: this test fails when using SUN JVM 1.4.2_12
-
- // get XML file
- File xmlFile = JUnitExtension.getFile("pearTests/encodingTests/UTF16_no_signature.xml");
- // get encoding
- String encoding = XMLUtil.detectXmlFileEncoding(xmlFile);
-
- // normalize encoding
- encoding = encoding.toUpperCase();
-
- Assert.assertTrue(encoding.equals("UTF-16LE"));
- }
-
- public void testUTF16WithSignature() throws Exception {
- // cancel this test for Sun's Java 1.3.x or 1.4.x - it does not support BOM
- String javaVendor = System.getProperty("java.vendor");
- if( javaVendor.startsWith("Sun") ) {
- String javaVersion = System.getProperty("java.version");
- if( javaVersion.startsWith("1.3") || javaVersion.startsWith("1.4") )
- return;
- }
- // get XML file
- File xmlFile = JUnitExtension.getFile("pearTests/encodingTests/UTF16_with_signature.xml");
- // get encoding
- String encoding = XMLUtil.detectXmlFileEncoding(xmlFile);
-
- // normalize encoding
- encoding = encoding.toUpperCase();
-
- Assert.assertTrue(encoding.equals("UTF-16"));
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.pear.util;
+
+import java.io.File;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.uima.test.junit_extension.JUnitExtension;
+
+/**
+ * Pear encoding tests
+ *
+ */
+public class PearEncodingTest extends TestCase {
+
+ public void testUTF8NoSignature() throws Exception {
+ // get XML file
+ File xmlFile = JUnitExtension.getFile("pearTests/encodingTests/UTF8_no_signature.xml");
+ // get encoding
+ String encoding = XMLUtil.detectXmlFileEncoding(xmlFile);
+
+ // normalize encoding
+ encoding = encoding.toUpperCase();
+
+ Assert.assertTrue(encoding.equals("UTF-8"));
+ }
+
+ public void testUTF8WithSignature() throws Exception {
+ // cancel this test for Sun's Java 1.3.x or 1.4.x - it does not support BOM
+ String javaVendor = System.getProperty("java.vendor");
+ if( javaVendor.startsWith("Sun") ) {
+ String javaVersion = System.getProperty("java.version");
+ if( javaVersion.startsWith("1.3") || javaVersion.startsWith("1.4") )
+ return;
+ }
+ // get XML file
+ File xmlFile = JUnitExtension.getFile("pearTests/encodingTests/UTF8_with_signature.xml");
+ // get encoding
+ String encoding = XMLUtil.detectXmlFileEncoding(xmlFile);
+
+ // normalize encoding
+ encoding = encoding.toUpperCase();
+
+ Assert.assertTrue(encoding.equals("UTF-8"));
+ }
+
+ public void testUTF16NoSignature() throws Exception {
+
+ //NOTE: this test fails when using SUN JVM 1.4.2_12
+
+ // get XML file
+ File xmlFile = JUnitExtension.getFile("pearTests/encodingTests/UTF16_no_signature.xml");
+ // get encoding
+ String encoding = XMLUtil.detectXmlFileEncoding(xmlFile);
+
+ // normalize encoding
+ encoding = encoding.toUpperCase();
+
+ Assert.assertTrue(encoding.equals("UTF-16LE"));
+ }
+
+ public void testUTF16WithSignature() throws Exception {
+ // cancel this test for Sun's Java 1.3.x or 1.4.x - it does not support BOM
+ String javaVendor = System.getProperty("java.vendor");
+ if( javaVendor.startsWith("Sun") ) {
+ String javaVersion = System.getProperty("java.version");
+ if( javaVersion.startsWith("1.3") || javaVersion.startsWith("1.4") )
+ return;
+ }
+ // get XML file
+ File xmlFile = JUnitExtension.getFile("pearTests/encodingTests/UTF16_with_signature.xml");
+ // get encoding
+ String encoding = XMLUtil.detectXmlFileEncoding(xmlFile);
+
+ // normalize encoding
+ encoding = encoding.toUpperCase();
+
+ Assert.assertTrue(encoding.equals("UTF-16"));
+ }
+}
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/pear/util/PearEncodingTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/pear/util/PearInstallerTest.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/pear/util/PearInstallerTest.java?rev=690405&r1=690404&r2=690405&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/pear/util/PearInstallerTest.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/pear/util/PearInstallerTest.java Fri Aug 29 15:10:52 2008
@@ -1,121 +1,121 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.uima.pear.util;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.uima.UIMAFramework;
-import org.apache.uima.analysis_engine.AnalysisEngine;
-import org.apache.uima.cas.CAS;
-import org.apache.uima.pear.tools.PackageBrowser;
-import org.apache.uima.pear.tools.PackageInstaller;
-import org.apache.uima.resource.ResourceManager;
-import org.apache.uima.resource.ResourceSpecifier;
-import org.apache.uima.test.junit_extension.JUnitExtension;
-import org.apache.uima.util.XMLInputSource;
-
-/**
- * The PearInstallerTest tests the PEAR installation and checks some
- * parameters of the installed PEAR file
- *
- */
-public class PearInstallerTest extends TestCase {
-
- // Temporary working directory, used to install the pear package
- private File tempInstallDir = null;
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception {
-
- // create temporary working directory
- File tempFile = File.createTempFile("pear_installer_test_", "tmp");
- if (tempFile.delete()) {
- File tempDir = tempFile;
- if (tempDir.mkdirs())
- this.tempInstallDir = tempDir;
- }
- }
-
- /**
- * @see junit.framework.TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- if (this.tempInstallDir != null) {
- FileUtil.deleteDirectory(this.tempInstallDir);
- }
- }
-
- /**
- * @throws Exception
- */
- public void testPearInstall() throws Exception {
-
- // check temporary working directory
- if (this.tempInstallDir == null)
- throw new FileNotFoundException("temp directory not found");
- // check sample PEAR files
-
- //get pear file to install
- File pearFile = JUnitExtension.getFile("pearTests/DateTime.pear");
- Assert.assertNotNull(pearFile);
-
- // Install PEAR package
- PackageBrowser instPear = PackageInstaller.installPackage(
- this.tempInstallDir, pearFile, true);
-
- //check pear PackageBrowser object
- Assert.assertNotNull(instPear);
-
- //check PEAR component ID
- String componentID = instPear.getInstallationDescriptor().getMainComponentId();
- Assert.assertEquals("uima.example.DateTimeAnnotator", componentID);
-
- //check PEAR datapath setting
- //pear file contains (uima.datapath = $main_root/my/test/data/path)
- File datapath = new File(this.tempInstallDir, "uima.example.DateTimeAnnotator/my/test/data/path");
- File pearDatapath = new File(instPear.getComponentDataPath());
- Assert.assertEquals(datapath, pearDatapath);
-
- // Create resouce manager and set PEAR package classpath
- ResourceManager rsrcMgr = UIMAFramework.newDefaultResourceManager();
-
- // Create analysis engine from the installed PEAR package
- XMLInputSource in = new XMLInputSource(instPear.getComponentPearDescPath());
- ResourceSpecifier specifier = UIMAFramework.getXMLParser()
- .parseResourceSpecifier(in);
- AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(
- specifier, rsrcMgr, null);
- Assert.assertNotNull(ae);
-
-
- // Create a CAS with a sample document text and process the CAS
- CAS cas = ae.newCAS();
- cas.setDocumentText("Sample text to process with a date 05/29/07 and a time 9:45 AM");
- cas.setDocumentLanguage("en");
- ae.process(cas);
-
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.pear.util;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.uima.UIMAFramework;
+import org.apache.uima.analysis_engine.AnalysisEngine;
+import org.apache.uima.cas.CAS;
+import org.apache.uima.pear.tools.PackageBrowser;
+import org.apache.uima.pear.tools.PackageInstaller;
+import org.apache.uima.resource.ResourceManager;
+import org.apache.uima.resource.ResourceSpecifier;
+import org.apache.uima.test.junit_extension.JUnitExtension;
+import org.apache.uima.util.XMLInputSource;
+
+/**
+ * The PearInstallerTest tests the PEAR installation and checks some
+ * parameters of the installed PEAR file
+ *
+ */
+public class PearInstallerTest extends TestCase {
+
+ // Temporary working directory, used to install the pear package
+ private File tempInstallDir = null;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+
+ // create temporary working directory
+ File tempFile = File.createTempFile("pear_installer_test_", "tmp");
+ if (tempFile.delete()) {
+ File tempDir = tempFile;
+ if (tempDir.mkdirs())
+ this.tempInstallDir = tempDir;
+ }
+ }
+
+ /**
+ * @see junit.framework.TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ if (this.tempInstallDir != null) {
+ FileUtil.deleteDirectory(this.tempInstallDir);
+ }
+ }
+
+ /**
+ * @throws Exception
+ */
+ public void testPearInstall() throws Exception {
+
+ // check temporary working directory
+ if (this.tempInstallDir == null)
+ throw new FileNotFoundException("temp directory not found");
+ // check sample PEAR files
+
+ //get pear file to install
+ File pearFile = JUnitExtension.getFile("pearTests/DateTime.pear");
+ Assert.assertNotNull(pearFile);
+
+ // Install PEAR package
+ PackageBrowser instPear = PackageInstaller.installPackage(
+ this.tempInstallDir, pearFile, true);
+
+ //check pear PackageBrowser object
+ Assert.assertNotNull(instPear);
+
+ //check PEAR component ID
+ String componentID = instPear.getInstallationDescriptor().getMainComponentId();
+ Assert.assertEquals("uima.example.DateTimeAnnotator", componentID);
+
+ //check PEAR datapath setting
+ //pear file contains (uima.datapath = $main_root/my/test/data/path)
+ File datapath = new File(this.tempInstallDir, "uima.example.DateTimeAnnotator/my/test/data/path");
+ File pearDatapath = new File(instPear.getComponentDataPath());
+ Assert.assertEquals(datapath, pearDatapath);
+
+ // Create resouce manager and set PEAR package classpath
+ ResourceManager rsrcMgr = UIMAFramework.newDefaultResourceManager();
+
+ // Create analysis engine from the installed PEAR package
+ XMLInputSource in = new XMLInputSource(instPear.getComponentPearDescPath());
+ ResourceSpecifier specifier = UIMAFramework.getXMLParser()
+ .parseResourceSpecifier(in);
+ AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(
+ specifier, rsrcMgr, null);
+ Assert.assertNotNull(ae);
+
+
+ // Create a CAS with a sample document text and process the CAS
+ CAS cas = ae.newCAS();
+ cas.setDocumentText("Sample text to process with a date 05/29/07 and a time 9:45 AM");
+ cas.setDocumentLanguage("en");
+ ae.process(cas);
+
+ }
+}
Propchange: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/pear/util/PearInstallerTest.java
------------------------------------------------------------------------------
svn:eol-style = native