debug test suite action for Ant Projects
authorLukas Jungmann <jungi@netbeans.org>
Sun, 01 Jan 2012 18:47:55 +0100
changeset 17722d8d939eb8204
parent 17721 ab0b68a09c6d
child 17723 7b2056feb248
debug test suite action for Ant Projects
testng.ant/src/org/netbeans/modules/contrib/testng/ant/AntTestNGSupport.java
     1.1 --- a/testng.ant/src/org/netbeans/modules/contrib/testng/ant/AntTestNGSupport.java	Sun Jan 01 18:47:19 2012 +0100
     1.2 +++ b/testng.ant/src/org/netbeans/modules/contrib/testng/ant/AntTestNGSupport.java	Sun Jan 01 18:47:55 2012 +0100
     1.3 @@ -1,7 +1,7 @@
     1.4  /*
     1.5   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     1.6   *
     1.7 - * Copyright © 2008-2011 Oracle and/or its affiliates. All rights reserved.
     1.8 + * Copyright © 2008-2012 Oracle and/or its affiliates. All rights reserved.
     1.9   *
    1.10   * The contents of this file are subject to the terms of either the GNU
    1.11   * General Public License Version 2 only ("GPL") or the Common
    1.12 @@ -84,6 +84,7 @@
    1.13          s.add(Action.RUN_TESTSUITE);
    1.14          s.add(Action.DEBUG_TEST);
    1.15          s.add(Action.DEBUG_TESTMETHOD);
    1.16 +        s.add(Action.DEBUG_TESTSUITE);
    1.17          SUPPORTED_ACTIONS = Collections.unmodifiableSet(s);
    1.18      }
    1.19  
    1.20 @@ -164,22 +165,22 @@
    1.21                  FileObject failedTestsConfig = projectHome.getFileObject(failedConfPath);
    1.22                  props.put("testng.config", FileUtil.getRelativePath(projectHome, failedTestsConfig));
    1.23              } else {
    1.24 -                if (Action.RUN_TESTSUITE.equals(action)) {
    1.25 -                props.put("testng.config", FileUtil.toFile(config.getTest()).getAbsolutePath());
    1.26 +                if (Action.RUN_TESTSUITE.equals(action) || Action.DEBUG_TESTSUITE.equals(action)) {
    1.27 +                    props.put("testng.config", FileUtil.toFile(config.getTest()).getAbsolutePath());
    1.28                  } else {
    1.29 -                File f = XMLSuiteSupport.createSuiteforMethod(
    1.30 +                    File f = XMLSuiteSupport.createSuiteforMethod(
    1.31                          FileUtil.normalizeFile(new File(System.getProperty("java.io.tmpdir"))), //NOI18N
    1.32                          ProjectUtils.getInformation(p).getDisplayName(),
    1.33                          config.getPackageName(),
    1.34                          config.getClassName(),
    1.35                          config.getMethodName());
    1.36 -                f = FileUtil.normalizeFile(f);
    1.37 -                props.put("testng.config", f.getAbsolutePath());
    1.38 +                    f = FileUtil.normalizeFile(f);
    1.39 +                    props.put("testng.config", f.getAbsolutePath());
    1.40                  }
    1.41              }
    1.42              try {
    1.43                  String target = "run-testng"; //NOI18N
    1.44 -                if (Action.DEBUG_TEST.equals(action) || Action.DEBUG_TESTMETHOD.equals(action)) {
    1.45 +                if (Action.DEBUG_TEST.equals(action) || Action.DEBUG_TESTMETHOD.equals(action) || Action.DEBUG_TESTSUITE.equals(action)) {
    1.46                      target = "debug-testng"; //NOI18N
    1.47                      FileObject test = config.getTest();
    1.48                      FileObject[] testRoots = ClassPath.getClassPath(test, ClassPath.SOURCE).getRoots();
    1.49 @@ -191,8 +192,13 @@
    1.50                          }
    1.51                      }
    1.52                      assert testRoot != null;
    1.53 -                    props.put("javac.includes", //NOI18N
    1.54 +                    if (Action.DEBUG_TESTSUITE.equals(action)) {
    1.55 +                        props.put("javac.includes", //NOI18N
    1.56 +                            ActionUtils.antIncludesList(new FileObject[]{testRoot}, testRoot, true));
    1.57 +                    } else {
    1.58 +                        props.put("javac.includes", //NOI18N
    1.59                              ActionUtils.antIncludesList(new FileObject[]{test}, testRoot));
    1.60 +                    }
    1.61                  }
    1.62                  ActionUtils.runTarget(projectHome.getFileObject("build.xml"), new String[]{target}, props); //NOI18N
    1.63              } catch (IOException ex) {