예제 #1
0
 public void setSession(Session session) {
   WebDriver.Options options = getDriver().manage();
   options.deleteAllCookies();
   if (session != null) {
     for (Cookie cookie : session.getCookies()) {
       options.addCookie(cookie);
     }
   }
   if (session != null && !StringUtils.isEmpty(session.getSecretToken())) {
     this.secretToken = session.getSecretToken();
   } else {
     recacheSecretToken();
   }
 }
예제 #2
0
 public void createUser(final String username, final String password, Object... properties) {
   Map<String, String> parameters = new HashMap<String, String>();
   parameters.put("register", "1");
   parameters.put("xwikiname", username);
   parameters.put("register_password", password);
   parameters.put("register2_password", password);
   parameters.put("register_email", "");
   parameters.put(
       "xredirect", getURLToLoginAndGotoPage(username, password, getURLToNonExistentPage()));
   parameters.put("form_token", getSecretToken());
   getDriver().get(getURL("XWiki", "Register", "register", parameters));
   recacheSecretToken();
   if (properties.length > 0) {
     updateObject("XWiki", username, "XWiki.XWikiUsers", 0, properties);
   }
 }