Definiere Pac-Admin-Passwort

This commit is contained in:
Peter Hormanns 2012-06-12 13:27:10 +00:00
parent 6d8744533e
commit 7665ac5734
2 changed files with 25 additions and 0 deletions

View File

@ -85,6 +85,7 @@ public class InitDataTest {
try { try {
Object execute = client.execute(PAC_MODULE + ".add", params); Object execute = client.execute(PAC_MODULE + ".add", params);
assertTrue(execute instanceof Map<?, ?>); assertTrue(execute instanceof Map<?, ?>);
cas.setPassword(client, "aaa00");
} catch (XmlRpcException e) { } catch (XmlRpcException e) {
fail(e.getMessage()); fail(e.getMessage());
} }

View File

@ -1,5 +1,7 @@
package de.hsadmin.remote; package de.hsadmin.remote;
import static org.junit.Assert.fail;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.IOException; import java.io.IOException;
@ -8,9 +10,14 @@ import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URL; import java.net.URL;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.HttpsURLConnection;
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import de.hsadmin.core.util.Config; import de.hsadmin.core.util.Config;
public class RemoteCASHelper { public class RemoteCASHelper {
@ -83,4 +90,21 @@ public class RemoteCASHelper {
return result; 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());
}
}
} }