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 2018/05/07 21:27:44 UTC

svn commit: r1831129 [2/5] - in /uima/uima-as/branches/uima-as-3: uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/ uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/client/ uimaj-as-activemq/src/main/java/org/apache/uima/...

Modified: uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/service/builder/UimaAsJmsServiceBuilder.java
URL: http://svn.apache.org/viewvc/uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/service/builder/UimaAsJmsServiceBuilder.java?rev=1831129&r1=1831128&r2=1831129&view=diff
==============================================================================
--- uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/service/builder/UimaAsJmsServiceBuilder.java (original)
+++ uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/service/builder/UimaAsJmsServiceBuilder.java Mon May  7 21:27:43 2018
@@ -18,8 +18,12 @@
  */
 package org.apache.uima.adapter.jms.service.builder;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.UUID;
 
 import org.apache.activemq.ActiveMQConnectionFactory;
@@ -182,7 +186,7 @@ public class UimaAsJmsServiceBuilder ext
 		// by Spring.
 		TempDestinationResolver resolver = new TempDestinationResolver(controller.getComponentName(),remoteDelegate.getKey());
 		resolver.setConnectionFactory(factory);
-		
+		threadExecutor.initialize();
 		UimaDefaultMessageListenerContainer replyListener =
 				replyListenerBuilder.withController(controller)
 						.withType(Type.Reply)
@@ -202,7 +206,7 @@ public class UimaAsJmsServiceBuilder ext
 		if ( controller.getOutputChannel(ENDPOINT_TYPE.JMS) == null) {
 	  		JmsOutputChannel oc = new JmsOutputChannel();
 			oc.setController(controller);
-			oc.setServerURI(brokerURL);
+//			oc.setServerURI(brokerURL);
 			oc.setControllerInputEndpoint("");
 			oc.setServiceInputEndpoint("");
 			oc.initialize();
@@ -236,6 +240,10 @@ public class UimaAsJmsServiceBuilder ext
 		// fetch service definition from DD
 		ServiceType s = getService(doc);
 
+		if ( topLevelController.getErrorHandlerChain() == null ) {
+			ErrorHandlerChain errorHandlerChain = createServiceErrorHandlers();
+			topLevelController.setErrorHandlerChain(errorHandlerChain);
+		}
 		AsyncPrimitiveErrorConfigurationType pec;
 		if (s.getAnalysisEngine() != null && s.getAnalysisEngine().getAsyncPrimitiveErrorConfiguration() != null) {
 			pec = s.getAnalysisEngine().getAsyncPrimitiveErrorConfiguration();
@@ -251,10 +259,108 @@ public class UimaAsJmsServiceBuilder ext
 		return service;
 	}
 
+	/*
+	protected ErrorHandlerChain getErrorHandlerChain(Map<String, ResourceSpecifier> delegates) {
+
+		Map<String, Threshold> processThresholdMap = new HashMap<String, Threshold>();
+		Map<String, Threshold> getMetaThresholdMap = new HashMap<String, Threshold>();
+		Map<String, Threshold> cpcThresholdMap = new HashMap<String, Threshold>();
+		// for each delegate add error handling configuration
+		for( Entry<String, ResourceSpecifier> entry : delegates.entrySet() ) {
+			// first fetch error handling from deployment descriptor for current delegate
+			Object o = delegateMap.get(entry.getKey()); 
+			
+			GetMetadataErrorsType gmet = null;
+			// the DD may not have error handlers specified. This is ok, we just use defaults
+			if ( o != null ) {
+				if (o instanceof DelegateAnalysisEngineType ) {
+					if ( ((DelegateAnalysisEngineType)o).getAsyncAggregateErrorConfiguration() != null && 
+							((DelegateAnalysisEngineType)o).getAsyncAggregateErrorConfiguration().getGetMetadataErrors() != null ) {
+						gmet = ((DelegateAnalysisEngineType)o).getAsyncAggregateErrorConfiguration().getGetMetadataErrors();
+						getMetaThresholdMap.put(entry.getKey(), getThreshold(gmet.getErrorAction(), gmet.getMaxRetries()));
+					}
+					if ( ((DelegateAnalysisEngineType)o).getAsyncAggregateErrorConfiguration() != null && 
+							((DelegateAnalysisEngineType)o).getAsyncAggregateErrorConfiguration().getProcessCasErrors() != null ) {
+						ProcessCasErrorsType pcet = ((DelegateAnalysisEngineType)o).getAsyncAggregateErrorConfiguration().getProcessCasErrors();
+						processThresholdMap.put(entry.getKey(), getThreshold(pcet.getThresholdAction(),pcet.getMaxRetries()));
+					}
+					cpcThresholdMap.put(entry.getKey(), newThreshold());
+				} else if ( o instanceof RemoteAnalysisEngineType ){
+					if ( ((RemoteAnalysisEngineType)o).getAsyncAggregateErrorConfiguration() != null && 
+							((RemoteAnalysisEngineType)o).getAsyncAggregateErrorConfiguration().getGetMetadataErrors() != null ) {
+						gmet = ((RemoteAnalysisEngineType)o).getAsyncAggregateErrorConfiguration().getGetMetadataErrors();
+						getMetaThresholdMap.put(entry.getKey(), getThreshold(gmet.getErrorAction(), gmet.getMaxRetries()));
+					}
+					if ( ((RemoteAnalysisEngineType)o).getAsyncAggregateErrorConfiguration() != null && 
+							((RemoteAnalysisEngineType)o).getAsyncAggregateErrorConfiguration().getProcessCasErrors() != null ) {
+						ProcessCasErrorsType pcet = ((RemoteAnalysisEngineType)o).getAsyncAggregateErrorConfiguration().getProcessCasErrors();
+						processThresholdMap.put(entry.getKey(), getThreshold(pcet.getThresholdAction(),pcet.getMaxRetries()));
+					}
+					cpcThresholdMap.put(entry.getKey(), newThreshold());
+				}
+			}
+		}
+		List<org.apache.uima.aae.error.ErrorHandler> errorHandlers =
+				new ArrayList<org.apache.uima.aae.error.ErrorHandler>();
+		if ( getMetaThresholdMap.size() > 0 ) {
+			errorHandlers.add(new GetMetaErrorHandler(getMetaThresholdMap));
+		}
+		if ( processThresholdMap.size() > 0 ) {
+			errorHandlers.add(new ProcessCasErrorHandler(processThresholdMap));
+		}
+		if ( cpcThresholdMap.size() > 0 ) {
+			errorHandlers.add(new CpcErrorHandler(cpcThresholdMap));
+		}
+		ErrorHandlerChain errorHandlerChain = new ErrorHandlerChain(errorHandlers);
+		return errorHandlerChain;
+	}
+	
+	protected ErrorHandlerChain getErrorHandlerChain(ResourceSpecifier delegate) {
+
+		Map<String, Threshold> processThresholdMap = new HashMap<String, Threshold>();
+		Map<String, Threshold> getMetaThresholdMap = new HashMap<String, Threshold>();
+		Map<String, Threshold> cpcThresholdMap = new HashMap<String, Threshold>();
+		Object o = delegateMap.get(""); 
+		GetMetadataErrorsType gmet = null;
+		if ( o != null ) {
+			if (o instanceof DelegateAnalysisEngineType ) {
+				gmet = ((DelegateAnalysisEngineType)o).getAsyncAggregateErrorConfiguration().getGetMetadataErrors();
+				getMetaThresholdMap.put("", getThreshold(gmet.getErrorAction(), gmet.getMaxRetries()));
+				ProcessCasErrorsType pcet = ((DelegateAnalysisEngineType)o).getAsyncAggregateErrorConfiguration().getProcessCasErrors();
+				processThresholdMap.put("", getThreshold(pcet.getThresholdAction(),pcet.getMaxRetries()));
+				cpcThresholdMap.put("", newThreshold());
+			} else if ( o instanceof RemoteAnalysisEngineType ){
+				gmet = ((RemoteAnalysisEngineType)o).getAsyncAggregateErrorConfiguration().getGetMetadataErrors();
+				getMetaThresholdMap.put("", getThreshold(gmet.getErrorAction(), gmet.getMaxRetries()));
+				ProcessCasErrorsType pcet = ((RemoteAnalysisEngineType)o).getAsyncAggregateErrorConfiguration().getProcessCasErrors();
+				processThresholdMap.put("", getThreshold(pcet.getThresholdAction(),pcet.getMaxRetries()));
+				cpcThresholdMap.put("", newThreshold());
+			}
+		}
+		List<org.apache.uima.aae.error.ErrorHandler> errorHandlers = new ArrayList<org.apache.uima.aae.error.ErrorHandler>();
+		if ( getMetaThresholdMap.size() > 0 ) {
+			errorHandlers.add(new GetMetaErrorHandler(getMetaThresholdMap));
+		}
+		if ( processThresholdMap.size() > 0 ) {
+			errorHandlers.add(new ProcessCasErrorHandler(processThresholdMap));
+		}
+		if ( cpcThresholdMap.size() > 0 ) {
+			errorHandlers.add(new CpcErrorHandler(cpcThresholdMap));
+		}
+		ErrorHandlerChain errorHandlerChain = new ErrorHandlerChain(errorHandlers);
+		
+		return errorHandlerChain;
+	
+	}
+	
+	*/
+	
+	
 	private void configureTopLevelService(AnalysisEngineController topLevelController, UimaASJmsService service,
 			AsyncPrimitiveErrorConfigurationType pec) throws Exception {
 		// ResourceSpecifier resourceSpecifier = service.getResourceSpecifier();
 		if (!topLevelController.isPrimitive() && pec != null) {
+		//if ( pec != null) {
 
 			ErrorHandlerChain chain = topLevelController.getErrorHandlerChain();
 			Iterator<ErrorHandler> handlers = chain.iterator();

Modified: uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/main/java/org/apache/uima/as/deployer/AbstractUimaASDeployer.java
URL: http://svn.apache.org/viewvc/uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/main/java/org/apache/uima/as/deployer/AbstractUimaASDeployer.java?rev=1831129&r1=1831128&r2=1831129&view=diff
==============================================================================
--- uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/main/java/org/apache/uima/as/deployer/AbstractUimaASDeployer.java (original)
+++ uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/main/java/org/apache/uima/as/deployer/AbstractUimaASDeployer.java Mon May  7 21:27:43 2018
@@ -18,26 +18,26 @@
  */
 package org.apache.uima.as.deployer;
 
-import java.util.Map;
 import java.util.concurrent.CountDownLatch;
 
 import org.apache.uima.aae.UimaASApplicationEvent.EventTrigger;
 import org.apache.uima.aae.controller.AnalysisEngineController;
 import org.apache.uima.aae.controller.ControllerCallbackListener;
-import org.apache.uima.aae.service.UimaASService;
-import org.apache.uima.resourceSpecifier.AnalysisEngineDeploymentDescriptionDocument;
+import org.apache.uima.resource.ResourceInitializationException;
 
 public abstract class AbstractUimaASDeployer 
 implements UimaAsServiceDeployer, ControllerCallbackListener {
 	CountDownLatch latch;
-	
+	private ResourceInitializationException initException = null;
 	protected AbstractUimaASDeployer(CountDownLatch latch) {
 		this.latch = latch;
 	}
-	public abstract UimaASService deploy(AnalysisEngineDeploymentDescriptionDocument dd, Map<String, String> deploymentProperties) throws Exception;
-	
-	public void waitUntilInitialized() throws InterruptedException {
+
+	public void waitUntilInitialized() throws InterruptedException, ResourceInitializationException {
 		latch.await();
+		if ( initException != null ) {
+			throw initException;
+		}
 	}
 	@Override
 	public void notifyOnTermination(String aMessage, EventTrigger cause) {
@@ -49,7 +49,7 @@ implements UimaAsServiceDeployer, Contro
 	public void notifyOnInitializationFailure(AnalysisEngineController aController, Exception e) {
 		// TODO Auto-generated method stub
 		System.out.println("------- Controller:"+aController.getName()+" Exception During Initialization - Error:\n");
-		e.printStackTrace();
+		notifyOnInitializationFailure(e);
 	}
 
 	@Override
@@ -60,15 +60,21 @@ implements UimaAsServiceDeployer, Contro
 
 	@Override
 	public void notifyOnInitializationFailure(Exception e) {
-		// TODO Auto-generated method stub
+		if ( !(e instanceof ResourceInitializationException) ) {
+			initException = new ResourceInitializationException(e);
+		} else {
+			initException = (ResourceInitializationException) e;
+		}
 		latch.countDown();
+		e.printStackTrace();
+		
 
 	}
 
 	@Override
 	public void notifyOnInitializationSuccess() {
 		// TODO Auto-generated method stub
-
+System.out.println(".................. WHAT?");
 	}
 
 	@Override

Modified: uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/main/java/org/apache/uima/as/deployer/UimaAsServiceDeployer.java
URL: http://svn.apache.org/viewvc/uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/main/java/org/apache/uima/as/deployer/UimaAsServiceDeployer.java?rev=1831129&r1=1831128&r2=1831129&view=diff
==============================================================================
--- uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/main/java/org/apache/uima/as/deployer/UimaAsServiceDeployer.java (original)
+++ uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/main/java/org/apache/uima/as/deployer/UimaAsServiceDeployer.java Mon May  7 21:27:43 2018
@@ -21,6 +21,7 @@ package org.apache.uima.as.deployer;
 import java.util.Map;
 
 import org.apache.uima.aae.service.UimaASService;
+import org.apache.uima.resource.ResourceInitializationException;
 import org.apache.uima.resourceSpecifier.AnalysisEngineDeploymentDescriptionDocument;
 
 public interface UimaAsServiceDeployer {
@@ -31,6 +32,6 @@ public interface UimaAsServiceDeployer {
 		LOCAL;
 	};
 	public UimaASService deploy(AnalysisEngineDeploymentDescriptionDocument dd, Map<String, String> deploymentProperties) throws Exception;
-	public void waitUntilInitialized() throws InterruptedException;
+	public void waitUntilInitialized() throws InterruptedException, ResourceInitializationException;
 
 }

Modified: uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/main/java/org/apache/uima/as/deployer/direct/UimaAsDirectServiceDeployer.java
URL: http://svn.apache.org/viewvc/uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/main/java/org/apache/uima/as/deployer/direct/UimaAsDirectServiceDeployer.java?rev=1831129&r1=1831128&r2=1831129&view=diff
==============================================================================
--- uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/main/java/org/apache/uima/as/deployer/direct/UimaAsDirectServiceDeployer.java (original)
+++ uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/main/java/org/apache/uima/as/deployer/direct/UimaAsDirectServiceDeployer.java Mon May  7 21:27:43 2018
@@ -29,27 +29,7 @@ import org.apache.uima.as.deployer.Abstr
 import org.apache.uima.resourceSpecifier.AnalysisEngineDeploymentDescriptionDocument;
 
 public class UimaAsDirectServiceDeployer  extends AbstractUimaASDeployer {
-	public static void main(String[] args) {
-		String dd4 = "../uimaj-as-activemq/src/test/resources/deployment/Deploy_AggregateAnnotator.xml";
-		try {
-			CountDownLatch latch = new CountDownLatch(1);
 
-			UimaAsDirectServiceDeployer deployer = new UimaAsDirectServiceDeployer(latch);
-
-			Map<String, String> deploymentProperties = new HashMap<String, String>();
-
-			deploymentProperties.put(Deployment, DeploymentStrategy.LOCAL.name());
-
-			AnalysisEngineDeploymentDescriptionDocument dd = AnalysisEngineDeploymentDescriptionDocument.Factory
-					.parse(new File(dd4));
-
-			deployer.deploy(dd, deploymentProperties);
-
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-
-	}
 
 	public UimaAsDirectServiceDeployer(CountDownLatch latch) {
 		// pass in a latch object which will block until service
@@ -65,7 +45,7 @@ public class UimaAsDirectServiceDeployer
 			uimaAsService = new UimaAsDirectServiceBuilder().build(dd, this);
 			// start listeners
 			uimaAsService.start();
-			// 
+			// block until all internal components initialize and are ready to process
 			waitUntilInitialized();
 
 		} catch (Exception e) {
@@ -74,4 +54,25 @@ public class UimaAsDirectServiceDeployer
 		}
 		return uimaAsService;
 	}
+	public static void main(String[] args) {
+		String dd4 = "../uimaj-as-activemq/src/test/resources/deployment/Deploy_AggregateAnnotator.xml";
+		try {
+			CountDownLatch latch = new CountDownLatch(1);
+
+			UimaAsDirectServiceDeployer deployer = new UimaAsDirectServiceDeployer(latch);
+
+			Map<String, String> deploymentProperties = new HashMap<String, String>();
+
+			deploymentProperties.put(Deployment, DeploymentStrategy.LOCAL.name());
+
+			AnalysisEngineDeploymentDescriptionDocument dd = AnalysisEngineDeploymentDescriptionDocument.Factory
+					.parse(new File(dd4));
+
+			deployer.deploy(dd, deploymentProperties);
+
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+
+	}
 }

Modified: uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/main/java/org/apache/uima/as/deployer/jms/UimaAsJmsServiceDeployer.java
URL: http://svn.apache.org/viewvc/uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/main/java/org/apache/uima/as/deployer/jms/UimaAsJmsServiceDeployer.java?rev=1831129&r1=1831128&r2=1831129&view=diff
==============================================================================
--- uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/main/java/org/apache/uima/as/deployer/jms/UimaAsJmsServiceDeployer.java (original)
+++ uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/main/java/org/apache/uima/as/deployer/jms/UimaAsJmsServiceDeployer.java Mon May  7 21:27:43 2018
@@ -46,6 +46,15 @@ public class UimaAsJmsServiceDeployer ex
 
 		} catch (Exception e) {
 			e.printStackTrace();
+			try {
+				if ( uimaAsService != null ) {
+					uimaAsService.stop();
+				}
+			} catch( Exception ee) {
+				ee.printStackTrace();
+			}
+			
+			
 			throw e;
 		}
 		return uimaAsService;

Modified: uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/test/java/org/apache/uima/ae/noop/NoOpAnnotator.java
URL: http://svn.apache.org/viewvc/uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/test/java/org/apache/uima/ae/noop/NoOpAnnotator.java?rev=1831129&r1=1831128&r2=1831129&view=diff
==============================================================================
--- uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/test/java/org/apache/uima/ae/noop/NoOpAnnotator.java (original)
+++ uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/test/java/org/apache/uima/ae/noop/NoOpAnnotator.java Mon May  7 21:27:43 2018
@@ -52,7 +52,7 @@ public class NoOpAnnotator extends CasAn
     super.initialize(aContext);
     // this can be null. The TargetSelectorProperty is optional
     thisServiceTargetId = System.getProperty(UimaAsynchronousEngine.TargetSelectorProperty);
-    
+    System.out.println(">>>>>>>>>>>>>> NoOpAnnotator ServiceTargetId:"+thisServiceTargetId);
     if (getContext().getConfigParameterValue("FailDuringInitialization") != null) {
       throw new ResourceInitializationException(new FileNotFoundException("Simulated Exception"));
     }
@@ -141,8 +141,11 @@ public class NoOpAnnotator extends CasAn
           throw new IndexOutOfBoundsException();
         }
       }
+	  System.out.println("NoOpAnnotator.process() - thisServiceTargetId="+thisServiceTargetId+" addServiceTargetId="+addServiceTargetId);
+
       if ( addServiceTargetId && thisServiceTargetId != null) {
     	  aCAS.setDocumentText(thisServiceTargetId);
+    	  System.out.println("NoOpAnnotator added target ID to CAS:"+thisServiceTargetId);
       }
      
     } catch (Exception e) {

Modified: uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java
URL: http://svn.apache.org/viewvc/uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java?rev=1831129&r1=1831128&r2=1831129&view=diff
==============================================================================
--- uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java (original)
+++ uima/uima-as/branches/uima-as-3/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java Mon May  7 21:27:43 2018
@@ -60,9 +60,11 @@ import org.apache.uima.UIMAFramework;
 import org.apache.uima.UIMA_IllegalStateException;
 import org.apache.uima.aae.InputChannel.ChannelType;
 import org.apache.uima.aae.UimaClassFactory;
+import org.apache.uima.aae.client.UimaAS;
 import org.apache.uima.aae.client.UimaASProcessStatus;
 import org.apache.uima.aae.client.UimaAsBaseCallbackListener;
 import org.apache.uima.aae.client.UimaAsynchronousEngine;
+import org.apache.uima.aae.client.UimaAsynchronousEngine.Transport;
 import org.apache.uima.aae.controller.Endpoint;
 import org.apache.uima.aae.error.ServiceShutdownException;
 import org.apache.uima.aae.error.UimaASPingTimeout;
@@ -162,6 +164,18 @@ public class TestUimaASExtended extends
       eeUimaEngine.stop();
     }
 */
+    @Test
+    public void testDeploy() throws Exception {
+    	UimaAsynchronousEngine uimaAs = 
+    			UimaAS.newInstance(Transport.Java);
+    
+    	Map ctx = new HashMap<>();
+    	ctx.put(UimaAsynchronousEngine.Provider,"java");
+        ctx.put(UimaAsynchronousEngine.Protocol,"java");
+        
+        uimaAs.deploy(relativePath + "/Deploy_NoOpAnnotator.xml", ctx);
+    
+    }
     
     /**
      * This test starts a secondary broker, starts NoOp Annotator, and
@@ -255,6 +269,7 @@ public class TestUimaASExtended extends
      * 
      * @throws Exception
      */
+    /*
     @Test
     public void testMultipleSyncClientsRecoveryFromBrokerStopAndRestart() throws Exception  {
       System.out.println("-------------- testMultipleSyncClientsRecoveryFromBrokerStopAndRestart -------------");
@@ -335,6 +350,7 @@ public class TestUimaASExtended extends
         }
       }
   }
+  */
     @Test
     public void testClient() throws Exception {
       System.out.println("-------------- testClient -------------");
@@ -550,7 +566,7 @@ public class TestUimaASExtended extends
     		  , 10, TimeUnit.SECONDS);
 
 
-      for (int i = 0; i < 3; i++) {
+      for (int i = 0; i < 5; i++) {
           CAS cas = uimaAsEngine.getCAS();
           cas.setDocumentText("Some Text");
           try {
@@ -900,6 +916,28 @@ public class TestUimaASExtended extends
     	throw e;
     }
   }
+    /**
+     * Test use of a JMS Service Adapter. Invoke from a synchronous aggregate to emulate usage from
+     * RunAE or RunCPE.
+     * 
+     * @throws Exception
+     */
+     @Test
+      public void testJmsServiceAdapterInAsyncAggregate() throws Exception {
+  	  Logger.getLogger(this.getClass()).info("-------------- testJmsServiceAdapter -------------");
+  	  //setUp();
+  	  BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
+      try {
+          deployService(eeUimaEngine, relativePath + "/Deploy_NoOpAnnotator.xml");
+  //        deployService(eeUimaEngine, relativePath + "/Deploy_AsyncAggregateWithJmsService.xml");
+//          runTest(null, eeUimaEngine, String.valueOf(getMasterConnectorURI(broker)), "TopLevelTaeQueue",
+          runTest(null, eeUimaEngine, String.valueOf(getMasterConnectorURI(broker)), "NoOpAnnotatorQueue",
+                  1, PROCESS_LATCH);
+         
+      } catch( Exception e ) {
+      	throw e;
+      }
+    }
   /*
    * Tests Uima AS client placeholder handling and substitution. The Uima Aggregate instantiates
    * UIMA AS client proxy using Jms Client Descriptor that contains a placeholder
@@ -1007,6 +1045,7 @@ public class TestUimaASExtended extends
 
     runTest(null, uimaAsEngine, String.valueOf(getMasterConnectorURI(broker)),
             "MeetingDetectorTaeQueue", 3, PROCESS_LATCH);
+    uimaAsEngine.stop();
   }
 
   
@@ -1031,7 +1070,17 @@ public class TestUimaASExtended extends
 		runTest(null, eeUimaEngine, String.valueOf(getMasterConnectorURI(broker)), "TopLevelTaeQueue",
 		            100, PROCESS_LATCH);
   }
+  @Test
+  public void testSimpleTestAggregateWithInnerCMAggregate() throws Exception {
+		System.out
+		            .println("-------------- testSimpleTestAggregateWithInnerCMAggregate -------------");
+		System.setProperty("BrokerURL", getMasterConnectorURI(broker));
 
+		BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
+		deployService(eeUimaEngine, relativePath + "/Deploy_SimpleAggregateMultiplier.xml");
+		runTest(null, eeUimaEngine, String.valueOf(getMasterConnectorURI(broker)), "TopLevelTaeQueue",
+		            1, PROCESS_LATCH);
+  }
   /**
    * Tests programmatic generation of DD for deployment
    * 
@@ -1268,7 +1317,9 @@ public class TestUimaASExtended extends
           cas.release();
       }
       */
-      
+   	System.setProperty(UimaAsynchronousEngine.Provider,"activemq");
+   	System.setProperty(UimaAsynchronousEngine.Protocol,"jms");
+
       String id = deployService(uimaAsEngine, relativePath + "/Deploy_NoOpAnnotator.xml");
       deployService(uimaAsEngine, relativePath + "/Deploy_AggregateAnnotator.xml");
       // Deploy Uima AS Primitive Service
@@ -1413,6 +1464,9 @@ public class TestUimaASExtended extends
   public void testClientHttpTunnellingToAggregate() throws Exception {
 	  System.out.println("-------------- testClientHttpTunnellingToAggregate -------------");
     // Add HTTP Connector to the broker. 
+	    System.setProperty("Protocol","jms");
+	    System.setProperty("Provider","activemq");
+
     String httpURI = getHttpURI();
     // Create Uima-AS Client
     BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
@@ -1912,10 +1966,10 @@ public class TestUimaASExtended extends
         } 
         CAS cas = uimaClient1.getCAS();
         cas.setDocumentText("Some Text");
-//        System.out.println("UIMA AS Client Sending CAS#" + (i + 1) + " Request to a Service");
+        System.out.println("UIMA AS Client Sending CAS#" + (i + 1) + " Request to a Service");
         try {
           uimaClient1.sendAndReceiveCAS(cas);
-   //       System.out.println("UIMA AS Client Received Reply For CAS#" + (i + 1) );
+          System.out.println("UIMA AS Client Received Reply For CAS#" + (i + 1) );
         } catch( Exception e) {
           errorCount++;
           System.out.println("UIMA AS Client Received Expected Error on CAS:"+(i+1));
@@ -2208,6 +2262,9 @@ private class Killer {
   public void testDeployPrimitiveService() throws Exception {
     System.out.println("-------------- testDeployPrimitiveService -------------");
     // Instantiate Uima-AS Client
+    System.setProperty("Protocol","jms");
+    System.setProperty("Provider","activemq");
+
     BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
     // Deploy Uima-AS Primitive Service
     deployService(eeUimaEngine, relativePath + "/Deploy_PersonTitleAnnotator.xml");
@@ -2272,6 +2329,7 @@ private class Killer {
           eeUimaEngine.sendCAS(cas, tsId);
           //cas.release();
       }
+      
     } catch( Exception e) {
     	e.printStackTrace();
     } finally {
@@ -2383,6 +2441,9 @@ private class Killer {
   @Test
   public void testDeployAggregateWithDelegateCpCException() throws Exception {
     System.out.println("-------------- testDeployAggregateWithDelegateCpCException -------------");
+    System.setProperty("Protocol","jms");
+    System.setProperty("Provider","activemq");
+ 
     // Instantiate Uima-AS Client
     BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
     // Deploy Uima-AS Primitive Service
@@ -2562,7 +2623,8 @@ private class Killer {
   public void testDeployAggregateService() throws Exception {
     System.out.println("-------------- testDeployAggregateService -------------");
     BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
-    
+    System.setProperty("Protocol","jms");
+    System.setProperty("Provider","activemq");
     
  //   System.setProperty("BrokerURL", "tcp::/localhost:61616");