/**
  * Check that the PYTHON name is specified
  *
  * @param value The value to check
  */
 public FormValidation doCheckName(@QueryParameter String value) {
   // Trim name
   String name = Util.fixEmptyAndTrim(value);
   // Check that folder specified
   if (name == null)
     // Folder is required
     return FormValidation.error(Messages.PythonInstallation_Name_Required());
   // Check that path does not contains some whitespace chars
   if (StringUtil.hasWhitespace(name))
     // Whitespace are not allowed
     return FormValidation.error(Messages.PythonInstallation_Name_WhitespaceNotAllowed());
   // Seems fine
   return FormValidation.ok();
 }
예제 #2
0
 public void testNoInterpreter() throws Exception {
   ToxBuilder builder = new ToxBuilder("tox.ini", false, null);
   MatrixProject project = createMatrixProject();
   AxisList axes = new AxisList(new ToxAxis(new String[] {"py27"}));
   project.setAxes(axes);
   project.getBuildersList().add(builder);
   MatrixBuild build = project.scheduleBuild2(0).get();
   List<MatrixRun> runs = build.getRuns();
   assertEquals(1, runs.size());
   MatrixRun run = runs.get(0);
   String log = FileUtils.readFileToString(run.getLogFile());
   assertTrue(
       "should not have found an interpreter:\n" + log,
       log.contains(Messages.BuilderUtil_NoInterpreterFound()));
 }
예제 #3
0
 public void testNoAxis() throws Exception {
   ToxBuilder builder = new ToxBuilder("tox.ini", false, null);
   MatrixProject project = createMatrixProject();
   AxisList axes = new AxisList(new TextAxis("TOTO", "TUTU"));
   project.setAxes(axes);
   project.getBuildersList().add(builder);
   MatrixBuild build = project.scheduleBuild2(0).get();
   List<MatrixRun> runs = build.getRuns();
   assertEquals(1, runs.size());
   MatrixRun run = runs.get(0);
   String log = FileUtils.readFileToString(run.getLogFile());
   assertTrue(
       "should not have found a tox axis:\n" + log,
       log.contains(Messages.ToxBuilder_ToxAxis_Required()));
 }
예제 #4
0
 public void testToxenvPatternBlank() throws Exception {
   configureCPython2();
   ToxBuilder builder = new ToxBuilder("tox.ini", false, "$FOOBAR");
   MatrixProject project = createMatrixProject();
   AxisList axes = new AxisList(new TextAxis("FOOBAR2", "badluck"));
   project.setScm(new ToxSCM("tox.ini", "[testenv]\ncommand = echo"));
   project.setAxes(axes);
   project.getBuildersList().add(builder);
   MatrixBuild build = project.scheduleBuild2(0).get();
   List<MatrixRun> runs = build.getRuns();
   assertEquals(1, runs.size());
   MatrixRun run = runs.get(0);
   String log = FileUtils.readFileToString(run.getLogFile());
   System.out.println(log);
   assertTrue(
       "should not be able to run with a blank TOXENV pattern:\n" + log,
       log.contains(Messages.ToxBuilder_ToxenvPattern_Invalid("$FOOBAR")));
 }
예제 #5
0
 public void testToxAxisAndToxenvPattern() throws Exception {
   configureCPython2();
   ToxBuilder builder = new ToxBuilder("tox.ini", false, "$INTERPRETER$VERSION");
   MatrixProject project = createMatrixProject();
   AxisList axes =
       new AxisList(
           new ToxAxis(new String[] {"py27"}),
           new TextAxis("INTERPRETER", "py"),
           new TextAxis("VERSION", "27"));
   project.setScm(new ToxSCM("tox.ini", "[testenv]\ncommand = echo"));
   project.setAxes(axes);
   project.getBuildersList().add(builder);
   MatrixBuild build = project.scheduleBuild2(0).get();
   List<MatrixRun> runs = build.getRuns();
   assertEquals(1, runs.size());
   MatrixRun run = runs.get(0);
   String log = FileUtils.readFileToString(run.getLogFile());
   System.out.println(log);
   assertTrue(
       "should not be able to run with both Tox axis and TOXENV pattern:\n" + log,
       log.contains(Messages.ToxBuilder_ToxAxis_And_ToxenvPattern()));
 }
 /*
  * (non-Javadoc)
  *
  * @see hudson.model.Descriptor#getDisplayName()
  */
 @Override
 public String getDisplayName() {
   return Messages.PythonInstallation_DisplayName();
 }