1 25 26 package org.objectweb.jonas.jonasadmin.test.util; 27 28 import com.meterware.httpunit.WebConversation; 29 import com.meterware.httpunit.WebForm; 30 import com.meterware.httpunit.WebResponse; 31 32 37 public class JonasAdminAuth { 38 39 43 private JonasAdminAuth() { 44 super(); 45 } 46 53 public static WebResponse doValidAuth(WebConversation wc, String url) throws Exception { 54 return doAuth(wc, url, "jonas", "jonas"); 55 } 56 57 66 public static WebResponse doAuth(WebConversation wc, String url, String login, String password) throws Exception { 67 WebResponse wr = wc.getResponse(url); 68 WebForm[] webForms = wr.getForms(); 69 WebForm webForm = webForms[0]; 70 71 webForm.setParameter("j_username", login); 72 webForm.setParameter("j_password", password); 73 return webForm.submit(); 74 } 75 } 76 | Popular Tags |