beehive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mm...@apache.org
Subject svn commit: rev 46142 - incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/processor/reflection
Date Thu, 16 Sep 2004 01:22:55 GMT
Author: mmerz
Date: Wed Sep 15 18:22:54 2004
New Revision: 46142

Modified:
   incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/processor/reflection/ReflectionProcessingTest.java
Log:
Added test for the reflection annotation processing.

Contributor: Daryoush Mehrtash


Modified: incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/processor/reflection/ReflectionProcessingTest.java
==============================================================================
--- incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/processor/reflection/ReflectionProcessingTest.java
(original)
+++ incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/processor/reflection/ReflectionProcessingTest.java
Wed Sep 15 18:22:54 2004
@@ -1,24 +1,85 @@
 package org.apache.beehive.wsm.jsr181.processor.reflection;
 
+import java.util.Collection;
+import java.util.List;
+
 import junit.framework.TestCase;
 
+import org.apache.beehive.wsm.jsr181.model.WebServiceMETHODMetadata;
+import org.apache.beehive.wsm.jsr181.model.WebServicePARAMETERMetadata;
 import org.apache.beehive.wsm.jsr181.model.WebServiceTYPEMetadata;
 import org.apache.beehive.wsm.jsr181.processor.reflection.WsmReflectionAnnotationProcessor;
 
-
 public class ReflectionProcessingTest extends TestCase {
-    
-    public void setUp( ) {
+
+    public void setUp() {
     }
-    
-    public void tearDown( ) {
-        
+
+    public void tearDown() {
+
     }
+
     public void testMetaDataFromCompiledClass() throws Exception {
-         WebServiceTYPEMetadata model= WsmReflectionAnnotationProcessor.getObjectModel(Class.forName("Foo"));
-         assertTrue("Unexpected Webservice name", model.getWsName().compareTo("Abacus") ==
0);
-    }
+        WebServiceTYPEMetadata model = WsmReflectionAnnotationProcessor
+                .getObjectModel(Class.forName("Foo"));
+        assertTrue("Unexpected Webservice name", model.getWsName().compareTo(
+                "Abacus") == 0);
+
+        //TODO: get the endpointInterface
+
+        assertTrue(model.getWsTargetNamespace().compareTo(
+                "http://www.superflaco.com/AnnotationTest") == 0);
+        Collection<WebServiceMETHODMetadata> methods = model.getMethods();
 
+        for (WebServiceMETHODMetadata nxtMethod : methods) {
+            if (nxtMethod.getWmOperationName().compareTo("GoLoco") == 0) {
+                assertTrue(nxtMethod.getWmAction().compareTo("LocoAction") == 0);
+                assertTrue(nxtMethod.getWrName().compareTo("result") == 0);
+                // test parameters
+
+                List<WebServicePARAMETERMetadata> params = nxtMethod
+                        .getParams();
+                for (WebServicePARAMETERMetadata nxtParam : params) {
+
+                    if (nxtParam.getWpName().compareTo("in0") == 0) {
+                        assertTrue("Invalid return type: "
+                                + nxtParam.getJavaType(), nxtParam
+                                .getJavaType() == int.class);
+                    } else if (nxtParam.getWpName().compareTo("detail") == 0) {
+                        assertTrue("Invalid return type: "
+                                + nxtParam.getJavaType(), nxtParam
+                                .getJavaType() == String.class);
+
+                    } else {
+                        assertTrue("Found an unexpected parameter: "
+                                + nxtParam.getJavaType(), false);
+
+                    }
+                }
+            } else if (nxtMethod.getWmOperationName().compareTo("goHome") == 0) {
+                assertTrue(nxtMethod.isOneWay());
+                List<WebServicePARAMETERMetadata> params = nxtMethod
+                        .getParams();
+                // test parameters
+                for (WebServicePARAMETERMetadata nxtParam : params) {
+
+                    if (nxtParam.getWpName().compareTo("when") == 0) {
+                        assertTrue("Invalid return type: "
+                                + nxtParam.getJavaType(), nxtParam
+                                .getJavaType() == long.class);
+                    } else {
+                        assertTrue("Found an unexpected parameter: "
+                                + nxtParam.getJavaType(), false);
+
+                    }
+                }
+
+            } else {
+                assertTrue("Found an unexpected method: "
+                        + nxtMethod.getWmOperationName(), false);
+            }
+
+        }
+    }
+}
 
-    
-}
\ No newline at end of file

Mime
View raw message