changeset 523:17900f4ca4a6

Added basic ClosingLIstener support, implementation and example
author Jiri Vanek <jvanek@redhat.com>
date Mon, 24 Sep 2012 17:05:41 +0200
parents 97280ecda136
children 077a48d226c4
files ChangeLog tests/reproducers/signed/AppletTestSigned/resources/AppletTestSigned.html tests/reproducers/signed/AppletTestSigned/resources/AppletTestSigned2.html tests/reproducers/signed/AppletTestSigned/srcs/AppletTestSigned.java tests/reproducers/signed/AppletTestSigned/testcases/AppletTestSignedTests.java tests/test-extensions/net/sourceforge/jnlp/ClosingListener.java tests/test-extensions/net/sourceforge/jnlp/ProcessAssasin.java tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java tests/test-extensions/net/sourceforge/jnlp/closinglisteners/AutoAllClosingListener.java tests/test-extensions/net/sourceforge/jnlp/closinglisteners/AutoErrorClosingListener.java tests/test-extensions/net/sourceforge/jnlp/closinglisteners/AutoOkClosingListener.java tests/test-extensions/net/sourceforge/jnlp/closinglisteners/StringBasedClosingListener.java tests/test-extensions/net/sourceforge/jnlp/closinglisteners/StringMatchClosingListener.java
diffstat 13 files changed, 449 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Sep 24 16:57:08 2012 +0200
+++ b/ChangeLog	Mon Sep 24 17:05:41 2012 +0200
@@ -1,3 +1,30 @@
+2012-09-24  Jiri Vanek <jvanek@redhat.com>
+
+	* tests/reproducers/signed/AppletTestSigned/resources/AppletTestSigned.html:
+	removed unnecessary XslowX
+	* tests/reproducers/signed/AppletTestSigned/resources/AppletTestSigned2.html:
+	aded missing XslowX
+	* tests/reproducers/signed/AppletTestSigned/srcs/AppletTestSigned.java:
+	added standard closing sentence
+	* tests/reproducers/signed/AppletTestSigned/testcases/AppletTestSignedTests.java:
+	used auto*clsoing listeners
+	* tests/test-extensions/net/sourceforge/jnlp/ClosingListener.java:
+	interface for identifying closing listeners
+	* tests/test-extensions/net/sourceforge/jnlp/ProcessAssasin.java:
+	added possibility to set timeout n the fly
+	* tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java:
+	(executeBrowser) added shortcut for autoclosing listeners,
+	(setUpClosingListener) method for setting properties of ClosingListener
+	(executeBrowser) add logic to handle ClosingListeners
+	* tests/test-extensions/net/sourceforge/jnlp/closinglisteners/AutoAllClosingListener.java:
+	listener closing  on "APPLET FINISHED" string
+	* tests/test-extensions/net/sourceforge/jnlp/closinglisteners/AutoErrorClosingListener.java:
+	listener closing on "xception" match
+	* tests/test-extensions/net/sourceforge/jnlp/closinglisteners/AutoOkClosingListener.java:
+	listener closing on both xception and finished string.
+	* tests/test-extensions/net/sourceforge/jnlp/closinglisteners/StringBasedClosingListener.java:
+	Base forefather for Auto*ClosingListener 
+
 2012-09-24  Jiri Vanek <jvanek@redhat.com>
             Jana Fabrikova <jfabriko@redhat.com>
 
--- a/tests/reproducers/signed/AppletTestSigned/resources/AppletTestSigned.html	Mon Sep 24 16:57:08 2012 +0200
+++ b/tests/reproducers/signed/AppletTestSigned/resources/AppletTestSigned.html	Mon Sep 24 17:05:41 2012 +0200
@@ -37,7 +37,7 @@
  -->
 <html><head></head><body bgcolor="red">
 <p>
-  <applet code="AppletTestSigned.class" archive="XslowXAppletTestSigned.jar" codebase="." width="100" height="100">
+  <applet code="AppletTestSigned.class" archive="AppletTestSigned.jar" codebase="." width="100" height="100">
     <param name="key1" value="value1">
     <param name="key2" value="#value2">
   </applet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/reproducers/signed/AppletTestSigned/resources/AppletTestSigned2.html	Mon Sep 24 17:05:41 2012 +0200
@@ -0,0 +1,46 @@
+<!--
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+IcedTea is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+
+ -->
+<html><head></head><body bgcolor="red">
+<p>
+  <applet code="AppletTestSigned.class" archive="XslowXAppletTestSigned.jar" codebase="." width="100" height="100">
+    <param name="key1" value="value1">
+    <param name="key2" value="#value2">
+  </applet>
+</p>
+</body>
+</html>
--- a/tests/reproducers/signed/AppletTestSigned/srcs/AppletTestSigned.java	Mon Sep 24 16:57:08 2012 +0200
+++ b/tests/reproducers/signed/AppletTestSigned/srcs/AppletTestSigned.java	Mon Sep 24 17:05:41 2012 +0200
@@ -48,6 +48,7 @@
             try {
                 Thread.sleep(n);
                 System.out.println("AppletTestSigned killing himself after " + n + " ms of life");
+                System.out.println("*** APPLET FINISHED ***");
                 System.exit(0);
             } catch (Exception ex) {
             }
--- a/tests/reproducers/signed/AppletTestSigned/testcases/AppletTestSignedTests.java	Mon Sep 24 16:57:08 2012 +0200
+++ b/tests/reproducers/signed/AppletTestSigned/testcases/AppletTestSignedTests.java	Mon Sep 24 17:05:41 2012 +0200
@@ -84,15 +84,24 @@
 
     @Test
     @TestInBrowsers(testIn = {Browsers.all})
-    public void AppletTestSignedFirefoxTest() throws Exception {
+    public void AppletTestSignedFirefoxTestXslowX() throws Exception {
         ServerAccess.PROCESS_TIMEOUT = 30 * 1000;
         try {
-            ProcessResult pr = server.executeBrowser("/AppletTestSigned.html");
+            ProcessResult pr = server.executeBrowser("/AppletTestSigned2.html");
             evaluateSignedApplet(pr, false);
-            Assert.assertTrue(pr.wasTerminated);
+            //Assert.assertTrue(pr.wasTerminated);
             //Assert.assertEquals((Integer) 0, pr.returnValue); due to destroy is null
         } finally {
             ServerAccess.PROCESS_TIMEOUT = 20 * 1000; //back to normal
         }
     }
+
+    @Test
+    @TestInBrowsers(testIn = {Browsers.all})
+    public void AppletTestSignedFirefoxTest() throws Exception {
+        ProcessResult pr = server.executeBrowser("/AppletTestSigned.html", ServerAccess.AutoClose.CLOSE_ON_BOTH);
+        evaluateSignedApplet(pr, false);
+        //Assert.assertTrue(pr.wasTerminated);
+        //Assert.assertEquals((Integer) 0, pr.returnValue); due to destroy is null
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-extensions/net/sourceforge/jnlp/ClosingListener.java	Mon Sep 24 17:05:41 2012 +0200
@@ -0,0 +1,55 @@
+/* ClosingListener.java
+Copyright (C) 2012 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+ */
+package net.sourceforge.jnlp;
+
+public abstract class ClosingListener implements ContentReaderListener {
+
+    private ThreadedProcess process;
+    private ProcessAssasin assasin;
+
+    void setProcess(ThreadedProcess p) {
+        this.process = p;
+    }
+
+    void setAssasin(ProcessAssasin assasin) {
+        this.assasin = assasin;
+    }
+
+    public void terminate() {
+        assasin.setTimeout(Long.MIN_VALUE);
+    }
+}
--- a/tests/test-extensions/net/sourceforge/jnlp/ProcessAssasin.java	Mon Sep 24 16:57:08 2012 +0200
+++ b/tests/test-extensions/net/sourceforge/jnlp/ProcessAssasin.java	Mon Sep 24 17:05:41 2012 +0200
@@ -98,6 +98,11 @@
         return skipInstedOfDesroy;
     }
 
+    void setTimeout(long timeout) {
+        this.timeout = timeout;
+    }
+
+
     @Override
     public void run() {
         long startTime = System.nanoTime() / ServerAccess.NANO_TIME_DELIMITER;
--- a/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java	Mon Sep 24 16:57:08 2012 +0200
+++ b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java	Mon Sep 24 17:05:41 2012 +0200
@@ -1,5 +1,5 @@
 /* ServerAccess.java
-Copyright (C) 2011 Red Hat, Inc.
+Copyright (C) 2011, 2012 Red Hat, Inc.
 
 This file is part of IcedTea.
 
@@ -58,6 +58,8 @@
 import net.sourceforge.jnlp.browsertesting.Browser;
 import net.sourceforge.jnlp.browsertesting.BrowserFactory;
 import net.sourceforge.jnlp.browsertesting.Browsers;
+import net.sourceforge.jnlp.closinglisteners.AutoErrorClosingListener;
+import net.sourceforge.jnlp.closinglisteners.AutoOkClosingListener;
 import org.junit.Assert;
 
 /**
@@ -77,6 +79,11 @@
  */
 public class ServerAccess {
 
+    public static enum AutoClose {
+
+        CLOSE_ON_EXCEPTION, CLOSE_ON_CORRECT_END, CLOSE_ON_BOTH
+    }
+
     public static final long NANO_TIME_DELIMITER=1000000l;
     /**
      * java property which value containing path to default (makefile by) directory with deployed resources
@@ -545,6 +552,20 @@
     public ProcessResult executeJavaws(String resource,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception {
         return executeJavaws(null, resource,stdoutl,stderrl);
     }
+
+    public net.sourceforge.jnlp.ProcessResult executeBrowser(String string, AutoClose autoClose) throws Exception {
+        ClosingListener errClosing = null;
+        ClosingListener outClosing = null;
+        if (autoClose == AutoClose.CLOSE_ON_BOTH || autoClose == AutoClose.CLOSE_ON_EXCEPTION){
+            errClosing=new AutoErrorClosingListener();
+        }
+        if (autoClose == AutoClose.CLOSE_ON_BOTH || autoClose == AutoClose.CLOSE_ON_CORRECT_END){
+            outClosing=new AutoOkClosingListener();
+        }
+        return executeBrowser(string, outClosing, errClosing);
+    }
+    
+
     public ProcessResult executeBrowser(String resource) throws Exception {
         return executeBrowser(getBrowserParams(), resource);
     }
@@ -797,6 +818,8 @@
             log(connectionMesaage, true, true);
         }
         ProcessAssasin pa = new ProcessAssasin(t, PROCESS_TIMEOUT);
+        setUpClosingListener(stdoutl, pa, t);
+        setUpClosingListener(stderrl, pa, t);
         pa.start();
         t.start();
         while (t.getP() == null && t.deadlyException == null) {
@@ -834,6 +857,13 @@
         return pr;
     }
 
+     private static void setUpClosingListener(ContentReaderListener listener, ProcessAssasin pa, ThreadedProcess t) {
+        if (listener != null && (listener instanceof ClosingListener)) {
+            ((ClosingListener) listener).setAssasin(pa);
+            ((ClosingListener) listener).setProcess(t);
+        }
+    }
+
     /**
      * this is temprary solution until refactoring is fully done
      * Use  net.sourceforge.jnlp.ProcessResult instead
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-extensions/net/sourceforge/jnlp/closinglisteners/AutoAllClosingListener.java	Mon Sep 24 17:05:41 2012 +0200
@@ -0,0 +1,57 @@
+/* CountingClosingListener.java
+Copyright (C) 2012 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+ */
+package net.sourceforge.jnlp.closinglisteners;
+
+import net.sourceforge.jnlp.ClosingListener;
+
+public  class AutoAllClosingListener extends ClosingListener {
+
+    
+
+    @Override
+    public void charReaded(char ch) {
+
+    }
+
+    @Override
+    public void lineReaded(String s) {
+       if (s.contains(AutoErrorClosingListener.MAGICAL_ERROR_CLOSING_STRING) || s.contains(AutoOkClosingListener.MAGICAL_OK_CLOSING_STRING)){
+           terminate();
+       }
+    }
+  
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-extensions/net/sourceforge/jnlp/closinglisteners/AutoErrorClosingListener.java	Mon Sep 24 17:05:41 2012 +0200
@@ -0,0 +1,46 @@
+/* AutoErrorClosingListener.java
+Copyright (C) 2012 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+ */
+package net.sourceforge.jnlp.closinglisteners;
+
+public class AutoErrorClosingListener extends StringBasedClosingListener {
+
+    public static final String MAGICAL_ERROR_CLOSING_STRING = "xception";
+
+    public AutoErrorClosingListener() {
+        super(MAGICAL_ERROR_CLOSING_STRING);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-extensions/net/sourceforge/jnlp/closinglisteners/AutoOkClosingListener.java	Mon Sep 24 17:05:41 2012 +0200
@@ -0,0 +1,48 @@
+/* CountingClosingListener.java
+Copyright (C) 2012 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+ */
+package net.sourceforge.jnlp.closinglisteners;
+
+
+public  class AutoOkClosingListener extends StringBasedClosingListener {
+
+    public static final String MAGICAL_OK_CLOSING_STRING = "*** APPLET FINISHED ***";
+
+    public AutoOkClosingListener() {
+        super(MAGICAL_OK_CLOSING_STRING);
+    }
+  
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-extensions/net/sourceforge/jnlp/closinglisteners/StringBasedClosingListener.java	Mon Sep 24 17:05:41 2012 +0200
@@ -0,0 +1,67 @@
+/* StringBasedClosingListener.java
+Copyright (C) 2012 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+ */
+package net.sourceforge.jnlp.closinglisteners;
+
+import net.sourceforge.jnlp.ClosingListener;
+
+public  class StringBasedClosingListener extends ClosingListener {
+
+    private  final String condition;
+
+    public StringBasedClosingListener(String condition) {
+        this.condition = condition;
+    }
+
+    @Override
+    public void charReaded(char ch) {
+
+    }
+
+    @Override
+    public void lineReaded(String s) {
+           if (s.contains(condition)){
+           terminate();
+       }
+    }
+
+
+    public String getCondition() {
+        return condition;
+    }
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-extensions/net/sourceforge/jnlp/closinglisteners/StringMatchClosingListener.java	Mon Sep 24 17:05:41 2012 +0200
@@ -0,0 +1,53 @@
+/* StringMatchClosingListener.java
+Copyright (C) 2012 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+ */
+
+import net.sourceforge.jnlp.closinglisteners.StringBasedClosingListener;
+
+
+public class StringMatchClosingListener extends StringBasedClosingListener {
+
+    public StringMatchClosingListener(String s) {
+        super(s);
+    }
+
+    @Override
+    public void lineReaded(String s) {
+        if (s.matches(getCondition())) {
+            terminate();
+        }
+    }
+}