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 2010/05/13 19:44:44 UTC

svn commit: r943952 - /uima/uima-as/trunk/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java

Author: cwiklik
Date: Thu May 13 17:44:43 2010
New Revision: 943952

URL: http://svn.apache.org/viewvc?rev=943952&view=rev
Log:
UIMA-1781 Added new testcase testCpcAfterCasTimeout()

Modified:
    uima/uima-as/trunk/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java

Modified: uima/uima-as/trunk/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java
URL: http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java?rev=943952&r1=943951&r2=943952&view=diff
==============================================================================
--- uima/uima-as/trunk/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java (original)
+++ uima/uima-as/trunk/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/TestUimaASExtended.java Thu May 13 17:44:43 2010
@@ -86,6 +86,7 @@ public class TestUimaASExtended extends 
 
   public BaseTestSupport superRef = null;
 
+  
   /**
    * Tests Broker startup and shutdown
    */
@@ -747,7 +748,35 @@ public class TestUimaASExtended extends 
         wait(3000);   // allow broker some time to stop  
       }
   }
-  
+  /**
+   * Tests sending CPC after CAS timeout. The service is a Primitive taking 
+   * 6 seconds to process a CAS. The client waits for 5 secs to force
+   * a timeout. This test forces the client to send GetMeta Ping and to
+   * 'hold' the subsequent CPC request.
+   *   
+   * @throws Exception
+   */
+  public void testCpcAfterCasTimeout() throws Exception  {
+    System.out.println("-------------- testCpcAfterCasTimeout -------------");
+     // Instantiate Uima AS Client
+      BaseUIMAAsynchronousEngine_impl uimaAsEngine = new BaseUIMAAsynchronousEngine_impl();
+      deployService(uimaAsEngine, relativePath + "/Deploy_NoOpAnnotatorAWithLongDelay.xml");
+      Map<String, Object> appCtx = buildContext("tcp://localhost:8118",
+      "NoOpAnnotatorAQueue");
+      appCtx.put(UimaAsynchronousEngine.Timeout, 5000);
+      appCtx.put(UimaAsynchronousEngine.CpcTimeout, 1100);
+      initialize(uimaAsEngine, appCtx);
+      waitUntilInitialized();
+      
+      for( int i=0; i < 3; i++ ) {
+        CAS cas = uimaAsEngine.getCAS();
+        cas.setDocumentText("Some Text");
+        uimaAsEngine.sendCAS(cas);  // will timeout after 5 secs
+        uimaAsEngine.collectionProcessingComplete();  // the CPC should not
+        // be sent to a service until the timeout occurs.
+      }
+      uimaAsEngine.stop();
+  }
   
   public void testClientProcess() throws Exception {
     System.out.println("-------------- testClientProcess -------------");
@@ -1128,7 +1157,7 @@ public class TestUimaASExtended extends 
 
     Map<String, Object> appCtx = buildContext(String.valueOf(broker.getMasterConnectorURI()),"TopLevelTaeQueue");
     runTest(appCtx, eeUimaEngine, String.valueOf(broker.getMasterConnectorURI()), "TopLevelTaeQueue",
-            2, PROCESS_LATCH);
+            1, PROCESS_LATCH);
   }
   
   public void testScaledSyncAggregateProcess() throws Exception {