From dffa8330eabab7f0a2b78ff7e9955cc68735d763 Mon Sep 17 00:00:00 2001
From: Peter Hormanns <peter.hormanns@hostsharing.net>
Date: Wed, 04 Jan 2012 14:45:57 +0100
Subject: [PATCH] fix #79 with testcase

---
 hsarback/test/de/hsadmin/remote/SSLCertDomainTest.java |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/hsarback/test/de/hsadmin/remote/SSLCertDomainTest.java b/hsarback/test/de/hsadmin/remote/SSLCertDomainTest.java
index 9cb8ff4..16d4e6a 100644
--- a/hsarback/test/de/hsadmin/remote/SSLCertDomainTest.java
+++ b/hsarback/test/de/hsadmin/remote/SSLCertDomainTest.java
@@ -55,11 +55,15 @@
 			Object execute = client.execute(MODULE + ".add", params);
 			assertTrue(execute instanceof Map<?, ?>);
 			Thread.sleep(5000L);
-			CommandShell.execute("grep 'SSLCertificateChainFile' /var/local/lxc/hive/etc/apache2/sites-generated/aaa02.hostsharing.net");
-			fail("ShellException expected");
+			String out = CommandShell.execute("( ls /var/local/lxc/hive/etc/apache2/sites-generated/aaa02.hostsharing.net >/dev/null 2>&1 " +
+					" && grep 'SSLCertificateChainFile' /var/local/lxc/hive/etc/apache2/sites-generated/aaa02.hostsharing.net >/dev/null 2>&1 " +
+					" && echo Ok )" +
+					" || echo fail");
+			assertTrue(out.startsWith("Ok"));		
 		} catch (XmlRpcException e) {
 			fail(e.getMessage());
 		} catch (ShellException e) {
+			fail(e.getMessage());
 		} catch (InterruptedException e) {
 			fail(e.getMessage());
 		}
@@ -82,11 +86,15 @@
 			Object execute = client.execute(MODULE + ".add", params);
 			assertTrue(execute instanceof Map<?, ?>);
 			Thread.sleep(5000L);
-			CommandShell.execute("grep 'SSLCertificate.*default' /var/local/lxc/hive/etc/apache2/sites-generated/aaa02.hostsharing.net");
-			fail("ShellException expected");
+			String out = CommandShell.execute("( ls /var/local/lxc/hive/etc/apache2/sites-generated/aaa03.hostsharing.net >/dev/null 2>&1 " +
+					" && grep 'SSLCertificate.*default' /var/local/lxc/hive/etc/apache2/sites-generated/aaa03.hostsharing.net >/dev/null 2>&1 " +
+					" && echo Ok )" +
+					" || echo fail");
+			assertTrue(out.startsWith("Ok"));		
 		} catch (XmlRpcException e) {
 			fail(e.getMessage());
 		} catch (ShellException e) {
+			fail(e.getMessage());
 		} catch (InterruptedException e) {
 			fail(e.getMessage());
 		}

--
Gitblit v1.9.1