1.1 --- a/testng.ant/src/org/netbeans/modules/contrib/testng/ant/AntTestNGSupport.java Thu May 05 15:25:43 2011 +0200
1.2 +++ b/testng.ant/src/org/netbeans/modules/contrib/testng/ant/AntTestNGSupport.java Thu May 05 16:48:47 2011 +0200
1.3 @@ -78,7 +78,6 @@
1.4
1.5 static {
1.6 Set<Action> s = new HashSet<Action>();
1.7 - s.add(Action.CONVERT);
1.8 s.add(Action.CREATE_TEST);
1.9 s.add(Action.RUN_FAILED);
1.10 s.add(Action.RUN_TEST);
2.1 --- a/testng.ant/src/org/netbeans/modules/contrib/testng/ant/testng-build.xml Thu May 05 15:25:43 2011 +0200
2.2 +++ b/testng.ant/src/org/netbeans/modules/contrib/testng/ant/testng-build.xml Thu May 05 16:48:47 2011 +0200
2.3 @@ -57,7 +57,7 @@
2.4 <attribute name="testincludes" default="**/*Test.class"/>
2.5 <sequential>
2.6 <taskdef name="testng" classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}"/>
2.7 - <testng workingDir="${basedir}" failureProperty="testng.tests.failed" outputdir="${build.test.results.dir}" sourcedir="${test.src.dir}" dumpCommand="true" useDefaultListeners="true" verbose="2">
2.8 + <testng workingDir="${basedir}" failureProperty="testng.tests.failed" outputdir="${build.test.results.dir}" dumpCommand="true" useDefaultListeners="true" verbose="2">
2.9 <classpath>
2.10 <pathelement path="${run.test.classpath}"/>
2.11 <pathelement path="${j2ee.platform.classpath}"/>
2.12 @@ -74,15 +74,13 @@
2.13 <attribute name="testSuite" default="${build.dir}/generated/testng/temp-testng-customsuite.xml"/>
2.14 <sequential>
2.15 <taskdef name="testng" classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}"/>
2.16 - <testng workingDir="${basedir}" failureProperty="testng.tests.failed" outputdir="${build.test.results.dir}" sourcedir="${test.src.dir}" dumpCommand="true" useDefaultListeners="true" verbose="2">
2.17 + <testng workingDir="${basedir}" failureProperty="testng.tests.failed" outputdir="${build.test.results.dir}" dumpCommand="true" useDefaultListeners="true" verbose="2">
2.18 <classpath>
2.19 <pathelement path="${run.test.classpath}"/>
2.20 <pathelement path="${j2ee.platform.classpath}"/>
2.21 <pathelement path="${build.test.classes.dir}"/>
2.22 </classpath>
2.23 - <xmlfileset dir="${basedir}">
2.24 - <filename name="@{testSuite}"/>
2.25 - </xmlfileset>
2.26 + <xmlfileset file="@{testSuite}"/>
2.27 <jvmarg line="${run.jvmargs.prop}"/>
2.28 </testng>
2.29 </sequential>
2.30 @@ -287,22 +285,7 @@
2.31 </macrodef>
2.32 </target>
2.33
2.34 - <target name="-init-macrodef-testng-junit-converter">
2.35 - <macrodef name="junit-converter">
2.36 - <sequential>
2.37 - <java classname="org.testng.JUnitConverter" dir="${basedir}">
2.38 - <classpath>
2.39 - <path path="${run.test.classpath}:${java.home}/../lib/tools.jar"/>
2.40 - </classpath>
2.41 - <arg line="-overwrite"/>
2.42 - <arg line="-annotation"/>
2.43 - <arg line="-srcdir ${test.src.dir}"/>
2.44 - </java>
2.45 - </sequential>
2.46 - </macrodef>
2.47 - </target>
2.48 -
2.49 - <target name="-reinit-tasks" depends="-init-env, -init-macrodef-testng, -testng, -testng-junit, -init-macrodef-testng-junit-converter" />
2.50 + <target name="-reinit-tasks" depends="-init-env, -init-macrodef-testng, -testng, -testng-junit" />
2.51
2.52 <target name="-run-testng-default" unless="testng.config">
2.53 <testng-ant/>
2.54 @@ -314,10 +297,6 @@
2.55
2.56 <target name="run-testng" depends="compile-test, -init-macrodef-testng, -run-testng-default, -run-testng-custom"/>
2.57
2.58 - <target name="convert" depends="init, -init-macrodef-testng-junit-converter">
2.59 - <junit-converter/>
2.60 - </target>
2.61 -
2.62 <!-- Call testng from java -->
2.63 <target name="-init-macrodef-testng-java">
2.64 <macrodef name="testng-java">
3.1 --- a/testng/src/org/netbeans/modules/contrib/testng/actions/Bundle.properties Thu May 05 15:25:43 2011 +0200
3.2 +++ b/testng/src/org/netbeans/modules/contrib/testng/actions/Bundle.properties Thu May 05 16:48:47 2011 +0200
3.3 @@ -37,13 +37,10 @@
3.4 # Version 2 license, then the option applies only if the new code is
3.5 # made subject to such option by the copyright holder.
3.6
3.7 -CTL_ConvertAction=Convert
3.8 CTL_CreateTestAction=Create Test...
3.9 CTL_DebugTestClassAction=Debug Test Class
3.10 CTL_DebugTestMethodAction=Debug
3.11 CTL_RerunFailedTestsAction=Re-run Failed Tests
3.12 CTL_RunTestClassAction=Run Test Class
3.13 -CTL_RunTestMethodAction=Run Again
3.14 +CTL_RunTestMethodAction=Run Test Method
3.15 DummyUI.jLabel1.text=Test Name:
3.16 -MSG_Overwrite_tests=All JUnit tests will be overwritten. Do you want to continue?
3.17 -TLT_Overwrite=Overwrite tests...
4.1 --- a/testng/src/org/netbeans/modules/contrib/testng/actions/ConvertAction.java Thu May 05 15:25:43 2011 +0200
4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
4.3 @@ -1,140 +0,0 @@
4.4 -/*
4.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4.6 - *
4.7 - * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
4.8 - *
4.9 - * The contents of this file are subject to the terms of either the GNU
4.10 - * General Public License Version 2 only ("GPL") or the Common
4.11 - * Development and Distribution License("CDDL") (collectively, the
4.12 - * "License"). You may not use this file except in compliance with the
4.13 - * License. You can obtain a copy of the License at
4.14 - * http://www.netbeans.org/cddl-gplv2.html
4.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
4.16 - * specific language governing permissions and limitations under the
4.17 - * License. When distributing the software, include this License Header
4.18 - * Notice in each file and include the License file at
4.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
4.20 - * particular file as subject to the "Classpath" exception as provided
4.21 - * by Sun in the GPL Version 2 section of the License file that
4.22 - * accompanied this code. If applicable, add the following below the
4.23 - * License Header, with the fields enclosed by brackets [] replaced by
4.24 - * your own identifying information:
4.25 - * "Portions Copyrighted [year] [name of copyright owner]"
4.26 - *
4.27 - * If you wish your version of this file to be governed by only the CDDL
4.28 - * or only the GPL Version 2, indicate your decision by adding
4.29 - * "[Contributor] elects to include this software in this distribution
4.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
4.31 - * single choice of license, a recipient has the option to distribute
4.32 - * your version of this file under either the CDDL, the GPL Version 2 or
4.33 - * to extend the choice of license to its licensees as provided above.
4.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
4.35 - * Version 2 license, then the option applies only if the new code is
4.36 - * made subject to such option by the copyright holder.
4.37 - *
4.38 - * Contributor(s):
4.39 - *
4.40 - * Portions Copyrighted 2008 Sun Microsystems, Inc.
4.41 - */
4.42 -package org.netbeans.modules.contrib.testng.actions;
4.43 -
4.44 -import java.io.File;
4.45 -import java.io.IOException;
4.46 -import java.util.logging.Level;
4.47 -import java.util.logging.Logger;
4.48 -import org.apache.tools.ant.module.api.support.ActionUtils;
4.49 -import org.netbeans.api.project.FileOwnerQuery;
4.50 -import org.netbeans.api.project.Project;
4.51 -import org.netbeans.modules.contrib.testng.api.TestNGSupport;
4.52 -import org.netbeans.modules.contrib.testng.api.TestNGSupport.Action;
4.53 -import org.openide.DialogDisplayer;
4.54 -import org.openide.NotifyDescriptor;
4.55 -import org.openide.awt.ActionID;
4.56 -import org.openide.awt.ActionReference;
4.57 -import org.openide.awt.ActionReferences;
4.58 -import org.openide.awt.ActionRegistration;
4.59 -import org.openide.filesystems.FileObject;
4.60 -import org.openide.filesystems.FileUtil;
4.61 -import org.openide.loaders.DataObject;
4.62 -import org.openide.nodes.Node;
4.63 -import org.openide.util.HelpCtx;
4.64 -import org.openide.util.NbBundle;
4.65 -import org.openide.util.actions.CookieAction;
4.66 -
4.67 -@ActionID(id = "org.netbeans.modules.contrib.testng.actions.ConvertAction", category = "TestNG")
4.68 -@ActionRegistration(displayName = "#CTL_ConvertAction")
4.69 -@ActionReferences(value = {
4.70 - @ActionReference(path = "Loaders/text/x-java/Actions", position = 2196),
4.71 - @ActionReference(path = "Editors/text/x-java/Popup/TestNG", position = 700)})
4.72 -public final class ConvertAction extends CookieAction {
4.73 -
4.74 - private static final Logger LOGGER = Logger.getLogger(ConvertAction.class.getName());
4.75 -
4.76 - @Override
4.77 - protected boolean enable(Node[] activatedNodes) {
4.78 - if (super.enable(activatedNodes)) {
4.79 - DataObject dataObject = activatedNodes[0].getLookup().lookup(DataObject.class);
4.80 - Project p = FileOwnerQuery.getOwner(dataObject.getPrimaryFile());
4.81 - return TestNGSupport.isActionSupported(Action.CONVERT, p);
4.82 - }
4.83 - return false;
4.84 - }
4.85 -
4.86 -
4.87 - protected void performAction(Node[] activatedNodes) {
4.88 - DataObject dataObject = activatedNodes[0].getLookup().lookup(DataObject.class);
4.89 - //XXX - should check if a file to be converted is a JUnit test here...
4.90 - NotifyDescriptor nd = new NotifyDescriptor(
4.91 - NbBundle.getMessage(ConvertAction.class, "MSG_Overwrite_tests"),
4.92 - NbBundle.getMessage(ConvertAction.class, "TLT_Overwrite"),
4.93 - NotifyDescriptor.OK_CANCEL_OPTION,
4.94 - NotifyDescriptor.WARNING_MESSAGE,
4.95 - null,
4.96 - NotifyDescriptor.OK_OPTION);
4.97 - if (NotifyDescriptor.OK_OPTION.equals(DialogDisplayer.getDefault().notify(nd))) {
4.98 - FileObject fo = dataObject.getPrimaryFile();
4.99 - TestNGSupport.findTestNGSupport(FileOwnerQuery.getOwner(fo)).configureProject(fo);
4.100 - fo = FileOwnerQuery.getOwner(fo).getProjectDirectory();
4.101 - File f = FileUtil.toFile(fo);
4.102 - try {
4.103 - ActionUtils.runTarget(
4.104 - fo.getFileObject("build.xml"),
4.105 - new String[] {"convert"},
4.106 - null);
4.107 - } catch (IOException ioe) {
4.108 - LOGGER.log(Level.SEVERE, null, ioe);
4.109 - }
4.110 - FileUtil.refreshFor(f);
4.111 - }
4.112 -
4.113 - }
4.114 -
4.115 - protected int mode() {
4.116 - return CookieAction.MODE_EXACTLY_ONE;
4.117 - }
4.118 -
4.119 - public String getName() {
4.120 - return NbBundle.getMessage(ConvertAction.class, "CTL_ConvertAction");
4.121 - }
4.122 -
4.123 - protected Class[] cookieClasses() {
4.124 - return new Class[]{DataObject.class};
4.125 - }
4.126 -
4.127 - @Override
4.128 - protected void initialize() {
4.129 - super.initialize();
4.130 - // see org.openide.util.actions.SystemAction.iconResource() Javadoc for more details
4.131 - putValue("noIconInMenu", Boolean.TRUE);
4.132 - }
4.133 -
4.134 - public HelpCtx getHelpCtx() {
4.135 - return HelpCtx.DEFAULT_HELP;
4.136 - }
4.137 -
4.138 - @Override
4.139 - protected boolean asynchronous() {
4.140 - return false;
4.141 - }
4.142 -}
4.143 -
5.1 --- a/testng/src/org/netbeans/modules/contrib/testng/api/TestNGSupport.java Thu May 05 15:25:43 2011 +0200
5.2 +++ b/testng/src/org/netbeans/modules/contrib/testng/api/TestNGSupport.java Thu May 05 16:48:47 2011 +0200
5.3 @@ -62,8 +62,7 @@
5.4 RUN_TEST,
5.5 RUN_TESTMETHOD,
5.6 DEBUG_TEST,
5.7 - DEBUG_TESTMETHOD,
5.8 - CONVERT
5.9 + DEBUG_TESTMETHOD
5.10 }
5.11
5.12 private TestNGSupport() {
6.1 --- a/testng/test/unit/src/org/netbeans/modules/contrib/testng/actions/ConvertActionTest.java Thu May 05 15:25:43 2011 +0200
6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
6.3 @@ -1,71 +0,0 @@
6.4 -/*
6.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
6.6 - *
6.7 - * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
6.8 - *
6.9 - * The contents of this file are subject to the terms of either the GNU
6.10 - * General Public License Version 2 only ("GPL") or the Common
6.11 - * Development and Distribution License("CDDL") (collectively, the
6.12 - * "License"). You may not use this file except in compliance with the
6.13 - * License. You can obtain a copy of the License at
6.14 - * http://www.netbeans.org/cddl-gplv2.html
6.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
6.16 - * specific language governing permissions and limitations under the
6.17 - * License. When distributing the software, include this License Header
6.18 - * Notice in each file and include the License file at
6.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
6.20 - * particular file as subject to the "Classpath" exception as provided
6.21 - * by Sun in the GPL Version 2 section of the License file that
6.22 - * accompanied this code. If applicable, add the following below the
6.23 - * License Header, with the fields enclosed by brackets [] replaced by
6.24 - * your own identifying information:
6.25 - * "Portions Copyrighted [year] [name of copyright owner]"
6.26 - *
6.27 - * If you wish your version of this file to be governed by only the CDDL
6.28 - * or only the GPL Version 2, indicate your decision by adding
6.29 - * "[Contributor] elects to include this software in this distribution
6.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
6.31 - * single choice of license, a recipient has the option to distribute
6.32 - * your version of this file under either the CDDL, the GPL Version 2 or
6.33 - * to extend the choice of license to its licensees as provided above.
6.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
6.35 - * Version 2 license, then the option applies only if the new code is
6.36 - * made subject to such option by the copyright holder.
6.37 - *
6.38 - * Contributor(s):
6.39 - *
6.40 - * Portions Copyrighted 2008 Sun Microsystems, Inc.
6.41 - */
6.42 -package org.netbeans.modules.contrib.testng.actions;
6.43 -
6.44 -import org.netbeans.modules.contrib.testng.api.TestNGSupport.Action;
6.45 -import org.netbeans.modules.contrib.testng.impl.TestNGImpl;
6.46 -import org.openide.util.actions.NodeActionsInfraHid;
6.47 -import org.openide.util.actions.SystemAction;
6.48 -
6.49 -/**
6.50 - *
6.51 - * @author lukas
6.52 - */
6.53 -public class ConvertActionTest extends TestActionT {
6.54 -
6.55 - static {
6.56 - TestNGImpl.setSupportedActions(Action.CONVERT);
6.57 - }
6.58 - private final ConvertAction action = SystemAction.get(ConvertAction.class);
6.59 -
6.60 - public ConvertActionTest(String name) {
6.61 - super(name);
6.62 - }
6.63 -
6.64 - public void testEnable() {
6.65 - NodeActionsInfraHid.setCurrentNodes(EMPTY_ARRAY);
6.66 - assertFalse(action.isEnabled());
6.67 - NodeActionsInfraHid.setCurrentNodes(EMPTY_NODES);
6.68 - assertFalse(action.isEnabled());
6.69 - NodeActionsInfraHid.setCurrentNodes(FILEOBJECT_NODE);
6.70 - assertFalse(action.isEnabled());
6.71 - NodeActionsInfraHid.setCurrentNodes(DATAOBJECT_NODE);
6.72 - assertTrue(action.isEnabled());
6.73 - }
6.74 -}
6.75 \ No newline at end of file