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/05/27 17:22:21 UTC

svn commit: r779211 - in /incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test: java/org/apache/uima/ae/noop/ java/org/apache/uima/ee/test/ java/org/apache/uima/ee/test/flow/ java/org/apache/uima/ee/test/utils/ resources/deployment/ resource...

Author: cwiklik
Date: Wed May 27 15:22:20 2009
New Revision: 779211

URL: http://svn.apache.org/viewvc?rev=779211&view=rev
Log:
UIMA-1353 Applying Burns Patch. Also Modified testJmsServiceAdapterWithGetMetaTimeout to test for failure

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/TestUimaASBasic.java
    incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java
    incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/flow/AdvancedFixedFlowController.java
    incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/utils/BaseTestSupport.java
    incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/deployment/Deploy_AggregateAnnotatorWithThresholdWindow.xml
    incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWith100DocCM.xml
    incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWithFlowControllerExceptionOnDisableDelegate.xml
    incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWithParallelFlow.xml
    incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWithRetries.xml
    incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/flow/AdvancedFixedFlowController.xml

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=779211&r1=779210&r2=779211&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 May 27 15:22:20 2009
@@ -92,7 +92,7 @@
 			System.out.println("NoOpAnnotator.process() called for the " + counter + "th time. Hashcode:"+hashCode());
       }
      else {
-    	 if ( UIMAFramework.getLogger().isLoggable(Level.FINE))
+//    	 if ( UIMAFramework.getLogger().isLoggable(Level.FINE))
 				System.out.println("NoOpAnnotator.process() called for the " + counter + "th time, delaying Response For:" +processDelay +" millis");
 				synchronized( this )
 				{

Modified: incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASBasic.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASBasic.java?rev=779211&r1=779210&r2=779211&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASBasic.java (original)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASBasic.java Wed May 27 15:22:20 2009
@@ -80,7 +80,6 @@
 		System.out.println("-------------- testInvalidInitializeCall -------------");
 		//	Instantiate Uima EE Client
 		BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
-		super.setExpectingServiceShutdown();
 
 		deployService(eeUimaEngine, relativePath+"/Deploy_PersonTitleAnnotator.xml");
 		Map<String, Object> appCtx = buildContext( String.valueOf(broker.getMasterConnectorURI()),"PersonTitleAnnotatorQueue" );
@@ -132,7 +131,6 @@
 		BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
 		//	Deploy Uima EE Primitive Service 
 		deployService(eeUimaEngine, relativePath+"/Deploy_PersonTitleAnnotator.xml");
-		super.setExpectingServiceShutdown();
 		runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"PersonTitleAnnotatorQueue", 0, EXCEPTION_LATCH);
 	}
 	/**
@@ -147,7 +145,6 @@
 		System.setProperty(JmsConstants.SessionTimeoutOverride, "2500000");
 		deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator.xml");
 		deployService(eeUimaEngine, relativePath+"/Deploy_AggregateAnnotator.xml");
-		super.setExpectingServiceShutdown();
 		runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 0, EXCEPTION_LATCH);
 	}
 

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=779211&r1=779210&r2=779211&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 May 27 15:22:20 2009
@@ -34,6 +34,8 @@
 import javax.jms.MessageListener;
 import javax.jms.Session;
 
+import junit.framework.Assert;
+
 import org.apache.activemq.ActiveMQMessageConsumer;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.command.ActiveMQDestination;
@@ -91,7 +93,6 @@
 		System.out.println("-------------- testInvalidInitializeCall -------------");
 		//	Instantiate Uima EE Client
 		BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
-		super.setExpectingServiceShutdown();
 
 		deployService(eeUimaEngine, relativePath+"/Deploy_PersonTitleAnnotator.xml");
 		Map<String, Object> appCtx = buildContext( String.valueOf(broker.getMasterConnectorURI()),"PersonTitleAnnotatorQueue" );
@@ -143,7 +144,6 @@
 		BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
 		//	Deploy Uima EE Primitive Service 
 		deployService(eeUimaEngine, relativePath+"/Deploy_PersonTitleAnnotator.xml");
-		super.setExpectingServiceShutdown();
     runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"PersonTitleAnnotatorQueue", 0, EXCEPTION_LATCH);
 	}
 	/**
@@ -158,7 +158,6 @@
 		System.setProperty(JmsConstants.SessionTimeoutOverride, "2500000");
 		deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator.xml");
 		deployService(eeUimaEngine, relativePath+"/Deploy_AggregateAnnotator.xml");
-		super.setExpectingServiceShutdown();
 		runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 0, PROCESS_LATCH);
 	}
   /**
@@ -170,7 +169,6 @@
   {
     System.out.println("-------------- testDeployAggregateServiceWithBrokerPlaceholder -------------");
     final BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
-    super.setExpectingServiceShutdown();
     System.setProperty(JmsConstants.SessionTimeoutOverride, "2500000");
     System.setProperty("AggregateBroker", "tcp://localhost:8120");
     System.setProperty("NoOpBroker","tcp://localhost:8120");
@@ -232,7 +230,6 @@
 	    final BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
 	    deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator.xml");
 	    deployService(eeUimaEngine, relativePath+"/Deploy_AggregateAnnotatorOnSecondaryBroker.xml");
-	    super.setExpectingServiceShutdown();
 	   try {
 	     Thread t = new Thread() {
 	        public void run()
@@ -283,7 +280,6 @@
 		BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
 		deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator.xml");
 		deployService(eeUimaEngine, relativePath+"/Deploy_AggregateUsingRemoteTempQueue.xml");
-    super.setExpectingServiceShutdown();
 		runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, PROCESS_LATCH);
 		
 	}
@@ -302,7 +298,6 @@
 		deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator.xml");
 		deployService(eeUimaEngine, relativePath+"/Deploy_AggregateAnnotatorWithInternalCM1000Docs.xml");
 //		deployService(eeUimaEngine, relativePath+"/Deploy_AggregateAnnotatorWith1MillionDocs.xml");
-    super.setExpectingServiceShutdown();
 		runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, PROCESS_LATCH);
 		
 	}
@@ -314,7 +309,6 @@
 	    BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
 	    System.setProperty(JmsConstants.SessionTimeoutOverride, "2500000");
 	    deployService(eeUimaEngine, relativePath+"/Deploy_ComplexAggregateWithInnerAggregateCM.xml");
-	    super.setExpectingServiceShutdown();
 	    runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, PROCESS_LATCH);
 	  }
 
@@ -332,7 +326,6 @@
     //  Instantiate Uima EE Client
     BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
     deployService(eeUimaEngine, relativePath+"/Deploy_PersonTitleAnnotator.xml");
-    super.setExpectingServiceShutdown();
     Map<String, Object> appCtx = buildContext( String.valueOf(broker.getMasterConnectorURI()),"PersonTitleAnnotatorQueue" );
     // reduce the cas pool size and reply window
     appCtx.remove(UimaAsynchronousEngine.CasPoolSize);
@@ -365,7 +358,6 @@
 		BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
 		deployService(eeUimaEngine, relativePath+"/Deploy_PersonTitleAnnotator.xml");
 		Map<String, Object> appCtx = buildContext( String.valueOf(broker.getMasterConnectorURI()),"PersonTitleAnnotatorQueue" );
-		super.setExpectingServiceShutdown();
 		initialize(eeUimaEngine, appCtx);
 		waitUntilInitialized();
 		try
@@ -399,11 +391,10 @@
 	 */
 	public void testTerminateOnFlowControllerExceptionOnDisable() throws Exception
 	  {
-	    System.out.println("-------------- testTerminateOnFlowControllerExceptionOnNextStep -------------");
+	    System.out.println("-------------- testTerminateOnFlowControllerExceptionOnDisable -------------");
 	    BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
 	    deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotatorWithException.xml");
 	    deployService(eeUimaEngine, relativePath+"/Deploy_AggregateWithFlowControllerExceptionOnDisable.xml");
-		super.setExpectingServiceShutdown();
 	    runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, EXCEPTION_LATCH); //PC_LATCH);
 	  }
   
@@ -416,7 +407,6 @@
     System.out.println("-------------- testTerminateOnFlowControllerExceptionOnInitialization -------------");
     
     BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
-    super.setExpectingServiceShutdown();
     String[] containerIds = new String[2];
     try {
         containerIds[0] = deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator.xml");
@@ -447,7 +437,6 @@
     System.out.println("-------------- testTerminateOnFlowControllerExceptionOnInitializationWithDisabledDelegates -----");
     
     BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
-    super.setExpectingServiceShutdown();
     String containerId = null;
     try {
         containerId = deployService(eeUimaEngine, relativePath+"/Deploy_AggregateWithFlowControllerExceptionOnInitialization.xml");
@@ -477,7 +466,6 @@
 		BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
 		//	Deploy Uima EE Primitive Service 
 		deployService(eeUimaEngine, relativePath+"/Deploy_PersonTitleAnnotator.xml");
-		super.setExpectingServiceShutdown();
     runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"PersonTitleAnnotatorQueue", 5, PROCESS_LATCH);
 	}
 
@@ -494,7 +482,6 @@
     BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
     //  Deploy Uima EE Primitive Service 
     deployService(eeUimaEngine, relativePath+"/Deploy_MeetingDetectorAggregate.xml");
-    super.setExpectingServiceShutdown();
     runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"MeetingDetectorQueue", 5, PROCESS_LATCH);
   }
 
@@ -511,7 +498,6 @@
     final BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
     //  Deploy Uima EE Primitive Service 
     final String containerID = deployService(eeUimaEngine, relativePath+"/Deploy_PersonTitleAnnotator.xml");
-    super.setExpectingServiceShutdown();
     Map<String, Object> appCtx = buildContext( String.valueOf(broker.getMasterConnectorURI()), "PersonTitleAnnotatorQueue" );
     // Set an explicit getMeta (Ping)timeout 
     appCtx.put(UimaAsynchronousEngine.GetMetaTimeout, 2000 );
@@ -527,8 +513,9 @@
         Object mux = new Object();
         synchronized( mux ) {
           try {
-            mux.wait(500);
+            mux.wait(1000);
             //  Undeploy service container
+            System.out.println("** About to undeploy PersonTitle service");
             eeUimaEngine.undeploy(containerID);
           } catch (Exception e) {}
         }
@@ -536,10 +523,11 @@
     }.start();
     
     try {
-      //  RuntimeException is expected due to failure
-      super.addExceptionToignore(ResourceInitializationException.class);
       runTest(appCtx,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"PersonTitleAnnotatorQueue", 500, EXCEPTION_LATCH);
-    } catch( RuntimeException e) {}
+    } catch( RuntimeException e) {
+      System.out.println(">>> runtest generated exception: "+e);
+      e.printStackTrace(System.out);
+    }
     
   }
 
@@ -560,7 +548,6 @@
     //  Deploy Uima EE Primitive Service 
     final String containerID = deployService(eeUimaEngine, relativePath+"/Deploy_RoomNumberAnnotator.xml");
     deployService(eeUimaEngine, relativePath+"/Deploy_MeetingDetectorTAE_RemoteRoomNumberDisable.xml");
-    super.setExpectingServiceShutdown();
     Map<String, Object> appCtx = buildContext( String.valueOf(broker.getMasterConnectorURI()), "MeetingDetectorTaeQueue" );
     // Set an explicit getMeta (Ping)timeout 
     appCtx.put(UimaAsynchronousEngine.GetMetaTimeout, 2000 );
@@ -606,7 +593,6 @@
     //  Deploy Uima EE Primitive Service 
     final String containerID = deployService(eeUimaEngine, relativePath+"/Deploy_RoomNumberAnnotator.xml");
     deployService(eeUimaEngine, relativePath+"/Deploy_MeetingDetectorTAEWithCM_RemoteRoomNumberDisable.xml");
-    super.setExpectingServiceShutdown();
     Map<String, Object> appCtx = buildContext( String.valueOf(broker.getMasterConnectorURI()), "MeetingDetectorTaeQueue" );
     // Set an explicit getMeta (Ping)timeout 
     appCtx.put(UimaAsynchronousEngine.GetMetaTimeout, 2000 );
@@ -645,7 +631,6 @@
 		System.out.println("-------------- testSynchCallProcessWithMultipleThreads -------------");
 		int howManyCASesPerRunningThread = 100;
 		int howManyRunningThreads = 4;
-		super.setExpectingServiceShutdown();
 		runTestWithMultipleThreads(relativePath+"/Deploy_PersonTitleAnnotator.xml", "PersonTitleAnnotatorQueue", howManyCASesPerRunningThread, howManyRunningThreads, 0, 0 );
 	}
 	/**
@@ -658,7 +643,6 @@
 		BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
 		//	Deploy Uima EE Primitive Service 
 		deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotatorWithLongDelay.xml");
-		super.setExpectingServiceShutdown();
 		//	We expect 18000ms to be spent in process method
 		super.setExpectedProcessTime(6000);
 
@@ -686,7 +670,6 @@
 		deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotatorBWithLongDelay.xml");
 		deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotatorCWithLongDelay.xml");
 		deployService(eeUimaEngine, relativePath+"/Deploy_AggregateAnnotatorWithLongDelay.xml");
-		super.setExpectingServiceShutdown();
 		//	We expect 18000ms to be spent in process method
 		super.setExpectedProcessTime(18000);
 	    Map<String, Object> appCtx = buildContext( String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue" );
@@ -707,7 +690,6 @@
 		BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
 		//	Deploy Uima EE Primitive Services each with 6000ms delay in process()
 		deployService(eeUimaEngine, relativePath+"/Deploy_AggregateWithLastCM.xml");
-		super.setExpectingServiceShutdown();
 		runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, PROCESS_LATCH, true);
 	}
 
@@ -724,7 +706,6 @@
 	  System.out.println("-------------- testTimeoutInSynchCallProcessWithMultipleThreads -------------");
 		int howManyCASesPerRunningThread = 2;
 		int howManyRunningThreads = 4;
-		super.setExpectingServiceShutdown();
     int processTimeout = 2000;
     int getMetaTimeout = 500;
 		runTestWithMultipleThreads(relativePath+"/Deploy_NoOpAnnotatorWithLongDelay.xml", "NoOpAnnotatorQueueLongDelay", howManyCASesPerRunningThread, howManyRunningThreads, processTimeout, getMetaTimeout );
@@ -743,7 +724,6 @@
     System.out.println("-------------- testTimeoutFailureInSynchCallProcessWithMultipleThreads -------------");
     int howManyCASesPerRunningThread = 1000;
     int howManyRunningThreads = 4;
-    super.setExpectingServiceShutdown();
     int processTimeout = 2000;
     int getMetaTimeout = 500;
     runTestWithMultipleThreads(relativePath+"/Deploy_NoOpAnnotator.xml", "NoOpAnnotatorQueue", howManyCASesPerRunningThread, howManyRunningThreads, 2000, 1000, true );
@@ -762,7 +742,6 @@
 		deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator.xml");
 		deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator2.xml");
     deployService(eeUimaEngine, relativePath+"/Deploy_AggregateWithParallelFlow.xml");
-    super.setExpectingServiceShutdown();
 		runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, PROCESS_LATCH);
 	}
 	/**
@@ -776,7 +755,6 @@
 		BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
 		deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator2.xml");
 		deployService(eeUimaEngine, relativePath+"/Deploy_AggregateWithParallelFlow.xml");
-    super.setExpectingServiceShutdown();
 		runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, PROCESS_LATCH);
 	}
 	/**
@@ -795,9 +773,6 @@
     Map<String, Object> appCtx = buildContext( String.valueOf(broker.getMasterConnectorURI()), "TopLevelTaeQueue" );
     // Set an explicit process timeout so one of the 1st parallels is disabled but 2nd parallel flow continues.
     appCtx.put(UimaAsynchronousEngine.Timeout, 20000 );
-    addExceptionToignore(org.apache.uima.aae.error.UimaEEServiceException.class);
-    addExceptionToignore(org.apache.uima.aae.error.UimaASProcessCasTimeout.class);
-    super.setExpectingServiceShutdown();
     
     runTest(appCtx, eeUimaEngine, null, null, 1, PROCESS_LATCH);
   }
@@ -819,10 +794,7 @@
     //  The Remote NoOp delays each CAS for 6000ms. The Aggregate sends two CASes so adjust
     //  client timeout to be just over 12000ms.
     appCtx.put(UimaAsynchronousEngine.Timeout, 13000 );
-    addExceptionToignore(org.apache.uima.aae.error.UimaEEServiceException.class);
-    addExceptionToignore(org.apache.uima.aae.error.UimaASProcessCasTimeout.class);
 
-    super.setExpectingServiceShutdown();
     runTest(appCtx, eeUimaEngine, null, null, 1, PROCESS_LATCH);
   }
 
@@ -843,13 +815,10 @@
     //  The Remote NoOp delays each CAS for 6000ms. The Aggregate sends two CASes so adjust
     //  client timeout to be just over 12000ms.
     appCtx.put(UimaAsynchronousEngine.Timeout, 13000 );
-    addExceptionToignore(org.apache.uima.aae.error.UimaEEServiceException.class);
-    addExceptionToignore(org.apache.uima.aae.error.UimaASProcessCasTimeout.class);
     //  Remove container with the remote NoOp delegate so that we can test
     //  the CAS Process and Ping timeout.
     eeUimaEngine.undeploy(delegateContainerId);  
     //  Send the CAS and handle exception
-    super.setExpectingServiceShutdown();
     runTest(appCtx, eeUimaEngine, null, null, 1, EXCEPTION_LATCH);
   }
 
@@ -859,7 +828,6 @@
 		BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
 		deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator.xml");
 		deployService(eeUimaEngine, relativePath+"/Deploy_ComplexAggregate.xml");
-		super.setExpectingServiceShutdown();
 		runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 10, PROCESS_LATCH);
 	}
 
@@ -869,7 +837,6 @@
 		BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
 		deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator.xml");
 		deployService(eeUimaEngine, relativePath+"/Deploy_AggregateAnnotator.xml");
-    super.setExpectingServiceShutdown();
 		runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, PROCESS_LATCH);
 	}
 
@@ -880,7 +847,6 @@
 		deployService(eeUimaEngine, relativePath+"/Deploy_RemoteCasMultiplier.xml");
 		deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator.xml");
 		deployService(eeUimaEngine, relativePath+"/Deploy_AggregateWithRemoteMultiplier.xml");
-    super.setExpectingServiceShutdown();
 		runTest(null, eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, PROCESS_LATCH);
 	}
 
@@ -896,7 +862,6 @@
     System.out.println("-------------- testProcessWithAggregateUsingRemoteMerger -------------");
     BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
     deployService(eeUimaEngine, relativePath+"/Deploy_AggregateWithCollocatedMerger.xml");
-    super.setExpectingServiceShutdown();
     runTest(null, eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, PROCESS_LATCH);
   }
 
@@ -906,7 +871,6 @@
 	    BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
 	    deployService(eeUimaEngine, relativePath+"/Deploy_RemoteCasMerger.xml");
 	    deployService(eeUimaEngine, relativePath+"/Deploy_AggregateWithRemoteMerger.xml");
-	    super.setExpectingServiceShutdown();
 	    runTest(null, eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, PROCESS_LATCH);
   }
 
@@ -922,7 +886,6 @@
 	    // reduce the cas pool size and reply window
 	    appCtx.remove(UimaAsynchronousEngine.ShadowCasPoolSize);
 	    appCtx.put(UimaAsynchronousEngine.ShadowCasPoolSize, Integer.valueOf(2));
-	    super.setExpectingServiceShutdown();
 		runTest(appCtx, eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, PROCESS_LATCH);
 	}
 	public void testClientProcessWithRemoteMultiplier() throws Exception
@@ -934,7 +897,6 @@
 		Map<String, Object> appCtx = buildContext( String.valueOf(broker.getMasterConnectorURI()),"TestMultiplierQueue" );
 	    appCtx.remove(UimaAsynchronousEngine.ShadowCasPoolSize);
 	    appCtx.put(UimaAsynchronousEngine.ShadowCasPoolSize, Integer.valueOf(1));
-	    super.setExpectingServiceShutdown();
 	    runTest(appCtx,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TestMultiplierQueue", 1, PROCESS_LATCH);
 	}
 
@@ -947,7 +909,6 @@
 		deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator.xml");
 		deployService(eeUimaEngine, relativePath+"/Deploy_RemoteCasMultiplierWith10Docs_1.xml");
 		deployService(eeUimaEngine, relativePath+"/Deploy_CasMultiplierAggregateWithRemoteCasMultiplier.xml");
-    super.setExpectingServiceShutdown();
 		runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, PROCESS_LATCH);
 	}
 	
@@ -960,7 +921,6 @@
 		deployService(eeUimaEngine, relativePath+"/Deploy_RemoteCasMultiplierWith10Docs_1.xml");
 		deployService(eeUimaEngine, relativePath+"/Deploy_RemoteCasMultiplierWith10Docs_2.xml");
 		deployService(eeUimaEngine, relativePath+"/Deploy_AggregateWith2RemoteMultipliers.xml");
-    super.setExpectingServiceShutdown();
 		runTest(null, eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, PROCESS_LATCH);
 	}
 	
@@ -970,7 +930,6 @@
 		BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
 		deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator.xml");
 		deployService(eeUimaEngine, relativePath+"/Deploy_AggregateWith2Multipliers.xml");
-    super.setExpectingServiceShutdown();
 		runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, PROCESS_LATCH);
 	}
 
@@ -979,7 +938,6 @@
     System.out.println("-------------- testProcessAggregateWithInnerCMAggregate -------------");
     BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
     deployService(eeUimaEngine, relativePath+"/Deploy_TopAggregateWithInnerAggregateCM.xml");
-    super.setExpectingServiceShutdown();
     runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, PROCESS_LATCH);
   }
 	
@@ -998,7 +956,6 @@
 		//	Deploy top level Aggregate Cas Multiplier with 2 collocated Cas Multipliers
 		//	CM1 --> CM2 --> Remote AggregateCM --> Candidate Answer --> CC
 		deployService(eeUimaEngine, relativePath+"/Deploy_TopLevelBlueJAggregateCM.xml");
-		super.setExpectingServiceShutdown();
 		
 //    runTest2(null,eeUimaEngine,"tcp://localhost:61616","BJTopLevelAggregate", 1, PROCESS_LATCH);
   runTest2(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 10, PROCESS_LATCH);
@@ -1009,7 +966,6 @@
     System.out.println("-------------- testTypesystemMergeWithMultiplier -------------");
 		BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
 		deployService(eeUimaEngine, relativePath+"/Deploy_AggregateWithMergedTypes.xml");
-    super.setExpectingServiceShutdown();
 		runTest(null, eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, PROCESS_LATCH);
 	}
 	
@@ -1020,7 +976,6 @@
 		deployService(eeUimaEngine, relativePath+"/Deploy_RemoteCasMultiplier.xml");
 		deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotatorWithExceptionOn5thCAS.xml");
 		deployService(eeUimaEngine, relativePath+"/Deploy_AggregateWithRemoteMultiplier.xml");
-		super.setExpectingServiceShutdown();
 		runTest(null, eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, EXCEPTION_LATCH);
 	}
 
@@ -1030,7 +985,6 @@
 		BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
 		deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator.xml");
 		deployService(eeUimaEngine, relativePath+"/Deploy_ComplexAggregateWith1MillionDocs.xml");
-		super.setExpectingServiceShutdown();
 		//	Spin a thread to cancel Process after 20 seconds
 		spinShutdownThread( eeUimaEngine, 20000 );
 		runTest(null, eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1,PROCESS_LATCH);
@@ -1042,7 +996,6 @@
 		deployService(eeUimaEngine, relativePath+"/Deploy_RemoteCasMultiplierWith1MillionDocs.xml");
 		deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator.xml");
 		deployService(eeUimaEngine, relativePath+"/Deploy_AggregateWithRemoteMultiplier.xml");
-		super.setExpectingServiceShutdown();
 		//	Spin a thread to cancel Process after 20 seconds
 		spinShutdownThread( eeUimaEngine, 20000 );
 		runTest(null, eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1,PROCESS_LATCH);//EXCEPTION_LATCH);
@@ -1063,7 +1016,6 @@
 		BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
 		//	Deploy remote service
 		deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotatorWithException.xml");
-		super.setExpectingServiceShutdown();
 		//	Deploy Uima EE Primitive Service 
 		//	Initialize and run the Test. Wait for a completion and cleanup resources.
 		runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"NoOpAnnotatorQueue", 1, EXCEPTION_LATCH);
@@ -1082,8 +1034,6 @@
 		//	Deploy top level aggregate service
 		deployService(eeUimaEngine, relativePath+"/Deploy_AggregateWithParallelFlowTerminateOnDelegateFailure.xml");
 		
-		super.setExpectingServiceShutdown();
-		
 		//	Initialize and run the Test. Wait for a completion and cleanup resources.
 		runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, EXCEPTION_LATCH); //PC_LATCH);
 	}
@@ -1105,8 +1055,6 @@
     Map<String, Object> appCtx = buildContext( String.valueOf(broker.getMasterConnectorURI()), "TopLevelTaeQueue" );
     // Set an explicit CPC timeout as exceptions thrown in the 2nd annotator's CPC don't reach the client.
     appCtx.put(UimaAsynchronousEngine.CpcTimeout, 20000 );
-    addExceptionToignore(org.apache.uima.aae.error.UimaEEServiceException.class);
-    super.setExpectingServiceShutdown();
     runTest(appCtx,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, PROCESS_LATCH); //PC_LATCH);
   }
 
@@ -1118,8 +1066,6 @@
     deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotatorWithException.xml");
     deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator2.xml");
     deployService(eeUimaEngine, relativePath+"/Deploy_AggregateWithParallelFlowDisableOnDelegateFailure.xml");
-    addExceptionToignore(org.apache.uima.aae.error.UimaEEServiceException.class);
-    super.setExpectingServiceShutdown();
     runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, PROCESS_LATCH); //PC_LATCH);
   }
 
@@ -1132,7 +1078,6 @@
 		deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator.xml");
 		//	Deploy top level aggregate service
 		deployService(eeUimaEngine, relativePath+"/Deploy_AggregateAnnotator.xml");
-		super.setExpectingServiceShutdown();
 		//	Initialize and run the Test. Wait for a completion and cleanup resources.
 		runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, CPC_LATCH );
 	}
@@ -1146,7 +1091,6 @@
 		BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
 		//	Deploy remote service
 		deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator.xml");
-		super.setExpectingServiceShutdown();
 		//	Initialize and run the Test. Wait for a completion and cleanup resources.
 		runTest(null,eeUimaEngine,httpURI,"NoOpAnnotatorQueue", 1, CPC_LATCH );
 	}
@@ -1160,7 +1104,6 @@
 		//	Deploy remote service
 		deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator.xml");
 		deployService(eeUimaEngine, relativePath+"/Deploy_AggregateAnnotator.xml");
-		super.setExpectingServiceShutdown();
 		//	Initialize and run the Test. Wait for a completion and cleanup resources.
 		runTest(null,eeUimaEngine,httpURI,"TopLevelTaeQueue", 1, CPC_LATCH );
 	}
@@ -1200,7 +1143,6 @@
         if (err >= 0) {
           fail("Illegal XML char at offset " + err);
         }
-				super.setExpectingServiceShutdown();
 				//	Initialize and run the Test. Wait for a completion and cleanup resources.
 				runTest(null,eeUimaEngine,httpURI,"NoOpAnnotatorQueue", 1, CPC_LATCH );
 			}
@@ -1224,7 +1166,6 @@
 		deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator.xml");
 		//	Deploy top level aggregate that communicates with the remote via Http Tunnelling
 		deployService(eeUimaEngine, relativePath+"/Deploy_AggregateAnnotatorWithHttpDelegate.xml");
-		super.setExpectingServiceShutdown();
 		
 		//	Initialize and run the Test. Wait for a completion and cleanup resources.
 		runTest(null,eeUimaEngine, String.valueOf(broker.getMasterConnectorURI()), "TopLevelTaeQueue", 10, CPC_LATCH );
@@ -1249,7 +1190,6 @@
 	    appCtx.put(UimaAsynchronousEngine.CasPoolSize, Integer.valueOf(2));
 	    appCtx.remove(UimaAsynchronousEngine.ReplyWindow);
 	    appCtx.put(UimaAsynchronousEngine.ReplyWindow, 1);
-	    super.setExpectingServiceShutdown();
 
 	    // set the collection reader
 	    String filename = super.getFilepathFromClassloader("descriptors/collection_reader/FileSystemCollectionReader.xml");
@@ -1286,7 +1226,6 @@
     initialize(eeUimaEngine, appCtx);
     //  Wait until the top level service returns its metadata
     waitUntilInitialized();
-    super.setExpectingServiceShutdown();
 
     CAS cas = eeUimaEngine.getCAS();
     System.out.println(" Sending CAS to kick off aggregate w/colocated CasMultiplier");
@@ -1311,7 +1250,6 @@
     initialize(eeUimaEngine, appCtx);
     //  Wait until the top level service returns its metadata
     waitUntilInitialized();
-    super.setExpectingServiceShutdown();
     CAS cas = eeUimaEngine.getCAS();
     //	Register special callback listener. This listener will receive
     //	an exception with the Cas Reference id.
@@ -1402,7 +1340,6 @@
 		appCtx.put(UimaAsynchronousEngine.ServerUri, String.valueOf(broker.getMasterConnectorURI()));
 		appCtx.put(UimaAsynchronousEngine.Endpoint, "TopLevelTaeQueue");
 		appCtx.put(UimaAsynchronousEngine.GetMetaTimeout, 20000);
-    super.setExpectingServiceShutdown();
 		runTest(appCtx,eeUimaEngine, String.valueOf(broker.getMasterConnectorURI()), "TopLevelTaeQueue", 1, EXCEPTION_LATCH );
 		fail("Expected ResourceInitializationException. Instead, the Aggregate Reports Successfull Initialization");
 	}
@@ -1445,7 +1382,6 @@
 		appCtx.put(UimaAsynchronousEngine.ServerUri, String.valueOf(broker.getMasterConnectorURI()));
 		appCtx.put(UimaAsynchronousEngine.Endpoint, "TopLevelTaeQueue");
 		appCtx.put(UimaAsynchronousEngine.GetMetaTimeout, 20000);
-    super.setExpectingServiceShutdown();
 		runTest(appCtx,eeUimaEngine, String.valueOf(broker.getMasterConnectorURI()), "TopLevelTaeQueue", 1, PROCESS_LATCH );
 	}
 	catch( Exception e)
@@ -1472,7 +1408,6 @@
 		deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator.xml");
 		//	Deploy top level aggregate that communicates with the remote via Http Tunnelling
 		deployService(eeUimaEngine, relativePath+"/Deploy_AggregateAnnotatorWithHttpDelegateNoRetries.xml");
-		super.setExpectingServiceShutdown();
 		runTest(null,eeUimaEngine, String.valueOf(broker.getMasterConnectorURI()), "TopLevelTaeQueue", 10, EXCEPTION_LATCH );
 		fail("Expected ResourceInitializationException. Instead, the Aggregate Reports Successfull Initialization");
 	}
@@ -1508,7 +1443,6 @@
     deployService(eeUimaEngine, relativePath+"/Deploy_WriterAnnotatorA.xml");
     deployService(eeUimaEngine, relativePath+"/Deploy_WriterAnnotatorB.xml");
     deployService(eeUimaEngine, relativePath+"/Deploy_AggregateWithContinueOnRetryFailures.xml");
-    super.setExpectingServiceShutdown();
     runTest(null, eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, PROCESS_LATCH);
     if ( !(new File(tempDir, "WriterAnnotatorB.3")).exists()
             || (new File(tempDir, "WriterAnnotatorB.4")).exists()) {
@@ -1530,7 +1464,6 @@
     BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
     deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotator.xml");
     deployService(eeUimaEngine, relativePath+"/Deploy_SyncAggregateWithJmsService.xml");
-    super.setExpectingServiceShutdown();
     runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, PROCESS_LATCH);
   }
 
@@ -1539,7 +1472,6 @@
 	  BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
     deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotatorWithException.xml");
     deployService(eeUimaEngine, relativePath+"/Deploy_SyncAggregateWithJmsService.xml");
-    super.setExpectingServiceShutdown();
     runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, EXCEPTION_LATCH);
   }
   
@@ -1548,26 +1480,28 @@
     BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
     deployService(eeUimaEngine, relativePath+"/Deploy_NoOpAnnotatorWithLongDelay.xml");
     deployService(eeUimaEngine, relativePath+"/Deploy_SyncAggregateWithJmsServiceLongDelay.xml");
-    super.setExpectingServiceShutdown();
     runTest(null,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, EXCEPTION_LATCH);
   }
 
   public void testJmsServiceAdapterWithGetmetaTimeout() throws Exception {
     System.out.println("-------------- testJmsServiceAdapterWithGetmetaTimeout -------------");
     BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
-    addExceptionToignore(ResourceInitializationException.class);
-    deployService(eeUimaEngine, relativePath+"/Deploy_SyncAggregateWithJmsService.xml");
-    Map<String, Object> appCtx = buildContext( String.valueOf(broker.getMasterConnectorURI()), "TopLevelTaeQueue" );
-    appCtx.put(UimaAsynchronousEngine.GetMetaTimeout, 1500 );
-    super.setExpectingServiceShutdown();
-    runTest(appCtx,eeUimaEngine,String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue", 1, EXCEPTION_LATCH);
+    // This test now fails.  First the deployment fails, leaving the running flag set (!)
+    // which makes runTest fail in the initialization phase ... so it never gets to
+    // use the EXCEPTION_LATCH
+    //addExceptionToignore(ResourceInitializationException.class);
+    try {
+      deployService(eeUimaEngine, relativePath+"/Deploy_SyncAggregateWithJmsService.xml");
+    } catch( ResourceInitializationException e ) {
+      return;
+    } 
+    Assert.fail("Expected ResourceInitializationException Not Thrown. Instead Got Clean Run");
   }
 
   public void testDeployAgainAndAgain() throws Exception
 	  {
 	    System.out.println("-------------- testDeployAgainAndAgain -------------");
 	    BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl(); // here or in the loop, no change.
-	    super.setExpectingServiceShutdown();
 	    
 	    for (int num=1; num<=50; num++) {
 	      System.out.println("\nRunning iteration " + num );
@@ -1695,11 +1629,11 @@
 			
 		}
     public void onBeforeMessageSend(UimaASProcessStatus status) {
-      System.out.println("Client Received onBeforeMessageSend Notification with Cas:"+status.getCasReferenceId());
+      System.out.println("TestListener Received onBeforeMessageSend Notification with Cas:"+status.getCasReferenceId());
     }
 
 		public void entityProcessComplete(CAS aCAS, EntityProcessStatus aProcessStatus) {
-			if (aProcessStatus.isException())
+		  if (aProcessStatus.isException())
 			{
 				if ( aProcessStatus instanceof UimaASProcessStatus )
 				{
@@ -1740,7 +1674,7 @@
 		}
     	public void run()
     	{
-    		System.out.println("Stopping Callback Listener Thread");
+    		System.out.println("Stopping TestListener Callback Listener Thread");
     	}
     }
 }

Modified: incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/flow/AdvancedFixedFlowController.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/flow/AdvancedFixedFlowController.java?rev=779211&r1=779210&r2=779211&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/flow/AdvancedFixedFlowController.java (original)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/flow/AdvancedFixedFlowController.java Wed May 27 15:22:20 2009
@@ -58,6 +58,8 @@
 import org.apache.uima.flow.SimpleStep;
 import org.apache.uima.flow.Step;
 import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.util.Level;
+import org.apache.uima.util.Logger;
 
 /**
  * Simple FlowController that invokes components in a fixed sequence.
@@ -66,6 +68,8 @@
   public static final String PARAM_ACTION_AFTER_CAS_MULTIPLIER = "ActionAfterCasMultiplier";
 
   public static final String PARAM_ALLOW_CONTINUE_ON_FAILURE = "AllowContinueOnFailure";
+
+  public static final String PARAM_ALLOW_DROP_ON_FAILURE = "AllowDropOnFailure";
   
   public static final String PARAM_FLOW = "Flow";
 
@@ -85,12 +89,19 @@
   
   private Set mAEsAllowingContinueOnFailure = new HashSet();
   
+  private Set mAEsAllowingDropOnFailure = new HashSet();
+
   private boolean flowError;
 
   private String[] exceptionsToIgnore;
   
+  private Logger mLogger;
+
+  private int nCreated;
+
   public void initialize(FlowControllerContext aContext) throws ResourceInitializationException {
     super.initialize(aContext);
+    mLogger = aContext.getLogger();
 
     String[] flow = (String[])aContext.getConfigParameterValue(PARAM_FLOW);
     mSequence = new ArrayList();
@@ -124,13 +135,22 @@
     exceptionsToIgnore = (String[])aContext
       .getConfigParameterValue(EXCEPTIONS_TO_IGNORE);
     
+    // Some delegates allow the CAS to continue in the flow after an error
     String[] aeKeysAllowingContinue = (String[])aContext
             .getConfigParameterValue(PARAM_ALLOW_CONTINUE_ON_FAILURE);
     if (aeKeysAllowingContinue != null) {
       mAEsAllowingContinueOnFailure.addAll(Arrays.asList(aeKeysAllowingContinue));
     }
     
-    flowError = false;
+    // Some delegates want the CAS quietly dropped after an error
+    String[] aeKeysAllowingDrop = (String[])aContext
+             .getConfigParameterValue(PARAM_ALLOW_DROP_ON_FAILURE);
+    if (aeKeysAllowingDrop != null) {
+      mAEsAllowingDropOnFailure.addAll(Arrays.asList(aeKeysAllowingDrop));
+    }
+
+   flowError = false;
+    nCreated = 0;
   }
 
   /*
@@ -139,7 +159,8 @@
    * @see org.apache.uima.flow.CasFlowController_ImplBase#computeFlow(org.apache.uima.cas.CAS)
    */
   public Flow computeFlow(CAS aCAS) throws AnalysisEngineProcessException {
-    return new FixedFlowObject(0);
+    ++nCreated;
+    return new FixedFlowObject(0, false, Integer.toString(nCreated));
   }
   
   /* (non-Javadoc)
@@ -181,16 +202,12 @@
     private boolean casMultiplierProducedNewCas = false;
 
     private boolean internallyCreatedCas = false;
+    
+    private boolean dropOnFailure = false;
+    
+    private String flowId;
 
-    /**
-     * Create a new fixed flow starting at step <code>startStep</code> of the fixed sequence.
-     * 
-     * @param startStep
-     *          index of mSequence to start at
-     */
-    public FixedFlowObject(int startStep) {
-      this(startStep, false);
-    }
+    private int nCreated;
 
     /**
      * Create a new fixed flow starting at step <code>startStep</code> of the fixed sequence.
@@ -201,9 +218,19 @@
      *          true to indicate that this Flow object is for a CAS that was produced by a
      *          CasMultiplier within this aggregate. Such CASes area allowed to be dropped and not
      *          output from the aggregate.
+     * @param id
+     *          id of CAS used in logging messages
      * 
      */
-    public FixedFlowObject(int startStep, boolean internallyCreatedCas) {
+    public FixedFlowObject(int startStep, boolean internallyCreatedCas, String id) {
+      if (internallyCreatedCas) {
+        mLogger.log(Level.FINE, "CAS " + id + " created by "
+                + ((SimpleStep) mSequence.get(startStep - 1)).getAnalysisEngineKey());
+      } else {
+        mLogger.log(Level.FINE, "CAS " + id + " at start of flow");
+      }
+      flowId = id;
+      nCreated = 0;
       currentStep = startStep;
       this.internallyCreatedCas = internallyCreatedCas;
     }
@@ -219,16 +246,25 @@
         throw new RuntimeException("Flow error found in continueOnFailure");
       }
 
+      if (dropOnFailure) {
+        mLogger.log(Level.FINE, "CAS " + flowId + " skips rest of flow after failing previous step");
+        return new FinalStep(internallyCreatedCas);
+      }
+      
       // if CAS was passed to a CAS multiplier on the last step, special processing
       // is needed according to the value of the ActionAfterCasMultiplier config parameter
       if (wasPassedToCasMultiplier) {
         switch (mActionAfterCasMultiplier) {
           case ACTION_STOP:
+            mLogger.log(Level.FINE, "CAS " + flowId + " stops after CasMultiplier ");
             return new FinalStep();
           case ACTION_DROP:
+            mLogger.log(Level.FINE, "CAS " + flowId + " discarded after CasMultiplier");
             return new FinalStep(internallyCreatedCas);
           case ACTION_DROP_IF_NEW_CAS_PRODUCED:
             if (casMultiplierProducedNewCas) {
+              mLogger.log(Level.FINE, "CAS " + flowId
+                      + " discarded after CasMultiplier (as new CAS produced)");
               return new FinalStep(internallyCreatedCas);
             }
             // else, continue with flow
@@ -243,15 +279,34 @@
       Step nextStep;
       do {
         if (currentStep >= mSequence.size()) {
+          mLogger.log(Level.FINE, "CAS " + flowId + " at end of flow");
           return new FinalStep(); // this CAS has finished the sequence
         }
         nextStep = (Step) mSequence.get(currentStep++);
+        if (nextStep == null) {
+          mLogger.log(Level.FINE, "CAS " + flowId + " skipping disabled step " + currentStep);
+        }
       } while (nextStep == null);
 
       // if next step is a CasMultiplier, set wasPassedToCasMultiplier to true for next time
       if (stepContainsCasMultiplier(nextStep))
         wasPassedToCasMultiplier = true;
 
+      String stepName = "?";
+      if (nextStep instanceof SimpleStep) {
+        stepName = ((SimpleStep) nextStep).getAnalysisEngineKey();
+        mLogger.log(Level.FINE, "CAS " + flowId + " sent to " + stepName);
+      } else if (nextStep instanceof FinalStep) {
+        stepName = "Final-" + currentStep;
+        mLogger.log(Level.FINE, "CAS " + flowId + " at final step - will"
+                + (((FinalStep) nextStep).getForceCasToBeDropped() ? "" : " not") + " be dropped");
+      } else if (nextStep instanceof ParallelStep) {
+        String[] keys = (String[]) ((ParallelStep) nextStep).getAnalysisEngineKeys().toArray(
+                new String[0]);
+        stepName = ((ParallelStep) nextStep).getAnalysisEngineKeys().toString();
+        mLogger.log(Level.FINE, "CAS " + flowId + " sent in parallel to: " + stepName);
+      }
+
       // now send the CAS to the next AE(s) in sequence.
       return nextStep;
     }
@@ -295,7 +350,8 @@
       int i = 0;
       while (!stepContains((Step)mSequence.get(i), producedBy))
         i++;
-      return new FixedFlowObject(i + 1, true);
+      ++nCreated;
+      return new FixedFlowObject(i + 1, true, flowId + "." + nCreated);
     }
 
     /**
@@ -324,21 +380,34 @@
      * @see org.apache.uima.flow.CasFlow_ImplBase#continueOnFailure(java.lang.String, java.lang.Exception)
      */
     public boolean continueOnFailure(String failedAeKey, Exception failure) {
-      // Check that root cause is an IndexOutOfBounds exception
-      Throwable cause = failure.getCause() == null ? failure : failure.getCause();
+      // Check that root cause is expected
+      Throwable cause = failure;
       while (cause.getCause() != null) {
         cause = cause.getCause();       
       }
-      if (cause.getClass() != IndexOutOfBoundsException.class && !ignoreException(cause)) {
-        System.out.println("FlowController.continueOnFailure - Invalid cause for delegate failure - expected "
-                + IndexOutOfBoundsException.class + " - received "+ cause.getClass());
+      mLogger.log(Level.WARNING, failedAeKey + " ERROR = " + cause.toString());
+      // Usually expect IndexOutOfBoundsException and MessageTimeoutException 
+      // which is forced when a delegate with outstanding CASes is disabled.
+      if ( !expectedException(cause)) {
+        System.out.println("FlowController.continueOnFailure - Unexpected cause for delegate failure: "+ cause.getClass());
         // Throwing an exception here doesn't stop flow!
+        // Will be thrown in "next" method so should let CAS continue !?
         flowError = true;
+        return false;
+      }
+      Boolean carryOn = mAEsAllowingContinueOnFailure.contains(failedAeKey);
+      dropOnFailure = internallyCreatedCas && mAEsAllowingDropOnFailure.contains(failedAeKey);
+      if (dropOnFailure) {
+        mLogger.log(Level.FINE, "CAS " + flowId
+                + " will be quietly dropped after failure of " + failedAeKey);
+      } else {
+        mLogger.log(Level.FINE, "CAS " + flowId + " CAN" + (carryOn ? "" : "NOT")
+                + " continue in flow after failure of " + failedAeKey);
       }
-      return mAEsAllowingContinueOnFailure.contains(failedAeKey);
+      return carryOn || dropOnFailure;
     }
     
-    private boolean ignoreException(Throwable failure) {
+    private boolean expectedException(Throwable failure) {
       if ( exceptionsToIgnore != null ) {
         for( String exception: exceptionsToIgnore) {
           if ( failure.getClass().getName().equals(exception)) {

Modified: incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/utils/BaseTestSupport.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/utils/BaseTestSupport.java?rev=779211&r1=779210&r2=779211&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/utils/BaseTestSupport.java (original)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/utils/BaseTestSupport.java Wed May 27 15:22:20 2009
@@ -31,12 +31,12 @@
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.jms.Message;
-import org.apache.uima.aae.error.UimaASProcessCasTimeout;
+
+import org.apache.uima.UIMAFramework;
 import org.apache.uima.aae.client.UimaASProcessStatus;
+import org.apache.uima.aae.client.UimaASProcessStatusImpl;
 import org.apache.uima.aae.client.UimaAsBaseCallbackListener;
 import org.apache.uima.aae.client.UimaAsynchronousEngine;
-import org.apache.uima.aae.client.UimaASProcessStatusImpl;
-import org.apache.uima.aae.client.UimaASStatusCallbackListener;
 import org.apache.uima.aae.error.ServiceShutdownException;
 import org.apache.uima.aae.error.UimaASPingTimeout;
 import org.apache.uima.aae.error.UimaASProcessCasTimeout;
@@ -46,6 +46,7 @@
 import org.apache.uima.collection.EntityProcessStatus;
 import org.apache.uima.resource.ResourceInitializationException;
 import org.apache.uima.resource.ResourceProcessException;
+import org.apache.uima.util.Level;
 import org.apache.uima.util.ProcessTrace;
 import org.apache.uima.util.ProcessTraceEvent;
 import org.apache.uima.util.impl.ProcessTrace_impl;
@@ -68,6 +69,7 @@
 	protected boolean initialized = false;
 	protected Object initializeMonitor = new Object();
 	protected boolean isStopped = false;
+	protected boolean isStopping = false;
 	protected long responseCounter = 0;
 	protected boolean expectingServiceShutdownException = false;
 	protected long expectedProcessTime = 0;
@@ -82,7 +84,7 @@
 	{
 	  String defaultBrokerURL = System.getProperty("BrokerURL");
 	  if (  defaultBrokerURL != null ) {
-	      System.out.println(">>> Setting defaultBrokerURL to:"+defaultBrokerURL);
+	      System.out.println(">>> runTest: Setting defaultBrokerURL to:"+defaultBrokerURL);
 	      System.setProperty("defaultBrokerURL", defaultBrokerURL);
     } else {
 	      System.setProperty("defaultBrokerURL", "tcp://localhost:8118");
@@ -98,13 +100,14 @@
 		  containerId = eeUimaEngine.deploy(aDeploymentDescriptorPath, appCtx);
 		} catch( ResourceInitializationException e) {
 		  if ( !ignoreException(ResourceInitializationException.class)) {
-		    System.out.println(">>>>>>>>>>> Stopping Client API Due To Initialization Exception");
+		    System.out.println(">>>>>>>>>>> runTest: Stopping Client API Due To Initialization Exception");
+		    isStopping = true;
 		    eeUimaEngine.stop();
 		    throw e;
 		  }
       System.out.println(">>>>>>>>>>> Exception ---:"+e.getClass().getName());
 		} catch( Exception e) {
-      System.out.println(">>>>>>>>>>> Exception:"+e.getClass().getName());
+      System.out.println(">>>>>>>>>>> runTest: Exception:"+e.getClass().getName());
       throw e;
 		}
 		return containerId;
@@ -126,6 +129,7 @@
 	    String name = anException.getName();
 	    if ( name.equals( exceptionsToIgnore.get(i).getName()) )
 	    {
+	      System.out.println("!!! runTest ignoring exception: "+name);
 	      return true;
 	    }
 	  }
@@ -136,10 +140,6 @@
 		eeUimaEngine.addStatusCallbackListener(listener);
 		eeUimaEngine.initialize(appCtx);
 	}
-	protected void setExpectingServiceShutdown()
-	{
-		expectingServiceShutdownException = true;
-	}
 	protected void setDoubleByteText( String aDoubleByteText )
 	{
 		doubleByteText = aDoubleByteText;
@@ -195,7 +195,7 @@
 
 		case PROCESS_LATCH:
 			// Initialize latch to open after CPC reply comes in.
-			System.out.println("Initializing Process Latch. Number of CASes Expected:" + howMany);
+			System.out.println("runTest: Initializing Process Latch. Number of CASes Expected:" + howMany);
 			processCountLatch = new CountDownLatch(howMany);
 			break;
 		}
@@ -278,6 +278,8 @@
 	protected void runTestWithMultipleThreads(String serviceDeplyDescriptor, String queueName, int howManyCASesPerRunningThread, int howManyRunningThreads, int timeout, int aGetMetaTimeout, boolean failOnTimeout) throws Exception
 	{
 		// Instantiate Uima EE Client
+	  isStopped = false;
+	  isStopping = false;
 		final BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
 		// Deploy Uima EE Primitive Service
 		final String containerId = deployService(eeUimaEngine, serviceDeplyDescriptor);
@@ -328,7 +330,7 @@
 			SynchRunner runner = new SynchRunner(eeUimaEngine, howManyCASesPerRunningThread);
 			Thread runnerThread = new Thread(runner);
 			runnerThread.start();
-			System.out.println("Started Runner Thread::Id=" + runnerThread.getId());
+			System.out.println("runTest: Started Runner Thread::Id=" + runnerThread.getId());
 
 		}
 		// Wait until ALL CASes return from the service
@@ -337,7 +339,7 @@
 
 		if (!isStopped && !unexpectedException)
 		{
-			System.out.println("Sending CPC");
+			System.out.println("runTest: Sending CPC");
 			// Send CPC
 			eeUimaEngine.collectionProcessingComplete();
 		}
@@ -348,8 +350,8 @@
 			cpcLatch.countDown();
 		}
 		t1.join();
+		isStopping = true;
 		eeUimaEngine.stop();
-
 	}
 
   protected void runCrTest(BaseUIMAAsynchronousEngine_impl aUimaEeEngine, int howMany) throws Exception
@@ -392,8 +394,10 @@
 		serviceShutdownException = false;
 		unexpectedException = false;
     engine = aUimaEeEngine;
+    isStopped = false;
+    isStopping = false;
 
-		if (appCtx == null)
+    if (appCtx == null)
 		{
 			appCtx = buildContext(aBrokerURI, aTopLevelServiceQueueName, 0);
 		}
@@ -414,8 +418,8 @@
 		if (howMany > 0)
 		{
 			final AtomicBoolean ctrlMonitor = new AtomicBoolean();
-			// Create a thread that will block until the CPC reply come back
-			// from the top level service
+			// Create a thread that will block until an exception is returned,
+			// or 2 threads that wait for 'howMany' CASes and then a CPC reply
 			if (aLatchKind == EXCEPTION_LATCH)
 			{
 				t1 = spinMonitorThread(ctrlMonitor, 1, EXCEPTION_LATCH);
@@ -428,7 +432,7 @@
 
 			if (!isStopped)
 			{
-				// Wait until the CPC Thread is ready.
+				// Wait until the monitor thread(s) start.
 				waitOnMonitor(ctrlMonitor);
 				if (!isStopped)
 				{
@@ -442,19 +446,17 @@
 
 					if (!serviceShutdownException && !isStopped && !unexpectedException)
 					{
-						System.out.println("Sending CPC");
-
-						// Send CPC
+						System.out.println("runTest: Sending CPC");
 						aUimaEeEngine.collectionProcessingComplete();
 					}
 					else
 					{
-            System.out.println(">>>>>>>>>>>>>>>> Not Sending CPC Due To Exception [serviceShutdownException="+serviceShutdownException+"] [isStopped="+isStopped+"] [unexpectedException="+unexpectedException+"]");
+            System.out.println(">>>>>>>>>>>>>>>> runTest: Not Sending CPC Due To Exception [serviceShutdownException="+serviceShutdownException+"] [isStopped="+isStopped+"] [unexpectedException="+unexpectedException+"]");
 					}
 				}
 
 				// If have skipped CPC trip the latch
-				if ( serviceShutdownException || (unexpectedException && cpcLatch != null) )
+				if ( (serviceShutdownException || unexpectedException) && cpcLatch != null )
 				{
 					cpcLatch.countDown();
 				}
@@ -467,6 +469,7 @@
 		{
 			fail("Unexpected exception returned");
 		}
+		isStopping = true;
 		aUimaEeEngine.stop();
 	}
 
@@ -488,6 +491,8 @@
 		Thread t1 = null;
 		Thread t2 = null;
     engine = aUimaEeEngine;
+    isStopped = false;
+    isStopping = false;
 
 		if (appCtx == null)
 		{
@@ -528,7 +533,7 @@
 
 					if (!serviceShutdownException && !isStopped && !unexpectedException)
 					{
-						System.out.println("Sending CPC");
+						System.out.println("runTest: Sending CPC");
 
 						// Send CPC
 						aUimaEeEngine.collectionProcessingComplete();
@@ -549,6 +554,7 @@
 		{
 			fail("Unexpected exception returned");
 		}
+		isStopping = true;
 		aUimaEeEngine.stop();
 	}
 	/**
@@ -566,13 +572,22 @@
 		for (int i = 0; i < howMany; i++)
 		{
 			CAS cas = eeUimaEngine.getCAS();
+			if (cas == null) {
+			  if (isStopping) {
+			    System.out.println(">> runTest: stopping after sending "+i+" of "+howMany+" CASes");
+			    return;
+			  }
+			  else {
+			    System.out.println(">>>> ERROR! sendCas: "+(i+1)+"-th CAS is null?");
+			  }
+			}
 			if ( doubleByteText != null )
 			{
 				cas.setDocumentText(doubleByteText);
 			}
 			else
 			{
-				cas.setDocumentText(text);
+			  cas.setDocumentText(text);
 			}
 			if (sendCasAsynchronously)
 			{
@@ -591,14 +606,14 @@
 	protected void incrementCASesProcessed()
 	{
 		responseCounter++;
-		System.out.println("Client:::::::::::::: Received:" + responseCounter + " Reply");
+		System.out.println("runTest: Client:::::::::::::: Received:" + responseCounter + " Reply");
 
 	}
 	
 	protected class UimaAsTestCallbackListener extends UimaAsBaseCallbackListener {
 	  
     public void onBeforeMessageSend(UimaASProcessStatus status) {
-      System.out.println("Received onBeforeMessageSend() Notification With CAS:"+status.getCasReferenceId());
+      System.out.println("runTest: Received onBeforeMessageSend() Notification With CAS:"+status.getCasReferenceId());
     }
 
 	  /**
@@ -618,13 +633,16 @@
 	      parentCasReferenceId = 
 	        ((UimaASProcessStatus)aProcessStatus).getParentCasReferenceId();
 	    }
+	    if (isStopping) {
+	      System.out.println(">>>>> runTest: Ignoring entityProcessComplete callback as engine is shutting down");
+	      return;
+	    }
 	    if (aProcessStatus.isException())
 	    {
+	      List list = aProcessStatus.getExceptions();
 	      if ( !expectingServiceShutdownException )
-	        System.out.println(" Process Received Reply Containing Exception.");
-	      
+	        System.out.println("runTest: Process Received Reply Containing "+list.size()+" Exception(s)");	      
 
-	      List list = aProcessStatus.getExceptions();
 	      for( int i=0; i < list.size(); i++)
 	      {
 	        Exception e = (Exception)list.get(i);
@@ -638,16 +656,15 @@
 	          expectedException = true;
 	        } else if ( e instanceof ResourceProcessException && isProcessTimeout(e) ) {
 	          synchronized(errorCounterMonitor) {
-	            System.out.println("Incrementing ProcessTimeout Counter");
+	            System.out.println("runTest: Incrementing ProcessTimeout Counter");
 	            timeoutCounter++;
 	          }
 	        } else if ( engine != null && e instanceof UimaASPingTimeout) {
-	          System.out.println(".......... Listener Stopping Uima AS Due to Ping Timeout. Service Not Responding To Ping");
-	          if ( cpcLatch != null)
-	          {
+	          System.out.println("runTest: Ping Timeout - service Not Responding To Ping");
+	          if ( cpcLatch != null) {
 	            cpcLatch.countDown();
 	          }
-
+	          isStopping = true;
 	          engine.stop();
 	        }
 	        if ( !expectedException && !expectingServiceShutdownException )
@@ -668,7 +685,7 @@
 	        if ( !expectedException && !(serviceShutdownException && expectingServiceShutdownException) )
 	        {
 	        unexpectedException = true;
-	        System.out.println(" ... when expecting normal completion!");
+	        System.out.println("runTest:  ... when expecting normal completion!");
 	        }
 	        while (processCountLatch.getCount() > 0)
 	        {
@@ -680,11 +697,11 @@
 	    {
 	      if ( parentCasReferenceId != null )
 	      {
-	        System.out.println("Client Received Reply Containing CAS:"+casReferenceId+" The Cas Was Generated From Parent Cas Id:"+parentCasReferenceId);
+	        System.out.println("runTest: Received Reply Containing CAS:"+casReferenceId+" The Cas Was Generated From Parent Cas Id:"+parentCasReferenceId);
 	      }
 	      else
 	      {
-	        System.out.println("Client Received Reply Containing CAS:"+casReferenceId);
+	        System.out.println("runTest: Received Reply Containing CAS:"+casReferenceId);
 	      }
 	      
 	      if ( doubleByteText != null )
@@ -711,7 +728,7 @@
 	      for( int i=0; i < eList.size(); i++)
 	      {
 	        ProcessTraceEvent eEvent = (ProcessTraceEvent)eList.get(i);
-	        System.out.println("Received Process Event - "+eEvent.getDescription()+" Duration::"+eEvent.getDuration()+" ms"); // / (float) 1000000);
+	        System.out.println("runTest: Received Process Event - "+eEvent.getDescription()+" Duration::"+eEvent.getDuration()+" ms"); // / (float) 1000000);
 	        //  Check if the running test wants to check how long the processing of CAS took
 	        if (  expectedProcessTime > 0 &&
 	            "Total Time In Process CAS".equals(eEvent.getDescription()))
@@ -720,7 +737,7 @@
 	          //  a CAS. Allow 50ms difference.
 	          if (eEvent.getDuration() > expectedProcessTime &&  (eEvent.getDuration() % expectedProcessTime ) > 50 ) 
 	          {
-	            System.out.println("!!!!!!!!!!!!! Expected Process CAS Duration of:"+expectedProcessTime+" ms. Instead Process CAS Took:"+eEvent.getDuration());
+	            System.out.println("!!!!!!!!!!!!! runTest: Expected Process CAS Duration of:"+expectedProcessTime+" ms. Instead Process CAS Took:"+eEvent.getDuration());
 	            unexpectedException = true;
 	          }
 	        }
@@ -742,12 +759,12 @@
 	    
 	    if (aStatus != null && aStatus.isException())
 	    {
-	      System.out.println("Initialization Received Reply Containing Exception:");
+	      System.out.println("runTest: Initialization Received Reply Containing Exception:");
 	      List exceptions = aStatus.getExceptions();
 	      for (int i = 0; i < exceptions.size(); i++)
 	      {
 	        if ( exceptions.get(i) instanceof UimaASPingTimeout ) {
-	          System.out.println("Client Received PING Timeout. Service Not Available");
+	          System.out.println("runTest: Client Received PING Timeout. Service Not Available");
 	          if (cpcLatch != null)
 	          {
 	            cpcLatch.countDown();
@@ -775,6 +792,11 @@
 	   */
 	  public void collectionProcessComplete(EntityProcessStatus aStatus)
 	  {
+	    if (isStopping) {
+	      System.out.println(">>>>> runTest: Ignoring collectionProcessComplete callback as engine is shutting down");
+	      return;
+	    }
+
 	    if (aStatus != null && aStatus.isException())
 	    {
 	      
@@ -799,8 +821,8 @@
 	      }
 	      if ( !expectedException && !(serviceShutdownException && expectingServiceShutdownException) )
 	      {
-	        System.out.println(" Received CPC Reply Containing Exception");
-	        System.out.println(" ... when expecting normal CPC reply!");
+	        System.out.println("runTest: Received CPC Reply Containing Exception\n" +
+	                           " ... when expecting normal CPC reply!");
 	        unexpectedException = true;
 	      }
 	      if (exceptionCountLatch != null)
@@ -814,7 +836,7 @@
 	    }
 	    else
 	    {
-	      System.out.println("Received CPC Reply");
+	      System.out.println("runTest: Received CPC Reply");
 	      if (cpcLatch != null)
 	      {
 	        cpcLatch.countDown();
@@ -867,7 +889,7 @@
 						cas.release();
 					}
 				}
-				System.out.println(">>>>>>>>Thread::" + Thread.currentThread().getId() + " Is Exiting - Completed Full Run");
+				System.out.println(">>>>>>>> runTest: Thread::" + Thread.currentThread().getId() + " Is Exiting - Completed Full Run");
 			}
 			catch (Exception e)
 			{
@@ -885,14 +907,19 @@
 			{
 				timer.cancel();
 				timer.purge();
-				System.out.println(">>>> Stopping UIMA EE Engine");
+				System.out.println(">>>> runTest: Stopping UIMA EE Engine");
+				isStopping = true;
 				uimaEEEngine.stop();
+				isStopping = false;
 				isStopped = true;
-				System.out.println(">>>> UIMA EE Engine Stopped");
+				System.out.println(">>>> runTest: UIMA EE Engine Stopped");
 				if (cpcLatch != null )
-				cpcLatch.countDown();
-				if ( processCountLatch != null)
-				processCountLatch.countDown();
+				  cpcLatch.countDown();
+				if ( processCountLatch != null) {
+          while (processCountLatch.getCount() > 0) {
+            processCountLatch.countDown();
+          }
+				}
 			}
 		}, timeToRun);
 		

Modified: incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/deployment/Deploy_AggregateAnnotatorWithThresholdWindow.xml
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/deployment/Deploy_AggregateAnnotatorWithThresholdWindow.xml?rev=779211&r1=779210&r2=779211&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/deployment/Deploy_AggregateAnnotatorWithThresholdWindow.xml (original)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/deployment/Deploy_AggregateAnnotatorWithThresholdWindow.xml Wed May 27 15:22:20 2009
@@ -47,7 +47,7 @@
             <scaleout numberOfInstances="1"/>
             <asyncAggregateErrorConfiguration>
               <getMetadataErrors maxRetries="0" timeout="5000" errorAction="continue"/>
-              <processCasErrors maxRetries="0" timeout="5000" continueOnRetryFailure="false" thresholdCount="3" thresholdWindow="7" thresholdAction="disable"/>
+              <processCasErrors maxRetries="0" timeout="5000" continueOnRetryFailure="true" thresholdCount="3" thresholdWindow="7" thresholdAction="disable"/>
               <collectionProcessCompleteErrors timeout="0" additionalErrorAction="terminate"/>
             </asyncAggregateErrorConfiguration>
           </analysisEngine>

Modified: incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWith100DocCM.xml
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWith100DocCM.xml?rev=779211&r1=779210&r2=779211&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWith100DocCM.xml (original)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWith100DocCM.xml Wed May 27 15:22:20 2009
@@ -33,6 +33,11 @@
       <import location="../multiplier/SimpleCasGenerator.xml"/>
     </delegateAnalysisEngine>
   </delegateAnalysisEngineSpecifiers>
+
+  <flowController key="FlowController">
+     <import location="../flow/AdvancedFixedFlowController.xml" /> 
+  </flowController>
+  
   <analysisEngineMetaData>
     <name>Test Aggregate TAE</name>
     <description>Detects Nothing</description>
@@ -67,6 +72,48 @@
           <parameter>NoOpAnnotatorWithCpcCheck/FinalCount</parameter>
         </overrides>
       </configurationParameter>
+
+      <configurationParameter>
+        <name>Flow</name>
+        <description> Specifies the flow. This is an array of strings where each string is either a single Analysis
+          Engine key or a comma-separated list of Analysis Engine keys that should be executed in parallel.
+          </description>
+        <type>String</type>
+        <multiValued>true</multiValued>
+        <mandatory>true</mandatory>
+        <overrides>
+          <parameter>FlowController/Flow</parameter>
+        </overrides>
+      </configurationParameter>
+      <configurationParameter>
+        <name>AllowContinueOnFailure</name>
+        <description/>
+        <type>String</type>
+        <multiValued>true</multiValued>
+        <overrides>
+          <parameter>FlowController/AllowContinueOnFailure</parameter>
+        </overrides>
+      </configurationParameter>
+      <configurationParameter>
+        <name>AllowDropOnFailure</name>
+        <description/>
+        <type>String</type>
+        <multiValued>true</multiValued>
+        <overrides>
+          <parameter>FlowController/AllowDropOnFailure</parameter>
+        </overrides>
+      </configurationParameter>
+      <configurationParameter>
+	        <name>ExceptionsToIgnore</name>
+	        <description>Specifies which exceptions to ignore.</description>
+	        <type>String</type>
+	        <multiValued>true</multiValued>
+	        <mandatory>false</mandatory>
+	        <overrides>
+	          <parameter>FlowController/ExceptionsToIgnore</parameter>
+	        </overrides>
+      </configurationParameter>
+      
     </configurationParameters>
     <configurationParameterSettings>
       <nameValuePair>
@@ -87,6 +134,36 @@
           <integer>91</integer>
         </value>
       </nameValuePair>
+
+      <!-- This specifies the flow -->
+      <nameValuePair>
+        <name>Flow</name>
+        <value>
+          <array>
+            <string>SimpleCasGenerator</string>
+            <string>NoOp</string>
+            <string>NoOpAnnotatorWithCpcCheck</string>
+          </array>
+        </value>
+      </nameValuePair>
+      <!-- This specifies for which AEs we can drop when an error occurs -->
+      <nameValuePair>
+        <name>AllowDropOnFailure</name>
+        <value>
+          <array>
+            <string>NoOp</string>
+          </array>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+	        <name>ExceptionsToIgnore</name>
+	        <value>
+	          <array>
+              <string>java.lang.IndexOutOfBoundsException</string>
+	          </array>
+	        </value>
+      </nameValuePair>
+      
     </configurationParameterSettings>
     <flowConstraints>
       <fixedFlow>

Modified: incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWithFlowControllerExceptionOnDisableDelegate.xml
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWithFlowControllerExceptionOnDisableDelegate.xml?rev=779211&r1=779210&r2=779211&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWithFlowControllerExceptionOnDisableDelegate.xml (original)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWithFlowControllerExceptionOnDisableDelegate.xml Wed May 27 15:22:20 2009
@@ -88,6 +88,7 @@
         <value>
           <array>
             <string>TestMultiplier</string>
+            <string>NoOp</string>
           </array>
         </value>
       </nameValuePair>

Modified: incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWithParallelFlow.xml
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWithParallelFlow.xml?rev=779211&r1=779210&r2=779211&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWithParallelFlow.xml (original)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWithParallelFlow.xml Wed May 27 15:22:20 2009
@@ -104,6 +104,7 @@
         <value>
           <array>
             <string>TestMultiplier</string>
+            <string>NoOp1</string>
           </array>
         </value>
       </nameValuePair>
@@ -112,6 +113,7 @@
 	        <name>ExceptionsToIgnore</name>
 	        <value>
 	          <array>
+              <string>java.lang.IndexOutOfBoundsException</string>
 	            <string>org.apache.uima.aae.error.MessageTimeoutException</string>
 	          </array>
 	        </value>

Modified: incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWithRetries.xml
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWithRetries.xml?rev=779211&r1=779210&r2=779211&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWithRetries.xml (original)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/analysis_engine/SimpleTestAggregateWithRetries.xml Wed May 27 15:22:20 2009
@@ -68,6 +68,25 @@
           <parameter>AdvancedFixedFlowController/AllowContinueOnFailure</parameter>
         </overrides>
       </configurationParameter>
+      <configurationParameter>
+        <name>AllowDropOnFailure</name>
+        <description/>
+        <type>String</type>
+        <multiValued>true</multiValued>
+        <overrides>
+          <parameter>AdvancedFixedFlowController/AllowDropOnFailure</parameter>
+        </overrides>
+      </configurationParameter>
+      <configurationParameter>
+	        <name>ExceptionsToIgnore</name>
+	        <description>Specifies which exceptions to ignore.</description>
+	        <type>String</type>
+	        <multiValued>true</multiValued>
+	        <mandatory>false</mandatory>
+	        <overrides>
+	          <parameter>AdvancedFixedFlowController/ExceptionsToIgnore</parameter>
+	        </overrides>
+      </configurationParameter>
     </configurationParameters>
     <configurationParameterSettings>
       <nameValuePair>
@@ -89,6 +108,23 @@
           </array>
         </value>
       </nameValuePair>
+      <!-- This specifies for which AEs we can drop when an error occurs -->
+      <nameValuePair>
+        <name>AllowDropOnFailure</name>
+        <value>
+          <array>
+            <string>WriterAnnotatorB</string>
+          </array>
+        </value>
+      </nameValuePair>
+      <nameValuePair>
+	        <name>ExceptionsToIgnore</name>
+	        <value>
+	          <array>
+              <string>java.lang.IndexOutOfBoundsException</string>
+	          </array>
+	        </value>
+      </nameValuePair>
     </configurationParameterSettings>
     <flowConstraints>
       <fixedFlow>

Modified: incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/flow/AdvancedFixedFlowController.xml
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/flow/AdvancedFixedFlowController.xml?rev=779211&r1=779210&r2=779211&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/flow/AdvancedFixedFlowController.xml (original)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/resources/descriptors/flow/AdvancedFixedFlowController.xml Wed May 27 15:22:20 2009
@@ -64,6 +64,25 @@
         <multiValued>true</multiValued>
         <mandatory>false</mandatory>
       </configurationParameter>
+
+      <configurationParameter>
+        <name>AllowDropOnFailure</name>
+        <description> Specifies for which AnalysisEngines a failed CAS can be dropped when an exception occurs. This
+          only applies to internally created CASes and prevents the exception from being transferred to their parent. This 
+          parameter takes an array of Strings as its value. Each String is the key of AnalysisEngine for which
+          dropping on failure should be allowed. </description>
+        <type>String</type>
+        <multiValued>true</multiValued>
+        <mandatory>false</mandatory>
+      </configurationParameter>
+
+      <configurationParameter>
+        <name>ExceptionsToIgnore</name>
+        <description>Specifies which exceptions to ignore.</description>
+        <type>String</type>
+        <multiValued>true</multiValued>
+        <mandatory>false</mandatory>
+      </configurationParameter>
     </configurationParameters>
     <configurationParameterSettings>
       <nameValuePair>
@@ -80,4 +99,4 @@
       </capability>
     </capabilities>
   </processingResourceMetaData>
-</flowControllerDescription>
\ No newline at end of file
+</flowControllerDescription>