From 7665ac5734f92c350cd8bb968ebd79a9c244dbaf Mon Sep 17 00:00:00 2001
From: Peter Hormanns <peter.hormanns@hostsharing.net>
Date: Tue, 12 Jun 2012 15:27:10 +0200
Subject: [PATCH] Definiere Pac-Admin-Passwort

---
 hsarback/test/de/hsadmin/remote/InitDataTest.java    |    1 +
 hsarback/test/de/hsadmin/remote/RemoteCASHelper.java |   24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/hsarback/test/de/hsadmin/remote/InitDataTest.java b/hsarback/test/de/hsadmin/remote/InitDataTest.java
index 111dcf7..fc09636 100644
--- a/hsarback/test/de/hsadmin/remote/InitDataTest.java
+++ b/hsarback/test/de/hsadmin/remote/InitDataTest.java
@@ -85,6 +85,7 @@
 		try {
 			Object execute = client.execute(PAC_MODULE + ".add", params);
 			assertTrue(execute instanceof Map<?, ?>);
+			cas.setPassword(client, "aaa00");
 		} catch (XmlRpcException e) {
 			fail(e.getMessage());
 		}
diff --git a/hsarback/test/de/hsadmin/remote/RemoteCASHelper.java b/hsarback/test/de/hsadmin/remote/RemoteCASHelper.java
index 1a3eaf5..ad7b8d7 100644
--- a/hsarback/test/de/hsadmin/remote/RemoteCASHelper.java
+++ b/hsarback/test/de/hsadmin/remote/RemoteCASHelper.java
@@ -1,5 +1,7 @@
 package de.hsadmin.remote;
 
+import static org.junit.Assert.fail;
+
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.IOException;
@@ -8,8 +10,13 @@
 import java.io.UnsupportedEncodingException;
 import java.net.URL;
 import java.net.URLEncoder;
+import java.util.HashMap;
+import java.util.Map;
 
 import javax.net.ssl.HttpsURLConnection;
+
+import org.apache.xmlrpc.XmlRpcException;
+import org.apache.xmlrpc.client.XmlRpcClient;
 
 import de.hsadmin.core.util.Config;
 
@@ -83,4 +90,21 @@
 		return result;
 	}
 	
+	public void setPassword(XmlRpcClient client, String user) {
+		try {
+			String admin = "ad";
+			String grantingTicketURL = getGrantingTicketURL(admin);
+			Map<String, String> whereParams = new HashMap<String, String>();
+			Map<String, String> setParams = new HashMap<String, String>();
+			whereParams.put("name", user);
+			setParams.put("password", "test123");
+			Object[] params = new Object[] { user, 
+					getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), 
+					setParams, whereParams };
+			client.execute("user.update", params);
+		} catch (XmlRpcException e) {
+			fail(e.getMessage());
+		}
+	}
+	
 }

--
Gitblit v1.9.1