コード例 #1
0
 /**
  * @param name
  * @param conf
  * @throws IOException
  */
 public void replaceGlobalConfigurations(String name, SeleniumGlobalConfiguration conf)
     throws IOException {
   validateAdmin();
   removeGlobalConfigurations(name, false);
   configurations.add(conf);
   PluginImpl.getPlugin().save();
 }
コード例 #2
0
  /**
   * @param req StaplerRequest
   * @param rsp StaplerResponse to redirect with
   * @throws IOException if redirection goes wrong
   */
  public void doCreate(StaplerRequest req, StaplerResponse rsp) throws Exception {
    validateAdmin();
    SeleniumGlobalConfiguration conf =
        req.bindJSON(SeleniumGlobalConfiguration.class, req.getSubmittedForm());
    if (null == conf.getName() || conf.getName().trim().equals("")) {
      throw new Failure("You must specify a name for the configuration");
    }

    if (PluginImpl.getPlugin().hasGlobalConfiguration(conf.getName())) {
      throw new Failure(
          "The configuration name you have chosen is already taken, please choose a unique name.");
    }

    PluginImpl.getPlugin().getGlobalConfigurations().add(conf);
    PluginImpl.getPlugin().save();
    rsp.sendRedirect2("configurations");
  }
コード例 #3
0
 public List<SeleniumGlobalConfiguration> getGlobalConfigurationForComputer(Computer computer) {
   List<SeleniumGlobalConfiguration> confs = new ArrayList<SeleniumGlobalConfiguration>();
   for (SeleniumGlobalConfiguration c : PluginImpl.getPlugin().getGlobalConfigurations()) {
     if (c.getMatcher().match(computer.getNode())) {
       confs.add(c);
     }
   }
   return confs;
 }