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/12/13 16:16:23 UTC
svn commit: r890066 -
/incubator/uima/uima-as/trunk/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java
Author: cwiklik
Date: Sun Dec 13 15:16:22 2009
New Revision: 890066
URL: http://svn.apache.org/viewvc?rev=890066&view=rev
Log:
UIMA-1702 Added testTerminateOnInitializationFailureWithAggregateForcedShutdown() and testTerminateOnInitializationFailureWithDelegateBrokerMissing()
Modified:
incubator/uima/uima-as/trunk/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java
Modified: incubator/uima/uima-as/trunk/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java?rev=890066&r1=890065&r2=890066&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java Sun Dec 13 15:16:22 2009
@@ -2355,7 +2355,80 @@
}
}
-
+ /**
+ * Tests shutdown due to delegate broker missing. The Aggregate is configured to retry getMeta 3
+ * times and continue. The client times out after 20 seconds and forces the shutdown. NOTE: The
+ * Spring listener tries to recover JMS connection on failure. In this test a Listener to remote
+ * delegate cannot be established due to a missing broker. The Listener is setup to retry every 60
+ * seconds. After failure, the listener goes to sleep for 60 seconds and tries again. This results
+ * in a 60 second delay at the end of this test.
+ *
+ * @throws Exception
+ */
+ public void testTerminateOnInitializationFailureWithDelegateBrokerMissing() throws Exception {
+ System.out
+ .println("-------------- testTerminateOnInitializationFailureWithDelegateBrokerMissing -------------");
+ System.out
+ .println("---------------------- The Uima Client Times Out After 20 seconds --------------------------");
+ System.out
+ .println("-- The test requires 1 minute to complete due to 60 second delay in Spring Listener ----");
+ BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
+ try {
+ // Deploy remote service
+ deployService(eeUimaEngine, relativePath + "/Deploy_NoOpAnnotator.xml");
+ // Deploy top level aggregate that communicates with the remote via Http Tunnelling
+ deployService(eeUimaEngine, relativePath
+ + "/Deploy_AggregateAnnotatorTerminateOnDelegateBadBrokerURL.xml");
+ // Initialize and run the Test. Wait for a completion and cleanup resources.
+ Map<String, Object> appCtx = new HashMap();
+ appCtx.put(UimaAsynchronousEngine.ServerUri, String.valueOf(broker.getMasterConnectorURI()));
+ appCtx.put(UimaAsynchronousEngine.Endpoint, "TopLevelTaeQueue");
+ appCtx.put(UimaAsynchronousEngine.GetMetaTimeout, 20000);
+ runTest(appCtx, eeUimaEngine, String.valueOf(broker.getMasterConnectorURI()),
+ "TopLevelTaeQueue", 1, EXCEPTION_LATCH);
+ fail("Expected ResourceInitializationException. Instead, the Aggregate Reports Successfull Initialization");
+ } catch (ResourceInitializationException e) {
+ Exception cause = getCause(e);
+ System.out.println("Expected Initialization Exception was received:" + cause);
+ } catch (Exception e) {
+ fail("Expected ResourceInitializationException. Instead Got:" + e.getClass());
+ } finally {
+ eeUimaEngine.stop();
+ }
+ }
+
+ /**
+ * Tests shutdown due to delegate broker missing. The Aggregate is configured to terminate on
+ * getMeta timeout.
+ *
+ * @throws Exception
+ */
+ public void testTerminateOnInitializationFailureWithAggregateForcedShutdown() throws Exception {
+ System.out
+ .println("-------------- testTerminateOnInitializationFailureWithAggregateForcedShutdown -------------");
+ BaseUIMAAsynchronousEngine_impl eeUimaEngine = new BaseUIMAAsynchronousEngine_impl();
+ // Initialize and run the Test. Wait for a completion and cleanup resources.
+ try {
+ // Deploy remote service
+ deployService(eeUimaEngine, relativePath + "/Deploy_NoOpAnnotator.xml");
+ // Deploy top level aggregate that communicates with the remote via Http Tunnelling
+ deployService(eeUimaEngine, relativePath
+ + "/Deploy_AggregateAnnotatorWithHttpDelegateNoRetries.xml");
+ runTest(null, eeUimaEngine, String.valueOf(broker.getMasterConnectorURI()),
+ "TopLevelTaeQueue", 10, EXCEPTION_LATCH);
+ fail("Expected ResourceInitializationException. Instead, the Aggregate Reports Successfull Initialization");
+ } catch (ResourceInitializationException e) {
+ Exception cause = getCause(e);
+ System.out.println("Expected Initialization Exception was received:" + cause);
+ } catch (Exception e) {
+ fail("Expected ResourceInitializationException. Instead Got:" + e.getClass());
+ } finally {
+ eeUimaEngine.stop();
+ }
+
+ }
+
+
/**
* Tests shutdown due to delegate broker missing. The Aggregate is configured to retry getMeta 3
* times and continue. The client times out after 20 seconds and forces the shutdown. NOTE: The