Esempio n. 1
0
 @Before
 public void setUp() throws Exception {
   File f = new File(new File(System.getProperty("user.home")), ".jenkins-ci.org");
   if (!f.exists()) {
     LOGGER.warning(f + " doesn't exist. Skipping JDK installation tests");
   } else {
     Properties prop = new Properties();
     FileInputStream in = new FileInputStream(f);
     try {
       prop.load(in);
       String u = prop.getProperty("oracle.userName");
       String p = prop.getProperty("oracle.password");
       if (u == null || p == null) {
         LOGGER.warning(
             f
                 + " doesn't contain oracle.userName and oracle.password. Skipping JDK installation tests.");
       } else {
         DescriptorImpl d = j.jenkins.getDescriptorByType(DescriptorImpl.class);
         d.doPostCredential(u, p);
       }
     } finally {
       in.close();
     }
   }
 }
Esempio n. 2
0
  @Test
  public void enterCredential() throws Exception {
    HtmlPage p =
        j.createWebClient().goTo("descriptorByName/hudson.tools.JDKInstaller/enterCredential");
    HtmlForm form = p.getFormByName("postCredential");
    form.getInputByName("username").setValueAttribute("foo");
    form.getInputByName("password").setValueAttribute("bar");
    HtmlFormUtil.submit(form, null);

    DescriptorImpl d = j.jenkins.getDescriptorByType(DescriptorImpl.class);
    assertEquals("foo", d.getUsername());
    assertEquals("bar", d.getPassword().getPlainText());
  }