[nobug] Update tests for executing under Java 11
Change-Id: Ic22bb2be20ea51d242ee47a36cafbbceac27d12e
Signed-off-by: Nitin Dahyabhai <thatnitind@gmail.com>
diff --git a/jaxws/bundles/org.eclipse.jst.ws.annotations.core/META-INF/MANIFEST.MF b/jaxws/bundles/org.eclipse.jst.ws.annotations.core/META-INF/MANIFEST.MF
index 6724265..c9ff759 100644
--- a/jaxws/bundles/org.eclipse.jst.ws.annotations.core/META-INF/MANIFEST.MF
+++ b/jaxws/bundles/org.eclipse.jst.ws.annotations.core/META-INF/MANIFEST.MF
@@ -2,6 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jst.ws.annotations.core;singleton:=true
+Automatic-Module-Name: org.eclipse.jst.ws.annotations.core
Bundle-Version: 1.2.200.qualifier
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/jaxws/bundles/org.eclipse.jst.ws.annotations.core/src/org/eclipse/jst/ws/annotations/core/utils/AnnotationUtils.java b/jaxws/bundles/org.eclipse.jst.ws.annotations.core/src/org/eclipse/jst/ws/annotations/core/utils/AnnotationUtils.java
index b233666..757108d 100644
--- a/jaxws/bundles/org.eclipse.jst.ws.annotations.core/src/org/eclipse/jst/ws/annotations/core/utils/AnnotationUtils.java
+++ b/jaxws/bundles/org.eclipse.jst.ws.annotations.core/src/org/eclipse/jst/ws/annotations/core/utils/AnnotationUtils.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 IONA Technologies PLC, Shane Clarke
+ * Copyright (c) 2008, 2020 IONA Technologies PLC, Shane Clarke, and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -22,6 +22,7 @@
import java.util.Set;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -320,6 +321,7 @@
final String annotationSimpleName = qualifiedName.substring(qualifiedName.lastIndexOf(".") + 1);
final List<String> occurences = new ArrayList<String>();
AnnotationDefinition annotationDefinition = AnnotationsManager.getAnnotationDefinitionForClass(qualifiedName);
+ Assert.isNotNull(annotationDefinition, "Annotation definition for " + qualifiedName + " in project " + javaElement.getJavaProject().getElementName() + " was unexpectedly null");
annotationDefinition.setJavaProject(javaElement.getJavaProject());
List<ElementType> elementTypes = Collections.emptyList();
if (annotationDefinition != null) {
diff --git a/jaxws/bundles/org.eclipse.jst.ws.jaxws.ui/build.properties b/jaxws/bundles/org.eclipse.jst.ws.jaxws.ui/build.properties
index 8b0366c..3f27cd9 100755
--- a/jaxws/bundles/org.eclipse.jst.ws.jaxws.ui/build.properties
+++ b/jaxws/bundles/org.eclipse.jst.ws.jaxws.ui/build.properties
@@ -1,5 +1,5 @@
src.includes = *
-src.excludes = src
+src.excludes = src/
source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
diff --git a/jaxws/tests/org.eclipse.jst.ws.jaxb.core.tests/src/org/eclipse/jst/ws/jaxb/core/tests/TestJavaProject.java b/jaxws/tests/org.eclipse.jst.ws.jaxb.core.tests/src/org/eclipse/jst/ws/jaxb/core/tests/TestJavaProject.java
index 66703a4..dfe5545 100644
--- a/jaxws/tests/org.eclipse.jst.ws.jaxb.core.tests/src/org/eclipse/jst/ws/jaxb/core/tests/TestJavaProject.java
+++ b/jaxws/tests/org.eclipse.jst.ws.jaxb.core.tests/src/org/eclipse/jst/ws/jaxb/core/tests/TestJavaProject.java
@@ -9,11 +9,17 @@
*******************************************************************************/
package org.eclipse.jst.ws.jaxb.core.tests;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IWorkspaceDescription;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.jdt.apt.core.util.AptConfig;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -26,8 +32,10 @@
import org.eclipse.jdt.launching.IVMInstall2;
import org.eclipse.jdt.launching.IVMInstallType;
import org.eclipse.jdt.launching.JavaRuntime;
+import org.osgi.framework.Bundle;
public class TestJavaProject extends TestProject {
+ private static final String[] ADDITIONAL_REQUIRED_BUNDLES = new String[]{"javax.xml.bind"};
private IJavaProject javaProject;
public TestJavaProject(String projectName) throws CoreException {
@@ -39,7 +47,20 @@
createSourceFolder();
addToClasspath(javaProject, getJREContainerEntry());
- createOutputFolder();
+
+ for (String bundleName : ADDITIONAL_REQUIRED_BUNDLES) {
+ Bundle bundle = Platform.getBundle(bundleName);
+ assertNotNull("The " + bundleName + " bundle was not found", bundle);
+ String location = bundle.getLocation();
+ if (location.indexOf("reference:file:") >= 0) {
+ location = location.substring(location.indexOf("reference:file:") + "reference:file:".length());
+ }
+ IPath absoluteLocation = Path.fromOSString(location).makeAbsolute();
+ assertTrue("Expected jar at " + absoluteLocation + " does not exist", absoluteLocation.toFile().exists());
+ addToClasspath(javaProject, JavaCore.newLibraryEntry(absoluteLocation, null, null));
+ }
+
+ createOutputFolder();
}
public void setAutoBuilding(boolean autoBuild) throws CoreException {
diff --git a/jaxws/tests/org.eclipse.jst.ws.jaxws.core.tests/META-INF/MANIFEST.MF b/jaxws/tests/org.eclipse.jst.ws.jaxws.core.tests/META-INF/MANIFEST.MF
index ec23a41..95fb7bc 100644
--- a/jaxws/tests/org.eclipse.jst.ws.jaxws.core.tests/META-INF/MANIFEST.MF
+++ b/jaxws/tests/org.eclipse.jst.ws.jaxws.core.tests/META-INF/MANIFEST.MF
@@ -2,6 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jst.ws.jaxws.core.tests
+Automatic-Module-Name: org.eclipse.jst.ws.jaxws.core.tests
Bundle-Version: 1.0.300.qualifier
Bundle-Vendor: %pluginProvider
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/jaxws/tests/org.eclipse.jst.ws.jaxws.core.tests/pom.xml b/jaxws/tests/org.eclipse.jst.ws.jaxws.core.tests/pom.xml
index 4e37da8..e0bcb50 100644
--- a/jaxws/tests/org.eclipse.jst.ws.jaxws.core.tests/pom.xml
+++ b/jaxws/tests/org.eclipse.jst.ws.jaxws.core.tests/pom.xml
@@ -40,6 +40,11 @@
<id>javax.jws</id>
<versionRange>0.0.0</versionRange>
</requirement>
+ <requirement>
+ <type>eclipse-plugin</type>
+ <id>javax.xml.ws</id>
+ <versionRange>0.0.0</versionRange>
+ </requirement>
</extraRequirements>
</dependency-resolution>
</configuration>
diff --git a/jaxws/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/SOAPBindingRPCStyleOnMethodRuleTest.java b/jaxws/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/SOAPBindingRPCStyleOnMethodRuleTest.java
index 14dfaee..a8cbc5c 100644
--- a/jaxws/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/SOAPBindingRPCStyleOnMethodRuleTest.java
+++ b/jaxws/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/SOAPBindingRPCStyleOnMethodRuleTest.java
@@ -79,7 +79,12 @@
IMarker[] allmarkers = source.getResource().findMarkers(IMarker.PROBLEM, true,
IResource.DEPTH_INFINITE);
- assertEquals(1, allmarkers.length);
+ StringBuilder messages = new StringBuilder();
+ for (int i = 0; i < allmarkers.length; i++) {
+ messages.append(allmarkers[i].getAttribute(IMarker.MESSAGE));
+ messages.append("\n");
+ }
+ assertEquals(messages.toString(), 1, allmarkers.length);
IMarker annotationProblemMarker = allmarkers[0];
diff --git a/jaxws/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/WebServiceSEINoWebResultRuleTest.java b/jaxws/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/WebServiceSEINoWebResultRuleTest.java
index 8082fc8..bbac331 100644
--- a/jaxws/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/WebServiceSEINoWebResultRuleTest.java
+++ b/jaxws/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/WebServiceSEINoWebResultRuleTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Shane Clarke.
+ * Copyright (c) 2009, 2020 Shane Clarke and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -55,8 +55,12 @@
IMarker[] allmarkers = source.getResource().findMarkers(IMarker.PROBLEM, true,
IResource.DEPTH_INFINITE);
-
- assertEquals(1, allmarkers.length);
+ StringBuilder messages = new StringBuilder();
+ for (int i = 0; i < allmarkers.length; i++) {
+ messages.append(allmarkers[i].getAttribute(IMarker.MESSAGE));
+ messages.append('\n');
+ }
+ assertEquals(messages.toString(), 1, allmarkers.length);
IMarker annotationProblemMarker = allmarkers[0];
diff --git a/jaxws/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/tests/RemoveAnnotationFromFieldTest.java b/jaxws/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/tests/RemoveAnnotationFromFieldTest.java
index 23d5a8d..8c4610e 100644
--- a/jaxws/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/tests/RemoveAnnotationFromFieldTest.java
+++ b/jaxws/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/tests/RemoveAnnotationFromFieldTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Shane Clarke.
+ * Copyright (c) 2009, 2020 Shane Clarke and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -65,7 +65,7 @@
assertTrue(executeChange(new NullProgressMonitor(), textFileChange));
assertFalse(AnnotationUtils.isAnnotationPresent(field, AnnotationUtils.getAnnotationName(annotation)));
- assertFalse(source.getImport(WebServiceRef.class.getCanonicalName()).exists());
+ assertFalse("import statement for " + WebServiceRef.class.getCanonicalName() + " was still there", source.getImport(WebServiceRef.class.getCanonicalName()).exists());
} catch (CoreException ce) {
fail(ce.getLocalizedMessage());
}
diff --git a/jaxws/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/tests/TestJavaProject.java b/jaxws/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/tests/TestJavaProject.java
index ed0ef6c..02b21cf 100644
--- a/jaxws/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/tests/TestJavaProject.java
+++ b/jaxws/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/tests/TestJavaProject.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Shane Clarke.
+ * Copyright (c) 2009, 2020 Shane Clarke and Others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -12,11 +12,17 @@
*******************************************************************************/
package org.eclipse.jst.ws.jaxws.core.tests;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IWorkspaceDescription;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.jdt.apt.core.util.AptConfig;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -29,9 +35,11 @@
import org.eclipse.jdt.launching.IVMInstall2;
import org.eclipse.jdt.launching.IVMInstallType;
import org.eclipse.jdt.launching.JavaRuntime;
+import org.osgi.framework.Bundle;
public class TestJavaProject extends TestProject {
- private IJavaProject javaProject;
+ private static final String[] ADDITIONAL_REQUIRED_BUNDLES = new String[]{"javax.xml.ws", "javax.jws"};
+ private IJavaProject javaProject;
public TestJavaProject(String projectName) throws CoreException {
super(projectName);
@@ -41,9 +49,22 @@
javaProject.setRawClasspath(new IClasspathEntry[0], null);
createSourceFolder();
- addToClasspath(javaProject, getJREContainerEntry());
- createOutputFolder();
- }
+
+ for (String bundleName : ADDITIONAL_REQUIRED_BUNDLES) {
+ Bundle bundle = Platform.getBundle(bundleName);
+ assertNotNull("The " + bundleName + " bundle was not found", bundle);
+ String location = bundle.getLocation();
+ if (location.indexOf("reference:file:") >= 0) {
+ location = location.substring(location.indexOf("reference:file:") + "reference:file:".length());
+ }
+ IPath absoluteLocation = Path.fromOSString(location).makeAbsolute();
+ assertTrue("Expected jar at " + absoluteLocation + " does not exist", absoluteLocation.toFile().exists());
+ addToClasspath(javaProject, JavaCore.newLibraryEntry(absoluteLocation, null, null));
+ }
+
+ addToClasspath(javaProject, getJREContainerEntry());
+ createOutputFolder();
+ }
public void setAutoBuilding(boolean autoBuild) throws CoreException {
IWorkspaceDescription description = ResourcesPlugin.getWorkspace().getDescription();
diff --git a/jaxws/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/project/TestProjectsUtils.java b/jaxws/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/project/TestProjectsUtils.java
index 0224cdb..d7fa20c 100755
--- a/jaxws/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/project/TestProjectsUtils.java
+++ b/jaxws/tests/org.eclipse.jst.ws.jaxws.testutils/src/org/eclipse/jst/ws/jaxws/testutils/project/TestProjectsUtils.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 by SAP AG, Walldorf.
+ * Copyright (c) 2009, 2020 by SAP AG, Walldorf, and Others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -12,6 +12,9 @@
*******************************************************************************/
package org.eclipse.jst.ws.jaxws.testutils.project;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
@@ -30,8 +33,11 @@
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
@@ -52,6 +58,7 @@
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.osgi.framework.Bundle;
public class TestProjectsUtils
{
@@ -123,6 +130,17 @@
project.setDescription(description, null);
IJavaProject javaP = JavaCore.create(project);
addToClasspath(javaP, JavaRuntime.getDefaultJREContainerEntry());
+ for (String bundleName : new String[] {"javax.jws", "javax.xml.ws"}) {
+ Bundle bundle = Platform.getBundle(bundleName);
+ assertNotNull("The " + bundleName + " bundle was not found", bundle);
+ String location = bundle.getLocation();
+ if (location.indexOf("reference:file:") >= 0) {
+ location = location.substring(location.indexOf("reference:file:") + "reference:file:".length());
+ }
+ IPath absoluteLocation = Path.fromOSString(location).makeAbsolute();
+ assertTrue("Expected jar at " + absoluteLocation + " does not exist", absoluteLocation.toFile().exists());
+ addToClasspath(javaP, JavaCore.newLibraryEntry(absoluteLocation, null, null));
+ }
return project;
}