You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by sc...@apache.org on 2010/06/29 23:49:01 UTC
svn commit: r959117 - in /axis/axis2/java/core/trunk/modules/metadata:
src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
test/org/apache/axis2/jaxws/description/GetSyncOperationTests.java
Author: scheu
Date: Tue Jun 29 21:49:01 2010
New Revision: 959117
URL: http://svn.apache.org/viewvc?rev=959117&view=rev
Log:
AXIS2-4758
Contributor: Rich Scheuerle (design) and Paul Mariduena (test)
The algorithm to find a JAX-WS synchronous method is improved.
A testcase is contributed to verify the code.
Modified:
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/GetSyncOperationTests.java
Modified: axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java?rev=959117&r1=959116&r2=959117&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java Tue Jun 29 21:49:01 2010
@@ -905,7 +905,11 @@ class OperationDescriptionImpl
* @see org.apache.axis2.jaxws.description.OperationDescription#getSyncOperation()
*/
public OperationDescription getSyncOperation() {
-
+ if (log.isDebugEnabled()) {
+ log.debug("Current OperationDescription Web Method annotation \"operation\" name: "
+ + getOperationName());
+ log.debug("Current OperationDescription java method name: " + getJavaMethodName());
+ }
if (syncOperationDescription != null) {
// No need to do anything; the sync operation has already been set and will be
// returned below
@@ -923,16 +927,15 @@ class OperationDescriptionImpl
webMethodAnnoName != javaMethodName) {
EndpointInterfaceDescription eid = getEndpointInterfaceDescription();
if (eid != null) {
- //searching for opDesc of sync operation.
- OperationDescription[] ods = null;
- ods = eid.getOperationForJavaMethod(webMethodAnnoName);
- if (ods != null) {
- for (OperationDescription od : ods) {
- if (od.getJavaMethodName().equals(webMethodAnnoName)
- && !od.isJAXWSAsyncClientMethod()) {
- opDesc = od;
- break;
- }
+ //searching for operationDescription of synchronous operation.
+ OperationDescription[] allOperations = eid.getOperations();
+ // Find a method that has a matching annotation but is not
+ // an asynchronous operation.
+ for (OperationDescription operation : allOperations) {
+ if (webMethodAnnoName.equals(operation.getOperationName()) &&
+ !operation.isJAXWSAsyncClientMethod()) {
+ opDesc = operation;
+ break;
}
}
}
@@ -940,9 +943,13 @@ class OperationDescriptionImpl
// Note that opDesc might still be null
syncOperationDescription = opDesc;
}
+ if (log.isDebugEnabled()) {
+ log.debug("Synchronous operationDescription: " + syncOperationDescription);
+ }
return syncOperationDescription;
}
+
public String getAction() {
return getAnnoWebMethodAction();
}
Modified: axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/GetSyncOperationTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/GetSyncOperationTests.java?rev=959117&r1=959116&r2=959117&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/GetSyncOperationTests.java (original)
+++ axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/GetSyncOperationTests.java Tue Jun 29 21:49:01 2010
@@ -94,6 +94,44 @@ public class GetSyncOperationTests exten
}
+ public void testSyncMismatchedCaseOperation() {
+ ServiceDescription sDesc =
+ DescriptionFactory.createServiceDescription(null,
+ new QName("org.apache.axis2.jaxws.description", "syncOperationTestService3"),
+ javax.xml.ws.Service.class);
+ EndpointDescription eDesc =
+ DescriptionFactory.updateEndpoint(sDesc,
+ SyncAndAsyncSEIMismatchedCase.class,
+ new QName("org.apache.axis2.jaxws.description", "syncOperationTestPort3"),
+ DescriptionFactory.UpdateType.GET_PORT);
+ EndpointInterfaceDescription eiDesc = eDesc.getEndpointInterfaceDescription();
+ OperationDescription opDescs[] = eiDesc.getOperations();
+ assertNotNull(opDescs);
+ assertEquals(3, opDescs.length);
+ // Make sure each of the async operations reference the sync opDesc
+ int asyncOperations = 0;
+
+ //essentially getting the java-cased sync method name "echo"
+ OperationDescription syncOpDescs[] = eiDesc.getOperationForJavaMethod("echo");
+ assertNotNull(syncOpDescs);
+ assertEquals(1, syncOpDescs.length);
+ // In this test case, only 1 sync method exists for the interface
+ // SyncAndAsyncSEIMismatchedCase, namely "echo"
+ OperationDescription syncOpDesc = syncOpDescs[0];
+
+ for (OperationDescription opDesc : opDescs) {
+ if (opDesc.isJAXWSAsyncClientMethod()) {
+ asyncOperations++;
+ // Make sure the sync operation can be found from the
+ // async operation's getSyncOperation() newly corrected
+ // fail-safe algorithm
+ assertEquals(syncOpDesc, opDesc.getSyncOperation());
+ }
+ }
+
+ assertEquals(2, asyncOperations);
+ }
+
}
@WebService
@@ -116,3 +154,14 @@ interface SyncAndAsyncSEI {
@WebMethod(operationName = "echo")
public String echo(String toEcho);
}
+
+@WebService
+interface SyncAndAsyncSEIMismatchedCase {
+ @WebMethod(operationName = "Echo")
+ public Response<String> echoAsync(String toEcho);
+ @WebMethod(operationName = "Echo")
+ public Future<?> echoAsync(String toEcho, AsyncHandler<String> asyncHandler);
+ @WebMethod(operationName = "Echo")
+ public String echo(String toEcho);
+}
+