1.1 --- a/testng/external/binaries-list Thu Feb 02 20:29:07 2012 +0400
1.2 +++ b/testng/external/binaries-list Sat Feb 04 21:12:07 2012 +0100
1.3 @@ -1,2 +1,2 @@
1.4 -DF5F9C7C57FC4FC7EB15DF6F24E11F86E3CEFB84 testng-6.3.2beta.jar
1.5 -5BDA0E395A1CAE0FBA9EF35D1CDF6275FF526E0C testng-6.3.2beta-javadoc.zip
1.6 +B6CCD3D416D3415023C758324631D99F1AE95E2F testng-6.3.2beta.jar
1.7 +DA32C831D0D41AF1B10D158176CECEBC3E740C40 testng-6.3.2beta-javadoc.zip
2.1 --- a/testng/nbproject/project.xml Thu Feb 02 20:29:07 2012 +0400
2.2 +++ b/testng/nbproject/project.xml Sat Feb 04 21:12:07 2012 +0100
2.3 @@ -2,7 +2,7 @@
2.4 <!--
2.5 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2.6
2.7 -Copyright © 2008-2011 Oracle and/or its affiliates. All rights reserved.
2.8 +Copyright © 2008-2012 Oracle and/or its affiliates. All rights reserved.
2.9
2.10
2.11 The contents of this file are subject to the terms of either the GNU
2.12 @@ -74,6 +74,15 @@
2.13 </run-dependency>
2.14 </dependency>
2.15 <dependency>
2.16 + <code-name-base>org.netbeans.api.progress</code-name-base>
2.17 + <build-prerequisite/>
2.18 + <compile-dependency/>
2.19 + <run-dependency>
2.20 + <release-version>1</release-version>
2.21 + <specification-version>1.27</specification-version>
2.22 + </run-dependency>
2.23 + </dependency>
2.24 + <dependency>
2.25 <code-name-base>org.netbeans.api.xml</code-name-base>
2.26 <build-prerequisite/>
2.27 <compile-dependency/>
2.28 @@ -100,6 +109,33 @@
2.29 </run-dependency>
2.30 </dependency>
2.31 <dependency>
2.32 + <code-name-base>org.netbeans.modules.editor</code-name-base>
2.33 + <build-prerequisite/>
2.34 + <compile-dependency/>
2.35 + <run-dependency>
2.36 + <release-version>3</release-version>
2.37 + <specification-version>1.60</specification-version>
2.38 + </run-dependency>
2.39 + </dependency>
2.40 + <dependency>
2.41 + <code-name-base>org.netbeans.modules.editor.lib</code-name-base>
2.42 + <build-prerequisite/>
2.43 + <compile-dependency/>
2.44 + <run-dependency>
2.45 + <release-version>3</release-version>
2.46 + <specification-version>3.18</specification-version>
2.47 + </run-dependency>
2.48 + </dependency>
2.49 + <dependency>
2.50 + <code-name-base>org.netbeans.modules.editor.lib2</code-name-base>
2.51 + <build-prerequisite/>
2.52 + <compile-dependency/>
2.53 + <run-dependency>
2.54 + <release-version>1</release-version>
2.55 + <specification-version>1.54</specification-version>
2.56 + </run-dependency>
2.57 + </dependency>
2.58 + <dependency>
2.59 <code-name-base>org.netbeans.modules.extexecution</code-name-base>
2.60 <build-prerequisite/>
2.61 <compile-dependency/>
2.62 @@ -143,6 +179,24 @@
2.63 </run-dependency>
2.64 </dependency>
2.65 <dependency>
2.66 + <code-name-base>org.netbeans.modules.java.sourceui</code-name-base>
2.67 + <build-prerequisite/>
2.68 + <compile-dependency/>
2.69 + <run-dependency>
2.70 + <release-version>1</release-version>
2.71 + <specification-version>1.26</specification-version>
2.72 + </run-dependency>
2.73 + </dependency>
2.74 + <dependency>
2.75 + <code-name-base>org.netbeans.modules.lexer</code-name-base>
2.76 + <build-prerequisite/>
2.77 + <compile-dependency/>
2.78 + <run-dependency>
2.79 + <release-version>2</release-version>
2.80 + <specification-version>1.43</specification-version>
2.81 + </run-dependency>
2.82 + </dependency>
2.83 + <dependency>
2.84 <code-name-base>org.netbeans.modules.project.ant</code-name-base>
2.85 <build-prerequisite/>
2.86 <compile-dependency/>
2.87 @@ -179,6 +233,14 @@
2.88 </run-dependency>
2.89 </dependency>
2.90 <dependency>
2.91 + <code-name-base>org.netbeans.modules.xml.lexer</code-name-base>
2.92 + <build-prerequisite/>
2.93 + <compile-dependency/>
2.94 + <run-dependency>
2.95 + <specification-version>1.16</specification-version>
2.96 + </run-dependency>
2.97 + </dependency>
2.98 + <dependency>
2.99 <code-name-base>org.openide.awt</code-name-base>
2.100 <build-prerequisite/>
2.101 <compile-dependency/>
3.1 --- a/testng/src/org/netbeans/modules/contrib/testng/Bundle.properties Thu Feb 02 20:29:07 2012 +0400
3.2 +++ b/testng/src/org/netbeans/modules/contrib/testng/Bundle.properties Sat Feb 04 21:12:07 2012 +0100
3.3 @@ -1,6 +1,6 @@
3.4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3.5 #
3.6 -# Copyright \u00a9 1997-2011 Oracle and/or its affiliates. All rights reserved.
3.7 +# Copyright \u00a9 1997-2012 Oracle and/or its affiliates. All rights reserved.
3.8 #
3.9 # The contents of this file are subject to the terms of either the GNU
3.10 # General Public License Version 2 only ("GPL") or the Common
3.11 @@ -48,3 +48,6 @@
3.12 Templates/TestNG/TestNGTest.java=TestNG Test Case
3.13 TestNG=TestNG 6.0.1
3.14 Loaders/text/x-testng+xml/Factories/org-netbeans-modules-contrib-testng-TestNGSuiteDataLoader.instance=TestNG Suite Files
3.15 +
3.16 +LBL_GoToDeclaration=Go to Declaration
3.17 +goto_source_source_not_found=Source file for {0} not found.
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/testng/src/org/netbeans/modules/contrib/testng/TestNGSuiteHyperlingProvider.java Sat Feb 04 21:12:07 2012 +0100
4.3 @@ -0,0 +1,342 @@
4.4 +/*
4.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4.6 + *
4.7 + * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
4.8 + *
4.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
4.10 + * Other names may be trademarks of their respective owners.
4.11 + *
4.12 + * The contents of this file are subject to the terms of either the GNU
4.13 + * General Public License Version 2 only ("GPL") or the Common
4.14 + * Development and Distribution License("CDDL") (collectively, the
4.15 + * "License"). You may not use this file except in compliance with the
4.16 + * License. You can obtain a copy of the License at
4.17 + * http://www.netbeans.org/cddl-gplv2.html
4.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
4.19 + * specific language governing permissions and limitations under the
4.20 + * License. When distributing the software, include this License Header
4.21 + * Notice in each file and include the License file at
4.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
4.23 + * particular file as subject to the "Classpath" exception as provided
4.24 + * by Oracle in the GPL Version 2 section of the License file that
4.25 + * accompanied this code. If applicable, add the following below the
4.26 + * License Header, with the fields enclosed by brackets [] replaced by
4.27 + * your own identifying information:
4.28 + * "Portions Copyrighted [year] [name of copyright owner]"
4.29 + *
4.30 + * If you wish your version of this file to be governed by only the CDDL
4.31 + * or only the GPL Version 2, indicate your decision by adding
4.32 + * "[Contributor] elects to include this software in this distribution
4.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
4.34 + * single choice of license, a recipient has the option to distribute
4.35 + * your version of this file under either the CDDL, the GPL Version 2 or
4.36 + * to extend the choice of license to its licensees as provided above.
4.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
4.38 + * Version 2 license, then the option applies only if the new code is
4.39 + * made subject to such option by the copyright holder.
4.40 + *
4.41 + * Contributor(s):
4.42 + *
4.43 + * Portions Copyrighted 2012 Sun Microsystems, Inc.
4.44 + */
4.45 +package org.netbeans.modules.contrib.testng;
4.46 +
4.47 +import java.io.File;
4.48 +import java.io.IOException;
4.49 +import java.text.MessageFormat;
4.50 +import java.util.Collections;
4.51 +import java.util.List;
4.52 +import java.util.Map;
4.53 +import java.util.concurrent.ConcurrentHashMap;
4.54 +import java.util.concurrent.atomic.AtomicBoolean;
4.55 +import javax.lang.model.element.Element;
4.56 +import javax.lang.model.element.ElementKind;
4.57 +import javax.lang.model.element.TypeElement;
4.58 +import javax.swing.text.Document;
4.59 +import javax.swing.text.JTextComponent;
4.60 +import javax.swing.text.StyledDocument;
4.61 +import org.netbeans.api.editor.EditorRegistry;
4.62 +import org.netbeans.api.java.source.ClasspathInfo;
4.63 +import org.netbeans.api.java.source.CompilationController;
4.64 +import org.netbeans.api.java.source.JavaSource;
4.65 +import org.netbeans.api.java.source.Task;
4.66 +import org.netbeans.api.java.source.ui.ElementOpen;
4.67 +import org.netbeans.api.lexer.Token;
4.68 +import org.netbeans.api.lexer.TokenHierarchy;
4.69 +import org.netbeans.api.lexer.TokenSequence;
4.70 +import org.netbeans.api.progress.ProgressUtils;
4.71 +import org.netbeans.api.xml.lexer.XMLTokenId;
4.72 +import org.netbeans.lib.editor.hyperlink.spi.HyperlinkProvider;
4.73 +import org.netbeans.modules.editor.NbEditorUtilities;
4.74 +import org.openide.awt.StatusDisplayer;
4.75 +import org.openide.cookies.OpenCookie;
4.76 +import org.openide.filesystems.FileObject;
4.77 +import org.openide.filesystems.FileUtil;
4.78 +import org.openide.loaders.DataObject;
4.79 +import org.openide.loaders.DataObjectNotFoundException;
4.80 +import org.openide.nodes.Node;
4.81 +import org.openide.util.Exceptions;
4.82 +import org.openide.util.NbBundle;
4.83 +
4.84 +/**
4.85 + *
4.86 + * @author lukas
4.87 + */
4.88 +public class TestNGSuiteHyperlingProvider implements HyperlinkProvider {
4.89 +
4.90 + private int startOffset;
4.91 + private int endOffset;
4.92 + private String file;
4.93 + private String method;
4.94 + private LinkType targetType;
4.95 + private static final Map<String, LinkType> linkMap = new ConcurrentHashMap<String, LinkType>();
4.96 +
4.97 + private enum LinkType {
4.98 +
4.99 + RESOURCE,
4.100 + JAVA_SOURCE;
4.101 + }
4.102 +
4.103 + static {
4.104 + linkMap.put("suite-file#path", LinkType.RESOURCE);
4.105 + linkMap.put("class#name", LinkType.JAVA_SOURCE);
4.106 + linkMap.put("listener#class-name", LinkType.JAVA_SOURCE);
4.107 + linkMap.put("selector-class#name", LinkType.JAVA_SOURCE);
4.108 + linkMap.put("include#name", LinkType.JAVA_SOURCE);
4.109 + linkMap.put("exclude#name", LinkType.JAVA_SOURCE);
4.110 +// linkMap.put("class/methods/include#name", LinkType.JAVA_SOURCE);
4.111 +// linkMap.put("class/methods/exclude#name", LinkType.JAVA_SOURCE);
4.112 + }
4.113 +
4.114 + public TestNGSuiteHyperlingProvider() {
4.115 + }
4.116 +
4.117 + public boolean isHyperlinkPoint(Document doc, int offset) {
4.118 + JTextComponent target = EditorRegistry.lastFocusedComponent();
4.119 + final StyledDocument styledDoc = (StyledDocument) target.getDocument();
4.120 + if (styledDoc == null) {
4.121 + return false;
4.122 + }
4.123 +
4.124 + // Work only with the open editor
4.125 + //and the editor has to be the active component:
4.126 + if ((target == null) || (target.getDocument() != doc)) {
4.127 + return false;
4.128 + }
4.129 +
4.130 + TokenHierarchy hi = TokenHierarchy.get(doc);
4.131 + TokenSequence<XMLTokenId> ts = hi.tokenSequence(XMLTokenId.language());
4.132 + ts.move(offset);
4.133 + ts.moveNext();
4.134 + Token<XMLTokenId> tok = ts.token();
4.135 + if (tok != null) {
4.136 + int tokOffset = ts.offset();
4.137 + Token<XMLTokenId> t = getAttribute(ts);
4.138 + if (t == null) {
4.139 + return false;
4.140 + }
4.141 + String xpath = "#" + t.text().toString();
4.142 + t = getParentElement(ts);
4.143 + xpath = getElementName(t) + xpath;
4.144 +
4.145 + targetType = linkMap.get(xpath);
4.146 + if (targetType == null) {
4.147 + return false;
4.148 + }
4.149 +
4.150 + if (xpath.startsWith("include") || xpath.startsWith("exclude")) {
4.151 + t = getParentElement(ts);
4.152 + if ("methods".equals(getElementName(t))) {
4.153 + method = tok.text().toString();
4.154 + getParentElement(ts); // <class ...> element
4.155 + file = getAttributeValue(ts, "name");
4.156 + } else {
4.157 + return false;
4.158 + }
4.159 + } else {
4.160 + method = null;
4.161 + }
4.162 + startOffset = tokOffset + 1;
4.163 + endOffset = startOffset + tok.text().length() - 2;
4.164 + if (method == null) {
4.165 + file = tok.text().subSequence(1, tok.text().length() - 1).toString();
4.166 + } else {
4.167 + method = method.substring(1, method.length() - 1);
4.168 + }
4.169 + return true;
4.170 + }
4.171 + return false;
4.172 + }
4.173 +
4.174 + public int[] getHyperlinkSpan(Document doc, int offset) {
4.175 + JTextComponent target = EditorRegistry.lastFocusedComponent();
4.176 + final StyledDocument styledDoc = (StyledDocument) target.getDocument();
4.177 + if (styledDoc == null) {
4.178 + return null;
4.179 + }
4.180 +
4.181 + // Return the position, which was set in the isHyperlink method:
4.182 + return new int[]{startOffset, endOffset};
4.183 + }
4.184 +
4.185 + public void performClickAction(final Document doc, final int offset) {
4.186 + final AtomicBoolean cancel = new AtomicBoolean();
4.187 + ProgressUtils.runOffEventDispatchThread(new Runnable() {
4.188 +
4.189 + public void run() {
4.190 + performGoTo(doc, offset, file, method, targetType, cancel);
4.191 + }
4.192 + }, NbBundle.getMessage(TestNGSuiteHyperlingProvider.class, "LBL_GoToDeclaration"), cancel, false);
4.193 + }
4.194 +
4.195 + private Token<XMLTokenId> getAttribute(TokenSequence<XMLTokenId> ts) {
4.196 + Token<XMLTokenId> tok = ts.token();
4.197 + if (tok.id() == XMLTokenId.VALUE) {
4.198 + while (ts.movePrevious()) {
4.199 + tok = ts.token();
4.200 + switch (tok.id()) {
4.201 + case ARGUMENT:
4.202 + return tok;
4.203 + case OPERATOR:
4.204 + case EOL:
4.205 + case ERROR:
4.206 + case WS:
4.207 + continue;
4.208 + default:
4.209 + return null;
4.210 + }
4.211 + }
4.212 + }
4.213 + return null;
4.214 + }
4.215 +
4.216 + private Token<XMLTokenId> getParentElement(TokenSequence<XMLTokenId> ts) {
4.217 + int depth = 0;
4.218 + while (ts.movePrevious()) {
4.219 + Token<XMLTokenId> prev = ts.token();
4.220 + switch (prev.id()) {
4.221 + case TAG:
4.222 + if (prev.text().length() == 1) {
4.223 + continue;
4.224 + }
4.225 + if (prev.text().toString().contains("/")) {
4.226 + depth++;
4.227 + continue;
4.228 + }
4.229 + depth--;
4.230 + if (depth == -1) {
4.231 + return prev;
4.232 + }
4.233 + continue;
4.234 + default:
4.235 + continue;
4.236 + }
4.237 + }
4.238 + return null;
4.239 + }
4.240 +
4.241 + private String getElementName(Token<XMLTokenId> tok) {
4.242 + return tok.text().toString().substring(1);
4.243 + }
4.244 +
4.245 + private String getAttributeValue(TokenSequence<XMLTokenId> ts, String name) {
4.246 + boolean readValue = false;
4.247 + while (ts.moveNext()) {
4.248 + Token<XMLTokenId> next = ts.token();
4.249 +
4.250 + switch (next.id()) {
4.251 + case ARGUMENT:
4.252 + if (name.equals(next.text().toString())) {
4.253 + readValue = true;
4.254 + }
4.255 + continue;
4.256 + case VALUE:
4.257 + if (readValue) {
4.258 + CharSequence val = next.text().subSequence(1, next.text().length() - 1);
4.259 + return val.toString();
4.260 + }
4.261 + continue;
4.262 + case OPERATOR:
4.263 + case EOL:
4.264 + case ERROR:
4.265 + case WS:
4.266 + continue;
4.267 + default:
4.268 + return null;
4.269 + }
4.270 + }
4.271 + return null;
4.272 + }
4.273 +
4.274 + private void performGoTo(Document doc, int offset, final String file, final String method, final LinkType type, AtomicBoolean cancel) {
4.275 + switch (type) {
4.276 + case RESOURCE:
4.277 + FileObject fo = NbEditorUtilities.getFileObject(doc);
4.278 + File target = new File(file);
4.279 + FileObject targetFO;
4.280 + if (target.isAbsolute()) {
4.281 + targetFO = FileUtil.toFileObject(FileUtil.normalizeFile(target));
4.282 + } else {
4.283 + targetFO = fo.getParent().getFileObject(file);
4.284 + }
4.285 + if (targetFO.isData() && targetFO.isValid() && !targetFO.isVirtual()) {
4.286 + openInEditor(targetFO);
4.287 + } else {
4.288 + String key = "goto_source_source_not_found"; //NOI18N
4.289 + String msg = NbBundle.getMessage(TestNGSuiteHyperlingProvider.class, key);
4.290 + StatusDisplayer.getDefault().setStatusText(MessageFormat.format(msg, new Object[]{file}));
4.291 + }
4.292 + break;
4.293 + case JAVA_SOURCE:
4.294 + final ClasspathInfo cp = ClasspathInfo.create(doc);
4.295 + JavaSource js = JavaSource.create(cp, Collections.EMPTY_LIST);
4.296 + try {
4.297 + js.runUserActionTask(new Task<CompilationController>() {
4.298 +
4.299 + @Override
4.300 + public void run(CompilationController cc) throws Exception {
4.301 + cc.toPhase(JavaSource.Phase.ELEMENTS_RESOLVED);
4.302 + Element element = cc.getElements().getTypeElement(file.trim());
4.303 + if (element != null) {
4.304 + if (method != null) {
4.305 + List<? extends Element> enclosedElements = cc.getElements().getAllMembers((TypeElement) element);
4.306 + for (Element e : enclosedElements) {
4.307 + if (e.getKind() == ElementKind.METHOD) {
4.308 + if (e.getSimpleName().toString().equals(method)) {
4.309 + element = e;
4.310 + break;
4.311 + }
4.312 + }
4.313 + }
4.314 + }
4.315 + if (!ElementOpen.open(cp, element)) {
4.316 + String key = "goto_source_source_not_found"; //NOI18N
4.317 + String msg = NbBundle.getMessage(TestNGSuiteHyperlingProvider.class, key);
4.318 + StatusDisplayer.getDefault().setStatusText(MessageFormat.format(msg, new Object[]{file}));
4.319 + }
4.320 + }
4.321 + }
4.322 + }, false);
4.323 + } catch (IOException ex) {
4.324 + Exceptions.printStackTrace(ex);
4.325 + }
4.326 + break;
4.327 + }
4.328 + }
4.329 +
4.330 + private void openInEditor(FileObject fo) {
4.331 + DataObject dobj;
4.332 + try {
4.333 + dobj = DataObject.find(fo);
4.334 + } catch (DataObjectNotFoundException e) {
4.335 + Exceptions.printStackTrace(e);
4.336 + return;
4.337 + }
4.338 + if (dobj != null) {
4.339 + Node.Cookie cookie = dobj.getLookup().lookup(OpenCookie.class);
4.340 + if (cookie != null) {
4.341 + ((OpenCookie) cookie).open();
4.342 + }
4.343 + }
4.344 + }
4.345 +}
5.1 --- a/testng/src/org/netbeans/modules/contrib/testng/actions/CreateTestAction.java Thu Feb 02 20:29:07 2012 +0400
5.2 +++ b/testng/src/org/netbeans/modules/contrib/testng/actions/CreateTestAction.java Sat Feb 04 21:12:07 2012 +0100
5.3 @@ -99,7 +99,7 @@
5.4 DummyUI gui = new DummyUI(s.substring(0, s.length() - 5).replace('/', '.') + "Test");
5.5 Object result = DialogDisplayer.getDefault().notify(new DialogDescriptor(gui, "Create TestNG Test"));
5.6 if (DialogDescriptor.OK_OPTION.equals(result)) {
5.7 - FileObject templateFO = FileUtil.getConfigFile("Templates/TestNG/TestNGTest.java");
5.8 + FileObject templateFO = FileUtil.getConfigFile("Templates/TestNG/EmptyTestNGTest.java");
5.9 DataObject templateDO = null;
5.10 try {
5.11 templateDO = DataObject.find(templateFO);
6.1 --- a/testng/src/org/netbeans/modules/contrib/testng/output/OutputUtils.java Thu Feb 02 20:29:07 2012 +0400
6.2 +++ b/testng/src/org/netbeans/modules/contrib/testng/output/OutputUtils.java Sat Feb 04 21:12:07 2012 +0100
6.3 @@ -57,7 +57,6 @@
6.4 import org.netbeans.api.java.source.JavaSource;
6.5 import org.netbeans.api.java.source.JavaSource.Phase;
6.6 import org.netbeans.api.java.source.Task;
6.7 -import org.netbeans.modules.contrib.testng.TestNGEntityResolver;
6.8 import org.netbeans.modules.gsf.testrunner.api.TestSuite;
6.9 import org.netbeans.modules.gsf.testrunner.api.Trouble;
6.10 import org.openide.cookies.EditorCookie;
6.11 @@ -68,11 +67,6 @@
6.12 import org.openide.text.Line;
6.13 import org.openide.text.Line.ShowOpenType;
6.14 import org.openide.text.Line.ShowVisibilityType;
6.15 -import org.openide.util.Exceptions;
6.16 -import org.openide.xml.XMLUtil;
6.17 -import org.xml.sax.InputSource;
6.18 -import org.xml.sax.SAXException;
6.19 -import org.xml.sax.XMLReader;
6.20
6.21 /**
6.22 *
7.1 --- a/testng/src/org/netbeans/modules/contrib/testng/resources/layer.xml Thu Feb 02 20:29:07 2012 +0400
7.2 +++ b/testng/src/org/netbeans/modules/contrib/testng/resources/layer.xml Sat Feb 04 21:12:07 2012 +0100
7.3 @@ -51,6 +51,14 @@
7.4 </folder>
7.5 </folder>
7.6 </folder>
7.7 + <folder name="x-testng+xml">
7.8 + <folder name="HyperlinkProviders">
7.9 + <file name="TestNGSuiteHyperlingProvider.instance">
7.10 + <attr name="instanceClass" stringvalue="org.netbeans.modules.contrib.testng.TestNGSuiteHyperlingProvider"/>
7.11 + <attr name="instanceOf" stringvalue="org.netbeans.lib.editor.hyperlink.spi.HyperlinkProvider"/>
7.12 + </file>
7.13 + </folder>
7.14 + </folder>
7.15 </folder>
7.16 </folder>
7.17 <folder name="Loaders">