changeset 1201:037811f1055e

reverted "Kill processes in Integration Tests more cleanly". It needs to be revisite
author Jiri Vanek <jvanek@redhat.com>
date Mon, 13 Apr 2015 13:55:20 +0200
parents 25e7471b4912
children 6c166ac38f89
files ChangeLog tests/test-extensions/net/sourceforge/jnlp/ProcessAssasin.java tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Firefox.java
diffstat 4 files changed, 40 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Apr 10 11:17:03 2015 -0400
+++ b/ChangeLog	Mon Apr 13 13:55:20 2015 +0200
@@ -1,3 +1,8 @@
+2015-04-13  Jiri Vanek  <jvanek@redhat.com>
+
+	reverted "Kill processes in Integration Tests more cleanly"
+	It needs to be revisited.
+
 2015-04-10  Lukasz Dracz  <ldracz@redhat.com>
 
 	add DeploymentPropertiesModifierTests
--- a/tests/test-extensions/net/sourceforge/jnlp/ProcessAssasin.java	Fri Apr 10 11:17:03 2015 -0400
+++ b/tests/test-extensions/net/sourceforge/jnlp/ProcessAssasin.java	Mon Apr 13 13:55:20 2015 +0200
@@ -200,19 +200,17 @@
             String pid = (f.get(p)).toString();
             if (reactingProcess != null) {
                 reactingProcess.beforeKill(pid);
-            }
-//            sigInt(pid);
-//            sigTerm(pid);
-//            sigKill(pid);
-            sigUsr1(pid);
-
-            p.destroy();
+            };
+            sigInt(pid);
+            //sigTerm(pid);
+            //sigKill(pid);
         } catch (Exception ex) {
             ServerAccess.logException(ex);
         } finally {
+            p.destroy();
             if (reactingProcess != null) {
                 reactingProcess.afterKill("");
-            }
+            };
         }
     }
 
@@ -228,10 +226,6 @@
         kill(pid, "SIGTERM");
     }
 
-    public static void sigUsr1(String pid) throws Exception {
-        kill(pid, "SIGUSR1");
-    }
-
     public static void kill(String pid, String signal) throws InterruptedException, Exception {
         List<String> ll = new ArrayList<String>(4);
         ll.add("kill");
@@ -246,4 +240,27 @@
     void setReactingProcess(ReactingProcess reactingProcess) {
         this.reactingProcess = reactingProcess;
     }
+
+    public static void closeWindow(String pid) throws Exception {
+        List<String> ll = new ArrayList<String>(2);
+        ll.add(ServerAccess.getInstance().getDir().getParent() + "/softkiller");
+        ll.add(pid);
+        ServerAccess.executeProcess(ll); //sync, but  acctually release
+        //before affected application "close"
+        Thread.sleep(100);
+
+    }
+
+    public static void closeWindows(String s) throws Exception {
+        closeWindows(s, 10);
+    }
+    
+    public static void closeWindows(String s, int count) throws Exception {
+        //each close closes just one tab...
+        for (int i = 0; i < count; i++) {
+            ProcessAssasin.closeWindow(s);
+        }
+    }
+
+
 }
--- a/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java	Fri Apr 10 11:17:03 2015 -0400
+++ b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java	Mon Apr 13 13:55:20 2015 +0200
@@ -108,7 +108,7 @@
      * timeout in ms to let process to finish, before assassin will kill it.
      * This can be changed in runtime, but will affect all following tasks
      */
-    public static long PROCESS_TIMEOUT = 10 * 1000;//ms
+    public static long PROCESS_TIMEOUT = 20 * 1000;//ms
     /**
      * this flag is indicating whether output of executeProcess should be logged. By default true.
      */
--- a/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Firefox.java	Fri Apr 10 11:17:03 2015 -0400
+++ b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Firefox.java	Mon Apr 13 13:55:20 2015 +0200
@@ -77,6 +77,11 @@
 
     @Override
     public void beforeKill(String s) {
+        try {
+            ProcessAssasin.closeWindows(s);
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
     }
 
     @Override