Bugs #277016 and #275565
diff --git a/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/JAXWSCoreMessages.java b/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/JAXWSCoreMessages.java
index c49eeed..551e685 100644
--- a/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/JAXWSCoreMessages.java
+++ b/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/JAXWSCoreMessages.java
@@ -27,13 +27,11 @@
public static String ONEWAY_NO_RETURN_VALUE_ERROR_MESSAGE;
public static String ONEWAY_NO_CHECKED_EXCEPTIONS_ERROR_MESSAGE;
- public static String ONEWAY_NO_OUT_PARAMETERS;
- public static String ONEWAY_NO_INOUT_PARAMETERS;
-
- public static String HOLDER_TYPE_PARAMETER_ERROR_MESSAGE;
+ public static String ONEWAY_NO_HOLDER_PARAMETERS;
public static String WEBPARAM_MODE_OUT_INOUT_HOLDER_TYPE_ERROR_MESSAGE;
-
-// public static String DOC_BARE_ONE_NON_HEADER_IN_PARAMETER_ERROR_MESSAGE;
+
+ public static String HOLDER_TYPE_MUST_BE_OUT_INOUT_ERROR_MESSAGE;
+
public static String DOC_BARE_NON_VOID_RETURN_NO_INOUT_OUT_PARAMETER;
public static String DOC_BARE_ONLY_ONE_NON_HEADER_IN_PARAMETER_ERROR_MESSAGE;
public static String DOC_BARE_VOID_RETURN_ONE_IN_PARAMETER;
@@ -54,7 +52,7 @@
public static String WEBSERVICE_ENDPOINTINTERFACE_SEI_ERROR_MESSAGE;
public static String WEBSERVICE_PORTNAME_SEI_ERROR_MESSAGE;
public static String WEBSERVICE_SERVICENAME_SEI_ERROR_MESSAGE;
- public static String WEBSERVICE_ENPOINTINTERFACE_NO_WEBMETHOS_ERROR_MESSAGE;
+ public static String WEBSERVICE_ENPOINTINTERFACE_NO_WEBMETHODS_ERROR_MESSAGE;
public static String WEBSERVICE_WEBSERVICEPROVIDER_COMBINATION_ERROR_MESSAGE;
public static String SOAPBINDING_ON_METHOD_STYLE_DOCUMENT_ONLY_MESSAGE;
diff --git a/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/JAXWSCoreMessages.properties b/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/JAXWSCoreMessages.properties
index 088adec..e736c93 100644
--- a/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/JAXWSCoreMessages.properties
+++ b/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/JAXWSCoreMessages.properties
@@ -29,10 +29,10 @@
WEBSERVICE_WEBSERVICEPROVIDER_COMBINATION_ERROR_MESSAGE=@WebService and @WebServiceProvider annotations cannot both be present on the same class
ONEWAY_NO_RETURN_VALUE_ERROR_MESSAGE=@Oneway methods must not return a value
ONEWAY_NO_CHECKED_EXCEPTIONS_ERROR_MESSAGE=@Oneway methods must not declare any checked exceptions
-ONEWAY_NO_OUT_PARAMETERS=@Oneway methods cannot have any @WebParam.Mode.OUT parameters
-ONEWAY_NO_INOUT_PARAMETERS=@Oneway methods cannot have any @WebParam.Mode.INOUT parameters
-HOLDER_TYPE_PARAMETER_ERROR_MESSAGE=Parameters that conform to the definition of Holder Types must be annotated with @WebParam.Mode.OUT or @WebParam.Mode.INOUT
+ONEWAY_NO_HOLDER_PARAMETERS=@Oneway methods must not accept any javax.xml.ws.Holder<T> parameters.
+#HOLDER_TYPE_PARAMETER_ERROR_MESSAGE=Parameters that conform to the definition of Holder Types must be annotated with @WebParam.Mode.OUT or @WebParam.Mode.INOUT
WEBPARAM_MODE_OUT_INOUT_HOLDER_TYPE_ERROR_MESSAGE=The @WebParam.Mode.OUT and @WebParam.Mode.INOUT modes may only be specified for javax.xml.ws.Holder<T> parameters
+HOLDER_TYPE_MUST_BE_OUT_INOUT_ERROR_MESSAGE=javax.xml.ws.Holder<T> parameters must be @WebParam.Mode.OUT or @WebParam.Mode.INOUT
SOAPBINDING_ON_METHOD_STYLE_DOCUMENT_ONLY_MESSAGE=The @SOAPBinding annotation may be placed on a method if and only if the SOAPBinding.style is DOCUMENT
SOAPBINDING_NO_PARAMETERSTYLE_WHEN_ENCODED_MESSAGE=A method that has a SOAPBinding.use of ENCODED cannot have a SOAPBinding.parameterStyle present
#DOC_BARE_ONE_NON_HEADER_IN_PARAMETER_ERROR_MESSAGE=Document literal bare methods must have one non-header IN parameter
diff --git a/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/annotations/validation/HolderTypeParametersRule.java b/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/annotations/validation/HolderTypeParametersRule.java
index eea5dd8..54ab965 100644
--- a/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/annotations/validation/HolderTypeParametersRule.java
+++ b/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/annotations/validation/HolderTypeParametersRule.java
@@ -48,23 +48,22 @@
.getDeclarationsAnnotatedWith(annotationDeclaration);
for (Declaration declaration : annotatedTypes) {
- if (declaration instanceof ClassDeclaration) {
- Collection<AnnotationMirror> annotationMirrors = declaration.getAnnotationMirrors();
- for (AnnotationMirror mirror : annotationMirrors) {
- if (AnnotationUtils.findAnnotationValue(mirror, "endpointInterface").length() > 0) {
- break;
- } else {
- validateParameters((ClassDeclaration)declaration);
- }
- }
- }
- if (declaration instanceof InterfaceDeclaration) {
- validateParameters((InterfaceDeclaration) declaration);
+// if (declaration instanceof ClassDeclaration) {
+// Collection<AnnotationMirror> annotationMirrors = declaration.getAnnotationMirrors();
+// for (AnnotationMirror mirror : annotationMirrors) {
+// if (AnnotationUtils.findAnnotationValue(mirror, "endpointInterface").length() > 0) {
+// break;
+// } else {
+// validateParameters((ClassDeclaration)declaration);
+// }
+// }
+// }
+ if (declaration instanceof TypeDeclaration) {
+ validateParameters((TypeDeclaration) declaration);
}
}
}
-
private void validateParameters(TypeDeclaration typeDeclaration) {
Messager messager = environment.getMessager();
Collection<? extends MethodDeclaration> methods = typeDeclaration.getMethods();
@@ -72,22 +71,33 @@
Collection<ParameterDeclaration> parameters = methodDeclaration.getParameters();
for (ParameterDeclaration parameter : parameters) {
TypeMirror typeMirror = environment.getTypeUtils().getErasure(parameter.getType());
- if (hasWebParamModeOutOrInOut(parameter)) {
- if (!typeMirror.toString().equals(Holder.class.getCanonicalName())) {
- messager.printError(parameter.getPosition(),
+ boolean isHolderParameter = typeMirror.toString().equals(Holder.class.getCanonicalName());
+ if (isWebParamOutInoutMode(parameter) && !isHolderParameter) {
+ messager.printError(parameter.getPosition(),
JAXWSCoreMessages.WEBPARAM_MODE_OUT_INOUT_HOLDER_TYPE_ERROR_MESSAGE);
- }
- } else {
-// if (typeMirror.toString().equals(Holder.class.getCanonicalName())) {
-// messager.printError(parameter.getPosition(),
-// JAXWSCoreMessages.HOLDER_TYPE_PARAMETER_ERROR_MESSAGE);
-// }
+ } else if (isHolderParameter && isWebParamInMode(parameter)){
+ messager.printError(parameter.getPosition(),
+ JAXWSCoreMessages.HOLDER_TYPE_MUST_BE_OUT_INOUT_ERROR_MESSAGE);
}
}
}
-
}
- private boolean hasWebParamModeOutOrInOut(ParameterDeclaration parameter) {
+
+ private boolean isWebParamInMode(ParameterDeclaration parameter) {
+ Collection<AnnotationMirror> annotatinMirrors = parameter.getAnnotationMirrors();
+ for (AnnotationMirror mirror : annotatinMirrors) {
+ AnnotationTypeDeclaration annotationTypeDeclaration = mirror.getAnnotationType().getDeclaration();
+ if (annotationTypeDeclaration.getQualifiedName().equals(WebParam.class.getCanonicalName())) {
+ String mode = AnnotationUtils.findAnnotationValue(mirror, MODE); //$NON-NLS-1$
+ if (mode.equals(WebParam.Mode.IN.toString())) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean isWebParamOutInoutMode(ParameterDeclaration parameter) {
Collection<AnnotationMirror> annotatinMirrors = parameter.getAnnotationMirrors();
for (AnnotationMirror mirror : annotatinMirrors) {
AnnotationTypeDeclaration annotationTypeDeclaration = mirror.getAnnotationType().getDeclaration();
diff --git a/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/annotations/validation/OnewayRules.java b/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/annotations/validation/OnewayRules.java
index 79fce8a..9acb641 100644
--- a/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/annotations/validation/OnewayRules.java
+++ b/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/annotations/validation/OnewayRules.java
@@ -12,10 +12,9 @@
import java.util.Collection;
-import javax.jws.WebParam;
+import javax.xml.ws.Holder;
import org.eclipse.jst.ws.annotations.core.processor.AbstractAnnotationProcessor;
-import org.eclipse.jst.ws.annotations.core.utils.AnnotationUtils;
import org.eclipse.jst.ws.internal.jaxws.core.JAXWSCoreMessages;
import com.sun.mirror.apt.Messager;
@@ -24,6 +23,7 @@
import com.sun.mirror.declaration.Declaration;
import com.sun.mirror.declaration.MethodDeclaration;
import com.sun.mirror.declaration.ParameterDeclaration;
+import com.sun.mirror.type.TypeMirror;
/**
*
@@ -54,30 +54,19 @@
printError(annotationDeclaration, methodDeclaration,
JAXWSCoreMessages.ONEWAY_NO_CHECKED_EXCEPTIONS_ERROR_MESSAGE);
}
- checkParameters(methodDeclaration);
+ checkParameters(methodDeclaration, annotationDeclaration);
}
}
}
- private void checkParameters(MethodDeclaration methodDeclaration) {
+ private void checkParameters(MethodDeclaration methodDeclaration,
+ AnnotationTypeDeclaration annotationDeclaration) {
Collection<ParameterDeclaration> parameters = methodDeclaration.getParameters();
for (ParameterDeclaration parameter : parameters) {
- Collection<AnnotationMirror> annotatinMirrors = parameter.getAnnotationMirrors();
- for (AnnotationMirror mirror : annotatinMirrors) {
- AnnotationTypeDeclaration annotationTypeDeclaration = mirror.getAnnotationType()
- .getDeclaration();
- if (annotationTypeDeclaration.getQualifiedName().equals(WebParam.class.getCanonicalName())) {
- String mode = AnnotationUtils.findAnnotationValue(mirror, "mode"); //$NON-NLS-1$
- if (mode.equals(WebParam.Mode.OUT.toString())) {
- environment.getMessager().printError(mirror.getPosition(),
- JAXWSCoreMessages.ONEWAY_NO_OUT_PARAMETERS);
- }
- if (mode.equals(WebParam.Mode.INOUT.toString())) {
- environment.getMessager().printError(mirror.getPosition(),
- JAXWSCoreMessages.ONEWAY_NO_INOUT_PARAMETERS);
- }
-
- }
+ TypeMirror typeMirror = environment.getTypeUtils().getErasure(parameter.getType());
+ if (typeMirror.toString().equals(Holder.class.getCanonicalName())) {
+ printError(annotationDeclaration, methodDeclaration,
+ JAXWSCoreMessages.ONEWAY_NO_HOLDER_PARAMETERS);
}
}
}
@@ -94,6 +83,4 @@
}
}
}
-
-
}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/annotations/validation/WebServiceSEIPresentNoWebMethodRule.java b/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/annotations/validation/WebServiceSEIPresentNoWebMethodRule.java
index e94e3b5..a150f57 100644
--- a/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/annotations/validation/WebServiceSEIPresentNoWebMethodRule.java
+++ b/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/annotations/validation/WebServiceSEIPresentNoWebMethodRule.java
@@ -76,7 +76,7 @@
if (mirror.getAnnotationType().toString().equals(webMethodDeclaration
.getQualifiedName())) {
messager.printError(mirror.getPosition(), JAXWSCoreMessages
- .WEBSERVICE_ENPOINTINTERFACE_NO_WEBMETHOS_ERROR_MESSAGE);
+ .WEBSERVICE_ENPOINTINTERFACE_NO_WEBMETHODS_ERROR_MESSAGE);
}
}
}
diff --git a/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/AbstractOnewayValidationTest.java b/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/AbstractOnewayValidationTest.java
index 1d6284b..7cc38ca 100644
--- a/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/AbstractOnewayValidationTest.java
+++ b/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/AbstractOnewayValidationTest.java
@@ -47,14 +47,16 @@
public abstract String getErrorMessage();
+ public abstract IMethod getMethodToTest();
+
public void testOnewayRule() {
try {
assertNotNull(annotation);
assertEquals("Oneway", AnnotationUtils.getAnnotationName(annotation));
- IMethod method = source.findPrimaryType().getMethod("myMethod", new String[]{"I"});
+ IMethod method = getMethodToTest();
assertNotNull(method);
-
+
AnnotationUtils.getImportChange(compilationUnit, javax.jws.Oneway.class, textFileChange, true);
AnnotationUtils.createMethodAnnotationChange(source, compilationUnit, rewriter, method,
diff --git a/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/DocBareVoidOneINOneOutParameterRuleTest.java b/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/DocBareVoidOneINOneOutParameterRuleTest.java
index 29b4a74..8ba58fd 100644
--- a/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/DocBareVoidOneINOneOutParameterRuleTest.java
+++ b/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/DocBareVoidOneINOneOutParameterRuleTest.java
@@ -38,7 +38,7 @@
classContents.append("String inTwo) {\n\n\t}\n\n\t");
classContents.append("public void oneOut(@WebParam(name=\"outOne\", mode=WebParam.Mode.INOUT) ");
classContents.append("Holder<String> outOne, @WebParam(name=\"outTwo\", mode=WebParam.Mode.OUT) ");
- classContents.append("String outTwo) {\n\n\t}\n\n}");
+ classContents.append("Holder<String> outTwo) {\n\n\t}\n\n}");
return classContents.toString();
}
@@ -48,7 +48,7 @@
assertEquals("SOAPBinding", AnnotationUtils.getAnnotationName(annotation));
IMethod method = source.findPrimaryType().getMethod("oneIn", new String[] { "QHolder<QString;>;",
- "QString; "});
+ "QString;"});
assertNotNull(method);
@@ -90,7 +90,7 @@
assertEquals("SOAPBinding", AnnotationUtils.getAnnotationName(annotation));
IMethod method = source.findPrimaryType().getMethod("oneOut", new String[] { "QHolder<QString;>;",
- "QString; "});
+ "QHolder<QString;>;"});
assertNotNull(method);
diff --git a/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/HolderTypeParameterRuleTest.java b/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/HolderTypeParameterRuleTest.java
new file mode 100644
index 0000000..b23549c
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/HolderTypeParameterRuleTest.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Shane Clarke.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Shane Clarke - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.core.annotation.validation.tests;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jst.ws.annotations.core.AnnotationsCore;
+import org.eclipse.jst.ws.annotations.core.utils.AnnotationUtils;
+import org.eclipse.jst.ws.internal.jaxws.core.JAXWSCoreMessages;
+
+/**
+ *
+ * @author sclarke
+ *
+ */
+public class HolderTypeParameterRuleTest extends AbstractAnnotationValidationTest {
+
+ @Override
+ public Annotation getAnnotation() {
+ return AnnotationsCore.createAnnotation(ast, javax.jws.WebService.class, javax.jws.WebService.class
+ .getSimpleName(), null);
+ }
+
+ @Override
+ public String getPackageName() {
+ return "com.example";
+ }
+
+ @Override
+ public String getClassName() {
+ return "MyClass.java";
+ }
+
+ @Override
+ public String getClassContents() {
+ StringBuilder classContents = new StringBuilder("package com.example;\n\n");
+ classContents.append("import javax.jws.WebParam;\n");
+ classContents.append("import javax.xml.ws.Holder;\n\n");
+ classContents.append("public class MyClass {\n\n\tpublic void myMethod(");
+ classContents.append("@WebParam(mode=WebParam.Mode.IN) Holder<java.lang.String> param) {\n\n\t}\n}");
+ return classContents.toString();
+ }
+
+ public void testHolderTypeParameterRule() {
+ try {
+ assertNotNull(annotation);
+ assertEquals("WebService", AnnotationUtils.getAnnotationName(annotation));
+
+ AnnotationUtils.getImportChange(compilationUnit, javax.jws.WebService.class, textFileChange,
+ true);
+
+ AnnotationUtils.createTypeAnnotationChange(source, compilationUnit, rewriter, annotation,
+ textFileChange);
+
+ assertTrue(executeChange(new NullProgressMonitor(), textFileChange));
+
+ assertTrue(AnnotationUtils.isAnnotationPresent(source, AnnotationUtils
+ .getAnnotationName(annotation)));
+
+ Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
+
+ IMarker[] allmarkers = source.getResource().findMarkers(IMarker.PROBLEM, true,
+ IResource.DEPTH_INFINITE);
+
+ assertEquals(1, allmarkers.length);
+
+ IMarker annotationProblemMarker = allmarkers[0];
+
+ assertEquals(source.getResource(), annotationProblemMarker.getResource());
+ assertEquals(JAXWSCoreMessages.HOLDER_TYPE_MUST_BE_OUT_INOUT_ERROR_MESSAGE,
+ annotationProblemMarker.getAttribute(IMarker.MESSAGE));
+ } catch (CoreException ce) {
+ fail(ce.getLocalizedMessage());
+ }catch (OperationCanceledException oce) {
+ fail(oce.getLocalizedMessage());
+ } catch (InterruptedException ie) {
+ fail(ie.getLocalizedMessage());
+ }
+ }
+}
diff --git a/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/JAXWSAnnotationValidationTestSuite.java b/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/JAXWSAnnotationValidationTestSuite.java
index 545df11..ccf8b2b 100644
--- a/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/JAXWSAnnotationValidationTestSuite.java
+++ b/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/JAXWSAnnotationValidationTestSuite.java
@@ -31,8 +31,8 @@
addTestSuite(DocBareVoidOneINOneOutParameterRuleTest.class);
addTestSuite(OnewayNoReturnValueRuleTest.class);
addTestSuite(OnewayNoCheckedExceptionsRuleTest.class);
- addTestSuite(OnewayNoOutParametersRuleTest.class);
- addTestSuite(OnewayNoInOutParametersRuleTest.class);
+ addTestSuite(HolderTypeParameterRuleTest.class);
+ addTestSuite(OnewayNoHolderParametersRuleTest.class);
addTestSuite(SOAPBindingMethodStyleDocumentRuleTest.class);
addTestSuite(SOAPBindingMethodUseRuleTest.class);
addTestSuite(WebMethodCheckForWebServiceRuleTest.class);
diff --git a/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/OnewayNoCheckedExceptionsRuleTest.java b/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/OnewayNoCheckedExceptionsRuleTest.java
index 0ebc30a..680f047 100644
--- a/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/OnewayNoCheckedExceptionsRuleTest.java
+++ b/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/OnewayNoCheckedExceptionsRuleTest.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.jst.ws.jaxws.core.annotation.validation.tests;
+import org.eclipse.jdt.core.IMethod;
import org.eclipse.jst.ws.internal.jaxws.core.JAXWSCoreMessages;
/**
@@ -31,4 +32,9 @@
return JAXWSCoreMessages.ONEWAY_NO_CHECKED_EXCEPTIONS_ERROR_MESSAGE;
}
+ @Override
+ public IMethod getMethodToTest() {
+ return source.findPrimaryType().getMethod("myMethod", new String[]{"I"});
+ }
+
}
diff --git a/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/OnewayNoOutParametersRuleTest.java b/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/OnewayNoHolderParametersRuleTest.java
similarity index 67%
rename from tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/OnewayNoOutParametersRuleTest.java
rename to tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/OnewayNoHolderParametersRuleTest.java
index ac0bed6..c38c3af 100644
--- a/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/OnewayNoOutParametersRuleTest.java
+++ b/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/OnewayNoHolderParametersRuleTest.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.jst.ws.jaxws.core.annotation.validation.tests;
+import org.eclipse.jdt.core.IMethod;
import org.eclipse.jst.ws.internal.jaxws.core.JAXWSCoreMessages;
/**
@@ -17,20 +18,25 @@
* @author sclarke
*
*/
-public class OnewayNoOutParametersRuleTest extends AbstractOnewayValidationTest {
+public class OnewayNoHolderParametersRuleTest extends AbstractOnewayValidationTest {
@Override
protected String getClassContents() {
StringBuilder classContents = new StringBuilder("package com.example;\n\n");
- classContents.append("import javax.jws.WebParam;\n\n");
- classContents.append("public class MyClass {\n\n\tpublic void myMethod(@WebParam(");
- classContents.append("mode=WebParam.Mode.OUT) int i) {\n\t}\n}");
+ classContents.append("import javax.xml.ws.Holder;\n\n");
+ classContents.append("public class MyClass {\n\n\tpublic void myMethod(");
+ classContents.append("Holder<String> in) {\n\t}\n}");
return classContents.toString();
}
@Override
public String getErrorMessage() {
- return JAXWSCoreMessages.ONEWAY_NO_OUT_PARAMETERS;
+ return JAXWSCoreMessages.ONEWAY_NO_HOLDER_PARAMETERS;
+ }
+
+ @Override
+ public IMethod getMethodToTest() {
+ return source.findPrimaryType().getMethod("myMethod", new String[]{"QHolder<QString;>;"});
}
}
diff --git a/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/OnewayNoInOutParametersRuleTest.java b/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/OnewayNoInOutParametersRuleTest.java
deleted file mode 100644
index a0bf563..0000000
--- a/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/OnewayNoInOutParametersRuleTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Shane Clarke.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Shane Clarke - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.ws.jaxws.core.annotation.validation.tests;
-
-import org.eclipse.jst.ws.internal.jaxws.core.JAXWSCoreMessages;
-
-/**
- *
- * @author sclarke
- *
- */
-public class OnewayNoInOutParametersRuleTest extends AbstractOnewayValidationTest {
-
- @Override
- protected String getClassContents() {
- StringBuilder classContents = new StringBuilder("package com.example;\n\n");
- classContents.append("import javax.jws.WebParam;\n\n");
- classContents.append("public class MyClass {\n\n\tpublic void myMethod(@WebParam(");
- classContents.append("mode=WebParam.Mode.INOUT) int i) {\n\t}\n}");
- return classContents.toString();
- }
-
- @Override
- public String getErrorMessage() {
- return JAXWSCoreMessages.ONEWAY_NO_INOUT_PARAMETERS;
- }
-}
diff --git a/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/OnewayNoReturnValueRuleTest.java b/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/OnewayNoReturnValueRuleTest.java
index 76767d4..a1a6718 100644
--- a/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/OnewayNoReturnValueRuleTest.java
+++ b/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/OnewayNoReturnValueRuleTest.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.jst.ws.jaxws.core.annotation.validation.tests;
+import org.eclipse.jdt.core.IMethod;
import org.eclipse.jst.ws.internal.jaxws.core.JAXWSCoreMessages;
/**
@@ -29,5 +30,10 @@
public String getErrorMessage() {
return JAXWSCoreMessages.ONEWAY_NO_RETURN_VALUE_ERROR_MESSAGE;
}
+
+ @Override
+ public IMethod getMethodToTest() {
+ return source.findPrimaryType().getMethod("myMethod", new String[]{"I"});
+ }
}
diff --git a/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/WebServiceSEIPresentNoWebMethodRuleTest.java b/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/WebServiceSEIPresentNoWebMethodRuleTest.java
index c6d7af3..6e3dade 100644
--- a/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/WebServiceSEIPresentNoWebMethodRuleTest.java
+++ b/tests/org.eclipse.jst.ws.jaxws.core.tests/src/org/eclipse/jst/ws/jaxws/core/annotation/validation/tests/WebServiceSEIPresentNoWebMethodRuleTest.java
@@ -86,7 +86,7 @@
IMarker annotationProblemMarker = allmarkers[0];
assertEquals(source.getResource(), annotationProblemMarker.getResource());
- assertEquals(JAXWSCoreMessages.WEBSERVICE_ENPOINTINTERFACE_NO_WEBMETHOS_ERROR_MESSAGE,
+ assertEquals(JAXWSCoreMessages.WEBSERVICE_ENPOINTINTERFACE_NO_WEBMETHODS_ERROR_MESSAGE,
annotationProblemMarker.getAttribute(IMarker.MESSAGE));
} catch (CoreException ce) {
fail(ce.getLocalizedMessage());