1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/testng.ant/build.xml Thu May 05 17:57:16 2011 +0200
1.3 @@ -0,0 +1,5 @@
1.4 +<?xml version="1.0" encoding="UTF-8"?>
1.5 +<project basedir="." default="netbeans" name="contrib/testng.ant">
1.6 + <description>Builds, tests, and runs the project org.netbeans.modules.testng.ant</description>
1.7 + <import file="../../nbbuild/templates/projectized.xml"/>
1.8 +</project>
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/testng.ant/manifest.mf Thu May 05 17:57:16 2011 +0200
2.3 @@ -0,0 +1,6 @@
2.4 +Manifest-Version: 1.0
2.5 +AutoUpdate-Show-In-Client: true
2.6 +OpenIDE-Module: org.netbeans.modules.testng.ant
2.7 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/contrib/testng/ant/Bundle.properties
2.8 +OpenIDE-Module-Specification-Version: 1.0
2.9 +
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/testng.ant/nbproject/project.properties Thu May 05 17:57:16 2011 +0200
3.3 @@ -0,0 +1,3 @@
3.4 +is.eager=true
3.5 +javac.source=1.6
3.6 +javac.compilerargs=-Xlint -Xlint:-serial
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/testng.ant/nbproject/project.xml Thu May 05 17:57:16 2011 +0200
4.3 @@ -0,0 +1,94 @@
4.4 +<?xml version="1.0" encoding="UTF-8"?>
4.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
4.6 + <type>org.netbeans.modules.apisupport.project</type>
4.7 + <configuration>
4.8 + <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
4.9 + <code-name-base>org.netbeans.modules.testng.ant</code-name-base>
4.10 + <module-dependencies>
4.11 + <dependency>
4.12 + <code-name-base>org.apache.tools.ant.module</code-name-base>
4.13 + <build-prerequisite/>
4.14 + <compile-dependency/>
4.15 + <run-dependency>
4.16 + <release-version>3</release-version>
4.17 + <specification-version>3.39</specification-version>
4.18 + </run-dependency>
4.19 + </dependency>
4.20 + <dependency>
4.21 + <code-name-base>org.netbeans.api.java.classpath</code-name-base>
4.22 + <build-prerequisite/>
4.23 + <compile-dependency/>
4.24 + <run-dependency>
4.25 + <release-version>1</release-version>
4.26 + <specification-version>1.23</specification-version>
4.27 + </run-dependency>
4.28 + </dependency>
4.29 + <dependency>
4.30 + <code-name-base>org.netbeans.modules.project.ant</code-name-base>
4.31 + <build-prerequisite/>
4.32 + <compile-dependency/>
4.33 + <run-dependency>
4.34 + <release-version>1</release-version>
4.35 + <specification-version>1.36</specification-version>
4.36 + </run-dependency>
4.37 + </dependency>
4.38 + <dependency>
4.39 + <code-name-base>org.netbeans.modules.projectapi</code-name-base>
4.40 + <build-prerequisite/>
4.41 + <compile-dependency/>
4.42 + <run-dependency>
4.43 + <release-version>1</release-version>
4.44 + <specification-version>1.29</specification-version>
4.45 + </run-dependency>
4.46 + </dependency>
4.47 + <dependency>
4.48 + <code-name-base>org.netbeans.modules.testng</code-name-base>
4.49 + <build-prerequisite/>
4.50 + <compile-dependency/>
4.51 + <run-dependency>
4.52 + <specification-version>1.6</specification-version>
4.53 + </run-dependency>
4.54 + </dependency>
4.55 + <dependency>
4.56 + <code-name-base>org.openide.execution</code-name-base>
4.57 + <build-prerequisite/>
4.58 + <compile-dependency/>
4.59 + <run-dependency>
4.60 + <specification-version>1.17</specification-version>
4.61 + </run-dependency>
4.62 + </dependency>
4.63 + <dependency>
4.64 + <code-name-base>org.openide.filesystems</code-name-base>
4.65 + <build-prerequisite/>
4.66 + <compile-dependency/>
4.67 + <run-dependency>
4.68 + <specification-version>7.35</specification-version>
4.69 + </run-dependency>
4.70 + </dependency>
4.71 + <dependency>
4.72 + <code-name-base>org.openide.util.lookup</code-name-base>
4.73 + <build-prerequisite/>
4.74 + <compile-dependency/>
4.75 + <run-dependency>
4.76 + <specification-version>8.1</specification-version>
4.77 + </run-dependency>
4.78 + </dependency>
4.79 + </module-dependencies>
4.80 + <test-dependencies>
4.81 + <test-type>
4.82 + <name>unit</name>
4.83 + <test-dependency>
4.84 + <code-name-base>org.netbeans.libs.junit4</code-name-base>
4.85 + <compile-dependency/>
4.86 + </test-dependency>
4.87 + <test-dependency>
4.88 + <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
4.89 + <recursive/>
4.90 + <compile-dependency/>
4.91 + </test-dependency>
4.92 + </test-type>
4.93 + </test-dependencies>
4.94 + <public-packages/>
4.95 + </data>
4.96 + </configuration>
4.97 +</project>
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/testng.ant/src/org/netbeans/modules/contrib/testng/ant/AntTestNGSupport.java Thu May 05 17:57:16 2011 +0200
5.3 @@ -0,0 +1,201 @@
5.4 +/*
5.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5.6 + *
5.7 + * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
5.8 + *
5.9 + * The contents of this file are subject to the terms of either the GNU
5.10 + * General Public License Version 2 only ("GPL") or the Common
5.11 + * Development and Distribution License("CDDL") (collectively, the
5.12 + * "License"). You may not use this file except in compliance with the
5.13 + * License. You can obtain a copy of the License at
5.14 + * http://www.netbeans.org/cddl-gplv2.html
5.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
5.16 + * specific language governing permissions and limitations under the
5.17 + * License. When distributing the software, include this License Header
5.18 + * Notice in each file and include the License file at
5.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
5.20 + * particular file as subject to the "Classpath" exception as provided
5.21 + * by Sun in the GPL Version 2 section of the License file that
5.22 + * accompanied this code. If applicable, add the following below the
5.23 + * License Header, with the fields enclosed by brackets [] replaced by
5.24 + * your own identifying information:
5.25 + * "Portions Copyrighted [year] [name of copyright owner]"
5.26 + *
5.27 + * If you wish your version of this file to be governed by only the CDDL
5.28 + * or only the GPL Version 2, indicate your decision by adding
5.29 + * "[Contributor] elects to include this software in this distribution
5.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
5.31 + * single choice of license, a recipient has the option to distribute
5.32 + * your version of this file under either the CDDL, the GPL Version 2 or
5.33 + * to extend the choice of license to its licensees as provided above.
5.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
5.35 + * Version 2 license, then the option applies only if the new code is
5.36 + * made subject to such option by the copyright holder.
5.37 + *
5.38 + * Contributor(s):
5.39 + *
5.40 + * Portions Copyrighted 2008 Sun Microsystems, Inc.
5.41 + */
5.42 +package org.netbeans.modules.contrib.testng.ant;
5.43 +
5.44 +import java.io.File;
5.45 +import java.io.IOException;
5.46 +import java.io.InputStream;
5.47 +import java.io.OutputStream;
5.48 +import java.util.Collections;
5.49 +import java.util.HashSet;
5.50 +import java.util.Properties;
5.51 +import java.util.Set;
5.52 +import java.util.logging.Level;
5.53 +import java.util.logging.Logger;
5.54 +import org.apache.tools.ant.module.api.support.ActionUtils;
5.55 +import org.netbeans.api.java.classpath.ClassPath;
5.56 +import org.netbeans.api.project.FileOwnerQuery;
5.57 +import org.netbeans.api.project.Project;
5.58 +import org.netbeans.api.project.ProjectManager;
5.59 +import org.netbeans.api.project.ProjectUtils;
5.60 +import org.netbeans.api.project.ant.AntBuildExtender;
5.61 +import org.netbeans.api.project.ant.AntBuildExtender.Extension;
5.62 +import org.netbeans.modules.contrib.testng.api.TestNGSupport.Action;
5.63 +import org.netbeans.modules.contrib.testng.spi.TestConfig;
5.64 +import org.netbeans.modules.contrib.testng.spi.TestNGSupportImplementation;
5.65 +import org.netbeans.modules.contrib.testng.spi.XMLSuiteSupport;
5.66 +import org.netbeans.spi.project.ant.AntArtifactProvider;
5.67 +import org.openide.filesystems.FileLock;
5.68 +import org.openide.filesystems.FileObject;
5.69 +import org.openide.filesystems.FileUtil;
5.70 +import org.openide.util.lookup.ServiceProvider;
5.71 +
5.72 +/**
5.73 + *
5.74 + * @author lukas
5.75 + */
5.76 +@ServiceProvider(service=TestNGSupportImplementation.class)
5.77 +public class AntTestNGSupport extends TestNGSupportImplementation {
5.78 +
5.79 + private static final Logger LOGGER = Logger.getLogger(AntTestNGSupport.class.getName());
5.80 + private static final Set<Action> SUPPORTED_ACTIONS;
5.81 +
5.82 + static {
5.83 + Set<Action> s = new HashSet<Action>();
5.84 + s.add(Action.CREATE_TEST);
5.85 + s.add(Action.RUN_FAILED);
5.86 + s.add(Action.RUN_TEST);
5.87 + s.add(Action.RUN_TESTMETHOD);
5.88 + s.add(Action.DEBUG_TEST);
5.89 + s.add(Action.DEBUG_TESTMETHOD);
5.90 + SUPPORTED_ACTIONS = Collections.unmodifiableSet(s);
5.91 + }
5.92 +
5.93 + @Override
5.94 + public boolean isActionSupported(Action action, Project p) {
5.95 + return p != null && p.getLookup().lookup(AntArtifactProvider.class) != null && SUPPORTED_ACTIONS.contains(action);
5.96 + }
5.97 +
5.98 + @Override
5.99 + public void configureProject(FileObject createdFile) {
5.100 + try {
5.101 + addLibrary(createdFile);
5.102 + } catch (IOException ex) {
5.103 + LOGGER.log(Level.SEVERE, null, ex);
5.104 + }
5.105 + Project p = FileOwnerQuery.getOwner(createdFile);
5.106 + AntBuildExtender extender = p.getLookup().lookup(AntBuildExtender.class);
5.107 + if (extender != null) {
5.108 + String ID = "test-ng-1.0"; //NOI18N
5.109 + Extension extension = extender.getExtension(ID);
5.110 + if (extension == null) {
5.111 + LOGGER.log(Level.FINER, "Extensible targets: {0}", extender.getExtensibleTargets());
5.112 + try {
5.113 + // create testng-build.xml
5.114 + FileObject testng = p.getProjectDirectory().getFileObject("nbproject").createData("testng-impl", "xml"); //NOI18N
5.115 + InputStream is = AntTestNGSupport.class.getResourceAsStream("testng-build.xml"); //NOI18N
5.116 + FileLock lock = testng.lock();
5.117 + OutputStream os = testng.getOutputStream(lock);
5.118 + try {
5.119 + FileUtil.copy(is, os);
5.120 + } finally {
5.121 + if (is != null) {
5.122 + is.close();
5.123 + }
5.124 + if (os != null) {
5.125 + os.close();
5.126 + }
5.127 + lock.releaseLock();
5.128 + }
5.129 + extension = extender.addExtension(ID, testng);
5.130 + extension.addDependency("-pre-pre-compile", "-reinit-tasks"); //NOI18N
5.131 + ProjectManager.getDefault().saveProject(p);
5.132 + } catch (IOException ex) {
5.133 + LOGGER.log(Level.SEVERE, null, ex);
5.134 + }
5.135 + }
5.136 + }
5.137 + }
5.138 +
5.139 + @Override
5.140 + public TestExecutor createExecutor(Project p) {
5.141 + return new AntExecutor(p);
5.142 + }
5.143 +
5.144 + private static class AntExecutor implements TestNGSupportImplementation.TestExecutor {
5.145 +
5.146 + private static final String failedConfPath = "build/test/results/testng-failed.xml"; //NOI18N
5.147 + private Project p;
5.148 +
5.149 + public AntExecutor(Project p) {
5.150 + this.p = p;
5.151 + }
5.152 +
5.153 + @Override
5.154 + public boolean hasFailedTests() {
5.155 + FileObject projectHome = p.getProjectDirectory();
5.156 + //XXX - should rather listen on a fileobject??
5.157 + FileUtil.refreshFor(FileUtil.toFile(projectHome));
5.158 + FileObject failedTestsConfig = projectHome.getFileObject(failedConfPath);
5.159 + return failedTestsConfig != null && failedTestsConfig.isValid();
5.160 + }
5.161 +
5.162 + @Override
5.163 + public void execute(Action action, TestConfig config) throws IOException {
5.164 + FileObject projectHome = p.getProjectDirectory();
5.165 + Properties props = new Properties();
5.166 + if (config.doRerun()) {
5.167 + FileObject failedTestsConfig = projectHome.getFileObject(failedConfPath);
5.168 + props.put("testng.config", FileUtil.getRelativePath(projectHome, failedTestsConfig));
5.169 + } else {
5.170 + File f = XMLSuiteSupport.createSuiteforMethod(
5.171 + FileUtil.normalizeFile(new File(System.getProperty("java.io.tmpdir"))), //NOI18N
5.172 + ProjectUtils.getInformation(p).getDisplayName(),
5.173 + config.getPackageName(),
5.174 + config.getClassName(),
5.175 + config.getMethodName());
5.176 + f = FileUtil.normalizeFile(f);
5.177 + props.put("testng.config", f.getAbsolutePath());
5.178 + }
5.179 + try {
5.180 + String target = "run-testng"; //NOI18N
5.181 + if (Action.DEBUG_TEST.equals(action) || Action.DEBUG_TESTMETHOD.equals(action)) {
5.182 + target = "debug-testng"; //NOI18N
5.183 + FileObject test = config.getTest();
5.184 + FileObject[] testRoots = ClassPath.getClassPath(test, ClassPath.SOURCE).getRoots();
5.185 + FileObject testRoot = null;
5.186 + for (FileObject root : testRoots) {
5.187 + if (FileUtil.isParentOf(root, test)) {
5.188 + testRoot = root;
5.189 + break;
5.190 + }
5.191 + }
5.192 + assert testRoot != null;
5.193 + props.put("javac.includes", //NOI18N
5.194 + ActionUtils.antIncludesList(new FileObject[]{test}, testRoot));
5.195 + }
5.196 + ActionUtils.runTarget(projectHome.getFileObject("build.xml"), new String[]{target}, props); //NOI18N
5.197 + } catch (IOException ex) {
5.198 + LOGGER.log(Level.SEVERE, null, ex);
5.199 + } catch (IllegalArgumentException ex) {
5.200 + LOGGER.log(Level.SEVERE, null, ex);
5.201 + }
5.202 + }
5.203 + }
5.204 +}
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/testng.ant/src/org/netbeans/modules/contrib/testng/ant/Bundle.properties Thu May 05 17:57:16 2011 +0200
6.3 @@ -0,0 +1,2 @@
6.4 +OpenIDE-Module-Display-Category=Testing Tools
6.5 +OpenIDE-Module-Name=Ant TestNG support
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/testng.ant/src/org/netbeans/modules/contrib/testng/ant/testng-build.xml Thu May 05 17:57:16 2011 +0200
7.3 @@ -0,0 +1,383 @@
7.4 +<?xml version="1.0" encoding="UTF-8"?>
7.5 +<!--
7.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
7.7 +
7.8 +Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
7.9 +
7.10 +
7.11 +The contents of this file are subject to the terms of either the GNU
7.12 +General Public License Version 2 only ("GPL") or the Common
7.13 +Development and Distribution License("CDDL") (collectively, the
7.14 +"License"). You may not use this file except in compliance with the
7.15 +License. You can obtain a copy of the License at
7.16 +http://www.netbeans.org/cddl-gplv2.html
7.17 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
7.18 +specific language governing permissions and limitations under the
7.19 +License. When distributing the software, include this License Header
7.20 +Notice in each file and include the License file at
7.21 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
7.22 +particular file as subject to the "Classpath" exception as provided
7.23 +by Sun in the GPL Version 2 section of the License file that
7.24 +accompanied this code. If applicable, add the following below the
7.25 +License Header, with the fields enclosed by brackets [] replaced by
7.26 +your own identifying information:
7.27 +"Portions Copyrighted [year] [name of copyright owner]"
7.28 +
7.29 +Contributor(s):
7.30 +
7.31 +The Original Software is NetBeans. The Initial Developer of the Original
7.32 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2008 Sun
7.33 +Microsystems, Inc. All Rights Reserved.
7.34 +
7.35 +If you wish your version of this file to be governed by only the CDDL
7.36 +or only the GPL Version 2, indicate your decision by adding
7.37 +"[Contributor] elects to include this software in this distribution
7.38 +under the [CDDL or GPL Version 2] license." If you do not indicate a
7.39 +single choice of license, a recipient has the option to distribute
7.40 +your version of this file under either the CDDL, the GPL Version 2 or
7.41 +to extend the choice of license to its licensees as provided above.
7.42 +However, if you add GPL Version 2 code and therefore, elected the GPL
7.43 +Version 2 license, then the option applies only if the new code is
7.44 +made subject to such option by the copyright holder.
7.45 +-->
7.46 +<project name="testng-impl" default="default" basedir="..">
7.47 + <target name="default">
7.48 + <echo message="Default target is not set."/>
7.49 + </target>
7.50 +
7.51 + <target name="-init-env">
7.52 + <condition property="run.jvmargs.prop" value="${run.jvmargs}" else="">
7.53 + <isset property="run.jvmargs"/>
7.54 + </condition>
7.55 + </target>
7.56 +
7.57 + <!-- Call testng ant task -->
7.58 + <target name="-init-macrodef-testng">
7.59 + <macrodef name="testng-ant">
7.60 + <attribute name="testincludes" default="**/*Test.class"/>
7.61 + <sequential>
7.62 + <taskdef name="testng" classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}"/>
7.63 + <testng workingDir="${basedir}" failureProperty="testng.tests.failed" outputdir="${build.test.results.dir}" dumpCommand="true" useDefaultListeners="true" verbose="2">
7.64 + <classpath>
7.65 + <pathelement path="${run.test.classpath}"/>
7.66 + <pathelement path="${j2ee.platform.classpath}"/>
7.67 + <pathelement path="${build.test.classes.dir}"/>
7.68 + </classpath>
7.69 + <classfileset dir="${build.test.classes.dir}">
7.70 + <filename name="@{testincludes}"/>
7.71 + </classfileset>
7.72 + <jvmarg line="${run.jvmargs.prop}"/>
7.73 + </testng>
7.74 + </sequential>
7.75 + </macrodef>
7.76 + <macrodef name="testng-ant-xml">
7.77 + <attribute name="testSuite" default="${build.dir}/generated/testng/temp-testng-customsuite.xml"/>
7.78 + <sequential>
7.79 + <taskdef name="testng" classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}"/>
7.80 + <testng workingDir="${basedir}" failureProperty="testng.tests.failed" outputdir="${build.test.results.dir}" dumpCommand="true" useDefaultListeners="true" verbose="2">
7.81 + <classpath>
7.82 + <pathelement path="${run.test.classpath}"/>
7.83 + <pathelement path="${j2ee.platform.classpath}"/>
7.84 + <pathelement path="${build.test.classes.dir}"/>
7.85 + </classpath>
7.86 + <xmlfileset file="@{testSuite}"/>
7.87 + <jvmarg line="${run.jvmargs.prop}"/>
7.88 + </testng>
7.89 + </sequential>
7.90 + </macrodef>
7.91 + </target>
7.92 +
7.93 + <target name="-testng" unless="junit.enabled">
7.94 + <!-- Java SE projects -->
7.95 + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
7.96 + <attribute default="${includes}" name="includes"/>
7.97 + <attribute default="${excludes}" name="excludes"/>
7.98 + <attribute default="**" name="testincludes"/>
7.99 + <sequential>
7.100 + <testng-ant/>
7.101 + <condition property="tests.failed">
7.102 + <and>
7.103 + <isset property="testng.tests.failed"/>
7.104 + </and>
7.105 + </condition>
7.106 + </sequential>
7.107 + </macrodef>
7.108 +
7.109 + <!-- Web Projects -->
7.110 + <macrodef name="junit" uri="http://www.netbeans.org/ns/web-project/2">
7.111 + <attribute default="${includes}" name="includes"/>
7.112 + <attribute default="${excludes}" name="excludes"/>
7.113 + <attribute default="**" name="testincludes"/>
7.114 + <sequential>
7.115 + <testng-ant/>
7.116 + <condition property="tests.failed">
7.117 + <and>
7.118 + <isset property="testng.tests.failed"/>
7.119 + </and>
7.120 + </condition>
7.121 + </sequential>
7.122 + </macrodef>
7.123 +
7.124 + <!-- EJB Projects -->
7.125 + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2ee-ejbjarproject/2">
7.126 + <attribute default="${includes}" name="includes"/>
7.127 + <attribute default="${excludes}" name="excludes"/>
7.128 + <attribute default="**" name="testincludes"/>
7.129 + <sequential>
7.130 + <testng-ant/>
7.131 + <condition property="tests.failed">
7.132 + <and>
7.133 + <isset property="testng.tests.failed"/>
7.134 + </and>
7.135 + </condition>
7.136 + </sequential>
7.137 + </macrodef>
7.138 +
7.139 + <!-- Java EE application client projects -->
7.140 + <macrodef name="junit" uri="http://www.netbeans.org/ns/car-project/1">
7.141 + <attribute default="${includes}" name="includes"/>
7.142 + <attribute default="${excludes}" name="excludes"/>
7.143 + <attribute default="**" name="testincludes"/>
7.144 + <sequential>
7.145 + <testng-ant/>
7.146 + <condition property="tests.failed">
7.147 + <and>
7.148 + <isset property="testng.tests.failed"/>
7.149 + </and>
7.150 + </condition>
7.151 + </sequential>
7.152 + </macrodef>
7.153 + </target>
7.154 +
7.155 + <target name="-testng-junit" if="junit.enabled">
7.156 + <!-- Java SE projects -->
7.157 + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
7.158 + <attribute default="${includes}" name="includes"/>
7.159 + <attribute default="${excludes}" name="excludes"/>
7.160 + <attribute default="**" name="testincludes"/>
7.161 + <sequential>
7.162 + <junit dir="${basedir}" errorproperty="junit.tests.failed" failureproperty="junit.tests.failed" fork="true" showoutput="true">
7.163 + <batchtest todir="${build.test.results.dir}">
7.164 + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
7.165 + <filename name="@{testincludes}"/>
7.166 + </fileset>
7.167 + </batchtest>
7.168 + <classpath>
7.169 + <path path="${run.test.classpath}"/>
7.170 + </classpath>
7.171 + <syspropertyset>
7.172 + <propertyref prefix="test-sys-prop."/>
7.173 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
7.174 + </syspropertyset>
7.175 + <formatter type="brief" usefile="false"/>
7.176 + <formatter type="xml"/>
7.177 + <jvmarg line="${run.jvmargs.prop}"/>
7.178 + </junit>
7.179 + <testng-ant/>
7.180 + <condition property="tests.failed">
7.181 + <and>
7.182 + <isset property="junit.tests.failed"/>
7.183 + <isset property="testng.tests.failed"/>
7.184 + </and>
7.185 + </condition>
7.186 + </sequential>
7.187 + </macrodef>
7.188 +
7.189 + <!-- Web Projects -->
7.190 + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2ee-ejbjarproject/2">
7.191 + <attribute default="${includes}" name="includes"/>
7.192 + <attribute default="${excludes}" name="excludes"/>
7.193 + <attribute default="**" name="testincludes"/>
7.194 + <sequential>
7.195 + <junit dir="${basedir}" errorproperty="junit.tests.failed" failureproperty="junit.tests.failed" fork="true" showoutput="true">
7.196 + <batchtest todir="${build.test.results.dir}">
7.197 + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
7.198 + <filename name="@{testincludes}"/>
7.199 + </fileset>
7.200 + </batchtest>
7.201 + <classpath>
7.202 + <path path="${run.test.classpath}:${j2ee.platform.classpath}"/>
7.203 + </classpath>
7.204 + <syspropertyset>
7.205 + <propertyref prefix="test-sys-prop."/>
7.206 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
7.207 + </syspropertyset>
7.208 + <formatter type="brief" usefile="false"/>
7.209 + <formatter type="xml"/>
7.210 + <jvmarg line="${runmain.jvmargs}"/>
7.211 + </junit>
7.212 + <testng-ant/>
7.213 + <condition property="tests.failed">
7.214 + <and>
7.215 + <isset property="junit.tests.failed"/>
7.216 + <isset property="testng.tests.failed"/>
7.217 + </and>
7.218 + </condition>
7.219 + </sequential>
7.220 + </macrodef>
7.221 +
7.222 + <!-- EJB projects -->
7.223 + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2ee-ejbjarproject/2">
7.224 + <attribute default="${includes}" name="includes"/>
7.225 + <attribute default="${excludes}" name="excludes"/>
7.226 + <attribute default="**" name="testincludes"/>
7.227 + <sequential>
7.228 + <junit dir="${basedir}" errorproperty="junit.tests.failed" failureproperty="junit.tests.failed" fork="true" showoutput="true">
7.229 + <batchtest todir="${build.test.results.dir}">
7.230 + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
7.231 + <filename name="@{testincludes}"/>
7.232 + </fileset>
7.233 + </batchtest>
7.234 + <classpath>
7.235 + <path path="${run.test.classpath}"/>
7.236 + <path path="${j2ee.platform.classpath}"/>
7.237 + </classpath>
7.238 + <syspropertyset>
7.239 + <propertyref prefix="test-sys-prop."/>
7.240 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
7.241 + </syspropertyset>
7.242 + <formatter type="brief" usefile="false"/>
7.243 + <formatter type="xml"/>
7.244 + <jvmarg line="${runmain.jvmargs}"/>
7.245 + </junit>
7.246 + <testng-ant/>
7.247 + <condition property="tests.failed">
7.248 + <and>
7.249 + <isset property="junit.tests.failed"/>
7.250 + <isset property="testng.tests.failed"/>
7.251 + </and>
7.252 + </condition>
7.253 + </sequential>
7.254 + </macrodef>
7.255 +
7.256 + <!-- Java EE application client projects -->
7.257 + <macrodef name="junit" uri="http://www.netbeans.org/ns/car-project/1">
7.258 + <attribute default="${includes}" name="includes"/>
7.259 + <attribute default="${excludes}" name="excludes"/>
7.260 + <attribute default="**" name="testincludes"/>
7.261 + <sequential>
7.262 + <junit dir="${basedir}" errorproperty="junit.tests.failed" failureproperty="junit.tests.failed" fork="true" showoutput="true">
7.263 + <batchtest todir="${build.test.results.dir}">
7.264 + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
7.265 + <filename name="@{testincludes}"/>
7.266 + </fileset>
7.267 + </batchtest>
7.268 + <classpath>
7.269 + <path path="${run.test.classpath}"/>
7.270 + <path path="${j2ee.platform.classpath}"/>
7.271 + </classpath>
7.272 + <syspropertyset>
7.273 + <propertyref prefix="test-sys-prop."/>
7.274 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
7.275 + </syspropertyset>
7.276 + <formatter type="brief" usefile="false"/>
7.277 + <formatter type="xml"/>
7.278 + <jvmarg line="${run.jvmargs.param}"/>
7.279 + </junit>
7.280 + <testng-ant/>
7.281 + <condition property="tests.failed">
7.282 + <and>
7.283 + <isset property="junit.tests.failed"/>
7.284 + <isset property="testng.tests.failed"/>
7.285 + </and>
7.286 + </condition>
7.287 + </sequential>
7.288 + </macrodef>
7.289 + </target>
7.290 +
7.291 + <target name="-reinit-tasks" depends="-init-env, -init-macrodef-testng, -testng, -testng-junit" />
7.292 +
7.293 + <target name="-run-testng-default" unless="testng.config">
7.294 + <testng-ant/>
7.295 + </target>
7.296 +
7.297 + <target name="-run-testng-custom" if="testng.config">
7.298 + <testng-ant-xml testSuite="${testng.config}"/>
7.299 + </target>
7.300 +
7.301 + <target name="run-testng" depends="compile-test, -init-macrodef-testng, -run-testng-default, -run-testng-custom"/>
7.302 +
7.303 + <!-- Call testng from java -->
7.304 + <target name="-init-macrodef-testng-java">
7.305 + <macrodef name="testng-java">
7.306 + <sequential>
7.307 + <pathconvert property="testng.classnames" pathsep=" ">
7.308 + <path>
7.309 + <fileset dir="${build.test.classes.dir}" includes="**/*.class"/>
7.310 + </path>
7.311 + <map from="${basedir}${file.separator}" to="-testclass "/>
7.312 + </pathconvert>
7.313 + <java classname="org.testng.TestNG" dir="${basedir}">
7.314 + <classpath>
7.315 + <path path="${run.test.classpath}:${j2ee.platform.classpath}"/>
7.316 + </classpath>
7.317 + <arg line="-d ${build.test.results.dir}"/>
7.318 + <arg line="-sourcedir ${test.src.dir}"/>
7.319 + <arg line="-log 2"/>
7.320 + <arg line="${testng.classnames}"/>
7.321 + <syspropertyset>
7.322 + <propertyref prefix="test-sys-prop."/>
7.323 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
7.324 + </syspropertyset>
7.325 + <jvmarg value="-Dtestng.test.classpath=${build.test.classes.dir}"/>
7.326 + <jvmarg value="-ea"/>
7.327 + <jvmarg line="${run.jvmargs.prop}"/>
7.328 + </java>
7.329 + </sequential>
7.330 + </macrodef>
7.331 + </target>
7.332 +
7.333 + <target name="-init-macrodef-testng-java-xml">
7.334 + <macrodef name="testng-java-xml">
7.335 + <attribute name="testSuite" default="${build.dir}/generated/testng/temp-testng-customsuite.xml"/>
7.336 + <sequential>
7.337 + <java classname="org.testng.TestNG" dir="${basedir}">
7.338 + <classpath>
7.339 + <path path="${run.test.classpath}:${j2ee.platform.classpath}"/>
7.340 + </classpath>
7.341 + <arg line="-d ${build.test.results.dir}"/>
7.342 + <arg line="-sourcedir ${test.src.dir}"/>
7.343 + <arg line="@{testSuite}"/>
7.344 + <syspropertyset>
7.345 + <propertyref prefix="test-sys-prop."/>
7.346 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
7.347 + </syspropertyset>
7.348 + <jvmarg value="-Dtestng.test.classpath=${build.test.classes.dir}"/>
7.349 + <jvmarg value="-ea"/>
7.350 + <jvmarg line="${run.jvmargs.prop}"/>
7.351 + </java>
7.352 + </sequential>
7.353 + </macrodef>
7.354 + </target>
7.355 +
7.356 + <!-- DEBUG -->
7.357 + <target depends="-init-env, init, compile-test-single, -debug-start-debugger-test, -debug-start-debuggee-testng" name="debug-testng"/>
7.358 +
7.359 + <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-testng">
7.360 + <fail unless="testng.config">Must select test class in the IDE or set testng.config</fail>
7.361 + <delete dir="${build.test.results.dir}" quiet="true"/>
7.362 + <mkdir dir="${build.test.results.dir}"/>
7.363 + <java classname="org.testng.TestNG" dir="${basedir}" fork="true">
7.364 + <jvmarg line="${debug-args-line}"/>
7.365 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
7.366 + <jvmarg line="${run.jvmargs.prop}"/>
7.367 + <arg line="-d ${build.test.results.dir}"/>
7.368 + <arg line="-sourcedir ${test.src.dir}"/>
7.369 + <arg line="${testng.config}"/>
7.370 + <syspropertyset>
7.371 + <propertyref prefix="test-sys-prop."/>
7.372 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
7.373 + </syspropertyset>
7.374 + <jvmarg value="-Dtestng.test.classpath=${build.test.classes.dir}"/>
7.375 + <jvmarg value="-ea"/>
7.376 + <classpath>
7.377 + <path path="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}:${j2ee.platform.classpath}"/>
7.378 + </classpath>
7.379 + <syspropertyset>
7.380 + <propertyref prefix="run-sys-prop."/>
7.381 + <mapper from="run-sys-prop.*" to="*" type="glob"/>
7.382 + </syspropertyset>
7.383 + </java>
7.384 + </target>
7.385 +
7.386 +</project>
8.1 --- a/testng.maven/manifest.mf Thu May 05 11:28:45 2011 -0400
8.2 +++ b/testng.maven/manifest.mf Thu May 05 17:57:16 2011 +0200
8.3 @@ -2,5 +2,5 @@
8.4 AutoUpdate-Show-In-Client: true
8.5 OpenIDE-Module: org.netbeans.modules.testng.maven
8.6 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/contrib/testng/maven/Bundle.properties
8.7 -OpenIDE-Module-Specification-Version: 1.3
8.8 +OpenIDE-Module-Specification-Version: 1.6
8.9
9.1 --- a/testng.maven/nbproject/project.xml Thu May 05 11:28:45 2011 -0400
9.2 +++ b/testng.maven/nbproject/project.xml Thu May 05 17:57:16 2011 +0200
9.3 @@ -47,15 +47,6 @@
9.4 <code-name-base>org.netbeans.modules.testng.maven</code-name-base>
9.5 <module-dependencies>
9.6 <dependency>
9.7 - <code-name-base>org.netbeans.modules.java.project</code-name-base>
9.8 - <build-prerequisite/>
9.9 - <compile-dependency/>
9.10 - <run-dependency>
9.11 - <release-version>1</release-version>
9.12 - <specification-version>1.22</specification-version>
9.13 - </run-dependency>
9.14 - </dependency>
9.15 - <dependency>
9.16 <code-name-base>org.netbeans.modules.maven</code-name-base>
9.17 <build-prerequisite/>
9.18 <compile-dependency/>
9.19 @@ -87,7 +78,7 @@
9.20 <build-prerequisite/>
9.21 <compile-dependency/>
9.22 <run-dependency>
9.23 - <specification-version>1.1</specification-version>
9.24 + <specification-version>1.6</specification-version>
9.25 </run-dependency>
9.26 </dependency>
9.27 <dependency>
9.28 @@ -104,7 +95,7 @@
9.29 <build-prerequisite/>
9.30 <compile-dependency/>
9.31 <run-dependency>
9.32 - <specification-version>1.13</specification-version>
9.33 + <specification-version>1.17</specification-version>
9.34 </run-dependency>
9.35 </dependency>
9.36 <dependency>
9.37 @@ -112,15 +103,7 @@
9.38 <build-prerequisite/>
9.39 <compile-dependency/>
9.40 <run-dependency>
9.41 - <specification-version>7.13</specification-version>
9.42 - </run-dependency>
9.43 - </dependency>
9.44 - <dependency>
9.45 - <code-name-base>org.openide.util</code-name-base>
9.46 - <build-prerequisite/>
9.47 - <compile-dependency/>
9.48 - <run-dependency>
9.49 - <specification-version>8.0</specification-version>
9.50 + <specification-version>7.35</specification-version>
9.51 </run-dependency>
9.52 </dependency>
9.53 <dependency>
9.54 @@ -128,7 +111,7 @@
9.55 <build-prerequisite/>
9.56 <compile-dependency/>
9.57 <run-dependency>
9.58 - <specification-version>8.0</specification-version>
9.59 + <specification-version>8.1</specification-version>
9.60 </run-dependency>
9.61 </dependency>
9.62 </module-dependencies>
10.1 --- a/testng.maven/src/org/netbeans/modules/contrib/testng/maven/MavenModelUtils.java Thu May 05 11:28:45 2011 -0400
10.2 +++ b/testng.maven/src/org/netbeans/modules/contrib/testng/maven/MavenModelUtils.java Thu May 05 17:57:16 2011 +0200
10.3 @@ -113,7 +113,7 @@
10.4 Plugin plug = model.getFactory().createPlugin();
10.5 plug.setGroupId(Constants.GROUP_APACHE_PLUGINS);
10.6 plug.setArtifactId(Constants.PLUGIN_SUREFIRE);
10.7 - plug.setVersion("2.4.2"); //NOI18N
10.8 + plug.setVersion("2.8.1"); //NOI18N
10.9 Configuration conf = model.getFactory().createConfiguration();
10.10 POMExtensibilityElement suite = model.getFactory().createPOMExtensibilityElement(
10.11 POMQName.createQName("suiteXmlFiles", model.getPOMQNames().isNSAware()));//NOI18N
11.1 --- a/testng.maven/src/org/netbeans/modules/contrib/testng/maven/testngActionMappings.xml Thu May 05 11:28:45 2011 -0400
11.2 +++ b/testng.maven/src/org/netbeans/modules/contrib/testng/maven/testngActionMappings.xml Thu May 05 17:57:16 2011 +0200
11.3 @@ -49,7 +49,7 @@
11.4 </packagings>
11.5 <goals>
11.6 <goal>test-compile</goal>
11.7 - <goal>org.apache.maven.plugins:maven-surefire-plugin:2.4.2:test</goal>
11.8 + <goal>surefire:test</goal>
11.9 </goals>
11.10 </action>
11.11 </actions>
11.12 \ No newline at end of file
12.1 --- a/testng/external/binaries-list Thu May 05 11:28:45 2011 -0400
12.2 +++ b/testng/external/binaries-list Thu May 05 17:57:16 2011 +0200
12.3 @@ -1,2 +1,2 @@
12.4 -2F9C9B4E6C46B58E0788E5E610FCC105C2D83A6C testng-5.11-jdk15.jar
12.5 -B80AF8A407F20189D3752ACDF99258C73C842D01 TestNG-5.11.zip
12.6 +C0D2C5513D1F44E888E6E32C23848ACB6BB12D06 testng-6.0.1.jar
12.7 +289C5BBB7CB35A49F6695779F2067AFA6937A5D4 testng-6.0.1-javadoc.jar
13.1 --- a/testng/manifest.mf Thu May 05 11:28:45 2011 -0400
13.2 +++ b/testng/manifest.mf Thu May 05 17:57:16 2011 +0200
13.3 @@ -1,6 +1,7 @@
13.4 Manifest-Version: 1.0
13.5 +AutoUpdate-Show-In-Client: false
13.6 OpenIDE-Module: org.netbeans.modules.testng
13.7 OpenIDE-Module-Layer: org/netbeans/modules/contrib/testng/resources/layer.xml
13.8 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/contrib/testng/Bundle.properties
13.9 -OpenIDE-Module-Specification-Version: 1.5
13.10 +OpenIDE-Module-Specification-Version: 1.6
13.11
14.1 --- a/testng/nbproject/project.properties Thu May 05 11:28:45 2011 -0400
14.2 +++ b/testng/nbproject/project.properties Thu May 05 17:57:16 2011 +0200
14.3 @@ -40,8 +40,9 @@
14.4 javac.compilerargs=-Xlint -Xlint:-serial
14.5 nbm.homepage=http://wiki.netbeans.org/TestNG
14.6 nbm.module.author=Lukas Jungmann
14.7 -release.external/testng-5.11-jdk15.jar=modules/ext/testng/testng-5.11-jdk15.jar
14.8 -release.external/TestNG-5.11.zip=modules/ext/testng/TestNG-5.11.zip
14.9 +release.external/testng-6.0.1.jar=modules/ext/testng/testng-6.0.1.jar
14.10 +release.external/testng-6.0.1-javadoc.jar=modules/ext/testng/testng-6.0.1-javadoc.jar
14.11 jnlp.indirect.jars=\
14.12 - modules/ext/testng/testng-5.11-jdk15.jar,\
14.13 - modules/ext/testng/TestNG-5.11.zip
14.14 + modules/ext/testng/testng-6.0.1.jar,\
14.15 + modules/ext/testng/testng-6.0.1-javadoc.jar
14.16 +is.autoload=true
15.1 --- a/testng/nbproject/project.xml Thu May 05 11:28:45 2011 -0400
15.2 +++ b/testng/nbproject/project.xml Thu May 05 17:57:16 2011 +0200
15.3 @@ -56,15 +56,6 @@
15.4 </run-dependency>
15.5 </dependency>
15.6 <dependency>
15.7 - <code-name-base>org.jdesktop.layout</code-name-base>
15.8 - <build-prerequisite/>
15.9 - <compile-dependency/>
15.10 - <run-dependency>
15.11 - <release-version>1</release-version>
15.12 - <specification-version>1.6</specification-version>
15.13 - </run-dependency>
15.14 - </dependency>
15.15 - <dependency>
15.16 <code-name-base>org.netbeans.api.java</code-name-base>
15.17 <build-prerequisite/>
15.18 <compile-dependency/>
15.19 @@ -191,7 +182,7 @@
15.20 <build-prerequisite/>
15.21 <compile-dependency/>
15.22 <run-dependency>
15.23 - <specification-version>7.2</specification-version>
15.24 + <specification-version>7.30</specification-version>
15.25 </run-dependency>
15.26 </dependency>
15.27 <dependency>
15.28 @@ -339,13 +330,14 @@
15.29 </test-type>
15.30 </test-dependencies>
15.31 <friend-packages>
15.32 + <friend>org.netbeans.modules.testng.ant</friend>
15.33 <friend>org.netbeans.modules.testng.maven</friend>
15.34 <package>org.netbeans.modules.contrib.testng.api</package>
15.35 <package>org.netbeans.modules.contrib.testng.spi</package>
15.36 </friend-packages>
15.37 <class-path-extension>
15.38 - <runtime-relative-path>ext/testng/testng-5.11-jdk15.jar</runtime-relative-path>
15.39 - <binary-origin>external/testng-5.11-jdk15.jar</binary-origin>
15.40 + <runtime-relative-path>ext/testng/testng-6.0.1.jar</runtime-relative-path>
15.41 + <binary-origin>external/testng-6.0.1.jar</binary-origin>
15.42 </class-path-extension>
15.43 </data>
15.44 </configuration>
16.1 --- a/testng/src/org/netbeans/modules/contrib/testng/Bundle.properties Thu May 05 11:28:45 2011 -0400
16.2 +++ b/testng/src/org/netbeans/modules/contrib/testng/Bundle.properties Thu May 05 17:57:16 2011 +0200
16.3 @@ -44,5 +44,5 @@
16.4 OpenIDE-Module-Short-Description=Support for TestNG framework
16.5 Templates/TestNG=TestNG
16.6 Templates/TestNG/TestNGTest.java=TestNG Test Case
16.7 -TestNG-5.8=TestNG 5.8
16.8 +TestNG=TestNG 6.0.1
16.9 NewTestVisualPanel1.jLabel1.text=Add to Suite:
17.1 --- a/testng/src/org/netbeans/modules/contrib/testng/NewTestWizardIterator.java Thu May 05 11:28:45 2011 -0400
17.2 +++ b/testng/src/org/netbeans/modules/contrib/testng/NewTestWizardIterator.java Thu May 05 17:57:16 2011 +0200
17.3 @@ -53,6 +53,7 @@
17.4 import org.netbeans.api.project.Project;
17.5 import org.netbeans.api.project.ProjectUtils;
17.6 import org.netbeans.api.project.SourceGroup;
17.7 +import org.netbeans.api.project.SourceGroupModifier;
17.8 import org.netbeans.api.project.Sources;
17.9 import org.netbeans.modules.contrib.testng.api.TestNGSupport;
17.10 import org.netbeans.spi.java.project.support.ui.templates.JavaTemplates;
17.11 @@ -83,25 +84,16 @@
17.12 // Ask for Java folders
17.13 Project project = Templates.getProject(wizardDescriptor);
17.14 Sources sources = ProjectUtils.getSources(project);
17.15 - SourceGroup[] groups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
17.16 - assert groups != null : "Cannot return null from Sources.getSourceGroups: " + sources;
17.17 -
17.18 - //XXX - have to filter out regular source roots, there should
17.19 - //be better way to do this... (Hint: use UnitTestForSourceQuery)
17.20 - //${test - Ant based projects
17.21 - //2TestSourceRoot - Maven projects
17.22 - List<SourceGroup> result = new ArrayList<SourceGroup>(2);
17.23 - for (SourceGroup sg : groups) {
17.24 - if (sg.getName().startsWith("${test") || "2TestSourceRoot".equals(sg.getName())) { //NOI18N
17.25 - result.add(sg);
17.26 + SourceGroup[] groups = getTestRoots(sources);
17.27 + if (groups.length == 0) {
17.28 + if (SourceGroupModifier.createSourceGroup(project, JavaProjectConstants.SOURCES_TYPE_JAVA, JavaProjectConstants.SOURCES_HINT_TEST) != null) {
17.29 + groups = getTestRoots(sources);
17.30 }
17.31 }
17.32 - groups = result.toArray(new SourceGroup[result.size()]);
17.33 -
17.34 if (groups.length == 0) {
17.35 groups = sources.getSourceGroups(Sources.TYPE_GENERIC);
17.36 return new WizardDescriptor.Panel[]{
17.37 - Templates.createSimpleTargetChooser(project, groups)
17.38 + Templates.buildSimpleTargetChooser(project, groups).create()
17.39 };
17.40 } else {
17.41 return new WizardDescriptor.Panel[]{
17.42 @@ -234,4 +226,21 @@
17.43 }
17.44 return packageName;
17.45 }
17.46 +
17.47 + private SourceGroup[] getTestRoots(Sources srcs) {
17.48 + SourceGroup[] groups = srcs.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
17.49 + assert groups != null : "Cannot return null from Sources.getSourceGroups: " + srcs;
17.50 +
17.51 + //XXX - have to filter out regular source roots, there should
17.52 + //be better way to do this... (Hint: use UnitTestForSourceQuery)
17.53 + //${test - Ant based projects
17.54 + //2TestSourceRoot - Maven projects
17.55 + List<SourceGroup> result = new ArrayList<SourceGroup>(2);
17.56 + for (SourceGroup sg : groups) {
17.57 + if (sg.getName().startsWith("${test") || "2TestSourceRoot".equals(sg.getName())) { //NOI18N
17.58 + result.add(sg);
17.59 + }
17.60 + }
17.61 + return result.toArray(new SourceGroup[result.size()]);
17.62 + }
17.63 }
18.1 --- a/testng/src/org/netbeans/modules/contrib/testng/actions/Bundle.properties Thu May 05 11:28:45 2011 -0400
18.2 +++ b/testng/src/org/netbeans/modules/contrib/testng/actions/Bundle.properties Thu May 05 17:57:16 2011 +0200
18.3 @@ -37,13 +37,10 @@
18.4 # Version 2 license, then the option applies only if the new code is
18.5 # made subject to such option by the copyright holder.
18.6
18.7 -CTL_ConvertAction=Convert
18.8 CTL_CreateTestAction=Create Test...
18.9 CTL_DebugTestClassAction=Debug Test Class
18.10 CTL_DebugTestMethodAction=Debug
18.11 CTL_RerunFailedTestsAction=Re-run Failed Tests
18.12 CTL_RunTestClassAction=Run Test Class
18.13 -CTL_RunTestMethodAction=Run Again
18.14 +CTL_RunTestMethodAction=Run Test Method
18.15 DummyUI.jLabel1.text=Test Name:
18.16 -MSG_Overwrite_tests=All JUnit tests will be overwritten. Do you want to continue?
18.17 -TLT_Overwrite=Overwrite tests...
19.1 --- a/testng/src/org/netbeans/modules/contrib/testng/actions/ConvertAction.java Thu May 05 11:28:45 2011 -0400
19.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
19.3 @@ -1,131 +0,0 @@
19.4 -/*
19.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
19.6 - *
19.7 - * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
19.8 - *
19.9 - * The contents of this file are subject to the terms of either the GNU
19.10 - * General Public License Version 2 only ("GPL") or the Common
19.11 - * Development and Distribution License("CDDL") (collectively, the
19.12 - * "License"). You may not use this file except in compliance with the
19.13 - * License. You can obtain a copy of the License at
19.14 - * http://www.netbeans.org/cddl-gplv2.html
19.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
19.16 - * specific language governing permissions and limitations under the
19.17 - * License. When distributing the software, include this License Header
19.18 - * Notice in each file and include the License file at
19.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
19.20 - * particular file as subject to the "Classpath" exception as provided
19.21 - * by Sun in the GPL Version 2 section of the License file that
19.22 - * accompanied this code. If applicable, add the following below the
19.23 - * License Header, with the fields enclosed by brackets [] replaced by
19.24 - * your own identifying information:
19.25 - * "Portions Copyrighted [year] [name of copyright owner]"
19.26 - *
19.27 - * If you wish your version of this file to be governed by only the CDDL
19.28 - * or only the GPL Version 2, indicate your decision by adding
19.29 - * "[Contributor] elects to include this software in this distribution
19.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
19.31 - * single choice of license, a recipient has the option to distribute
19.32 - * your version of this file under either the CDDL, the GPL Version 2 or
19.33 - * to extend the choice of license to its licensees as provided above.
19.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
19.35 - * Version 2 license, then the option applies only if the new code is
19.36 - * made subject to such option by the copyright holder.
19.37 - *
19.38 - * Contributor(s):
19.39 - *
19.40 - * Portions Copyrighted 2008 Sun Microsystems, Inc.
19.41 - */
19.42 -package org.netbeans.modules.contrib.testng.actions;
19.43 -
19.44 -import java.io.File;
19.45 -import java.io.IOException;
19.46 -import java.util.logging.Level;
19.47 -import java.util.logging.Logger;
19.48 -import org.apache.tools.ant.module.api.support.ActionUtils;
19.49 -import org.netbeans.api.project.FileOwnerQuery;
19.50 -import org.netbeans.api.project.Project;
19.51 -import org.netbeans.modules.contrib.testng.api.TestNGSupport;
19.52 -import org.netbeans.modules.contrib.testng.api.TestNGSupport.Action;
19.53 -import org.openide.DialogDisplayer;
19.54 -import org.openide.NotifyDescriptor;
19.55 -import org.openide.filesystems.FileObject;
19.56 -import org.openide.filesystems.FileUtil;
19.57 -import org.openide.loaders.DataObject;
19.58 -import org.openide.nodes.Node;
19.59 -import org.openide.util.HelpCtx;
19.60 -import org.openide.util.NbBundle;
19.61 -import org.openide.util.actions.CookieAction;
19.62 -
19.63 -public final class ConvertAction extends CookieAction {
19.64 -
19.65 - private static final Logger LOGGER = Logger.getLogger(ConvertAction.class.getName());
19.66 -
19.67 - @Override
19.68 - protected boolean enable(Node[] activatedNodes) {
19.69 - if (super.enable(activatedNodes)) {
19.70 - DataObject dataObject = activatedNodes[0].getLookup().lookup(DataObject.class);
19.71 - Project p = FileOwnerQuery.getOwner(dataObject.getPrimaryFile());
19.72 - return TestNGSupport.isActionSupported(Action.CONVERT, p);
19.73 - }
19.74 - return false;
19.75 - }
19.76 -
19.77 -
19.78 - protected void performAction(Node[] activatedNodes) {
19.79 - DataObject dataObject = activatedNodes[0].getLookup().lookup(DataObject.class);
19.80 - //XXX - should check if a file to be converted is a JUnit test here...
19.81 - NotifyDescriptor nd = new NotifyDescriptor(
19.82 - NbBundle.getMessage(ConvertAction.class, "MSG_Overwrite_tests"),
19.83 - NbBundle.getMessage(ConvertAction.class, "TLT_Overwrite"),
19.84 - NotifyDescriptor.OK_CANCEL_OPTION,
19.85 - NotifyDescriptor.WARNING_MESSAGE,
19.86 - null,
19.87 - NotifyDescriptor.OK_OPTION);
19.88 - if (NotifyDescriptor.OK_OPTION.equals(DialogDisplayer.getDefault().notify(nd))) {
19.89 - FileObject fo = dataObject.getPrimaryFile();
19.90 - TestNGSupport.findTestNGSupport(FileOwnerQuery.getOwner(fo)).configureProject(fo);
19.91 - fo = FileOwnerQuery.getOwner(fo).getProjectDirectory();
19.92 - File f = FileUtil.toFile(fo);
19.93 - try {
19.94 - ActionUtils.runTarget(
19.95 - fo.getFileObject("build.xml"),
19.96 - new String[] {"convert"},
19.97 - null);
19.98 - } catch (IOException ioe) {
19.99 - LOGGER.log(Level.SEVERE, null, ioe);
19.100 - }
19.101 - FileUtil.refreshFor(f);
19.102 - }
19.103 -
19.104 - }
19.105 -
19.106 - protected int mode() {
19.107 - return CookieAction.MODE_EXACTLY_ONE;
19.108 - }
19.109 -
19.110 - public String getName() {
19.111 - return NbBundle.getMessage(ConvertAction.class, "CTL_ConvertAction");
19.112 - }
19.113 -
19.114 - protected Class[] cookieClasses() {
19.115 - return new Class[]{DataObject.class};
19.116 - }
19.117 -
19.118 - @Override
19.119 - protected void initialize() {
19.120 - super.initialize();
19.121 - // see org.openide.util.actions.SystemAction.iconResource() Javadoc for more details
19.122 - putValue("noIconInMenu", Boolean.TRUE);
19.123 - }
19.124 -
19.125 - public HelpCtx getHelpCtx() {
19.126 - return HelpCtx.DEFAULT_HELP;
19.127 - }
19.128 -
19.129 - @Override
19.130 - protected boolean asynchronous() {
19.131 - return false;
19.132 - }
19.133 -}
19.134 -
20.1 --- a/testng/src/org/netbeans/modules/contrib/testng/actions/CreateTestAction.java Thu May 05 11:28:45 2011 -0400
20.2 +++ b/testng/src/org/netbeans/modules/contrib/testng/actions/CreateTestAction.java Thu May 05 17:57:16 2011 +0200
20.3 @@ -52,6 +52,10 @@
20.4 import org.netbeans.modules.contrib.testng.api.TestNGSupport.Action;
20.5 import org.openide.DialogDescriptor;
20.6 import org.openide.DialogDisplayer;
20.7 +import org.openide.awt.ActionID;
20.8 +import org.openide.awt.ActionReference;
20.9 +import org.openide.awt.ActionReferences;
20.10 +import org.openide.awt.ActionRegistration;
20.11 import org.openide.cookies.EditorCookie;
20.12 import org.openide.cookies.LineCookie;
20.13 import org.openide.filesystems.FileObject;
20.14 @@ -66,6 +70,11 @@
20.15 import org.openide.util.NbBundle;
20.16 import org.openide.util.actions.CookieAction;
20.17
20.18 +@ActionID(id = "org.netbeans.modules.contrib.testng.actions.CreateTestAction", category = "TestNG")
20.19 +@ActionRegistration(displayName = "#CTL_CreateTestAction")
20.20 +@ActionReferences(value = {
20.21 + @ActionReference(path = "Loaders/text/x-java/Actions", position = 2192),
20.22 + @ActionReference(path = "Editors/text/x-java/Popup/TestNG", position = 100)})
20.23 public final class CreateTestAction extends CookieAction {
20.24
20.25 private static final Logger LOGGER = Logger.getLogger(CreateTestAction.class.getName());
21.1 --- a/testng/src/org/netbeans/modules/contrib/testng/actions/DebugTestClassAction.java Thu May 05 11:28:45 2011 -0400
21.2 +++ b/testng/src/org/netbeans/modules/contrib/testng/actions/DebugTestClassAction.java Thu May 05 17:57:16 2011 +0200
21.3 @@ -49,6 +49,9 @@
21.4 import org.netbeans.modules.contrib.testng.api.TestNGSupport.Action;
21.5 import org.netbeans.modules.contrib.testng.spi.TestConfig;
21.6 import org.netbeans.modules.contrib.testng.spi.TestNGSupportImplementation.TestExecutor;
21.7 +import org.openide.awt.ActionID;
21.8 +import org.openide.awt.ActionReference;
21.9 +import org.openide.awt.ActionRegistration;
21.10 import org.openide.cookies.EditorCookie;
21.11 import org.openide.filesystems.FileObject;
21.12 import org.openide.loaders.DataObject;
21.13 @@ -62,6 +65,9 @@
21.14 *
21.15 * @author lukas
21.16 */
21.17 +@ActionID(id = "org.netbeans.modules.contrib.testng.actions.DebugTestClassAction", category = "TestNG")
21.18 +@ActionRegistration(displayName = "#CTL_DebugTestClassAction")
21.19 +@ActionReference(path = "Editors/text/x-java/Popup/TestNG", position = 600)
21.20 public class DebugTestClassAction extends NodeAction {
21.21
21.22 private static final Logger LOGGER = Logger.getLogger(DebugTestClassAction.class.getName());
22.1 --- a/testng/src/org/netbeans/modules/contrib/testng/actions/DebugTestMethodAction.java Thu May 05 11:28:45 2011 -0400
22.2 +++ b/testng/src/org/netbeans/modules/contrib/testng/actions/DebugTestMethodAction.java Thu May 05 17:57:16 2011 +0200
22.3 @@ -50,6 +50,9 @@
22.4 import org.netbeans.modules.contrib.testng.spi.TestConfig;
22.5 import org.netbeans.modules.contrib.testng.spi.TestNGSupportImplementation.TestExecutor;
22.6 import org.netbeans.spi.project.SingleMethod;
22.7 +import org.openide.awt.ActionID;
22.8 +import org.openide.awt.ActionReference;
22.9 +import org.openide.awt.ActionRegistration;
22.10 import org.openide.cookies.EditorCookie;
22.11 import org.openide.filesystems.FileObject;
22.12 import org.openide.loaders.DataObject;
22.13 @@ -63,6 +66,9 @@
22.14 *
22.15 * @author lukas
22.16 */
22.17 +@ActionID(id = "org.netbeans.modules.contrib.testng.actions.DebugTestMethodAction", category = "TestNG")
22.18 +@ActionRegistration(displayName = "#CTL_DebugTestMethodAction")
22.19 +@ActionReference(path = "Editors/text/x-java/Popup/TestNG", position = 500)
22.20 public class DebugTestMethodAction extends NodeAction {
22.21
22.22 private static final Logger LOGGER = Logger.getLogger(RunTestMethodAction.class.getName());
23.1 --- a/testng/src/org/netbeans/modules/contrib/testng/actions/DummyUI.form Thu May 05 11:28:45 2011 -0400
23.2 +++ b/testng/src/org/netbeans/modules/contrib/testng/actions/DummyUI.form Thu May 05 17:57:16 2011 +0200
23.3 @@ -1,12 +1,13 @@
23.4 -<?xml version="1.0" encoding="UTF-8" ?>
23.5 +<?xml version="1.1" encoding="UTF-8" ?>
23.6
23.7 <Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
23.8 <AuxValues>
23.9 <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
23.10 <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
23.11 + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
23.12 <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
23.13 <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
23.14 - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
23.15 + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
23.16 <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
23.17 <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
23.18 <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
24.1 --- a/testng/src/org/netbeans/modules/contrib/testng/actions/DummyUI.java Thu May 05 11:28:45 2011 -0400
24.2 +++ b/testng/src/org/netbeans/modules/contrib/testng/actions/DummyUI.java Thu May 05 17:57:16 2011 +0200
24.3 @@ -64,25 +64,25 @@
24.4
24.5 jLabel1.setText(org.openide.util.NbBundle.getBundle(DummyUI.class).getString("DummyUI.jLabel1.text")); // NOI18N
24.6
24.7 - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
24.8 + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
24.9 this.setLayout(layout);
24.10 layout.setHorizontalGroup(
24.11 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
24.12 - .add(layout.createSequentialGroup()
24.13 + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
24.14 + .addGroup(layout.createSequentialGroup()
24.15 .addContainerGap()
24.16 - .add(jLabel1)
24.17 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
24.18 - .add(jTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 315, Short.MAX_VALUE)
24.19 + .addComponent(jLabel1)
24.20 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
24.21 + .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 315, Short.MAX_VALUE)
24.22 .addContainerGap())
24.23 );
24.24 layout.setVerticalGroup(
24.25 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
24.26 - .add(layout.createSequentialGroup()
24.27 + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
24.28 + .addGroup(layout.createSequentialGroup()
24.29 .addContainerGap()
24.30 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
24.31 - .add(jLabel1)
24.32 - .add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
24.33 - .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
24.34 + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
24.35 + .addComponent(jLabel1)
24.36 + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
24.37 + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
24.38 );
24.39 }// </editor-fold>//GEN-END:initComponents
24.40
25.1 --- a/testng/src/org/netbeans/modules/contrib/testng/actions/RerunFailedTestsAction.java Thu May 05 11:28:45 2011 -0400
25.2 +++ b/testng/src/org/netbeans/modules/contrib/testng/actions/RerunFailedTestsAction.java Thu May 05 17:57:16 2011 +0200
25.3 @@ -47,6 +47,10 @@
25.4 import org.netbeans.modules.contrib.testng.api.TestNGSupport;
25.5 import org.netbeans.modules.contrib.testng.api.TestNGSupport.Action;
25.6 import org.netbeans.modules.contrib.testng.spi.TestNGSupportImplementation.TestExecutor;
25.7 +import org.openide.awt.ActionID;
25.8 +import org.openide.awt.ActionReference;
25.9 +import org.openide.awt.ActionReferences;
25.10 +import org.openide.awt.ActionRegistration;
25.11 import org.openide.loaders.DataObject;
25.12 import org.openide.nodes.Node;
25.13 import org.openide.util.HelpCtx;
25.14 @@ -54,6 +58,11 @@
25.15 import org.openide.util.NbBundle;
25.16 import org.openide.util.actions.NodeAction;
25.17
25.18 +@ActionID(id = "org.netbeans.modules.contrib.testng.actions.RerunFailedTestsAction", category = "TestNG")
25.19 +@ActionRegistration(displayName = "#CTL_RerunFailedTestsAction")
25.20 +@ActionReferences(value = {
25.21 + @ActionReference(path = "Loaders/text/x-java/Actions", position = 2195),
25.22 + @ActionReference(path = "Editors/text/x-java/Popup/TestNG", position = 400)})
25.23 public final class RerunFailedTestsAction extends NodeAction {
25.24
25.25 private static final Logger LOGGER = Logger.getLogger(RerunFailedTestsAction.class.getName());
26.1 --- a/testng/src/org/netbeans/modules/contrib/testng/actions/RunTestClassAction.java Thu May 05 11:28:45 2011 -0400
26.2 +++ b/testng/src/org/netbeans/modules/contrib/testng/actions/RunTestClassAction.java Thu May 05 17:57:16 2011 +0200
26.3 @@ -49,6 +49,10 @@
26.4 import org.netbeans.modules.contrib.testng.api.TestNGSupport;
26.5 import org.netbeans.modules.contrib.testng.api.TestNGSupport.Action;
26.6 import org.netbeans.modules.contrib.testng.spi.TestNGSupportImplementation.TestExecutor;
26.7 +import org.openide.awt.ActionID;
26.8 +import org.openide.awt.ActionReference;
26.9 +import org.openide.awt.ActionReferences;
26.10 +import org.openide.awt.ActionRegistration;
26.11 import org.openide.cookies.EditorCookie;
26.12 import org.openide.filesystems.FileObject;
26.13 import org.openide.loaders.DataObject;
26.14 @@ -58,6 +62,11 @@
26.15 import org.openide.util.NbBundle;
26.16 import org.openide.util.actions.NodeAction;
26.17
26.18 +@ActionID(id = "org.netbeans.modules.contrib.testng.actions.RunTestClassAction", category = "TestNG")
26.19 +@ActionRegistration(displayName = "#CTL_RunTestClassAction")
26.20 +@ActionReferences(value = {
26.21 + @ActionReference(path = "Loaders/text/x-java/Actions", position = 2193),
26.22 + @ActionReference(path = "Editors/text/x-java/Popup/TestNG", position = 300)})
26.23 public final class RunTestClassAction extends NodeAction {
26.24
26.25 private static final Logger LOGGER = Logger.getLogger(RunTestClassAction.class.getName());
27.1 --- a/testng/src/org/netbeans/modules/contrib/testng/actions/RunTestMethodAction.java Thu May 05 11:28:45 2011 -0400
27.2 +++ b/testng/src/org/netbeans/modules/contrib/testng/actions/RunTestMethodAction.java Thu May 05 17:57:16 2011 +0200
27.3 @@ -50,6 +50,10 @@
27.4 import org.netbeans.modules.contrib.testng.api.TestNGSupport.Action;
27.5 import org.netbeans.modules.contrib.testng.spi.TestNGSupportImplementation.TestExecutor;
27.6 import org.netbeans.spi.project.SingleMethod;
27.7 +import org.openide.awt.ActionID;
27.8 +import org.openide.awt.ActionReference;
27.9 +import org.openide.awt.ActionReferences;
27.10 +import org.openide.awt.ActionRegistration;
27.11 import org.openide.cookies.EditorCookie;
27.12 import org.openide.filesystems.FileObject;
27.13 import org.openide.loaders.DataObject;
27.14 @@ -59,6 +63,11 @@
27.15 import org.openide.util.NbBundle;
27.16 import org.openide.util.actions.NodeAction;
27.17
27.18 +@ActionID(id = "org.netbeans.modules.contrib.testng.actions.RunTestMethodAction", category = "TestNG")
27.19 +@ActionRegistration(displayName = "#CTL_RunTestMethodAction")
27.20 +@ActionReferences(value = {
27.21 + @ActionReference(path = "Loaders/text/x-java/Actions", position = 2194),
27.22 + @ActionReference(path = "Editors/text/x-java/Popup/TestNG", position = 200)})
27.23 public final class RunTestMethodAction extends NodeAction {
27.24
27.25 private static final Logger LOGGER = Logger.getLogger(RunTestMethodAction.class.getName());
28.1 --- a/testng/src/org/netbeans/modules/contrib/testng/ant/AntTestNGSupport.java Thu May 05 11:28:45 2011 -0400
28.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
28.3 @@ -1,197 +0,0 @@
28.4 -/*
28.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
28.6 - *
28.7 - * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
28.8 - *
28.9 - * The contents of this file are subject to the terms of either the GNU
28.10 - * General Public License Version 2 only ("GPL") or the Common
28.11 - * Development and Distribution License("CDDL") (collectively, the
28.12 - * "License"). You may not use this file except in compliance with the
28.13 - * License. You can obtain a copy of the License at
28.14 - * http://www.netbeans.org/cddl-gplv2.html
28.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
28.16 - * specific language governing permissions and limitations under the
28.17 - * License. When distributing the software, include this License Header
28.18 - * Notice in each file and include the License file at
28.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
28.20 - * particular file as subject to the "Classpath" exception as provided
28.21 - * by Sun in the GPL Version 2 section of the License file that
28.22 - * accompanied this code. If applicable, add the following below the
28.23 - * License Header, with the fields enclosed by brackets [] replaced by
28.24 - * your own identifying information:
28.25 - * "Portions Copyrighted [year] [name of copyright owner]"
28.26 - *
28.27 - * If you wish your version of this file to be governed by only the CDDL
28.28 - * or only the GPL Version 2, indicate your decision by adding
28.29 - * "[Contributor] elects to include this software in this distribution
28.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
28.31 - * single choice of license, a recipient has the option to distribute
28.32 - * your version of this file under either the CDDL, the GPL Version 2 or
28.33 - * to extend the choice of license to its licensees as provided above.
28.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
28.35 - * Version 2 license, then the option applies only if the new code is
28.36 - * made subject to such option by the copyright holder.
28.37 - *
28.38 - * Contributor(s):
28.39 - *
28.40 - * Portions Copyrighted 2008 Sun Microsystems, Inc.
28.41 - */
28.42 -package org.netbeans.modules.contrib.testng.ant;
28.43 -
28.44 -import java.io.File;
28.45 -import java.io.IOException;
28.46 -import java.io.InputStream;
28.47 -import java.io.OutputStream;
28.48 -import java.util.Collections;
28.49 -import java.util.HashSet;
28.50 -import java.util.Properties;
28.51 -import java.util.Set;
28.52 -import java.util.logging.Level;
28.53 -import java.util.logging.Logger;
28.54 -import org.apache.tools.ant.module.api.support.ActionUtils;
28.55 -import org.netbeans.api.java.classpath.ClassPath;
28.56 -import org.netbeans.api.project.FileOwnerQuery;
28.57 -import org.netbeans.api.project.Project;
28.58 -import org.netbeans.api.project.ProjectManager;
28.59 -import org.netbeans.api.project.ProjectUtils;
28.60 -import org.netbeans.api.project.ant.AntBuildExtender;
28.61 -import org.netbeans.api.project.ant.AntBuildExtender.Extension;
28.62 -import org.netbeans.modules.contrib.testng.api.TestNGSupport.Action;
28.63 -import org.netbeans.modules.contrib.testng.spi.TestConfig;
28.64 -import org.netbeans.modules.contrib.testng.spi.TestNGSupportImplementation;
28.65 -import org.netbeans.modules.contrib.testng.spi.XMLSuiteSupport;
28.66 -import org.netbeans.spi.project.ant.AntArtifactProvider;
28.67 -import org.openide.filesystems.FileLock;
28.68 -import org.openide.filesystems.FileObject;
28.69 -import org.openide.filesystems.FileUtil;
28.70 -import org.openide.util.lookup.ServiceProvider;
28.71 -
28.72 -/**
28.73 - *
28.74 - * @author lukas
28.75 - */
28.76 -@ServiceProvider(service = TestNGSupportImplementation.class)
28.77 -public class AntTestNGSupport extends TestNGSupportImplementation {
28.78 -
28.79 - private static final Logger LOGGER = Logger.getLogger(AntTestNGSupport.class.getName());
28.80 - private static final Set<Action> SUPPORTED_ACTIONS;
28.81 -
28.82 - static {
28.83 - Set<Action> s = new HashSet<Action>();
28.84 - s.add(Action.CONVERT);
28.85 - s.add(Action.CREATE_TEST);
28.86 - s.add(Action.RUN_FAILED);
28.87 - s.add(Action.RUN_TEST);
28.88 - s.add(Action.RUN_TESTMETHOD);
28.89 - s.add(Action.DEBUG_TEST);
28.90 - s.add(Action.DEBUG_TESTMETHOD);
28.91 - SUPPORTED_ACTIONS = Collections.unmodifiableSet(s);
28.92 - }
28.93 -
28.94 - public boolean isActionSupported(Action action, Project p) {
28.95 - return p != null && p.getLookup().lookup(AntArtifactProvider.class) != null && SUPPORTED_ACTIONS.contains(action);
28.96 - }
28.97 -
28.98 - public void configureProject(FileObject createdFile) {
28.99 - try {
28.100 - addLibrary(createdFile);
28.101 - } catch (IOException ex) {
28.102 - LOGGER.log(Level.SEVERE, null, ex);
28.103 - }
28.104 - Project p = FileOwnerQuery.getOwner(createdFile);
28.105 - AntBuildExtender extender = p.getLookup().lookup(AntBuildExtender.class);
28.106 - if (extender != null) {
28.107 - String ID = "test-ng-1.0"; //NOI18N
28.108 - Extension extension = extender.getExtension(ID);
28.109 - if (extension == null) {
28.110 - LOGGER.finer("Extensible targets: " + extender.getExtensibleTargets());
28.111 - try {
28.112 - // create testng-build.xml
28.113 - FileObject testng = p.getProjectDirectory().getFileObject("nbproject").createData("testng-impl", "xml"); //NOI18N
28.114 - InputStream is = AntTestNGSupport.class.getResourceAsStream("resources/testng-build.xml"); //NOI18N
28.115 - FileLock lock = testng.lock();
28.116 - OutputStream os = testng.getOutputStream(lock);
28.117 - try {
28.118 - FileUtil.copy(is, os);
28.119 - } finally {
28.120 - if (is != null) {
28.121 - is.close();
28.122 - }
28.123 - if (os != null) {
28.124 - os.close();
28.125 - }
28.126 - lock.releaseLock();
28.127 - }
28.128 - extension = extender.addExtension(ID, testng);
28.129 - extension.addDependency("-pre-pre-compile", "-reinit-tasks"); //NOI18N
28.130 - ProjectManager.getDefault().saveProject(p);
28.131 - } catch (IOException ex) {
28.132 - LOGGER.log(Level.SEVERE, null, ex);
28.133 - }
28.134 - }
28.135 - }
28.136 - }
28.137 -
28.138 - public TestExecutor createExecutor(Project p) {
28.139 - return new AntExecutor(p);
28.140 - }
28.141 -
28.142 - private static class AntExecutor implements TestNGSupportImplementation.TestExecutor {
28.143 -
28.144 - private static final String failedConfPath = "build/test/results/testng-failed.xml"; //NOI18N
28.145 - private Project p;
28.146 -
28.147 - public AntExecutor(Project p) {
28.148 - this.p = p;
28.149 - }
28.150 -
28.151 - public boolean hasFailedTests() {
28.152 - FileObject projectHome = p.getProjectDirectory();
28.153 - //XXX - should rather listen on a fileobject??
28.154 - FileUtil.refreshFor(FileUtil.toFile(projectHome));
28.155 - FileObject failedTestsConfig = projectHome.getFileObject(failedConfPath);
28.156 - return failedTestsConfig != null && failedTestsConfig.isValid();
28.157 - }
28.158 -
28.159 - public void execute(Action action, TestConfig config) throws IOException {
28.160 - FileObject projectHome = p.getProjectDirectory();
28.161 - Properties props = new Properties();
28.162 - if (config.doRerun()) {
28.163 - FileObject failedTestsConfig = projectHome.getFileObject(failedConfPath);
28.164 - props.put("testng.config", FileUtil.getRelativePath(projectHome, failedTestsConfig));
28.165 - } else {
28.166 - File f = XMLSuiteSupport.createSuiteforMethod(
28.167 - FileUtil.normalizeFile(new File(System.getProperty("java.io.tmpdir"))), //NOI18N
28.168 - ProjectUtils.getInformation(p).getDisplayName(),
28.169 - config.getPackageName(),
28.170 - config.getClassName(),
28.171 - config.getMethodName());
28.172 - f = FileUtil.normalizeFile(f);
28.173 - props.put("testng.config", f.getAbsolutePath());
28.174 - }
28.175 - try {
28.176 - String target = "run-testng"; //NOI18N
28.177 - if (Action.DEBUG_TEST.equals(action) || Action.DEBUG_TESTMETHOD.equals(action)) {
28.178 - target = "debug-testng"; //NOI18N
28.179 - FileObject test = config.getTest();
28.180 - FileObject[] testRoots = ClassPath.getClassPath(test, ClassPath.SOURCE).getRoots();
28.181 - FileObject testRoot = null;
28.182 - for (FileObject root : testRoots) {
28.183 - if (FileUtil.isParentOf(root, test)) {
28.184 - testRoot = root;
28.185 - break;
28.186 - }
28.187 - }
28.188 - assert testRoot != null;
28.189 - props.put("javac.includes", //NOI18N
28.190 - ActionUtils.antIncludesList(new FileObject[]{test}, testRoot));
28.191 - }
28.192 - ActionUtils.runTarget(projectHome.getFileObject("build.xml"), new String[]{target}, props); //NOI18N
28.193 - } catch (IOException ex) {
28.194 - LOGGER.log(Level.SEVERE, null, ex);
28.195 - } catch (IllegalArgumentException ex) {
28.196 - LOGGER.log(Level.SEVERE, null, ex);
28.197 - }
28.198 - }
28.199 - }
28.200 -}
29.1 --- a/testng/src/org/netbeans/modules/contrib/testng/ant/resources/testng-build.xml Thu May 05 11:28:45 2011 -0400
29.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
29.3 @@ -1,404 +0,0 @@
29.4 -<?xml version="1.0" encoding="UTF-8"?>
29.5 -<!--
29.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
29.7 -
29.8 -Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
29.9 -
29.10 -
29.11 -The contents of this file are subject to the terms of either the GNU
29.12 -General Public License Version 2 only ("GPL") or the Common
29.13 -Development and Distribution License("CDDL") (collectively, the
29.14 -"License"). You may not use this file except in compliance with the
29.15 -License. You can obtain a copy of the License at
29.16 -http://www.netbeans.org/cddl-gplv2.html
29.17 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
29.18 -specific language governing permissions and limitations under the
29.19 -License. When distributing the software, include this License Header
29.20 -Notice in each file and include the License file at
29.21 -nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
29.22 -particular file as subject to the "Classpath" exception as provided
29.23 -by Sun in the GPL Version 2 section of the License file that
29.24 -accompanied this code. If applicable, add the following below the
29.25 -License Header, with the fields enclosed by brackets [] replaced by
29.26 -your own identifying information:
29.27 -"Portions Copyrighted [year] [name of copyright owner]"
29.28 -
29.29 -Contributor(s):
29.30 -
29.31 -The Original Software is NetBeans. The Initial Developer of the Original
29.32 -Software is Sun Microsystems, Inc. Portions Copyright 1997-2008 Sun
29.33 -Microsystems, Inc. All Rights Reserved.
29.34 -
29.35 -If you wish your version of this file to be governed by only the CDDL
29.36 -or only the GPL Version 2, indicate your decision by adding
29.37 -"[Contributor] elects to include this software in this distribution
29.38 -under the [CDDL or GPL Version 2] license." If you do not indicate a
29.39 -single choice of license, a recipient has the option to distribute
29.40 -your version of this file under either the CDDL, the GPL Version 2 or
29.41 -to extend the choice of license to its licensees as provided above.
29.42 -However, if you add GPL Version 2 code and therefore, elected the GPL
29.43 -Version 2 license, then the option applies only if the new code is
29.44 -made subject to such option by the copyright holder.
29.45 --->
29.46 -<project name="testng-impl" default="default" basedir="..">
29.47 - <target name="default">
29.48 - <echo message="Default target is not set."/>
29.49 - </target>
29.50 -
29.51 - <target name="-init-env">
29.52 - <condition property="run.jvmargs.prop" value="${run.jvmargs}" else="">
29.53 - <isset property="run.jvmargs"/>
29.54 - </condition>
29.55 - </target>
29.56 -
29.57 - <!-- Call testng ant task -->
29.58 - <target name="-init-macrodef-testng">
29.59 - <macrodef name="testng-ant">
29.60 - <attribute name="testincludes" default="**/*Test.class"/>
29.61 - <sequential>
29.62 - <taskdef name="testng" classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}"/>
29.63 - <testng workingDir="${basedir}" failureProperty="testng.tests.failed" outputdir="${build.test.results.dir}" sourcedir="${test.src.dir}" dumpCommand="true" useDefaultListeners="true" verbose="2">
29.64 - <classpath>
29.65 - <pathelement path="${run.test.classpath}"/>
29.66 - <pathelement path="${j2ee.platform.classpath}"/>
29.67 - <pathelement path="${build.test.classes.dir}"/>
29.68 - </classpath>
29.69 - <classfileset dir="${build.test.classes.dir}">
29.70 - <filename name="@{testincludes}"/>
29.71 - </classfileset>
29.72 - <jvmarg line="${run.jvmargs.prop}"/>
29.73 - </testng>
29.74 - </sequential>
29.75 - </macrodef>
29.76 - <macrodef name="testng-ant-xml">
29.77 - <attribute name="testSuite" default="${build.dir}/generated/testng/temp-testng-customsuite.xml"/>
29.78 - <sequential>
29.79 - <taskdef name="testng" classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}"/>
29.80 - <testng workingDir="${basedir}" failureProperty="testng.tests.failed" outputdir="${build.test.results.dir}" sourcedir="${test.src.dir}" dumpCommand="true" useDefaultListeners="true" verbose="2">
29.81 - <classpath>
29.82 - <pathelement path="${run.test.classpath}"/>
29.83 - <pathelement path="${j2ee.platform.classpath}"/>
29.84 - <pathelement path="${build.test.classes.dir}"/>
29.85 - </classpath>
29.86 - <xmlfileset dir="${basedir}">
29.87 - <filename name="@{testSuite}"/>
29.88 - </xmlfileset>
29.89 - <jvmarg line="${run.jvmargs.prop}"/>
29.90 - </testng>
29.91 - </sequential>
29.92 - </macrodef>
29.93 - </target>
29.94 -
29.95 - <target name="-testng" unless="junit.enabled">
29.96 - <!-- Java SE projects -->
29.97 - <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
29.98 - <attribute default="${includes}" name="includes"/>
29.99 - <attribute default="${excludes}" name="excludes"/>
29.100 - <attribute default="**" name="testincludes"/>
29.101 - <sequential>
29.102 - <testng-ant/>
29.103 - <condition property="tests.failed">
29.104 - <and>
29.105 - <isset property="testng.tests.failed"/>
29.106 - </and>
29.107 - </condition>
29.108 - </sequential>
29.109 - </macrodef>
29.110 -
29.111 - <!-- Web Projects -->
29.112 - <macrodef name="junit" uri="http://www.netbeans.org/ns/web-project/2">
29.113 - <attribute default="${includes}" name="includes"/>
29.114 - <attribute default="${excludes}" name="excludes"/>
29.115 - <attribute default="**" name="testincludes"/>
29.116 - <sequential>
29.117 - <testng-ant/>
29.118 - <condition property="tests.failed">
29.119 - <and>
29.120 - <isset property="testng.tests.failed"/>
29.121 - </and>
29.122 - </condition>
29.123 - </sequential>
29.124 - </macrodef>
29.125 -
29.126 - <!-- EJB Projects -->
29.127 - <macrodef name="junit" uri="http://www.netbeans.org/ns/j2ee-ejbjarproject/2">
29.128 - <attribute default="${includes}" name="includes"/>
29.129 - <attribute default="${excludes}" name="excludes"/>
29.130 - <attribute default="**" name="testincludes"/>
29.131 - <sequential>
29.132 - <testng-ant/>
29.133 - <condition property="tests.failed">
29.134 - <and>
29.135 - <isset property="testng.tests.failed"/>
29.136 - </and>
29.137 - </condition>
29.138 - </sequential>
29.139 - </macrodef>
29.140 -
29.141 - <!-- Java EE application client projects -->
29.142 - <macrodef name="junit" uri="http://www.netbeans.org/ns/car-project/1">
29.143 - <attribute default="${includes}" name="includes"/>
29.144 - <attribute default="${excludes}" name="excludes"/>
29.145 - <attribute default="**" name="testincludes"/>
29.146 - <sequential>
29.147 - <testng-ant/>
29.148 - <condition property="tests.failed">
29.149 - <and>
29.150 - <isset property="testng.tests.failed"/>
29.151 - </and>
29.152 - </condition>
29.153 - </sequential>
29.154 - </macrodef>
29.155 - </target>
29.156 -
29.157 - <target name="-testng-junit" if="junit.enabled">
29.158 - <!-- Java SE projects -->
29.159 - <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
29.160 - <attribute default="${includes}" name="includes"/>
29.161 - <attribute default="${excludes}" name="excludes"/>
29.162 - <attribute default="**" name="testincludes"/>
29.163 - <sequential>
29.164 - <junit dir="${basedir}" errorproperty="junit.tests.failed" failureproperty="junit.tests.failed" fork="true" showoutput="true">
29.165 - <batchtest todir="${build.test.results.dir}">
29.166 - <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
29.167 - <filename name="@{testincludes}"/>
29.168 - </fileset>
29.169 - </batchtest>
29.170 - <classpath>
29.171 - <path path="${run.test.classpath}"/>
29.172 - </classpath>
29.173 - <syspropertyset>
29.174 - <propertyref prefix="test-sys-prop."/>
29.175 - <mapper from="test-sys-prop.*" to="*" type="glob"/>
29.176 - </syspropertyset>
29.177 - <formatter type="brief" usefile="false"/>
29.178 - <formatter type="xml"/>
29.179 - <jvmarg line="${run.jvmargs.prop}"/>
29.180 - </junit>
29.181 - <testng-ant/>
29.182 - <condition property="tests.failed">
29.183 - <and>
29.184 - <isset property="junit.tests.failed"/>
29.185 - <isset property="testng.tests.failed"/>
29.186 - </and>
29.187 - </condition>
29.188 - </sequential>
29.189 - </macrodef>
29.190 -
29.191 - <!-- Web Projects -->
29.192 - <macrodef name="junit" uri="http://www.netbeans.org/ns/j2ee-ejbjarproject/2">
29.193 - <attribute default="${includes}" name="includes"/>
29.194 - <attribute default="${excludes}" name="excludes"/>
29.195 - <attribute default="**" name="testincludes"/>
29.196 - <sequential>
29.197 - <junit dir="${basedir}" errorproperty="junit.tests.failed" failureproperty="junit.tests.failed" fork="true" showoutput="true">
29.198 - <batchtest todir="${build.test.results.dir}">
29.199 - <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
29.200 - <filename name="@{testincludes}"/>
29.201 - </fileset>
29.202 - </batchtest>
29.203 - <classpath>
29.204 - <path path="${run.test.classpath}:${j2ee.platform.classpath}"/>
29.205 - </classpath>
29.206 - <syspropertyset>
29.207 - <propertyref prefix="test-sys-prop."/>
29.208 - <mapper from="test-sys-prop.*" to="*" type="glob"/>
29.209 - </syspropertyset>
29.210 - <formatter type="brief" usefile="false"/>
29.211 - <formatter type="xml"/>
29.212 - <jvmarg line="${runmain.jvmargs}"/>
29.213 - </junit>
29.214 - <testng-ant/>
29.215 - <condition property="tests.failed">
29.216 - <and>
29.217 - <isset property="junit.tests.failed"/>
29.218 - <isset property="testng.tests.failed"/>
29.219 - </and>
29.220 - </condition>
29.221 - </sequential>
29.222 - </macrodef>
29.223 -
29.224 - <!-- EJB projects -->
29.225 - <macrodef name="junit" uri="http://www.netbeans.org/ns/j2ee-ejbjarproject/2">
29.226 - <attribute default="${includes}" name="includes"/>
29.227 - <attribute default="${excludes}" name="excludes"/>
29.228 - <attribute default="**" name="testincludes"/>
29.229 - <sequential>
29.230 - <junit dir="${basedir}" errorproperty="junit.tests.failed" failureproperty="junit.tests.failed" fork="true" showoutput="true">
29.231 - <batchtest todir="${build.test.results.dir}">
29.232 - <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
29.233 - <filename name="@{testincludes}"/>
29.234 - </fileset>
29.235 - </batchtest>
29.236 - <classpath>
29.237 - <path path="${run.test.classpath}"/>
29.238 - <path path="${j2ee.platform.classpath}"/>
29.239 - </classpath>
29.240 - <syspropertyset>
29.241 - <propertyref prefix="test-sys-prop."/>
29.242 - <mapper from="test-sys-prop.*" to="*" type="glob"/>
29.243 - </syspropertyset>
29.244 - <formatter type="brief" usefile="false"/>
29.245 - <formatter type="xml"/>
29.246 - <jvmarg line="${runmain.jvmargs}"/>
29.247 - </junit>
29.248 - <testng-ant/>
29.249 - <condition property="tests.failed">
29.250 - <and>
29.251 - <isset property="junit.tests.failed"/>
29.252 - <isset property="testng.tests.failed"/>
29.253 - </and>
29.254 - </condition>
29.255 - </sequential>
29.256 - </macrodef>
29.257 -
29.258 - <!-- Java EE application client projects -->
29.259 - <macrodef name="junit" uri="http://www.netbeans.org/ns/car-project/1">
29.260 - <attribute default="${includes}" name="includes"/>
29.261 - <attribute default="${excludes}" name="excludes"/>
29.262 - <attribute default="**" name="testincludes"/>
29.263 - <sequential>
29.264 - <junit dir="${basedir}" errorproperty="junit.tests.failed" failureproperty="junit.tests.failed" fork="true" showoutput="true">
29.265 - <batchtest todir="${build.test.results.dir}">
29.266 - <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
29.267 - <filename name="@{testincludes}"/>
29.268 - </fileset>
29.269 - </batchtest>
29.270 - <classpath>
29.271 - <path path="${run.test.classpath}"/>
29.272 - <path path="${j2ee.platform.classpath}"/>
29.273 - </classpath>
29.274 - <syspropertyset>
29.275 - <propertyref prefix="test-sys-prop."/>
29.276 - <mapper from="test-sys-prop.*" to="*" type="glob"/>
29.277 - </syspropertyset>
29.278 - <formatter type="brief" usefile="false"/>
29.279 - <formatter type="xml"/>
29.280 - <jvmarg line="${run.jvmargs.param}"/>
29.281 - </junit>
29.282 - <testng-ant/>
29.283 - <condition property="tests.failed">
29.284 - <and>
29.285 - <isset property="junit.tests.failed"/>
29.286 - <isset property="testng.tests.failed"/>
29.287 - </and>
29.288 - </condition>
29.289 - </sequential>
29.290 - </macrodef>
29.291 - </target>
29.292 -
29.293 - <target name="-init-macrodef-testng-junit-converter">
29.294 - <macrodef name="junit-converter">
29.295 - <sequential>
29.296 - <java classname="org.testng.JUnitConverter" dir="${basedir}">
29.297 - <classpath>
29.298 - <path path="${run.test.classpath}:${java.home}/../lib/tools.jar"/>
29.299 - </classpath>
29.300 - <arg line="-overwrite"/>
29.301 - <arg line="-annotation"/>
29.302 - <arg line="-srcdir ${test.src.dir}"/>
29.303 - </java>
29.304 - </sequential>
29.305 - </macrodef>
29.306 - </target>
29.307 -
29.308 - <target name="-reinit-tasks" depends="-init-env, -init-macrodef-testng, -testng, -testng-junit, -init-macrodef-testng-junit-converter" />
29.309 -
29.310 - <target name="-run-testng-default" unless="testng.config">
29.311 - <testng-ant/>
29.312 - </target>
29.313 -
29.314 - <target name="-run-testng-custom" if="testng.config">
29.315 - <testng-ant-xml testSuite="${testng.config}"/>
29.316 - </target>
29.317 -
29.318 - <target name="run-testng" depends="compile-test, -init-macrodef-testng, -run-testng-default, -run-testng-custom"/>
29.319 -
29.320 - <target name="convert" depends="init, -init-macrodef-testng-junit-converter">
29.321 - <junit-converter/>
29.322 - </target>
29.323 -
29.324 - <!-- Call testng from java -->
29.325 - <target name="-init-macrodef-testng-java">
29.326 - <macrodef name="testng-java">
29.327 - <sequential>
29.328 - <pathconvert property="testng.classnames" pathsep=" ">
29.329 - <path>
29.330 - <fileset dir="${build.test.classes.dir}" includes="**/*.class"/>
29.331 - </path>
29.332 - <map from="${basedir}${file.separator}" to="-testclass "/>
29.333 - </pathconvert>
29.334 - <java classname="org.testng.TestNG" dir="${basedir}">
29.335 - <classpath>
29.336 - <path path="${run.test.classpath}:${j2ee.platform.classpath}"/>
29.337 - </classpath>
29.338 - <arg line="-d ${build.test.results.dir}"/>
29.339 - <arg line="-sourcedir ${test.src.dir}"/>
29.340 - <arg line="-log 2"/>
29.341 - <arg line="${testng.classnames}"/>
29.342 - <syspropertyset>
29.343 - <propertyref prefix="test-sys-prop."/>
29.344 - <mapper from="test-sys-prop.*" to="*" type="glob"/>
29.345 - </syspropertyset>
29.346 - <jvmarg value="-Dtestng.test.classpath=${build.test.classes.dir}"/>
29.347 - <jvmarg value="-ea"/>
29.348 - <jvmarg line="${run.jvmargs.prop}"/>
29.349 - </java>
29.350 - </sequential>
29.351 - </macrodef>
29.352 - </target>
29.353 -
29.354 - <target name="-init-macrodef-testng-java-xml">
29.355 - <macrodef name="testng-java-xml">
29.356 - <attribute name="testSuite" default="${build.dir}/generated/testng/temp-testng-customsuite.xml"/>
29.357 - <sequential>
29.358 - <java classname="org.testng.TestNG" dir="${basedir}">
29.359 - <classpath>
29.360 - <path path="${run.test.classpath}:${j2ee.platform.classpath}"/>
29.361 - </classpath>
29.362 - <arg line="-d ${build.test.results.dir}"/>
29.363 - <arg line="-sourcedir ${test.src.dir}"/>
29.364 - <arg line="@{testSuite}"/>
29.365 - <syspropertyset>
29.366 - <propertyref prefix="test-sys-prop."/>
29.367 - <mapper from="test-sys-prop.*" to="*" type="glob"/>
29.368 - </syspropertyset>
29.369 - <jvmarg value="-Dtestng.test.classpath=${build.test.classes.dir}"/>
29.370 - <jvmarg value="-ea"/>
29.371 - <jvmarg line="${run.jvmargs.prop}"/>
29.372 - </java>
29.373 - </sequential>
29.374 - </macrodef>
29.375 - </target>
29.376 -
29.377 - <!-- DEBUG -->
29.378 - <target depends="-init-env, init, compile-test-single, -debug-start-debugger-test, -debug-start-debuggee-testng" name="debug-testng"/>
29.379 -
29.380 - <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-testng">
29.381 - <fail unless="testng.config">Must select test class in the IDE or set testng.config</fail>
29.382 - <delete dir="${build.test.results.dir}" quiet="true"/>
29.383 - <mkdir dir="${build.test.results.dir}"/>
29.384 - <java classname="org.testng.TestNG" dir="${basedir}" fork="true">
29.385 - <jvmarg line="${debug-args-line}"/>
29.386 - <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
29.387 - <jvmarg line="${run.jvmargs.prop}"/>
29.388 - <arg line="-d ${build.test.results.dir}"/>
29.389 - <arg line="-sourcedir ${test.src.dir}"/>
29.390 - <arg line="${testng.config}"/>
29.391 - <syspropertyset>
29.392 - <propertyref prefix="test-sys-prop."/>
29.393 - <mapper from="test-sys-prop.*" to="*" type="glob"/>
29.394 - </syspropertyset>
29.395 - <jvmarg value="-Dtestng.test.classpath=${build.test.classes.dir}"/>
29.396 - <jvmarg value="-ea"/>
29.397 - <classpath>
29.398 - <path path="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}:${j2ee.platform.classpath}"/>
29.399 - </classpath>
29.400 - <syspropertyset>
29.401 - <propertyref prefix="run-sys-prop."/>
29.402 - <mapper from="run-sys-prop.*" to="*" type="glob"/>
29.403 - </syspropertyset>
29.404 - </java>
29.405 - </target>
29.406 -
29.407 -</project>
30.1 --- a/testng/src/org/netbeans/modules/contrib/testng/api/TestNGSupport.java Thu May 05 11:28:45 2011 -0400
30.2 +++ b/testng/src/org/netbeans/modules/contrib/testng/api/TestNGSupport.java Thu May 05 17:57:16 2011 +0200
30.3 @@ -62,8 +62,7 @@
30.4 RUN_TEST,
30.5 RUN_TESTMETHOD,
30.6 DEBUG_TEST,
30.7 - DEBUG_TESTMETHOD,
30.8 - CONVERT
30.9 + DEBUG_TESTMETHOD
30.10 }
30.11
30.12 private TestNGSupport() {
31.1 --- a/testng/src/org/netbeans/modules/contrib/testng/resources/TestNG-lib.xml Thu May 05 11:28:45 2011 -0400
31.2 +++ b/testng/src/org/netbeans/modules/contrib/testng/resources/TestNG-lib.xml Thu May 05 17:57:16 2011 +0200
31.3 @@ -42,22 +42,22 @@
31.4 -->
31.5 <!DOCTYPE library PUBLIC "-//NetBeans//DTD Library Declaration 1.0//EN" "http://www.netbeans.org/dtds/library-declaration-1_0.dtd">
31.6 <library version="1.0">
31.7 - <name>TestNG-5.11</name>
31.8 + <name>TestNG-6.0.1</name>
31.9 <type>j2se</type>
31.10 <localizing-bundle>org.netbeans.modules.contrib.testng.Bundle</localizing-bundle>
31.11 <volume>
31.12 <type>classpath</type>
31.13 - <resource>jar:nbinst://org.netbeans.modules.testng/modules/ext/testng/testng-5.11-jdk15.jar!/</resource>
31.14 + <resource>jar:nbinst://org.netbeans.modules.testng/modules/ext/testng/testng-6.0.1.jar!/</resource>
31.15 </volume>
31.16 <volume>
31.17 <type>src</type>
31.18 </volume>
31.19 <volume>
31.20 <type>javadoc</type>
31.21 - <resource>jar:nbinst://org.netbeans.modules.testng/modules/ext/testng/TestNG-5.11.zip!/</resource>
31.22 + <resource>jar:nbinst://org.netbeans.modules.testng/modules/ext/testng/testng-6.0.1-javadoc.jar!/</resource>
31.23 </volume>
31.24 <volume>
31.25 <type>maven-pom</type>
31.26 - <resource>http://repo1.maven.org/maven2/org/testng/testng/5.10/testng-5.10.pom#jdk15</resource>
31.27 + <resource>http://repo1.maven.org/maven2/org/testng/testng/6.0.1/testng-6.0.1.pom</resource>
31.28 </volume>
31.29 </library>
32.1 --- a/testng/src/org/netbeans/modules/contrib/testng/resources/layer.xml Thu May 05 11:28:45 2011 -0400
32.2 +++ b/testng/src/org/netbeans/modules/contrib/testng/resources/layer.xml Thu May 05 17:57:16 2011 +0200
32.3 @@ -40,95 +40,28 @@
32.4 Version 2 license, then the option applies only if the new code is
32.5 made subject to such option by the copyright holder.
32.6 -->
32.7 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
32.8 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
32.9 <filesystem>
32.10 - <folder name="Actions">
32.11 - <folder name="TestNG">
32.12 - <file name="org-netbeans-modules-contrib-testng-actions-ConvertAction.instance"/>
32.13 - <file name="org-netbeans-modules-contrib-testng-actions-CreateTestAction.instance"/>
32.14 - <file name="org-netbeans-modules-contrib-testng-actions-DebugTestClassAction.instance"/>
32.15 - <file name="org-netbeans-modules-contrib-testng-actions-DebugTestMethodAction.instance"/>
32.16 - <file name="org-netbeans-modules-contrib-testng-actions-RerunFailedTestsAction.instance"/>
32.17 - <file name="org-netbeans-modules-contrib-testng-actions-RunTestClassAction.instance"/>
32.18 - <file name="org-netbeans-modules-contrib-testng-actions-RunTestMethodAction.instance"/>
32.19 - </folder>
32.20 - </folder>
32.21 <folder name="Editors">
32.22 <folder name="text">
32.23 <folder name="x-java">
32.24 <folder name="Popup">
32.25 <folder name="TestNG">
32.26 <attr name="position" intvalue="1630"/>
32.27 - <file name="org-netbeans-modules-contrib-testng-actions-CreateTestAction.shadow">
32.28 - <attr name="originalFile" stringvalue="Actions/TestNG/org-netbeans-modules-contrib-testng-actions-CreateTestAction.instance"/>
32.29 - <attr name="position" intvalue="100"/>
32.30 - </file>
32.31 - <file name="org-netbeans-modules-contrib-testng-actions-RunTestMethodAction.shadow">
32.32 - <attr name="originalFile" stringvalue="Actions/TestNG/org-netbeans-modules-contrib-testng-actions-RunTestMethodAction.instance"/>
32.33 - <attr name="position" intvalue="200"/>
32.34 - </file>
32.35 - <file name="org-netbeans-modules-contrib-testng-actions-RunTestClassAction.shadow">
32.36 - <attr name="originalFile" stringvalue="Actions/TestNG/org-netbeans-modules-contrib-testng-actions-RunTestClassAction.instance"/>
32.37 - <attr name="position" intvalue="300"/>
32.38 - </file>
32.39 - <file name="org-netbeans-modules-contrib-testng-actions-RerunFailedTestsAction.shadow">
32.40 - <attr name="originalFile" stringvalue="Actions/TestNG/org-netbeans-modules-contrib-testng-actions-RerunFailedTestsAction.instance"/>
32.41 - <attr name="position" intvalue="400"/>
32.42 - </file>
32.43 - <file name="org-netbeans-modules-contrib-testng-actions-DebugTestMethodAction.shadow">
32.44 - <attr name="originalFile" stringvalue="Actions/TestNG/org-netbeans-modules-contrib-testng-actions-DebugTestMethodAction.instance"/>
32.45 - <attr name="position" intvalue="500"/>
32.46 - </file>
32.47 - <file name="org-netbeans-modules-contrib-testng-actions-DebugTestClassAction.shadow">
32.48 - <attr name="originalFile" stringvalue="Actions/TestNG/org-netbeans-modules-contrib-testng-actions-DebugTestClassAction.instance"/>
32.49 - <attr name="position" intvalue="600"/>
32.50 - </file>
32.51 - <file name="org-netbeans-modules-contrib-testng-actions-ConvertAction.shadow">
32.52 - <attr name="originalFile" stringvalue="Actions/TestNG/org-netbeans-modules-contrib-testng-actions-ConvertAction.instance"/>
32.53 - <attr name="position" intvalue="700"/>
32.54 - </file>
32.55 </folder>
32.56 </folder>
32.57 </folder>
32.58 </folder>
32.59 </folder>
32.60 - <folder name="Loaders">
32.61 - <folder name="text">
32.62 - <folder name="x-java">
32.63 - <folder name="Actions">
32.64 - <file name="org-netbeans-modules-contrib-testng-actions-CreateTestAction.shadow">
32.65 - <attr name="originalFile" stringvalue="Actions/TestNG/org-netbeans-modules-contrib-testng-actions-CreateTestAction.instance"/>
32.66 - <attr name="position" intvalue="2192"/>
32.67 - </file>
32.68 - <file name="org-netbeans-modules-contrib-testng-actions-RerunFailedTestsAction.shadow">
32.69 - <attr name="originalFile" stringvalue="Actions/TestNG/org-netbeans-modules-contrib-testng-actions-RerunFailedTestsAction.instance"/>
32.70 - <attr name="position" intvalue="2195"/>
32.71 - </file>
32.72 - <file name="org-netbeans-modules-contrib-testng-actions-RunTestMethodAction.shadow">
32.73 - <attr name="originalFile" stringvalue="Actions/TestNG/org-netbeans-modules-contrib-testng-actions-RunTestMethodAction.instance"/>
32.74 - <attr name="position" intvalue="2194"/>
32.75 - </file>
32.76 - <file name="org-netbeans-modules-contrib-testng-actions-RunTestClassAction.shadow">
32.77 - <attr name="originalFile" stringvalue="Actions/TestNG/org-netbeans-modules-contrib-testng-actions-RunTestClassAction.instance"/>
32.78 - <attr name="position" intvalue="2193"/>
32.79 - </file>
32.80 - <file name="org-netbeans-modules-contrib-testng-actions-ConvertAction.shadow">
32.81 - <attr name="originalFile" stringvalue="Actions/TestNG/org-netbeans-modules-contrib-testng-actions-ConvertAction.instance"/>
32.82 - <attr name="position" intvalue="2196"/>
32.83 - </file>
32.84 - </folder>
32.85 - </folder>
32.86 - </folder>
32.87 - </folder>
32.88 <folder name="Templates">
32.89 <folder name="TestNG">
32.90 + <attr name="displayName" bundlevalue="org.netbeans.modules.contrib.testng.Bundle#Templates/TestNG"/>
32.91 <attr name="position" intvalue="1250"/>
32.92 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.contrib.testng.Bundle"/>
32.93 <file name="TestNGTest.java" url="testng.template">
32.94 + <attr name="displayName" bundlevalue="org.netbeans.modules.contrib.testng.Bundle#Templates/TestNG/TestNGTest.java"/>
32.95 + <attr name="iconBase" stringvalue="org/netbeans/modules/contrib/testng/resources/testng.gif"/>
32.96 <attr name="position" intvalue="1000"/>
32.97 <attr name="javax.script.ScriptEngine" stringvalue="freemarker"/>
32.98 - <attr name="SystemFileSystem.icon" urlvalue="nbresloc:/org/netbeans/modules/contrib/testng/resources/testng.gif"/>
32.99 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.contrib.testng.Bundle"/>
32.100 <attr name="instantiatingIterator" methodvalue="org.netbeans.modules.contrib.testng.NewTestWizardIterator.create"/>
32.101 <attr name="template" boolvalue="true"/>
32.102 <attr name="templateWizardURL" urlvalue="nbresloc:/org/netbeans/modules/contrib/testng/resources/newTest.html"/>
33.1 --- a/testng/src/org/netbeans/modules/contrib/testng/spi/TestNGSupportImplementation.java Thu May 05 11:28:45 2011 -0400
33.2 +++ b/testng/src/org/netbeans/modules/contrib/testng/spi/TestNGSupportImplementation.java Thu May 05 17:57:16 2011 +0200
33.3 @@ -39,6 +39,7 @@
33.4 package org.netbeans.modules.contrib.testng.spi;
33.5
33.6 import java.io.IOException;
33.7 +import java.util.logging.Level;
33.8 import java.util.logging.Logger;
33.9 import org.netbeans.api.java.classpath.ClassPath;
33.10 import org.netbeans.api.java.project.classpath.ProjectClassPathModifier;
33.11 @@ -95,9 +96,9 @@
33.12 FileObject ng = cp.findResource("org.testng.annotations.Test"); //NOI18N
33.13 if (ng == null) {
33.14 // add library to the project
33.15 - Library nglib = LibraryManager.getDefault().getLibrary("TestNG-5.11"); //NOI18N
33.16 + Library nglib = LibraryManager.getDefault().getLibrary("TestNG-6.0.1"); //NOI18N
33.17 if (!ProjectClassPathModifier.addLibraries(new Library[]{nglib}, fo, ClassPath.COMPILE)) {
33.18 - LOGGER.fine("TestNG library not added to project " + p); //NOI18N
33.19 + LOGGER.log(Level.FINE, "TestNG library not added to project {0}", p); //NOI18N
33.20 return false;
33.21 }
33.22 }
34.1 --- a/testng/test/unit/data/projects/tngTestProject/nbproject/project.properties Thu May 05 11:28:45 2011 -0400
34.2 +++ b/testng/test/unit/data/projects/tngTestProject/nbproject/project.properties Thu May 05 17:57:16 2011 +0200
34.3 @@ -31,7 +31,7 @@
34.4 ${build.classes.dir}:\
34.5 ${libs.junit.classpath}:\
34.6 ${libs.junit_4.classpath}:\
34.7 - ${libs.TestNG-5.8.classpath}
34.8 + ${libs.TestNG.classpath}
34.9 javadoc.additionalparam=
34.10 javadoc.author=false
34.11 javadoc.encoding=${source.encoding}
35.1 --- a/testng/test/unit/src/org/netbeans/modules/contrib/testng/actions/ConvertActionTest.java Thu May 05 11:28:45 2011 -0400
35.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
35.3 @@ -1,71 +0,0 @@
35.4 -/*
35.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
35.6 - *
35.7 - * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
35.8 - *
35.9 - * The contents of this file are subject to the terms of either the GNU
35.10 - * General Public License Version 2 only ("GPL") or the Common
35.11 - * Development and Distribution License("CDDL") (collectively, the
35.12 - * "License"). You may not use this file except in compliance with the
35.13 - * License. You can obtain a copy of the License at
35.14 - * http://www.netbeans.org/cddl-gplv2.html
35.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
35.16 - * specific language governing permissions and limitations under the
35.17 - * License. When distributing the software, include this License Header
35.18 - * Notice in each file and include the License file at
35.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
35.20 - * particular file as subject to the "Classpath" exception as provided
35.21 - * by Sun in the GPL Version 2 section of the License file that
35.22 - * accompanied this code. If applicable, add the following below the
35.23 - * License Header, with the fields enclosed by brackets [] replaced by
35.24 - * your own identifying information:
35.25 - * "Portions Copyrighted [year] [name of copyright owner]"
35.26 - *
35.27 - * If you wish your version of this file to be governed by only the CDDL
35.28 - * or only the GPL Version 2, indicate your decision by adding
35.29 - * "[Contributor] elects to include this software in this distribution
35.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
35.31 - * single choice of license, a recipient has the option to distribute
35.32 - * your version of this file under either the CDDL, the GPL Version 2 or
35.33 - * to extend the choice of license to its licensees as provided above.
35.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
35.35 - * Version 2 license, then the option applies only if the new code is
35.36 - * made subject to such option by the copyright holder.
35.37 - *
35.38 - * Contributor(s):
35.39 - *
35.40 - * Portions Copyrighted 2008 Sun Microsystems, Inc.
35.41 - */
35.42 -package org.netbeans.modules.contrib.testng.actions;
35.43 -
35.44 -import org.netbeans.modules.contrib.testng.api.TestNGSupport.Action;
35.45 -import org.netbeans.modules.contrib.testng.impl.TestNGImpl;
35.46 -import org.openide.util.actions.NodeActionsInfraHid;
35.47 -import org.openide.util.actions.SystemAction;
35.48 -
35.49 -/**
35.50 - *
35.51 - * @author lukas
35.52 - */
35.53 -public class ConvertActionTest extends TestActionT {
35.54 -
35.55 - static {
35.56 - TestNGImpl.setSupportedActions(Action.CONVERT);
35.57 - }
35.58 - private final ConvertAction action = SystemAction.get(ConvertAction.class);
35.59 -
35.60 - public ConvertActionTest(String name) {
35.61 - super(name);
35.62 - }
35.63 -
35.64 - public void testEnable() {
35.65 - NodeActionsInfraHid.setCurrentNodes(EMPTY_ARRAY);
35.66 - assertFalse(action.isEnabled());
35.67 - NodeActionsInfraHid.setCurrentNodes(EMPTY_NODES);
35.68 - assertFalse(action.isEnabled());
35.69 - NodeActionsInfraHid.setCurrentNodes(FILEOBJECT_NODE);
35.70 - assertFalse(action.isEnabled());
35.71 - NodeActionsInfraHid.setCurrentNodes(DATAOBJECT_NODE);
35.72 - assertTrue(action.isEnabled());
35.73 - }
35.74 -}
35.75 \ No newline at end of file