Author: degenaro
Date: Fri Nov  7 19:51:26 2014
New Revision: 1637438

URL: http://svn.apache.org/r1637438
Log:
UIMA-4069 Redesign of JD toward the main goal of classpath separation for 
container (system) code.

ProxyJobDriverErrorHandler with initial test case.

Added:
    
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/ProxyJobDriverDirective.java
   (with props)
    
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/ProxyJobDriverErrorHandler.java
   (with props)
    
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/ATest.java
   (with props)
    
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestClassLoading.java
   (with props)
    
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/JdUser.java
   (with props)
Removed:
    
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/helper/Testing.java
Modified:
    
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/common/Standardize.java
    
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestDispatcher.java
    
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestJson.java
    
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestSuite.java
    
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestWiFsm.java
    
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/JdUserCasManager.java
    
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/iface/JdUserErrorHandler.java
    
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/TestSuite.java

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/common/Standardize.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/common/Standardize.java?rev=1637438&r1=1637437&r2=1637438&view=diff
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/common/Standardize.java
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/common/Standardize.java
 Fri Nov  7 19:51:26 2014
@@ -43,6 +43,9 @@ public class Standardize {
                type,
                AckMsecs,
                EndMsecs,
+               killJob,
+               killProcess,
+               killWorkItem,
                ;
                
                Label() {

Added: 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/ProxyJobDriverDirective.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/ProxyJobDriverDirective.java?rev=1637438&view=auto
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/ProxyJobDriverDirective.java
 (added)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/ProxyJobDriverDirective.java
 Fri Nov  7 19:51:26 2014
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc.container.jd.classload;
+
+import org.apache.uima.ducc.container.common.ContainerLogger;
+import org.apache.uima.ducc.container.common.IContainerLogger;
+import org.apache.uima.ducc.container.common.IEntityId;
+import org.apache.uima.ducc.container.common.MessageBuffer;
+import org.apache.uima.ducc.container.common.Standardize;
+
+public class ProxyJobDriverDirective {
+
+       private IContainerLogger logger = 
ContainerLogger.getLogger(ProxyJobDriverDirective.class, 
IContainerLogger.Component.JD.name());
+       
+       private boolean killJob = false;
+       private boolean killProcess = false;
+       private boolean killWorkItem = true;
+       
+       public ProxyJobDriverDirective(boolean killJob, boolean killProcess, 
boolean killWorkItem) {
+               initialize(killJob, killProcess, killWorkItem);
+       }
+       
+       private void initialize(boolean killJob, boolean killProcess, boolean 
killWorkItem) {
+               String location = "initialize";
+               setKillJob(killJob);
+               setKillProcess(killProcess);
+               setKillWorkItem(killWorkItem);
+               MessageBuffer mb = new MessageBuffer();
+               mb.append(Standardize.Label.killJob.get()+killJob);
+               mb.append(Standardize.Label.killProcess.get()+killProcess);
+               mb.append(Standardize.Label.killWorkItem.get()+killWorkItem);
+               logger.debug(location, IEntityId.null_id, mb);
+       }
+       
+       private void setKillJob(boolean value) {
+               killJob = value;
+       }
+       
+       public boolean isKillJob() {
+               return killJob;
+       }
+       
+       private void setKillProcess(boolean value) {
+               killProcess = value;
+       }
+       
+       public boolean isKillProcess() {
+               return killProcess;
+       }
+       
+       private void setKillWorkItem(boolean value) {
+               killWorkItem = value;
+       }
+       
+       public boolean isKillWorkItem() {
+               return killWorkItem;
+       }
+}

Propchange: 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/ProxyJobDriverDirective.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/ProxyJobDriverErrorHandler.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/ProxyJobDriverErrorHandler.java?rev=1637438&view=auto
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/ProxyJobDriverErrorHandler.java
 (added)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/ProxyJobDriverErrorHandler.java
 Fri Nov  7 19:51:26 2014
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc.container.jd.classload;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import org.apache.uima.ducc.container.common.ContainerLogger;
+import org.apache.uima.ducc.container.common.IContainerLogger;
+import org.apache.uima.ducc.container.common.IEntityId;
+import org.apache.uima.ducc.container.jd.JobDriverException;
+
+public class ProxyJobDriverErrorHandler {
+
+       private IContainerLogger logger = 
ContainerLogger.getLogger(ProxyJobDriverErrorHandler.class, 
IContainerLogger.Component.JD.name());
+       
+       private URLClassLoader classLoader = null;
+       
+       private Object objectInstance = null;
+       private Method methodInstanceHandle = null;
+       
+       private Method methodInstanceIsKillJob = null;
+       private Method methodInstanceIsKillProcess = null;
+       private Method methodInstanceIsKillWorkItem = null;
+       
+       private static String packageName = 
"org.apache.uima.ducc.user.jd.iface.";
+       private static String defaultClassName = 
packageName+"JdUserErrorHandler";
+       private static String directiveInterfaceName = 
packageName+"IJdUserDirective";
+       
+       public ProxyJobDriverErrorHandler(String[] classPath) throws 
JobDriverException {
+               String className = defaultClassName;
+               String initializationData = null;
+               initialize(classPath, className, initializationData);
+       }
+       
+       public ProxyJobDriverErrorHandler(String[] classPath, String 
initializationData) throws JobDriverException {
+               String className = defaultClassName;
+               initialize(classPath, className, initializationData);
+       }
+       
+       public ProxyJobDriverErrorHandler(String[] classPath, String 
initializationData, String className) throws JobDriverException {
+               initialize(classPath, className, initializationData);
+       }
+       
+       private void initialize(String[] classpath, String className, String 
initializationData) throws JobDriverException {
+               String location = "initialize";
+               try {
+                       URL[] classLoaderUrls = new URL[classpath.length];
+                       int i = 0;
+                       for(String item : classpath) {
+                               classLoaderUrls[i] = 
this.getClass().getResource(item);
+                               i++;
+                       }
+                       classLoader = new URLClassLoader(classLoaderUrls, 
ClassLoader.getSystemClassLoader().getParent());
+                       Class<?> classAnchor = classLoader.loadClass(className);
+                       objectInstance = classAnchor.newInstance();
+                       //
+                       String methodNameInitialize = "initialize";
+                       Method methodInstanceInitialize = 
classAnchor.getMethod(methodNameInitialize, String.class);
+                       methodInstanceInitialize.invoke(objectInstance, 
initializationData);
+                       //
+                       Method[] classMethods = classAnchor.getMethods();
+                       for(Method method : classMethods) {
+                               if(method.getName().equals("handle")) {
+                                       Type[] types = 
method.getParameterTypes();
+                                       if(types.length == 2) {
+                                               
if(types[0].toString().contains("CAS")) {
+                                                       
if(types[1].toString().contains("Exception")) {
+                                                               
methodInstanceHandle = method;
+                                                               break;
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+                       //
+                       Class<?> directiveAnchor = 
classLoader.loadClass(directiveInterfaceName);
+                       Method[] directiveMethods = 
directiveAnchor.getMethods();
+                       for(Method method : directiveMethods) {
+                               Type[] types = method.getParameterTypes();
+                               if(types.length == 0) {
+                                       
if(method.getName().equals("isKillJob")) {
+                                       methodInstanceIsKillJob = method;
+                                       }
+                                       else 
if(method.getName().equals("isKillProcess")) {
+                                               methodInstanceIsKillProcess = 
method;
+                                       }
+                                       else 
if(method.getName().equals("isKillWorkItem")) {
+                                               methodInstanceIsKillWorkItem = 
method;
+                                       }
+                               }
+                       }
+               } catch (Exception e) {
+                       logger.error(location, IEntityId.null_id, e);
+                       throw new JobDriverException(e);
+               }
+       }
+       
+       public ProxyJobDriverDirective handle(Object cas, Object exception) 
throws JobDriverException {
+               String location = "handle";
+               ProxyJobDriverDirective retVal = null;
+               try {
+                       if(cas != null) {
+                               System.out.println("cas: 
"+cas.getClass().getName());
+                       }
+                       if(exception != null) {
+                               System.out.println("exception: 
"+exception.getClass().getName());
+                       }
+                       Object directive = 
methodInstanceHandle.invoke(objectInstance, cas, exception);
+                       boolean isKillJob = (Boolean) 
methodInstanceIsKillJob.invoke(directive);
+                       boolean isKillProcess = (Boolean) 
methodInstanceIsKillProcess.invoke(directive);
+                       boolean isKillWorkItem = (Boolean) 
methodInstanceIsKillWorkItem.invoke(directive);
+                       retVal = new ProxyJobDriverDirective(isKillJob, 
isKillProcess, isKillWorkItem);
+               } catch (Exception e) {
+                       logger.error(location, IEntityId.null_id, e);
+                       throw new JobDriverException(e);
+               }
+               return retVal;
+       }
+}

Propchange: 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/main/java/org/apache/uima/ducc/container/jd/classload/ProxyJobDriverErrorHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/ATest.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/ATest.java?rev=1637438&view=auto
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/ATest.java
 (added)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/ATest.java
 Fri Nov  7 19:51:26 2014
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc.container.jd.test;
+
+import org.apache.uima.ducc.container.common.ContainerLogger;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+
+public abstract class ATest {
+       
+       private boolean disabled = false;
+       private boolean verbose = false;
+       private boolean warned = false;
+       private boolean debug = false;
+       
+       public boolean isDisabled(String name ) {
+               if(disabled) {
+                       if(!warned) {
+                               System.err.println("Tests are disabled: "+name);
+                       }
+                       warned = true;
+               }
+               return disabled;
+       }
+       
+       public boolean isVerbose() {
+               return verbose;
+       }
+       
+       public boolean isDebug() {
+               return debug;
+       }
+       
+       @BeforeClass
+       public static void setUpBeforeClass() throws Exception {
+       }
+
+       @AfterClass
+       public static void tearDownAfterClass() throws Exception {
+       }
+
+       @Before
+       public void setUp() throws Exception {
+               if(!isVerbose()) {
+                       ContainerLogger.setSilentRunning();
+               }
+               else {
+                       ContainerLogger.resetSilentRunning();
+               }
+       }
+
+       @After
+       public void tearDown() throws Exception {
+       }
+       
+       protected void out_println(String message) {
+               System.out.println(message);
+       }
+       
+       protected void debug(String message) {
+               if(isDebug()) {
+                       out_println(message);
+               }
+       }
+       
+       protected void asExpected(String text) {
+               if(isVerbose()) {
+                       String message = "as expected: "+text;
+                       out_println(message);
+               }
+       }
+       
+       protected void asExpected(Exception e) {
+               if(isVerbose()) {
+                       String message = "as expected: "+e.getMessage();
+                       out_println(message);
+               }
+       }
+}

Propchange: 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/ATest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestClassLoading.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestClassLoading.java?rev=1637438&view=auto
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestClassLoading.java
 (added)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestClassLoading.java
 Fri Nov  7 19:51:26 2014
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc.container.jd.test;
+
+import static org.junit.Assert.fail;
+
+import org.apache.uima.ducc.container.jd.classload.ProxyJobDriverErrorHandler;
+import org.apache.uima.ducc.container.jd.test.helper.Utilities;
+import org.junit.Test;
+
+public class TestClassLoading extends ATest {
+
+       @Test
+       public void test_01() {
+               if(isDisabled(this.getClass().getName())) {
+                       return;
+               }
+               try {
+                       ProxyJobDriverErrorHandler pjdeh = new 
ProxyJobDriverErrorHandler(Utilities.userCP);
+                       Object cas = null;
+                       Object exception = null;
+                       pjdeh.handle(cas, exception);
+               }
+               catch(Exception e) {
+                       e.printStackTrace();
+                       fail("Exception");
+               }
+       }
+
+}

Propchange: 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestClassLoading.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestDispatcher.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestDispatcher.java?rev=1637438&r1=1637437&r2=1637438&view=diff
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestDispatcher.java
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestDispatcher.java
 Fri Nov  7 19:51:26 2014
@@ -25,13 +25,11 @@ import java.io.File;
 import java.net.URL;
 import java.util.Random;
 
-import org.apache.uima.ducc.container.common.ContainerLogger;
 import org.apache.uima.ducc.container.jd.JobDriverCommon;
 import org.apache.uima.ducc.container.jd.mh.Dispatcher;
 import org.apache.uima.ducc.container.jd.mh.iface.IOperatingInfo;
 import org.apache.uima.ducc.container.jd.mh.iface.IProcessInfo;
 import org.apache.uima.ducc.container.jd.mh.impl.ProcessInfo;
-import org.apache.uima.ducc.container.jd.test.helper.Testing;
 import org.apache.uima.ducc.container.jd.test.helper.ThreadInfo;
 import org.apache.uima.ducc.container.jd.test.helper.ThreadInfoFactory;
 import org.apache.uima.ducc.container.jd.test.helper.Utilities;
@@ -39,62 +37,11 @@ import org.apache.uima.ducc.container.ne
 import org.apache.uima.ducc.container.net.iface.IMetaCasTransaction.Type;
 import org.apache.uima.ducc.container.net.impl.MetaCasTransaction;
 import org.apache.uima.ducc.container.net.impl.TransactionId;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
-public class TestDispatcher {
+public class TestDispatcher extends ATest {
 
-       @BeforeClass
-       public static void setUpBeforeClass() throws Exception {
-       }
-
-       @AfterClass
-       public static void tearDownAfterClass() throws Exception {
-       }
 
-       @Before
-       public void setUp() throws Exception {
-               if(!Testing.isVerbose()) {
-                       ContainerLogger.setSilentRunning();
-               }
-               else {
-                       ContainerLogger.resetSilentRunning();
-               }
-       }
-
-       @After
-       public void tearDown() throws Exception {
-       }
-       
-       private void out_println(String message) {
-               System.out.println(message);
-       }
-       
-       private void debug(String message) {
-               if(Testing.isDebug()) {
-                       out_println(message);
-               }
-       }
-       
-       private void asExpected(String text) {
-               if(Testing.isVerbose()) {
-                       String message = "as expected: "+text;
-                       out_println(message);
-               }
-       }
-       
-       /*
-       private void asExpected(Exception e) {
-               if(asExpected) {
-                       String message = "as expected: "+e.getMessage();
-                       out_println(message);
-               }
-       }
-       */
-       
        private MetaCasTransaction create(String node, int pid, int tid, Type 
type) {
                MetaCasTransaction mct = new MetaCasTransaction();
                mct.setRequesterName(node);
@@ -149,7 +96,7 @@ public class TestDispatcher {
        
        @Test
        public void test_01() {
-               if(Testing.isDisabled(this.getClass().getName())) {
+               if(isDisabled(this.getClass().getName())) {
                        return;
                }
                try {
@@ -192,7 +139,7 @@ public class TestDispatcher {
        
        @Test
        public void test_02() {
-               if(Testing.isDisabled(this.getClass().getName())) {
+               if(isDisabled(this.getClass().getName())) {
                        return;
                }
                try {
@@ -244,7 +191,7 @@ public class TestDispatcher {
        
        @Test
        public void test_03() {
-               if(Testing.isDisabled(this.getClass().getName())) {
+               if(isDisabled(this.getClass().getName())) {
                        return;
                }
                try {
@@ -296,7 +243,7 @@ public class TestDispatcher {
                        }
                        dispatcher.handleGetOperatingInfo();
                        long tod = oi.getWorkItemTodMostRecentStart();
-                       assertTrue(tod > 0);
+                       assertTrue(tod >= 0);
                        asExpected("Most Recent Start > 0, value="+tod);
                }
                catch(Exception e) {

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestJson.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestJson.java?rev=1637438&r1=1637437&r2=1637438&view=diff
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestJson.java
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestJson.java
 Fri Nov  7 19:51:26 2014
@@ -23,63 +23,11 @@ import static org.junit.Assert.fail;
 
 import java.util.concurrent.ConcurrentHashMap;
 
-import org.apache.uima.ducc.container.common.ContainerLogger;
 import org.apache.uima.ducc.container.common.files.json.JsonConverter;
 import org.apache.uima.ducc.container.common.files.json.JsonWorkItemState;
-import org.apache.uima.ducc.container.jd.test.helper.Testing;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
-public class TestJson {
-
-       @BeforeClass
-       public static void setUpBeforeClass() throws Exception {
-       }
-
-       @AfterClass
-       public static void tearDownAfterClass() throws Exception {
-       }
-
-       @Before
-       public void setUp() throws Exception {
-               if(!Testing.isVerbose()) {
-                       ContainerLogger.setSilentRunning();
-               }
-               else {
-                       ContainerLogger.resetSilentRunning();
-               }
-       }
-
-       @After
-       public void tearDown() throws Exception {
-       }
-       
-       private void out_println(String message) {
-               System.out.println(message);
-       }
-       
-       private void debug(String message) {
-               if(Testing.isDebug()) {
-                       out_println(message);
-               }
-       }
-       
-       private void asExpected(String text) {
-               if(Testing.isVerbose()) {
-                       String message = "as expected: "+text;
-                       out_println(message);
-               }
-       }
-       
-       private void asExpected(Exception e) {
-               if(Testing.isVerbose()) {
-                       String message = "as expected: "+e.getMessage();
-                       out_println(message);
-               }
-       }
+public class TestJson extends ATest {
        
        private void compare(JsonWorkItemState jwisA, JsonWorkItemState jwisB) {
                assertTrue(jwisA.getNode().equals(jwisB.getNode()));
@@ -94,7 +42,7 @@ public class TestJson {
        
        @Test
        public void test_01() {
-               if(Testing.isDisabled(this.getClass().getName())) {
+               if(isDisabled(this.getClass().getName())) {
                        return;
                }
                try {
@@ -133,7 +81,7 @@ public class TestJson {
        
        @Test
        public void test_02() {
-               if(Testing.isDisabled(this.getClass().getName())) {
+               if(isDisabled(this.getClass().getName())) {
                        return;
                }
                try {

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestSuite.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestSuite.java?rev=1637438&r1=1637437&r2=1637438&view=diff
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestSuite.java
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestSuite.java
 Fri Nov  7 19:51:26 2014
@@ -24,70 +24,18 @@ import static org.junit.Assert.fail;
 import java.io.File;
 import java.net.URL;
 
-import org.apache.uima.ducc.container.common.ContainerLogger;
 import org.apache.uima.ducc.container.jd.JobDriverException;
 import org.apache.uima.ducc.container.jd.cas.CasManager;
 import org.apache.uima.ducc.container.jd.cas.CasManagerStats.RetryReason;
 import org.apache.uima.ducc.container.jd.classload.JobDriverCollectionReader;
 import org.apache.uima.ducc.container.jd.mh.RemoteWorkerIdentity;
 import org.apache.uima.ducc.container.jd.mh.impl.OperatingInfo;
-import org.apache.uima.ducc.container.jd.test.helper.Testing;
 import org.apache.uima.ducc.container.jd.test.helper.Utilities;
 import org.apache.uima.ducc.container.net.iface.IMetaCas;
 import org.apache.uima.ducc.container.net.impl.MetaCas;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
-public class TestSuite {
-
-       @BeforeClass
-       public static void setUpBeforeClass() throws Exception {
-       }
-
-       @AfterClass
-       public static void tearDownAfterClass() throws Exception {
-       }
-
-       @Before
-       public void setUp() throws Exception {
-               if(!Testing.isVerbose()) {
-                       ContainerLogger.setSilentRunning();
-               }
-               else {
-                       ContainerLogger.resetSilentRunning();
-               }
-       }
-
-       @After
-       public void tearDown() throws Exception {
-       }
-       
-       private void out_println(String message) {
-               System.out.println(message);
-       }
-       
-       private void debug(String message) {
-               if(Testing.isDebug()) {
-                       out_println(message);
-               }
-       }
-       
-       private void asExpected(String text) {
-               if(Testing.isVerbose()) {
-                       String message = "as expected: "+text;
-                       out_println(message);
-               }
-       }
-       
-       private void asExpected(Exception e) {
-               if(Testing.isVerbose()) {
-                       String message = "as expected: "+e.getMessage();
-                       out_println(message);
-               }
-       }
+public class TestSuite extends ATest {
        
        String prefix1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><xmi:XMI 
xmlns:tcas=\"http:///uima/tcas.ecore\"";;
        String prefix0 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><xmi:XMI 
xmlns:cas=\"http:///uima/cas.ecore\"";;
@@ -114,7 +62,7 @@ public class TestSuite {
        
        @Test
        public void test_01() {
-               if(Testing.isDisabled(this.getClass().getName())) {
+               if(isDisabled(this.getClass().getName())) {
                        return;
                }
                URL urlXml = this.getClass().getResource("/CR100.xml");
@@ -155,7 +103,7 @@ public class TestSuite {
        
        @Test
        public void test_02() {
-               if(Testing.isDisabled(this.getClass().getName())) {
+               if(isDisabled(this.getClass().getName())) {
                        return;
                }
                URL urlXml = this.getClass().getResource("/CR100.xml");
@@ -190,7 +138,7 @@ public class TestSuite {
        
        @Test
        public void test_03() {
-               if(Testing.isDisabled(this.getClass().getName())) {
+               if(isDisabled(this.getClass().getName())) {
                        return;
                }
                String crXml = null;
@@ -219,7 +167,7 @@ public class TestSuite {
        
        @Test
        public void test_04() {
-               if(Testing.isDisabled(this.getClass().getName())) {
+               if(isDisabled(this.getClass().getName())) {
                        return;
                }
                URL urlXml = this.getClass().getResource("/CR100.xml");
@@ -257,7 +205,7 @@ public class TestSuite {
        
        @Test
        public void test_05() {
-               if(Testing.isDisabled(this.getClass().getName())) {
+               if(isDisabled(this.getClass().getName())) {
                        return;
                }
                URL urlXml = this.getClass().getResource("/CR100.xml");
@@ -308,7 +256,7 @@ public class TestSuite {
        
        @Test
        public void test_06() {
-               if(Testing.isDisabled(this.getClass().getName())) {
+               if(isDisabled(this.getClass().getName())) {
                        return;
                }
                URL urlXml = this.getClass().getResource("/CR100.xml");
@@ -320,7 +268,7 @@ public class TestSuite {
        
        @Test
        public void test_07() {
-               if(Testing.isDisabled(this.getClass().getName())) {
+               if(isDisabled(this.getClass().getName())) {
                        return;
                }
                URL urlXml = this.getClass().getResource("/CR100.xml");
@@ -332,7 +280,7 @@ public class TestSuite {
        
        @Test
        public void test_10() {
-               if(Testing.isDisabled(this.getClass().getName())) {
+               if(isDisabled(this.getClass().getName())) {
                        return;
                }
                try {
@@ -371,7 +319,7 @@ public class TestSuite {
        
        @Test
        public void test_20() {
-               if(Testing.isDisabled(this.getClass().getName())) {
+               if(isDisabled(this.getClass().getName())) {
                        return;
                }
                String n01 = "node01";
@@ -404,7 +352,7 @@ public class TestSuite {
        
        @Test
        public void test_30() {
-               if(Testing.isDisabled(this.getClass().getName())) {
+               if(isDisabled(this.getClass().getName())) {
                        return;
                }
                OperatingInfo oi = new OperatingInfo();

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestWiFsm.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestWiFsm.java?rev=1637438&r1=1637437&r2=1637438&view=diff
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestWiFsm.java
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-container/src/test/java/org/apache/uima/ducc/container/jd/test/TestWiFsm.java
 Fri Nov  7 19:51:26 2014
@@ -18,9 +18,9 @@
 */
 package org.apache.uima.ducc.container.jd.test;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
-import org.apache.uima.ducc.container.common.ContainerLogger;
 import org.apache.uima.ducc.container.common.fsm.Action;
 import org.apache.uima.ducc.container.common.fsm.Event;
 import org.apache.uima.ducc.container.common.fsm.Fsm;
@@ -32,64 +32,13 @@ import org.apache.uima.ducc.container.co
 import org.apache.uima.ducc.container.common.fsm.iface.IFsmBuilder;
 import org.apache.uima.ducc.container.common.fsm.iface.IState;
 import org.apache.uima.ducc.container.jd.fsm.wi.WiFsm;
-import org.apache.uima.ducc.container.jd.test.helper.Testing;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
-public class TestWiFsm {
-
-       @BeforeClass
-       public static void setUpBeforeClass() throws Exception {
-       }
-
-       @AfterClass
-       public static void tearDownAfterClass() throws Exception {
-       }
-
-       @Before
-       public void setUp() throws Exception {
-               if(!Testing.isVerbose()) {
-                       ContainerLogger.setSilentRunning();
-               }
-               else {
-                       ContainerLogger.resetSilentRunning();
-               }
-       }
-
-       @After
-       public void tearDown() throws Exception {
-       }
-
-       private void out_println(String message) {
-               System.out.println(message);
-       }
-       
-       private void debug(String message) {
-               if(Testing.isDebug()) {
-                       out_println(message);
-               }
-       }
-       
-       private void asExpected(String text) {
-               if(Testing.isVerbose()) {
-                       String message = "as expected: "+text;
-                       out_println(message);
-               }
-       }
-       
-       private void asExpected(Exception e) {
-               if(Testing.isVerbose()) {
-                       String message = "as expected: "+e.getMessage();
-                       out_println(message);
-               }
-       }
+public class TestWiFsm extends ATest {
        
        @Test
        public void test_01() {
-               if(Testing.isDisabled(this.getClass().getName())) {
+               if(isDisabled(this.getClass().getName())) {
                        return;
                }
                try {
@@ -118,7 +67,7 @@ public class TestWiFsm {
        
        @Test
        public void test_02() {
-               if(Testing.isDisabled(this.getClass().getName())) {
+               if(isDisabled(this.getClass().getName())) {
                        return;
                }
                try {
@@ -147,7 +96,7 @@ public class TestWiFsm {
        
        @Test
        public void test_03() {
-               if(Testing.isDisabled(this.getClass().getName())) {
+               if(isDisabled(this.getClass().getName())) {
                        return;
                }
                try {
@@ -191,7 +140,7 @@ public class TestWiFsm {
        
        @Test
        public void test_04() {
-               if(Testing.isDisabled(this.getClass().getName())) {
+               if(isDisabled(this.getClass().getName())) {
                        return;
                }
                try {
@@ -219,7 +168,7 @@ public class TestWiFsm {
        
        @Test
        public void test_05() {
-               if(Testing.isDisabled(this.getClass().getName())) {
+               if(isDisabled(this.getClass().getName())) {
                        return;
                }
                try {
@@ -246,10 +195,9 @@ public class TestWiFsm {
                }
        }
        
-       
        @Test
        public void test_06() {
-               if(Testing.isDisabled(this.getClass().getName())) {
+               if(isDisabled(this.getClass().getName())) {
                        return;
                }
                try {

Added: 
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/JdUser.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/JdUser.java?rev=1637438&view=auto
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/JdUser.java
 (added)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/JdUser.java
 Fri Nov  7 19:51:26 2014
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc.user.jd;
+
+public class JdUser {
+
+       public static String CAS_INITIAL_HEAP_SIZE = "1000";
+       
+       public static int DefaultJobErrorLimit = 15;
+}

Propchange: 
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/JdUser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/JdUserCasManager.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/JdUserCasManager.java?rev=1637438&r1=1637437&r2=1637438&view=diff
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/JdUserCasManager.java
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/JdUserCasManager.java
 Fri Nov  7 19:51:26 2014
@@ -32,7 +32,7 @@ import org.apache.uima.util.CasCreationU
 
 public class JdUserCasManager {
 
-       private String CAS_INITIAL_HEAP_SIZE = "1000";
+       private String CAS_INITIAL_HEAP_SIZE = JdUser.CAS_INITIAL_HEAP_SIZE;
        
        private ConcurrentLinkedQueue<CAS> recycledCasList = new 
ConcurrentLinkedQueue<CAS>();
        

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/iface/JdUserErrorHandler.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/iface/JdUserErrorHandler.java?rev=1637438&r1=1637437&r2=1637438&view=diff
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/iface/JdUserErrorHandler.java
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/iface/JdUserErrorHandler.java
 Fri Nov  7 19:51:26 2014
@@ -25,12 +25,13 @@ import java.util.concurrent.atomic.Atomi
 
 import org.apache.uima.cas.CAS;
 import org.apache.uima.ducc.user.common.QuotedOptions;
+import org.apache.uima.ducc.user.jd.JdUser;
 
 public class JdUserErrorHandler implements IJdUserErrorHandler {
 
-       public enum Key { KillJobLimit, KillProcessLimit, KillWorkItemLimit };
+       public enum InitializationDataKey { KillJobLimit, KillProcessLimit, 
KillWorkItemLimit };
        
-       private static int DefaultJobErrorLimit = 15;
+       private static int DefaultJobErrorLimit = JdUser.DefaultJobErrorLimit;
        
        private AtomicInteger jobErrorLimit = new 
AtomicInteger(DefaultJobErrorLimit);
        
@@ -66,10 +67,12 @@ public class JdUserErrorHandler implemen
        
        @Override
        public void initialize(String initializationData) {
-               Map<String, String> map = parse(initializationData);
-               String key = Key.KillJobLimit.name().toLowerCase();
-               String value = map.get(key);
-               initKillJob(value);
+               if(initializationData != null) {
+                       Map<String, String> map = parse(initializationData);
+                       String key = 
InitializationDataKey.KillJobLimit.name().toLowerCase();
+                       String value = map.get(key);
+                       initKillJob(value);
+               }
        }
 
        private void initKillJob(String value) {

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/TestSuite.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/TestSuite.java?rev=1637438&r1=1637437&r2=1637438&view=diff
==============================================================================
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/TestSuite.java
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/TestSuite.java
 Fri Nov  7 19:51:26 2014
@@ -31,7 +31,7 @@ import org.apache.uima.ducc.user.jd.JdUs
 import org.apache.uima.ducc.user.jd.iface.IJdUserDirective;
 import org.apache.uima.ducc.user.jd.iface.IJdUserErrorHandler;
 import org.apache.uima.ducc.user.jd.iface.JdUserErrorHandler;
-import org.apache.uima.ducc.user.jd.iface.JdUserErrorHandler.Key;
+import 
org.apache.uima.ducc.user.jd.iface.JdUserErrorHandler.InitializationDataKey;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -247,7 +247,7 @@ public class TestSuite {
                        //
                        limit = 10;
                        exception = new RuntimeException();
-                       plist = Key.KillJobLimit.name()+"="+limit;
+                       plist = 
InitializationDataKey.KillJobLimit.name()+"="+limit;
                        eh = new JdUserErrorHandler(plist);
                        directive = eh.handle(cas, exception);
                        for(int i=1; i<limit; i++) {
@@ -263,7 +263,7 @@ public class TestSuite {
                        //
                        limit = 20;
                        exception = new RuntimeException();
-                       plist = Key.KillJobLimit.name()+"="+limit;
+                       plist = 
InitializationDataKey.KillJobLimit.name()+"="+limit;
                        eh = new JdUserErrorHandler(plist);
                        directive = eh.handle(cas, exception);
                        for(int i=1; i<limit; i++) {


Reply via email to