You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by cw...@apache.org on 2009/06/03 22:42:49 UTC
svn commit: r781537 - in
/incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test:
java/org/apache/uima/ae/noop/ java/org/apache/uima/ee/test/
resources/deployment/ resources/descriptors/analysis_engine/
Author: cwiklik
Date: Wed Jun 3 20:42:48 2009
New Revision: 781537
URL: http://svn.apache.org/viewvc?rev=781537&view=rev
Log:
UIMA-1369 Added new testcase with supporting config files to test handling of exceptions thrown by collocated component during initialization
Added:
incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/deployment/Deploy_AggregateWithFailingCollocatedDelegate.xml
incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/NoOpAnnotatorWithInitFailure.xml
incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWithFailingCollocatedComponent.xml
Modified:
incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ae/noop/NoOpAnnotator.java
incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java
Modified: incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ae/noop/NoOpAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ae/noop/NoOpAnnotator.java?rev=781537&r1=781536&r2=781537&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ae/noop/NoOpAnnotator.java (original)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ae/noop/NoOpAnnotator.java Wed Jun 3 20:42:48 2009
@@ -19,6 +19,8 @@
package org.apache.uima.ae.noop;
+import java.io.FileNotFoundException;
+
import org.apache.uima.UIMAFramework;
import org.apache.uima.UimaContext;
import org.apache.uima.analysis_component.CasAnnotator_ImplBase;
@@ -42,16 +44,22 @@
{
super.initialize(aContext);
- if ( getContext().getConfigParameterValue("ErrorFrequency") != null )
+ if ( getContext().getConfigParameterValue("FailDuringInitialization") != null )
{
- errorFrequency = ((Integer)getContext().getConfigParameterValue("ErrorFrequency")).intValue();
- countDown = errorFrequency;
+ throw new ResourceInitializationException(new FileNotFoundException("Simulated Exception"));
}
+
+ if ( getContext().getConfigParameterValue("ErrorFrequency") != null )
+ {
+ errorFrequency = ((Integer)getContext().getConfigParameterValue("ErrorFrequency")).intValue();
+ countDown = errorFrequency;
+ }
+
+
if ( getContext().getConfigParameterValue("CpCDelay") != null )
{
cpcDelay = ((Integer)getContext().getConfigParameterValue("CpCDelay")).intValue();
}
-
if ( getContext().getConfigParameterValue("ProcessDelay") != null )
{
processDelay = ((Integer)getContext().getConfigParameterValue("ProcessDelay")).intValue();
Modified: incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java?rev=781537&r1=781536&r2=781537&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java (original)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java Wed Jun 3 20:42:48 2009
@@ -33,6 +33,7 @@
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.Session;
+import javax.resource.ResourceException;
import junit.framework.Assert;
@@ -74,6 +75,10 @@
private static final String primitiveServiceQueue1 = "NoOpAnnotatorQueue";
private static final String PrimitiveDescriptor1 = "resources/descriptors/analysis_engine/NoOpAnnotator.xml";
private int getMetaRequestCount = 0;
+
+
+
+
/**
* Tests Broker startup and shutdown
*/
@@ -146,20 +151,35 @@
deployService(eeUimaEngine, relativePath+"/Deploy_PersonTitleAnnotator.xml");
runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"PersonTitleAnnotatorQueue", 0, EXCEPTION_LATCH);
}
- /**
- * Tests a simple Aggregate with one remote Delegate and collocated Cas Multiplier
- *
- * @throws Exception
- */
- public void testDeployAggregateService() throws Exception
- {
- System.out.println("-------------- testDeployAggregateService -------------");
- BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
- System.setProperty(JmsConstants.SessionTimeoutOverride, "2500000");
- deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator.xml");
- deployService(eeUimaEngine, relativePath+"/Deploy_AggregateAnnotator.xml");
- runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 0, PROCESS_LATCH);
- }
+ /**
+ * Tests handling of ResourceInitializationException that happens in a collocated primitive
+ *
+ * @throws Exception
+ */
+ public void testDeployAggregateServiceWithFailingCollocatedComponent() throws Exception
+ {
+ System.out.println("-------------- testDeployAggregateServiceWithFailingCollocatedComponent -------------");
+ BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
+ try {
+ deployService(eeUimaEngine, relativePath+"/Deploy_AggregateWithFailingCollocatedDelegate.xml");
+ } catch ( ResourceInitializationException e) {
+ // This is expected
+ } catch ( Exception e) {
+ fail("Expected ResourceInitializationException Instead Caught:"+e.getClass().getName());
+ }
+ }
+ public void testDeployAggregateService() throws Exception
+ {
+ System.out.println("-------------- testDeployAggregateService -------------");
+ BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
+ System.setProperty(JmsConstants.SessionTimeoutOverride, "2500000");
+ deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator.xml");
+ deployService(eeUimaEngine, relativePath+"/Deploy_AggregateAnnotator.xml");
+ runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 0, PROCESS_LATCH);
+ }
+
+
+
/**
* Tests a simple Aggregate with one remote Delegate and collocated Cas Multiplier
*
Added: incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/deployment/Deploy_AggregateWithFailingCollocatedDelegate.xml
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/deployment/Deploy_AggregateWithFailingCollocatedDelegate.xml?rev=781537&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/deployment/Deploy_AggregateWithFailingCollocatedDelegate.xml (added)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/deployment/Deploy_AggregateWithFailingCollocatedDelegate.xml Wed Jun 3 20:42:48 2009
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <!--
+ ***************************************************************
+ * 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.
+ ***************************************************************
+ -->
+
+<analysisEngineDeploymentDescription xmlns="http://uima.apache.org/resourceSpecifier">
+
+ <name>Top Level TAE</name>
+ <description></description>
+
+ <deployment protocol="jms" provider="activemq">
+ <casPool numberOfCASes="5"/>
+ <service>
+ <inputQueue endpoint="TopLevelTaeQueue" brokerURL="tcp://localhost:8118" prefetch="1"/>
+ <topDescriptor>
+ <import location="../descriptors/analysis_engine/SimpleTestAggregateWithFailingCollocatedComponent.xml"/>
+ </topDescriptor>
+ <analysisEngine>
+ <delegates>
+
+ <analysisEngine key="TestMultiplier">
+ <casMultiplier poolSize="5"/>
+ </analysisEngine>
+
+ </delegates>
+ </analysisEngine>
+ </service>
+ </deployment>
+
+</analysisEngineDeploymentDescription>
\ No newline at end of file
Added: incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/NoOpAnnotatorWithInitFailure.xml
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/NoOpAnnotatorWithInitFailure.xml?rev=781537&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/NoOpAnnotatorWithInitFailure.xml (added)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/NoOpAnnotatorWithInitFailure.xml Wed Jun 3 20:42:48 2009
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+ ***************************************************************
+ * 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.
+ ***************************************************************
+ -->
+<analysisEngineDescription xmlns="http://uima.apache.org/resourceSpecifier">
+ <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+ <primitive>true</primitive>
+ <annotatorImplementationName>org.apache.uima.ae.noop.NoOpAnnotator</annotatorImplementationName>
+ <analysisEngineMetaData>
+ <name>NoOpAnnotator</name>
+ <description>Annotator That Does Nothin</description>
+ <version>1.0</version>
+ <vendor>The Apache Software Foundation</vendor>
+
+ <configurationParameters>
+ <configurationParameter>
+ <name>ErrorFrequency</name>
+ <description>Frequency of Generated Errors</description>
+ <type>Integer</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+
+ <configurationParameter>
+ <name>ProcessDelay</name>
+ <description>Process Delay</description>
+ <type>Integer</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+
+ <configurationParameter>
+ <name>FailDuringInitialization</name>
+ <description>Causes Failure During Initialization</description>
+ <type>Integer</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+
+ </configurationParameters>
+
+ <configurationParameterSettings>
+ <nameValuePair>
+ <name>ErrorFrequency</name>
+ <value>
+ <integer>0</integer>
+ </value>
+ </nameValuePair>
+
+ <nameValuePair>
+ <name>ProcessDelay</name>
+ <value>
+ <integer>0</integer>
+ </value>
+ </nameValuePair>
+
+ <nameValuePair>
+ <name>FailDuringInitialization</name>
+ <value>
+ <integer>0</integer>
+ </value>
+ </nameValuePair>
+
+ </configurationParameterSettings>
+
+ <typeSystemDescription>
+ </typeSystemDescription>
+
+ <capabilities>
+ </capabilities>
+
+ <operationalProperties>
+ <modifiesCas>true</modifiesCas>
+ <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+ <outputsNewCASes>false</outputsNewCASes>
+ </operationalProperties>
+ </analysisEngineMetaData>
+</analysisEngineDescription>
Added: incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWithFailingCollocatedComponent.xml
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWithFailingCollocatedComponent.xml?rev=781537&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWithFailingCollocatedComponent.xml (added)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWithFailingCollocatedComponent.xml Wed Jun 3 20:42:48 2009
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <!--
+ ***************************************************************
+ * 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.
+ ***************************************************************
+ -->
+
+<analysisEngineDescription xmlns="http://uima.apache.org/resourceSpecifier">
+ <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+ <primitive>false</primitive>
+ <delegateAnalysisEngineSpecifiers>
+
+ <delegateAnalysisEngine key="TestMultiplier">
+ <import location="../multiplier/SimpleCasGeneratorProducing10Cases.xml"/>
+ </delegateAnalysisEngine>
+
+ <delegateAnalysisEngine key="NoOp">
+ <import location="NoOpAnnotatorWithInitFailure.xml"/>
+ </delegateAnalysisEngine>
+
+ </delegateAnalysisEngineSpecifiers>
+ <analysisEngineMetaData>
+ <name>Test Aggregate TAE</name>
+ <description>Detects Nothing</description>
+ <configurationParameters/>
+ <configurationParameterSettings/>
+ <flowConstraints>
+ <fixedFlow>
+ <node>TestMultiplier</node>
+ <node>NoOp</node>
+ </fixedFlow>
+ </flowConstraints>
+ <capabilities>
+ <capability>
+ <inputs/>
+ <outputs>
+ </outputs>
+ <languagesSupported>
+ <language>en</language>
+ </languagesSupported>
+ </capability>
+ </capabilities>
+ <operationalProperties>
+ <modifiesCas>true</modifiesCas>
+ <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+ <outputsNewCASes>false</outputsNewCASes>
+ </operationalProperties>
+ </analysisEngineMetaData>
+</analysisEngineDescription>