geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgenen...@apache.org
Subject svn commit: r514994 - in /geronimo/server/trunk/modules: geronimo-axis2/src/test/java/org/apache/geronimo/axis2/ geronimo-axis2/src/test/java/org/apache/geronimo/axis2/testdata/ geronimo-tomcat6-builder/src/main/java/org/apache/geronimo/tomcat/deployme...
Date Tue, 06 Mar 2007 06:31:28 GMT
Author: jgenender
Date: Mon Mar  5 22:31:27 2007
New Revision: 514994

URL: http://svn.apache.org/viewvc?view=rev&rev=514994
Log:
Add test for application.xml vs default generated plan

Modified:
    geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2AbstractTestCase.java
    geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2WebServiceContainerTest.java
    geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/testdata/HelloWorld.java
    geronimo/server/trunk/modules/geronimo-tomcat6-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
    geronimo/server/trunk/modules/geronimo-tomcat6-builder/src/test/java/org/apache/geronimo/tomcat/deployment/PlanParsingTest.java

Modified: geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2AbstractTestCase.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2AbstractTestCase.java?view=diff&rev=514994&r1=514993&r2=514994
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2AbstractTestCase.java
(original)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2AbstractTestCase.java
Mon Mar  5 22:31:27 2007
@@ -24,7 +24,7 @@
 public abstract class Axis2AbstractTestCase
     extends TestSupport
 {
-    protected String testDir = "src/main/test/";
+    protected String testDir = "src/test/";
     protected String sampleDir = "src/main/test/samples/";
     protected String outDir = "target/generated/samples/";
     protected String tempDir = "target/generated/temp";

Modified: geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2WebServiceContainerTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2WebServiceContainerTest.java?view=diff&rev=514994&r1=514993&r2=514994
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2WebServiceContainerTest.java
(original)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2WebServiceContainerTest.java
Mon Mar  5 22:31:27 2007
@@ -19,12 +19,14 @@
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.StringReader;
 import java.net.URI;
 import java.util.HashMap;
 
 import org.apache.geronimo.axis2.pojo.POJOWebServiceContainer;
 import org.apache.geronimo.jaxws.PortInfo;
 import org.apache.geronimo.webservices.WebServiceContainer.Request;
+import org.xml.sax.InputSource;
 
 public class Axis2WebServiceContainerTest extends Axis2AbstractTestCase {
     public Axis2WebServiceContainerTest(String testName) {
@@ -34,18 +36,44 @@
     public void testInvokeWithWSDLDocLit() throws Exception {
         testInvokeWithWSDL("test_service_doc_lit_request.xml", "test_service_doc_lit.wsdl");
     }
-    
+
     //TODO:
     public void testInvokeWithWSDLRPCLit() throws Exception {
     }
-    
+
+    public void testGetWSDL() throws Exception {
+        ClassLoader cl = Thread.currentThread().getContextClassLoader();
+
+        PortInfo portInfo = new PortInfo();
+        portInfo.setLocation("HelloWorld");
+        portInfo.setServiceEndpointInterfaceName("org.apache.geronimo.axis2.testdata.HelloWorld");
+//        portInfo.setWsdlFile("file://" + testDir + "/resources/test_service_doc_lit.wsdl");
+
+        Axis2Request req = new Axis2Request(504,
+                "text/xml; charset=utf-8",
+                null,
+                Request.GET,
+                new HashMap(),
+                new URI("/axis2/HelloWorld?wsdl"),
+                new HashMap(),
+                "127.0.0.1");
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        Axis2Response res = new Axis2Response("text/xml; charset=utf-8", "127.0.0.1", null,
null, 8080, out);
+        
+        String endpointClassName = "org.apache.geronimo.axis2.testdata.HelloWorld";
+        POJOWebServiceContainer container = new POJOWebServiceContainer(portInfo, endpointClassName,
cl, null, null);
+        container.invoke(req, res);
+        out.flush();
+
+    }
+
     private void testInvokeWithWSDL(String requestFile, String wsdlFile) throws Exception
{
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
         InputStream in = cl.getResourceAsStream(requestFile);
 
         PortInfo portInfo = new PortInfo();
         portInfo.setLocation("servlet");
-     
+
         try {
             Axis2Request req = new Axis2Request(504,
                     "text/xml; charset=utf-8",
@@ -55,19 +83,19 @@
                     new URI("/axis2/servlet"),
                     new HashMap(),
                     "127.0.0.1");
-            
+
             ByteArrayOutputStream out = new ByteArrayOutputStream();
             Axis2Response res = new Axis2Response("text/xml; charset=utf-8", "127.0.0.1",
null, null, 8080, out);
-            
+
             String endpointClassName = "org.apache.geronimo.axis2.testdata.HelloWorld";
-            POJOWebServiceContainer container = new POJOWebServiceContainer(portInfo, endpointClassName,
cl , null, null);
+            POJOWebServiceContainer container = new POJOWebServiceContainer(portInfo, endpointClassName,
cl, null, null);
             container.invoke(req, res);
             out.flush();
-     
-        } catch(Throwable ex){    
+
+        } catch (Throwable ex) {
             ex.printStackTrace();
             throw new Exception(ex.toString());
-        }finally {
+        } finally {
             if (in != null) {
                 try {
                     in.close();
@@ -83,6 +111,6 @@
 
     protected void tearDown() throws Exception {
     }
-    
+
 }
 

Modified: geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/testdata/HelloWorld.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/testdata/HelloWorld.java?view=diff&rev=514994&r1=514993&r2=514994
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/testdata/HelloWorld.java
(original)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/testdata/HelloWorld.java
Mon Mar  5 22:31:27 2007
@@ -19,7 +19,7 @@
 import javax.jws.WebMethod;
 import javax.jws.WebService;
 
-@WebService(name="HelloWorld")
+@WebService(name="HelloWorld", targetNamespace = "http://example.org")
 public class HelloWorld {
 
     @WebMethod

Modified: geronimo/server/trunk/modules/geronimo-tomcat6-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-tomcat6-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?view=diff&rev=514994&r1=514993&r2=514994
==============================================================================
--- geronimo/server/trunk/modules/geronimo-tomcat6-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-tomcat6-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
Mon Mar  5 22:31:27 2007
@@ -32,6 +32,7 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.jar.JarFile;
 
 import javax.servlet.Servlet;
@@ -155,10 +156,11 @@
             webApp = WebAppType.Factory.newInstance();
 
         // parse vendor dd
-        TomcatWebAppType tomcatWebApp = getTomcatWebApp(plan, moduleFile, standAlone, targetPath,
webApp);
+        AtomicBoolean usedDefault = new AtomicBoolean(false);
+        TomcatWebAppType tomcatWebApp = getTomcatWebApp(plan, moduleFile, standAlone, targetPath,
webApp, usedDefault);
 
         //If we have a context root, override everything
-        if (tomcatWebApp.isSetContextRoot()) {
+        if (tomcatWebApp.isSetContextRoot() && !usedDefault.get()) {
             contextRoot = tomcatWebApp.getContextRoot();
         } else {
             //Otherwise if no contextRoot was passed in from the ear, then make up a default
@@ -207,7 +209,7 @@
     }
 
 
-    TomcatWebAppType getTomcatWebApp(Object plan, JarFile moduleFile, boolean standAlone,
String targetPath, WebAppType webApp) throws DeploymentException {
+    TomcatWebAppType getTomcatWebApp(Object plan, JarFile moduleFile, boolean standAlone,
String targetPath, WebAppType webApp, AtomicBoolean usedDefault) throws DeploymentException
{
         XmlObject rawPlan = null;
         try {
             // load the geronimo-web.xml from either the supplied plan or from the earFile
@@ -244,6 +246,7 @@
             } else {
                 String defaultContextRoot = determineDefaultContextRoot(webApp, standAlone,
moduleFile, targetPath);
                 tomcatWebApp = createDefaultPlan(defaultContextRoot);
+                usedDefault.set(true);
             }
             return tomcatWebApp;
         } catch (XmlException e) {

Modified: geronimo/server/trunk/modules/geronimo-tomcat6-builder/src/test/java/org/apache/geronimo/tomcat/deployment/PlanParsingTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-tomcat6-builder/src/test/java/org/apache/geronimo/tomcat/deployment/PlanParsingTest.java?view=diff&rev=514994&r1=514993&r2=514994
==============================================================================
--- geronimo/server/trunk/modules/geronimo-tomcat6-builder/src/test/java/org/apache/geronimo/tomcat/deployment/PlanParsingTest.java
(original)
+++ geronimo/server/trunk/modules/geronimo-tomcat6-builder/src/test/java/org/apache/geronimo/tomcat/deployment/PlanParsingTest.java
Mon Mar  5 22:31:27 2007
@@ -19,6 +19,7 @@
 import java.io.File;
 import java.net.URL;
 import java.util.Collections;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import junit.framework.TestCase;
 import org.apache.geronimo.deployment.xbeans.ArtifactType;
@@ -64,7 +65,7 @@
         URL resourceURL = classLoader.getResource("plans/plan1.xml");
         File resourcePlan = new File(resourceURL.getFile());
         assertTrue(resourcePlan.exists());
-        TomcatWebAppType tomcatWebApp = builder.getTomcatWebApp(resourcePlan, null, true,
null, null);
+        TomcatWebAppType tomcatWebApp = builder.getTomcatWebApp(resourcePlan, null, true,
null, null, new AtomicBoolean(false));
         assertEquals(1, tomcatWebApp.getResourceRefArray().length);
     }
 



Mime
View raw message