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/07/01 15:36:07 UTC
svn commit: r1834795 -
/uima/uima-ducc/trunk/uima-ducc-pullservice/src/test/java/org/apache/uima/ducc/ps/service/wrapper/JUnitServiceWrapperTestCase.java
Author: cwiklik
Date: Sun Jul 1 15:36:06 2018
New Revision: 1834795
URL: http://svn.apache.org/viewvc?rev=1834795&view=rev
Log:
UIMA-5806 added new test to cover ServiceWrapper process failure handling
Modified:
uima/uima-ducc/trunk/uima-ducc-pullservice/src/test/java/org/apache/uima/ducc/ps/service/wrapper/JUnitServiceWrapperTestCase.java
Modified: uima/uima-ducc/trunk/uima-ducc-pullservice/src/test/java/org/apache/uima/ducc/ps/service/wrapper/JUnitServiceWrapperTestCase.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pullservice/src/test/java/org/apache/uima/ducc/ps/service/wrapper/JUnitServiceWrapperTestCase.java?rev=1834795&r1=1834794&r2=1834795&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pullservice/src/test/java/org/apache/uima/ducc/ps/service/wrapper/JUnitServiceWrapperTestCase.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-pullservice/src/test/java/org/apache/uima/ducc/ps/service/wrapper/JUnitServiceWrapperTestCase.java Sun Jul 1 15:36:06 2018
@@ -65,6 +65,46 @@ public class JUnitServiceWrapperTestCase
}
}
+
+ @Test
+ public void testPullServiceWrapperWithProcessFailure() throws Exception {
+ //int scaleout = 2;
+ StateMonitor monitor = new StateMonitor();
+ monitor.start();
+ System.out.println("........... Monitor Port:"+System.getProperty("DUCC_STATE_UPDATE_PORT"));
+ super.startJetty(false); // don't block
+ String analysisEngineDescriptor = "NoOpAE";
+
+ String tasURL = "http://localhost:8080/test";
+ try {
+ // Force process failure
+ System.setProperty("ProcessFail","true");
+
+ System.setProperty("ducc.deploy.JdURL", tasURL);
+ System.setProperty("ducc.deploy.JpThreadCount","4");
+ System.setProperty("ducc.deploy.service.type", "NotesService");
+ System.getProperty("ducc.deploy.JpType", "uima");
+
+ ServiceWrapper service = new ServiceWrapper();
+
+ Timer fTimer = new Timer("testPullService Timer");
+ // after 5secs stop the pull service
+ fTimer.schedule(new MyTimerTask(service, fTimer), 5000);
+
+ service.initialize(new String[] {analysisEngineDescriptor});
+
+ service.start();
+
+
+ } catch (ServiceInitializationException e) {
+ throw e;
+ } catch (Exception e) {
+ throw e;
+ } finally {
+ monitor.stop();
+ System.getProperties().remove("ProcessFail");
+ }
+ }
class MyTimerTask extends TimerTask {
final ServiceWrapper service;
final Timer fTimer;