summaryrefslogtreecommitdiffstats
path: root/tests/DiagTalker.java
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-06-04 09:57:45 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-06-04 09:57:45 +0200
commit58e707b441aea88cd318762e6968e1db1211f949 (patch)
tree80271dac627000d5afed047a6372d633dd3fd068 /tests/DiagTalker.java
parent4f742a8e32c43dc9b514ceaf80f4d17e697dfdf6 (diff)
downloadrsyslog-58e707b441aea88cd318762e6968e1db1211f949.tar.gz
rsyslog-58e707b441aea88cd318762e6968e1db1211f949.tar.xz
rsyslog-58e707b441aea88cd318762e6968e1db1211f949.zip
backported some of the v5 testbench
this permits us to keep a persistent test environment between v4 and v5, most importantly using the same tools. As far as the actual tests are concerned, some had issues. I had no time to check if that was an issue with the test or an actual issue with the v3/4 engine. Will do that at some later stage.
Diffstat (limited to 'tests/DiagTalker.java')
-rw-r--r--tests/DiagTalker.java33
1 files changed, 30 insertions, 3 deletions
diff --git a/tests/DiagTalker.java b/tests/DiagTalker.java
index e33a5867..04e12327 100644
--- a/tests/DiagTalker.java
+++ b/tests/DiagTalker.java
@@ -1,3 +1,24 @@
+/* A yet very simple tool to talk to imdiag.
+ *
+ * Copyright 2009 Rainer Gerhards and Adiscon GmbH.
+ *
+ * This file is part of rsyslog.
+ *
+ * Rsyslog 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Rsyslog 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 Rsyslog. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * A copy of the GPL can be found in the file "COPYING" in this distribution.
+ */
//package com.rsyslog.diag;
import java.io.*;
import java.net.*;
@@ -13,6 +34,7 @@ public class DiagTalker {
try {
diagSocket = new Socket(host, port);
+ diagSocket.setSoTimeout(0); /* wait for lenghty operations */
out = new PrintWriter(diagSocket.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(
diagSocket.getInputStream()));
@@ -29,9 +51,14 @@ public class DiagTalker {
new InputStreamReader(System.in));
String userInput;
- while ((userInput = stdIn.readLine()) != null) {
- out.println(userInput);
- System.out.println("imdiag returns: " + in.readLine());
+ try {
+ while ((userInput = stdIn.readLine()) != null) {
+ out.println(userInput);
+ System.out.println("imdiag returns: " + in.readLine());
+ }
+ } catch (SocketException e) {
+ System.err.println("We had a socket exception and consider this to be OK: "
+ + e.getMessage());
}
out.close();