Author: dims Date: Tue Nov 2 13:28:59 2004 New Revision: 56419 Added: geronimo/trunk/modules/axis/src/etc/ geronimo/trunk/modules/axis/src/etc/META-INF/ geronimo/trunk/modules/axis/src/etc/META-INF/geronimo-service.xml geronimo/trunk/modules/axis/src/etc/META-INF/services/ geronimo/trunk/modules/axis/src/etc/META-INF/services/org.apache.axis.deployment.wsdd.Provider geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/EJBWSGBean.java geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/GeronimoProvider.java geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/POJOWSGBean.java geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/ReferenceCollectionImpl.java geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/WSConfigBuilder.java geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/WSDDJavaGeronimoProvider.java geronimo/trunk/modules/axis/src/plans/ geronimo/trunk/modules/axis/src/plans/plan1.xml geronimo/trunk/modules/axis/src/samples/echo-pojo/ geronimo/trunk/modules/axis/src/samples/echo-pojo/WEB-INF/ geronimo/trunk/modules/axis/src/samples/echo-pojo/WEB-INF/web.xml geronimo/trunk/modules/axis/src/samples/echo-pojo/WEB-INF/webservices.xml geronimo/trunk/modules/axis/src/samples/echo-pojo/build.xml geronimo/trunk/modules/axis/src/samples/echo-pojo/org/ geronimo/trunk/modules/axis/src/samples/echo-pojo/org/apache/ geronimo/trunk/modules/axis/src/samples/echo-pojo/org/apache/ws/ geronimo/trunk/modules/axis/src/samples/echo-pojo/org/apache/ws/echosample/ geronimo/trunk/modules/axis/src/samples/echo-pojo/org/apache/ws/echosample/Echo.java geronimo/trunk/modules/axis/src/samples/echo-pojo/org/apache/ws/echosample/EchoBean.java geronimo/trunk/modules/axis/src/samples/echo-pojo/org/apache/ws/echosample/EchoStruct.java geronimo/trunk/modules/axis/src/samples/echo-pojo/org/apache/ws/echosample/SmallEchoStruct.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AbstractWebServiceTest.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/SimpleEJBWebServiceTest.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/SimplePOJOWebServiceTest.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/WSConfigBuilderTest.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/preconditions/ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/preconditions/AdminClientDeploymentTest.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/preconditions/ClassLoadingTest.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/preconditions/DynamicEJBDeploymentTest.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/preconditions/EWSTest.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/preconditions/GBeanConfigTest.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/AxisGeronimoConstants.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/J2EEManager.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/J2EEManagerTest.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/JettyServiceWrapper.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/TestServer.java Removed: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGeronimoConstants.java geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/DependancyManager.java geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/J2EEManager.java geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/WebServiceDeployer.java geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/WebServiceDeployerGbean.java geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/WebServiceManager.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AdminClientDeploymentTest.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/ClassLoadingTest.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/DynamicEJBDeploymentTest.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/EWSTest.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/JettyServiceWrapper.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/TestServer.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/WebServiceDeploymentTest.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/WebServiceTest.java Modified: geronimo/trunk/modules/axis/maven.xml geronimo/trunk/modules/axis/project.xml geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGbean.java geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGeronimoUtils.java geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/GeronimoWsDeployContext.java geronimo/trunk/modules/axis/src/samples/echo/META-INF/ejb-jar.xml geronimo/trunk/modules/axis/src/samples/echo/META-INF/webservice.xml geronimo/trunk/modules/axis/src/samples/echo/build.xml geronimo/trunk/modules/axis/src/samples/echo/org/apache/ws/echosample/Echo.java geronimo/trunk/modules/axis/src/samples/echo/org/apache/ws/echosample/EchoBean.java geronimo/trunk/modules/axis/src/samples/echo/org/apache/ws/echosample/EchoStruct.java geronimo/trunk/modules/axis/src/samples/echo/org/apache/ws/echosample/SmallEchoStruct.java geronimo/trunk/modules/axis/src/test-resources/deployables/axis/WEB-INF/geronimo-web.xml geronimo/trunk/modules/axis/src/test-resources/deployables/axis/WEB-INF/web.xml geronimo/trunk/modules/axis/src/test-resources/deployables/axis/index.html geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisGBeanTest.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/ComplexTypeWebServiceTest.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/EchoHeadersTest.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/J2EEManagerTest.java Log: Latest fixes from Srinath and some code cleanup from me.
=========================================== Most of the cooments from the community is incoperated with this patch. This patch remove the referances to the kernel and remove hardcoded obj names. add a POJO sample and it's test case is working. there is a problem with the EJB test case will fix that and send a patch. =========================================== Modified: geronimo/trunk/modules/axis/maven.xml ============================================================================== --- geronimo/trunk/modules/axis/maven.xml (original) +++ geronimo/trunk/modules/axis/maven.xml Tue Nov 2 13:28:59 2004 @@ -1,11 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> - <project default="jar" xmlns:j="jelly:core" xmlns:maven="jelly:maven" xmlns:deploy="deploy" xmlns:ant="jelly:ant"> - <goal name="setclasspath"> <path id="test.classpath"> <path refid="maven.dependency.classpath"/> @@ -13,35 +11,60 @@ </path> </goal> + <!-- + <preGoal name="test:compile"> + <ant:javac + destdir="${basedir}/target/test-classes" + debug="on" + fork="true"> + <src path="${basedir}/src/test"/> + <ant:classpath> + <ant:path refid="maven.dependency.classpath"/> + <ant:pathelement path="${maven.build.dest}"/> + </ant:classpath> + </ant:javac> + </preGoal> + --> <preGoal name="test:test"> - <j:if test="${context.getVariable('maven.test.skip') != 'true'}"> - <deploy:copy-deps todir="${basedir}/target/lib"/> - <ant:java classname="org.apache.geronimo.ews.ws4j2ee.utils.PropertyStore" fork="no"> - <ant:arg value="${maven.repo.local}"/> - <ant:classpath refid="maven.dependency.classpath"/> - </ant:java> - <j:jelly xmlns="jelly:ant"> - <ant:ant antfile="build.xml" - inheritall="true" - inheritrefs="true" - dir="src/samples/echo"/> - <taskdef name="ews" classname="org.apache.geronimo.ews.ws4j2ee.utils.EWSTask"> - <classpath refid="maven.dependency.classpath"/> - </taskdef> - <ews outDir="target/generated/samples" module="target/samples/echo.jar"> + <j:if test="${context.getVariable('maven.test.skip') != 'true'}"> + <deploy:copy-deps todir="${basedir}/target/lib"/> + <ant:java classname="org.apache.geronimo.ews.ws4j2ee.utils.PropertyStore" fork="no"> + <ant:arg value="${maven.repo.local}"/> <ant:classpath refid="maven.dependency.classpath"/> - </ews> + </ant:java> + <j:jelly xmlns="jelly:ant"> + <ant:ant antfile="build.xml" + inheritall="true" + inheritrefs="true" + dir="src/samples/echo"/> + <ant:ant antfile="build.xml" + inheritall="true" + inheritrefs="true" + dir="src/samples/echo-pojo"/> + <taskdef name="ews" classname="org.apache.geronimo.ews.ws4j2ee.utils.EWSTask"> + <classpath refid="maven.dependency.classpath"/> + </taskdef> + <ews outDir="target/generated/samples/echo-jar" module="target/samples/echo.jar"> + <ant:classpath refid="maven.dependency.classpath"/> + </ews> + <ews outDir="target/generated/samples/echo-war" module="target/samples/echo.war"> + <ant:classpath refid="maven.dependency.classpath"/> + </ews> - <!-- The following ant task cause the build to break - if building with JAVA 5. The JAVA 5 'enum' reserved - word is used in the source code being compiled. - The generated ANT file might need to pass the - -source 1.4 option to the java compiler --> - <ant:ant antfile="build.xml" - inheritall="true" - inheritrefs="true" - dir="target/generated/samples"/> - </j:jelly> - </j:if> + <!-- The following ant task cause the build to break + if building with JAVA 5. The JAVA 5 'enum' reserved + word is used in the source code being compiled. + The generated ANT file might need to pass the + -source 1.4 option to the java compiler --> + <ant:ant antfile="build.xml" + inheritall="true" + inheritrefs="true" + dir="target/generated/samples/echo-jar"/> + <ant:ant antfile="build.xml" + inheritall="true" + inheritrefs="true" + dir="target/generated/samples/echo-war"/> + </j:jelly> + </j:if> </preGoal> </project> Modified: geronimo/trunk/modules/axis/project.xml ============================================================================== --- geronimo/trunk/modules/axis/project.xml (original) +++ geronimo/trunk/modules/axis/project.xml Tue Nov 2 13:28:59 2004 @@ -23,7 +23,6 @@ ]> <!-- $Rev$ $Date$ --> - <project> <pomVersion>3</pomVersion> <extend>${basedir}/../../etc/project.xml</extend> @@ -31,7 +30,6 @@ <!-- ===================== --> <!-- Module Identification --> <!-- ===================== --> - <name>Geronimo :: Axis</name> <id>geronimo-axis</id> <shortDescription>Axis Integration</shortDescription> @@ -39,13 +37,11 @@ <url>http://geronimo.apache.org/modules/axis/</url> <siteDirectory>/www/geronimo.apache.org/modules/axis</siteDirectory> <distributionDirectory>/www/incubator.apache.org/projects/geronimo/builds/axis</distributionDirectory> - <package>org.apache.geronimo.axis</package> <!-- ============ --> <!-- Dependencies --> <!-- ============ --> - <dependencies> <dependency> <groupId>geronimo</groupId> @@ -60,7 +56,6 @@ <artifactId>xbean-apache</artifactId> <version>&xmlbeans-version;</version> </dependency> - <dependency> <groupId>geronimo</groupId> <artifactId>geronimo-kernel</artifactId> @@ -79,13 +74,11 @@ <artifactId>geronimo-jetty</artifactId> <version>${pom.currentVersion}</version> </dependency> - <dependency> <groupId>geronimo</groupId> <artifactId>geronimo-deployment</artifactId> <version>${pom.currentVersion}</version> </dependency> - <dependency> <groupId>geronimo</groupId> <artifactId>geronimo-naming</artifactId> @@ -94,13 +87,11 @@ <xmlbeans>true</xmlbeans> </properties> </dependency> - <dependency> <groupId>geronimo</groupId> <artifactId>geronimo-j2ee</artifactId> <version>${pom.currentVersion}</version> </dependency> - <dependency> <groupId>geronimo</groupId> <artifactId>geronimo-security</artifactId> @@ -109,31 +100,26 @@ <xmlbeans>true</xmlbeans> </properties> </dependency> - <dependency> <groupId>geronimo</groupId> <artifactId>geronimo-transaction</artifactId> <version>${pom.currentVersion}</version> </dependency> - <dependency> <groupId>geronimo</groupId> <artifactId>geronimo-connector</artifactId> <version>${pom.currentVersion}</version> </dependency> - <dependency> <groupId>geronimo</groupId> <artifactId>geronimo-common</artifactId> <version>${pom.currentVersion}</version> </dependency> - <dependency> <groupId>geronimo</groupId> <artifactId>geronimo-system</artifactId> <version>${pom.currentVersion}</version> </dependency> - <dependency> <groupId>geronimo</groupId> <artifactId>geronimo-timer</artifactId> @@ -142,31 +128,26 @@ <runtime>true</runtime> </properties> </dependency> - <dependency> <groupId>geronimo-spec</groupId> <artifactId>geronimo-spec-jta</artifactId> <version>&geronimo-spec-jta-version;</version> </dependency> - <dependency> <groupId>geronimo-spec</groupId> <artifactId>geronimo-spec-j2ee-jacc</artifactId> <version>&geronimo-spec-j2ee-jacc-version;</version> </dependency> - <dependency> <groupId>geronimo-spec</groupId> <artifactId>geronimo-spec-j2ee-connector</artifactId> <version>&geronimo-spec-j2ee-connector-version;</version> </dependency> - <dependency> <groupId>geronimo-spec</groupId> <artifactId>geronimo-spec-j2ee-deployment</artifactId> <version>&geronimo-spec-j2ee-deployment-version;</version> </dependency> - <dependency> <groupId>geronimo</groupId> <artifactId>geronimo-j2ee-schema</artifactId> @@ -180,19 +161,16 @@ <artifactId>geronimo-spec-ejb</artifactId> <version>&geronimo-spec-ejb-version;</version> </dependency> - <dependency> <groupId>jetty</groupId> <artifactId>org.mortbay.jetty</artifactId> <version>&jetty-version;</version> </dependency> - <dependency> <groupId>mx4j</groupId> <artifactId>mx4j</artifactId> <version>&mx4j-version;</version> </dependency> - <dependency> <groupId>dom4j</groupId> <artifactId>dom4j</artifactId> @@ -208,71 +186,60 @@ <artifactId>geronimo-spec-servlet</artifactId> <version>&geronimo-spec-servlet-version;</version> </dependency> - <dependency> <groupId>geronimo-spec</groupId> <artifactId>geronimo-spec-jsp</artifactId> <version>&geronimo-spec-jsp-version;</version> </dependency> - <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>&commons-logging-version;</version> <url>http://jakarta.apache.org/commons/logging/</url> </dependency> - <dependency> <groupId>tomcat</groupId> <artifactId>jasper-compiler</artifactId> <version>&tomcat-version;</version> </dependency> - <dependency> <groupId>tomcat</groupId> <artifactId>jasper-runtime</artifactId> <version>&tomcat-version;</version> </dependency> - <dependency> <groupId>commons-el</groupId> <artifactId>commons-el</artifactId> <version>&commons-el-version;</version> <url>http://jakarta.apache.org/commons/el/</url> </dependency> - <dependency> <groupId>ant</groupId> <artifactId>ant</artifactId> <version>&ant-version;</version> </dependency> - <dependency> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> <version>&xerces-version;</version> </dependency> - <dependency> <groupId>cglib</groupId> <artifactId>cglib-full</artifactId> <version>&cglib-version;</version> <url>http://cglib.sf.net/</url> </dependency> - <dependency> <groupId>concurrent</groupId> <artifactId>concurrent</artifactId> <version>&concurrent-version;</version> </dependency> - <dependency> <groupId>regexp</groupId> <artifactId>regexp</artifactId> <version>®exp-version;</version> <url>http://jakarta.apache.org/regexp</url> </dependency> - <dependency> <groupId>tranql</groupId> <artifactId>tranql</artifactId> @@ -295,8 +262,7 @@ <module>true</module> </properties> </dependency> - - <dependency> + <dependency> <groupId>xmlbeans</groupId> <artifactId>xbean-apache-1.0</artifactId> <version>DEV</version> @@ -304,7 +270,6 @@ <module>true</module> </properties> </dependency> - <dependency> <groupId>axis</groupId> <artifactId>axis</artifactId> @@ -375,7 +340,6 @@ <!-- =================== --> <!-- Build Specification --> <!-- =================== --> - <build> <resources> <resource> @@ -385,15 +349,10 @@ </resources> <unitTest> <includes> - <include>**/*Test.java</include> + <include>**/SimplePOJO*Test.java</include> </includes> - <excludes> - <exclude>**/Abstract*.java</exclude> - <exclude>**/EWSTest.java</exclude> - <exclude>**/ComplexTypeWebServiceTest.java</exclude> - </excludes> - + </excludes> <resources> <resource> <directory>${basedir}/src/test-resources</directory> Added: geronimo/trunk/modules/axis/src/etc/META-INF/geronimo-service.xml ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/etc/META-INF/geronimo-service.xml Tue Nov 2 13:28:59 2004 @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Copyright 2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<gbeans> + <path>geronimo-transaction-DEV.jar</path> + <path>geronimo-spec-jta-DEV.jar</path> + <path>geronimo-spec-j2ee-connector-DEV.jar</path> + + <!-- transaction --> + <gbean class="org.apache.geronimo.transaction.TransactionManagerProxy" objectName="geronimo.transaction:service=TransactionManager"/> +</gbeans> \ No newline at end of file Added: geronimo/trunk/modules/axis/src/etc/META-INF/services/org.apache.axis.deployment.wsdd.Provider ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/etc/META-INF/services/org.apache.axis.deployment.wsdd.Provider Tue Nov 2 13:28:59 2004 @@ -0,0 +1 @@ +org.apache.geronimo.axis.WSDDJavaGeronimoProvider \ No newline at end of file Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGbean.java ============================================================================== --- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGbean.java (original) +++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGbean.java Tue Nov 2 13:28:59 2004 @@ -16,8 +16,6 @@ package org.apache.geronimo.axis; -import javax.management.ObjectName; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.geronimo.gbean.GBeanInfo; @@ -27,40 +25,18 @@ import org.apache.geronimo.kernel.Kernel; import org.apache.geronimo.kernel.jmx.JMXUtil; +import javax.management.ObjectName; +import java.util.Collection; + /** * Class AxisGbean */ public class AxisGbean implements GBeanLifecycle { private static Log log = LogFactory.getLog(AxisGbean.class); - /** - * Field name - */ private final String name; - - /** - * Field kernel - */ - private final Kernel kernel; - - /** - * Field GBEAN_INFO - */ private static final GBeanInfo GBEAN_INFO; - - /** - * Field objectName - */ private final ObjectName objectName; - /** - * Field wscontiner - */ - private WebServiceManager wscontiner; - - private WebServiceDeployer wsdeployer; - - private J2EEManager j2eeManager; - static { GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("AxisGbean", AxisGbean.class); @@ -69,18 +45,11 @@ infoFactory.addAttribute("Name", String.class, true); infoFactory.addAttribute("kernel", Kernel.class, false); infoFactory.addAttribute("objectName", String.class, false); + infoFactory.addReference("resourceManagers", Object.class); // operations infoFactory.setConstructor(new String[]{"kernel", "Name", - "objectName"}); - infoFactory.addOperation("deploy", new Class[]{String.class, - String.class, - String.class}); - infoFactory.addOperation("unDeploy", new Class[]{String.class, - String.class}); - infoFactory.addOperation("deployEWSModule", new Class[]{String.class, - String.class, - String.class}); + "objectName", "resourceManagers"}); GBEAN_INFO = infoFactory.getBeanInfo(); } @@ -91,12 +60,9 @@ * @param name * @param objectName */ - public AxisGbean(Kernel kernel, String name, String objectName) { + public AxisGbean(Kernel kernel, String name, String objectName, Collection resourceManagers) { this.name = name; - this.kernel = kernel; this.objectName = JMXUtil.getObjectName(objectName); - wscontiner = new WebServiceManager(kernel); - j2eeManager = new J2EEManager(); } /** @@ -114,13 +80,7 @@ */ public void doStart() throws WaitingException, Exception { log.info("Axis GBean has started"); - log.info(kernel); log.info(objectName); - j2eeManager.startJ2EEContainer(kernel); - wscontiner.doStart(); - wsdeployer = new WebServiceDeployer(AxisGeronimoConstants.TEMP_OUTPUT, - kernel); - } /** @@ -131,8 +91,6 @@ */ public void doStop() throws WaitingException, Exception { log.info("Axis GBean has stoped"); - wscontiner.doStop(); - j2eeManager.stopJ2EEContainer(kernel); } /** @@ -145,15 +103,6 @@ } /** - * Method getKernel - * - * @return - */ - public Kernel getKernel() { - return kernel; - } - - /** * Method getName * * @return @@ -161,20 +110,4 @@ public String getName() { return name; } - - public void deploy(String module, String j2eeApplicationName, String j2eeModuleName) - throws Exception { - wsdeployer.deploy(module, j2eeApplicationName, j2eeModuleName); - } - - public void deployEWSModule(String module, String j2eeApplicationName, String j2eeModuleName) - throws Exception { - wsdeployer.deployEWSModule(module, j2eeApplicationName, j2eeModuleName); - } - - public void unDeploy(String j2eeApplicationName, String j2eeModuleName) - throws Exception { - wsdeployer.unDeploy(j2eeApplicationName, j2eeModuleName); - } - } Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGeronimoUtils.java ============================================================================== --- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGeronimoUtils.java (original) +++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGeronimoUtils.java Tue Nov 2 13:28:59 2004 @@ -16,6 +16,9 @@ package org.apache.geronimo.axis; import org.apache.axis.AxisFault; +import org.apache.axis.client.AdminClient; +import org.apache.axis.client.Call; +import org.apache.axis.utils.ClassUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.geronimo.deployment.DeploymentException; @@ -27,19 +30,25 @@ import javax.ejb.EJBHome; import javax.management.ObjectName; import java.io.File; +import java.io.IOException; +import java.io.InputStream; import java.lang.reflect.Method; +import java.net.URL; import java.util.ArrayList; import java.util.Enumeration; import java.util.HashSet; import java.util.Set; import java.util.zip.ZipEntry; +import java.util.zip.ZipException; import java.util.zip.ZipFile; /** * Class AxisGeronimoUtils */ public class AxisGeronimoUtils { + public static final int AXIS_SERVICE_PORT = 5678; public static HashSet startedGbeans = new HashSet(); + public static final Log log = LogFactory.getLog(AxisGeronimoUtils.class); public static Object invokeEJB(String ejbName, @@ -83,7 +92,6 @@ } throw e; } - } } throw new NoSuchMethodException(methodName + " not found"); @@ -100,7 +108,6 @@ else throw AxisFault.makeFault(new Exception(e)); } - } /** @@ -169,7 +176,6 @@ file.delete(); } else { File[] files = file.listFiles(); - if (files != null) { for (int i = 0; i < files.length; i++) { delete(files[i]); @@ -188,7 +194,9 @@ String name = zipe.getName(); if (name.endsWith(".class")) { int index = name.lastIndexOf('.'); - list.add(name.substring(0, index).replace('/', '.')); + name = name.substring(0, index); + name = name.replace('\\', '.'); + list.add(name.replace('/', '.')); } } } @@ -204,6 +212,44 @@ return false; } return true; + } + public static void registerClassLoader(ZipFile module, ClassLoader classloader) throws ZipException, IOException { + ArrayList classList = AxisGeronimoUtils.getClassFileList(module); + for (int i = 0; i < classList.size(); i++) { + String className = (String) classList.get(i); + ClassUtils.setClassLoader(className, classloader); + } + } + + /** + * <p>add the entry to the Axis Confieration file about the web service. + * This find the coniguration file and and update this. There are two problems. + * Number one is service is deployed only once the Axis is restarted. And it is + * best not to do this while the Axis is running.</p> + * + * @param module + * @throws DeploymentException + */ + public static void addEntryToAxisDD(InputStream deplydd) throws DeploymentException { + try { + if (deplydd != null) { + AdminClient adminClient = new AdminClient(); + URL requestUrl = new URL("http://localhost:" + + AXIS_SERVICE_PORT + + "/axis/services/AdminService"); + Call call = adminClient.getCall(); + call.setTargetEndpointAddress(requestUrl); + String result = adminClient.process(null, deplydd); + } else { + throw new DeploymentException("the deploy.wsdd can not be found"); + } + } catch (DeploymentException e) { + throw e; + } catch (Exception e) { + e.printStackTrace(); + throw new DeploymentException(e); + } } + } Added: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/EJBWSGBean.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/EJBWSGBean.java Tue Nov 2 13:28:59 2004 @@ -0,0 +1,164 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.geronimo.axis; + +import org.apache.axis.utils.ClassUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.geronimo.gbean.GBeanInfo; +import org.apache.geronimo.gbean.GBeanInfoBuilder; +import org.apache.geronimo.gbean.GBeanLifecycle; +import org.apache.geronimo.gbean.WaitingException; +import org.apache.geronimo.kernel.config.Configuration; +import org.apache.geronimo.kernel.jmx.JMXUtil; + +import javax.management.ObjectName; +import java.util.Collection; +import java.util.Iterator; + +/** + * Class AxisGbean + */ +public class EJBWSGBean implements GBeanLifecycle { + private static Log log = LogFactory.getLog(EJBWSGBean.class); + /** + * Field name + */ + private final String name; + + /** + * Field GBEAN_INFO + */ + private static final GBeanInfo GBEAN_INFO; + + /** + * Field objectName + */ + private final ObjectName objectName; + private Configuration ejbConfig; + private Collection classList; + + static { + GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("EJBWSGBean", + EJBWSGBean.class); + + // attributes + infoFactory.addAttribute("Name", String.class, true); +// infoFactory.addAttribute("kernel", Kernel.class, false); + infoFactory.addAttribute("objectName", String.class, false); + infoFactory.addAttribute("classList", Collection.class, true); + infoFactory.addReference("ejbConfig", Configuration.class); + + // operations + infoFactory.setConstructor(new String[]{"Name", "objectName"}); + GBEAN_INFO = infoFactory.getBeanInfo(); + } + + /** + * Constructor AxisGbean + * + * @param name + * @param objectName + */ + public EJBWSGBean(String name, String objectName) { + this.name = name; +// this.axisGBean = axisGBean; + this.objectName = JMXUtil.getObjectName(objectName); +// wscontiner = new WebServiceManager(kernel); + } + + /** + * Method doFail + */ + public void doFail() { + log.info("Axis GBean has failed"); + } + + /** + * Method doStart + * + * @throws WaitingException + * @throws Exception + */ + public void doStart() throws WaitingException, Exception { + System.out.println(name + "has started"); + ClassLoader cl = ejbConfig.getClassLoader(); + for (Iterator it = classList.iterator(); it.hasNext();) { + String className = (String) it.next(); + ClassUtils.setClassLoader(className, cl); + } + AxisGeronimoUtils.addEntryToAxisDD(cl.getResourceAsStream("deploy.wsdd")); + log.info(objectName); + } + + /** + * Method doStop + * + * @throws WaitingException + * @throws Exception + */ + public void doStop() throws WaitingException, Exception { + log.info("WebServiceGBean has stoped"); + } + + /** + * Method getGBeanInfo + * + * @return + */ + public static GBeanInfo getGBeanInfo() { + return GBEAN_INFO; + } + + /** + * Method getName + * + * @return + */ + public String getName() { + return name; + } + + /** + * @return + */ + public Collection getClassList() { + return classList; + } + + /** + * @return + */ + public Configuration getEjbConfig() { + return ejbConfig; + } + + /** + * @param collection + */ + public void setClassList(Collection collection) { + classList = collection; + } + + /** + * @param configuration + */ + public void setEjbConfig(Configuration configuration) { + ejbConfig = configuration; + } + +} Added: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/GeronimoProvider.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/GeronimoProvider.java Tue Nov 2 13:28:59 2004 @@ -0,0 +1,103 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.geronimo.axis; + +import org.apache.axis.AxisFault; +import org.apache.axis.MessageContext; +import org.apache.axis.handlers.soap.SOAPService; +import org.apache.axis.providers.java.RPCProvider; +import org.apache.axis.utils.ClassUtils; + +import java.io.InputStream; +import java.lang.reflect.Method; + +/** + * register the MessageContext in the jax-rpc runtime of the JSR109 + * + * @author Srinath Perera([EMAIL PROTECTED]) + */ +public class GeronimoProvider extends RPCProvider { + public static final String OPTION_EJB_NAME = "beanName"; + public static final String OPTION_JNDI_LOOKUP_NAME = "beanJndiName"; + public static final String OPTION_HOMEINTERFACE_NAME = "homeInterfaceName"; + public static final String OPTION_REMOTEINTERFACE_NAME = "remoteInterfaceName"; + public static final String OPTION_LOCALHOMEINTERFACE_NAME = "localHomeInterfaceName"; + public static final String OPTION_LOCALINTERFACE_NAME = "localInterfaceName"; + public static final String OPTION_USE_EJB = "j2eeStyle"; + + private String ejblookupName; + private String localhome; + private String home; + private String remote; + private String local; + + private boolean ejbbased = false; + + protected Object makeNewServiceObject(MessageContext msgContext, + String clsName) + throws Exception { + SOAPService service = msgContext.getService(); + String j2eeStyle = (String) service.getOption(OPTION_LOCALINTERFACE_NAME); + if ("web".equals(j2eeStyle)) { + java.util.Properties env = new java.util.Properties(); + InputStream jndiIn = ClassUtils.getResourceAsStream(getClass(), "jndi.properties"); + if (jndiIn != null) { + env.load(jndiIn); + } else { + throw new AxisFault("Do not find the JNDI properties file in the class path"); + } + javax.naming.Context initial = new javax.naming.InitialContext(env); + ejblookupName = (String) service.getOption(OPTION_JNDI_LOOKUP_NAME); + remote = (String) service.getOption(OPTION_REMOTEINTERFACE_NAME); + home = (String) service.getOption(OPTION_HOMEINTERFACE_NAME); + local = (String) service.getOption(OPTION_LOCALINTERFACE_NAME); + localhome = (String) service.getOption(OPTION_LOCALHOMEINTERFACE_NAME); + if (remote != null && home != null && ejblookupName != null) { + Object objref = initial.lookup(ejblookupName); + Class homeClass = ClassUtils.forName(home); + Object homeObj = javax.rmi.PortableRemoteObject.narrow(objref, homeClass); + Method method = homeClass.getMethod("create", new Class[]{}); + return method.invoke(homeObj, new Object[]{}); + } else if (local != null && localhome != null && ejblookupName != null) { + Object homeObj = initial.lookup("java:comp/" + ejblookupName); + Class homeClass = ClassUtils.forName(localhome); + Method method = homeClass.getMethod("create", new Class[]{}); + return method.invoke(homeObj, new Object[]{}); + } + throw new AxisFault("Wrong configuration remote=" + remote + "home =" + home + "ejblookupName" + ejblookupName); + } else { + return super.makeNewServiceObject(msgContext, clsName); + } + } + + /* (non-Javadoc) + * @see org.apache.axis.providers.java.RPCProvider#invokeMethod(org.apache.axis.MessageContext, java.lang.reflect.Method, java.lang.Object, java.lang.Object[]) + */ + protected Object invokeMethod(MessageContext msgContext, + Method method, + Object obj, + Object[] argValues) + throws Exception { + if (ejbbased) { + throw new UnsupportedOperationException(); + } + { + Method invocationMethod = obj.getClass().getMethod(method.getName(), method.getParameterTypes()); + return invocationMethod.invoke(obj, argValues); + } + } +} Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/GeronimoWsDeployContext.java ============================================================================== --- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/GeronimoWsDeployContext.java (original) +++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/GeronimoWsDeployContext.java Tue Nov 2 13:28:59 2004 @@ -21,7 +21,6 @@ import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationConstants; import org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2eeDeployContext; - /** * Class GeronimoWsDeployContext */ Added: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/POJOWSGBean.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/POJOWSGBean.java Tue Nov 2 13:28:59 2004 @@ -0,0 +1,131 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.geronimo.axis; + +import org.apache.axis.utils.ClassUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.geronimo.gbean.GBeanInfo; +import org.apache.geronimo.gbean.GBeanInfoBuilder; +import org.apache.geronimo.gbean.GBeanLifecycle; +import org.apache.geronimo.gbean.WaitingException; +import org.apache.geronimo.kernel.Kernel; + +import java.net.URL; +import java.net.URLClassLoader; +import java.util.Collection; +import java.util.Iterator; + +/** + * Class AxisGbean + */ +public class POJOWSGBean implements GBeanLifecycle { + private static Log log = LogFactory.getLog(POJOWSGBean.class); + private final String name; + private static final GBeanInfo GBEAN_INFO; + private URL moduleURL; + private Collection classList; + + static { + GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("POJOWSGBean", + POJOWSGBean.class); + + // attributes + infoFactory.addAttribute("Name", String.class, true); + infoFactory.addAttribute("kernel", Kernel.class, false); + infoFactory.addAttribute("objectName", String.class, false); + infoFactory.addAttribute("moduleURL", URL.class, true); + infoFactory.addAttribute("classList", Collection.class, true); + // operations + infoFactory.setConstructor(new String[]{"kernel", "Name", + "objectName"}); + GBEAN_INFO = infoFactory.getBeanInfo(); + } + + public POJOWSGBean(Kernel kernel, String name, String objectName) { + this.name = name; + } + + public void doFail() { + } + + public void doStart() throws WaitingException, Exception { + ClassLoader cl = new URLClassLoader(new URL[]{moduleURL}); + for (Iterator it = classList.iterator(); it.hasNext();) { + String className = (String) it.next(); + ClassUtils.setClassLoader(className, cl); + } + AxisGeronimoUtils.addEntryToAxisDD(cl.getResourceAsStream("deploy.wsdd")); + } + + /** + * Method doStop + * + * @throws WaitingException + * @throws Exception + */ + public void doStop() throws WaitingException, Exception { +// ClassLoader cl = new URLClassLoader(new URL[]{moduleURL}); +// AxisGeronimoUtils.addEntryToAxisDD(cl.getResourceAsStream("undeploy.wsdd")); + log.info("WebServiceGBean has stoped"); + } + + /** + * Method getGBeanInfo + * + * @return + */ + public static GBeanInfo getGBeanInfo() { + return GBEAN_INFO; + } + + /** + * @return + */ + public URL getModuleURL() { + return moduleURL; + } + + /** + * @return + */ + public String getName() { + return name; + } + + /** + * @param url + */ + public void setModuleURL(URL url) { + moduleURL = url; + } + + /** + * @return + */ + public Collection getClassList() { + return classList; + } + + /** + * @param collection + */ + public void setClassList(Collection collection) { + classList = collection; + } + +} Added: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/ReferenceCollectionImpl.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/ReferenceCollectionImpl.java Tue Nov 2 13:28:59 2004 @@ -0,0 +1,155 @@ +package org.apache.geronimo.axis; + +import org.apache.geronimo.gbean.ReferenceCollection; +import org.apache.geronimo.gbean.ReferenceCollectionListener; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; + +public class ReferenceCollectionImpl implements ReferenceCollection { + private Set listeners = new HashSet(); + private boolean stopped = false; + private Map proxies = new HashMap(); + + public boolean isStopped() { + synchronized (this) { + return stopped; + } + } + + public void addReferenceCollectionListener(ReferenceCollectionListener listener) { + synchronized (this) { + listeners.add(listener); + } + } + + public void removeReferenceCollectionListener(ReferenceCollectionListener listener) { + synchronized (this) { + listeners.remove(listener); + } + } + + public int size() { + synchronized (this) { + if (stopped) { + return 0; + } + return proxies.size(); + } + } + + public boolean isEmpty() { + synchronized (this) { + if (stopped) { + return true; + } + return proxies.isEmpty(); + } + } + + public boolean contains(Object o) { + synchronized (this) { + if (stopped) { + return false; + } + return proxies.containsValue(o); + } + } + + public Iterator iterator() { + synchronized (this) { + if (stopped) { + return new Iterator() { + public boolean hasNext() { + return false; + } + + public Object next() { + throw new NoSuchElementException(); + } + + public void remove() { + throw new UnsupportedOperationException(); + } + }; + } + return new Iterator() { + // copy the proxies, so the client can iterate without concurrent modification + // this is necssary since the client has nothing to synchronize on + private final Iterator iterator = new ArrayList(proxies.values()).iterator(); + + public boolean hasNext() { + return iterator.hasNext(); + } + + public Object next() { + return iterator.next(); + } + + public void remove() { + throw new UnsupportedOperationException(); + } + }; + } + } + + public Object[] toArray() { + synchronized (this) { + if (stopped) { + return new Object[0]; + } + return proxies.values().toArray(); + } + } + + public Object[] toArray(Object a[]) { + synchronized (this) { + if (stopped) { + if (a.length > 0) { + a[0] = null; + } + return a; + } + return proxies.values().toArray(a); + } + } + + public boolean containsAll(Collection c) { + synchronized (this) { + if (stopped) { + return c.isEmpty(); + } + return proxies.values().containsAll(c); + } + } + + public boolean add(Object o) { + throw new UnsupportedOperationException(); + } + + public boolean remove(Object o) { + throw new UnsupportedOperationException(); + } + + public boolean addAll(Collection c) { + throw new UnsupportedOperationException(); + } + + public boolean removeAll(Collection c) { + throw new UnsupportedOperationException(); + } + + public boolean retainAll(Collection c) { + throw new UnsupportedOperationException(); + } + + public void clear() { + throw new UnsupportedOperationException(); + } +} Added: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/WSConfigBuilder.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/WSConfigBuilder.java Tue Nov 2 13:28:59 2004 @@ -0,0 +1,366 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.geronimo.axis; + +import org.apache.axis.utils.ClassUtils; +import org.apache.geronimo.deployment.ConfigurationBuilder; +import org.apache.geronimo.deployment.DeploymentException; +import org.apache.geronimo.gbean.GBeanInfo; +import org.apache.geronimo.gbean.GBeanInfoBuilder; +import org.apache.geronimo.gbean.WaitingException; +import org.apache.geronimo.gbean.jmx.GBeanMBean; +import org.apache.geronimo.j2ee.deployment.EARConfigBuilder; +import org.apache.geronimo.j2ee.deployment.ResourceReferenceBuilder; +import org.apache.geronimo.kernel.Kernel; +import org.apache.geronimo.kernel.config.Configuration; +import org.apache.geronimo.kernel.config.ConfigurationStore; +import org.apache.geronimo.kernel.repository.Repository; +import org.openejb.deployment.OpenEJBModuleBuilder; + +import javax.management.ObjectName; +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.net.URI; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.jar.JarFile; +import java.util.jar.JarOutputStream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +/** + * @author Srinath Perera([EMAIL PROTECTED]) + */ +public class WSConfigBuilder implements ConfigurationBuilder { + private static final String PARENT_ID = "org/apache/geronimo/Server"; + private boolean hasEJB = false; + + private final Kernel kernel; + private final Repository repository; + private final ConfigurationStore configurationStore; + private final String j2eeServerName; + private final String j2eeDomainName; + private final ObjectName j2eeServer; + private final ObjectName transactionContextManagerObjectName; + private final ObjectName connectionTrackerObjectName; + private final ObjectName transactionalTimerObjectName; + private final ObjectName nonTransactionalTimerObjectName; + private final ObjectName trackedConnectionAssocator; + + public WSConfigBuilder(ObjectName j2eeServer, + ObjectName transactionContextManagerObjectName, + ObjectName connectionTrackerObjectName, + ObjectName transactionalTimerObjectName, + ObjectName nonTransactionalTimerObjectName, + ObjectName trackedConnectionAssocator, + Repository repository, + Kernel kernel, + ConfigurationStore configurationStore) { + this.kernel = kernel; + this.repository = repository; + this.j2eeServer = j2eeServer; + j2eeServerName = j2eeServer.getKeyProperty("name"); + j2eeDomainName = j2eeServer.getDomain(); + this.transactionContextManagerObjectName = transactionContextManagerObjectName; + this.connectionTrackerObjectName = connectionTrackerObjectName; + this.transactionalTimerObjectName = transactionalTimerObjectName; + this.nonTransactionalTimerObjectName = nonTransactionalTimerObjectName; + this.trackedConnectionAssocator = trackedConnectionAssocator; + this.configurationStore = configurationStore; + } + + public void doStart() throws WaitingException, Exception { + } + + public Object getDeploymentPlan(File planFile, JarFile jarFile) throws DeploymentException { + return null; + } + + public List buildConfiguration(Object plan, JarFile earFile, File outfile) throws IOException, DeploymentException { + return null; + } + + public List buildConfiguration(Object plan, File earFile, File outfile) throws Exception { + Enumeration entires = new JarFile(earFile).entries(); + while (entires.hasMoreElements()) { + ZipEntry zipe = (ZipEntry) entires.nextElement(); + String name = zipe.getName(); + if (name.endsWith("/ejb-jar.xml")) { + hasEJB = true; + System.out.println("entry found " + name + " the web service is based on a ejb."); + //log.info("the web service is based on a ejb."); + break; + } + } + GBeanMBean[] confBeans = null; + if (hasEJB) { + File file = installEJBWebService(earFile, outfile, Thread.currentThread().getContextClassLoader()); + confBeans = loadEJBWebService(file, earFile); + } else { + File file = installPOJOWebService(earFile, outfile, Thread.currentThread().getContextClassLoader()); + confBeans = loadPOJOWebService(file); + } + + //TODO take tese from plan + ObjectName gbeanName1 = new ObjectName("geronimo.test:name=" + earFile.getName()); + ObjectName gbeanName2 = new ObjectName("geronimo.test:name=" + earFile.getName() + "EJB"); + Map gbeans = new HashMap(); + gbeans.put(gbeanName1, confBeans[0]); + if (confBeans.length > 1) + gbeans.put(gbeanName2, confBeans[1]); + byte[] state = Configuration.storeGBeans(gbeans); + GBeanMBean config = new GBeanMBean(Configuration.GBEAN_INFO); + config.setAttribute("ID", new URI("test")); + config.setReferencePatterns("Parent", null); + config.setAttribute("classPath", Collections.EMPTY_LIST); + config.setAttribute("gBeanState", state); + config.setAttribute("dependencies", Collections.EMPTY_LIST); + File sourceFile = null; + try { + sourceFile = File.createTempFile("test", ".car"); + URL source = sourceFile.toURL(); + JarOutputStream jos = new JarOutputStream(new BufferedOutputStream(new FileOutputStream(sourceFile))); + jos.putNextEntry(new ZipEntry("META-INF/config.ser")); + ObjectOutputStream oos = new ObjectOutputStream(jos); + config.getGBeanData().writeExternal(oos); + oos.flush(); + jos.closeEntry(); + jos.close(); + ArrayList list = new ArrayList(1); + list.add(configurationStore.install(source)); + return list; + } finally { + if (sourceFile != null) { + sourceFile.delete(); + } + } + } + + public GBeanMBean[] loadtheWSConfigurations(File installedLocation, File module) throws Exception { + if (hasEJB) { + return loadEJBWebService(installedLocation, module); + } else { + return loadPOJOWebService(installedLocation); + } + } + + public File installWebService(File module, File unpackedDir, ClassLoader classLoader) throws IOException, DeploymentException { + ZipFile zipfile = new ZipFile(module); + Enumeration entires = zipfile.entries(); + while (entires.hasMoreElements()) { + ZipEntry zipe = (ZipEntry) entires.nextElement(); + String name = zipe.getName(); + if (name.endsWith("/ejb-jar.xml")) { + hasEJB = true; + System.out.println("entry found " + name + " the web service is based on a ejb."); + //log.info("the web service is based on a ejb."); + break; + } + } + if (hasEJB) { + return installEJBWebService(module, unpackedDir, classLoader); + } else { + return installPOJOWebService(module, unpackedDir, classLoader); + } + } + + /** + * @param module Web Service module generated by EWS + * @param unpackedDir for WS + * @param cl + * @return the file to where Module is copied in to + */ + private File installPOJOWebService(File module, File unpackedDir, ClassLoader cl) throws IOException, DeploymentException { + ClassLoader parentClassLoder = ClassUtils.getDefaultClassLoader(); + ClassLoader classloader + = new URLClassLoader(new URL[]{module.toURL()}, parentClassLoder); + //TODO registerClassLoader(new ZipFile(module),classloader); + File out = new File(unpackedDir, module.getName()); + copyTheFile(module, out); + //The registration done from the POJOWS GBean + //addEntryToAxisDD(new ZipFile(module)); + return out; + } + + private File installEJBWebService(File module, File unpackedDir, ClassLoader cl) throws IOException, DeploymentException { + /** + * TODO following code deploy the EJB in the OpenEJB EJB continaer. + * The code is borrows from the geronimo openEJB module + * modules/core/src/test/org/openejb/deployment/EJBConfigBuilderTest.java#testEJBJarDeploy() + * Method. If this code is broken first the above test should check. If that change this will broke + * But this can quickly fix looking at it. + */ + + OpenEJBModuleBuilder moduleBuilder = new OpenEJBModuleBuilder(); + ResourceReferenceBuilder resourceReferenceBuilder = null; + EARConfigBuilder earConfigBuilder = new EARConfigBuilder(j2eeServer, + transactionContextManagerObjectName, + trackedConnectionAssocator, + transactionalTimerObjectName, + nonTransactionalTimerObjectName, + null, // Repository + moduleBuilder, + moduleBuilder, + null, + null, + resourceReferenceBuilder, // webconnector + null, // app client + null // kernel + ); + JarFile jarFile = new JarFile(module); + Object plan = earConfigBuilder.getDeploymentPlan(null, jarFile); + earConfigBuilder.buildConfiguration(plan, jarFile, unpackedDir); + + + +// OpenEJBModuleBuilder moduleBuilder = new OpenEJBModuleBuilder(); +// +// Thread.currentThread().setContextClassLoader(cl); +// +// File carFile = File.createTempFile("OpenEJBTest", ".car"); +// +// +// EARConfigBuilder earConfigBuilder +// = new EARConfigBuilder(j2eeServer, +// transactionContextManagerObjectName, +// trackedConnectionAssocator, +// transactionalTimerObjectName, +// nonTransactionalTimerObjectName, +// null, moduleBuilder, moduleBuilder, null, null, null, null, null); +// +// +// try { +// Object plan = earConfigBuilder.getDeploymentPlan(null, new JarFile(module)); +// earConfigBuilder.buildConfiguration(plan, new JarFile(module), unpackedDir); +// } finally { +// carFile.delete(); +// JarFile jarmodule = new JarFile(module); +// ZipEntry deployentry = jarmodule.getEntry("deploy.wsdd"); +// InputStream deplydd = jarmodule.getInputStream(deployentry); +// AxisGeronimoUtils.addEntryToAxisDD(deplydd); + return unpackedDir; +// } + } + + private GBeanMBean[] loadPOJOWebService(File module) throws Exception { + GBeanMBean gbean = new GBeanMBean(POJOWSGBean.getGBeanInfo()); + //TODO fill up the POJOWSGBean info + ArrayList classList = AxisGeronimoUtils.getClassFileList(new ZipFile(module)); + gbean.setAttribute("classList", classList); + gbean.setAttribute("moduleURL", module.toURL()); + return new GBeanMBean[]{gbean}; + } + + private GBeanMBean[] loadEJBWebService(File installLocation, File module) throws Exception { + GBeanMBean config = loadConfig(installLocation); + config.setAttribute("baseURL", installLocation.toURL()); + GBeanMBean gbean = new GBeanMBean(EJBWSGBean.getGBeanInfo()); + ArrayList classList = AxisGeronimoUtils.getClassFileList(new ZipFile(module)); + gbean.setAttribute("classList", classList); + gbean.setAttribute("ejbConfig", config.getTarget()); + return new GBeanMBean[]{gbean, config}; + +// ClassLoader classLoader = (ClassLoader)config.getAttribute("classLoader"); +// File[] list = installLocation.listFiles(); +// for(int i = 0; i< list.length;i++){ +// if(list[i].getName().endsWith(".jar")){ +// AxisGeronimoUtils.registerClassLoader(new ZipFile(list[i]),classLoader); +// return new GBeanMBean[]{gbean,config}; +// } +// } +// throw new DeploymentException("can not found the ews module in " + installLocation); + } + + private static GBeanMBean loadConfig(File unpackedCar) throws Exception { + InputStream in = new FileInputStream(new File(unpackedCar, + "META-INF/config.ser")); + try { + ObjectInputStream ois = + new ObjectInputStream(new BufferedInputStream(in)); + GBeanInfo gbeanInfo = Configuration.GBEAN_INFO; + GBeanMBean config = new GBeanMBean(gbeanInfo); + Configuration.loadGMBeanState(config, ois); + return config; + } finally { + in.close(); + } + } + + private void copyTheFile(File inFile, File outFile) throws IOException { + if (!outFile.exists()) + outFile.getParentFile().mkdirs(); + FileOutputStream out = new FileOutputStream(outFile); + FileInputStream in = new FileInputStream(inFile); + try { + byte[] buf = new byte[1024]; + int val = in.read(buf); + while (val > 0) { + out.write(buf, 0, val); + val = in.read(buf); + } + } finally { + in.close(); + out.close(); + } + } + + public static final GBeanInfo GBEAN_INFO; + + static { + GBeanInfoBuilder infoFactory = new GBeanInfoBuilder(WSConfigBuilder.class); + infoFactory.addAttribute("j2eeServer", ObjectName.class, true); + infoFactory.addAttribute("transactionContextManagerObjectName", ObjectName.class, true); + infoFactory.addAttribute("connectionTrackerObjectName", ObjectName.class, true); + infoFactory.addAttribute("transactionalTimerObjectName", ObjectName.class, true); + infoFactory.addAttribute("nonTransactionalTimerObjectName", ObjectName.class, true); + infoFactory.addAttribute("trackedConnectionAssocator", ObjectName.class, true); + infoFactory.addAttribute("configurationStore", ConfigurationStore.class, false); + infoFactory.addReference("Repository", Repository.class); + infoFactory.addAttribute("kernel", Kernel.class, false); + infoFactory.addInterface(ConfigurationBuilder.class); + infoFactory.setConstructor(new String[]{ + "j2eeServer", + "transactionContextManagerObjectName", + "connectionTrackerObjectName", + "transactionalTimerObjectName", + "nonTransactionalTimerObjectName", + "trackedConnectionAssocator", + "configurationStore", + "Repository", + "kernel" + }); + GBEAN_INFO = infoFactory.getBeanInfo(); + } + + public static GBeanInfo getGBeanInfo() { + return GBEAN_INFO; + } +} + Added: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/WSDDJavaGeronimoProvider.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/WSDDJavaGeronimoProvider.java Tue Nov 2 13:28:59 2004 @@ -0,0 +1,51 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.geronimo.axis; + +import org.apache.axis.EngineConfiguration; +import org.apache.axis.Handler; +import org.apache.axis.deployment.wsdd.WSDDProvider; +import org.apache.axis.deployment.wsdd.WSDDService; + +/** + * refering to axis comment of pluggable providers + * Look for file META-INF/services/org.apache.axis.deployment.wsdd.Provider + * in all the JARS, get the classes listed in those files and add them to + * providers list if they are valid providers. + * Here is how the scheme would work. + * A company providing a new provider will jar up their provider related + * classes in a JAR file. The following file containing the name of the new + * provider class is also made part of this JAR file. + * META-INF/services/org.apache.axis.deployment.wsdd.Provider + * By making this JAR part of the webapp, the new provider will be + * automatically discovered. + * + * @author Srinath Perera([EMAIL PROTECTED]) + */ +public class WSDDJavaGeronimoProvider extends WSDDProvider { + public static final String PROVIDER_EWS = "geronimo"; + + public String getName() { + return PROVIDER_EWS; + } + + public Handler newProviderInstance(WSDDService service, + EngineConfiguration registry) + throws Exception { + return new GeronimoProvider(); + } +} Added: geronimo/trunk/modules/axis/src/plans/plan1.xml ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/plans/plan1.xml Tue Nov 2 13:28:59 2004 @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<configuration + xmlns="http://geronimo.apache.org/xml/ns/deployment" + configId="test/plan1" + > + <dependency> + <groupId>geronimo</groupId> + <artifactId>geronimo-kernel</artifactId> + <version>DEV</version> + </dependency> + + <!-- Start Axis Servlet from the plan --> + <gbean name="geronimo.server:type=WebServiceContainer,container=axis" class="org.apache.geronimo.axis.AxisGBean"> +</configuration> \ No newline at end of file Added: geronimo/trunk/modules/axis/src/samples/echo-pojo/WEB-INF/web.xml ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/samples/echo-pojo/WEB-INF/web.xml Tue Nov 2 13:28:59 2004 @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<web-app xmlns="http://java.sun.com/xml/ns/j2ee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" + version="2.4"> + <servlet> + <servlet-name>echo</servlet-name> + <servlet-class>org.apache.ws.echosample.EchoBean</servlet-class> + <load-on-startup>1</load-on-startup> + </servlet> + <servlet-mapping> + <servlet-name>simple</servlet-name> + <url-pattern>/simple</url-pattern> + </servlet-mapping> +</web-app> Added: geronimo/trunk/modules/axis/src/samples/echo-pojo/WEB-INF/webservices.xml ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/samples/echo-pojo/WEB-INF/webservices.xml Tue Nov 2 13:28:59 2004 @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<webservices xmlns="http://java.sun.com/xml/ns/j2ee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ns1="http://echosample.ws.apache.org" + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee + http://www.ibm.com/standards/xml/webservices/j2ee/j2ee_web_services_1_1.xsd" version="1.1"> + <description>echo Service</description> + <display-name>echo</display-name> + <webservice-description> + <description>echo</description> + <display-name>echo</display-name> + <webservice-description-name>echoService</webservice-description-name> + <wsdl-file>echo.wsdl</wsdl-file> + <jaxrpc-mapping-file>echomapping.xml</jaxrpc-mapping-file> + <port-component> + <description>echo</description> + <display-name>echo</display-name> + <icon xml:lang="en-us" id="ID000298"> + <small-icon>token</small-icon> + <large-icon>token</large-icon> + </icon> + <port-component-name>echo</port-component-name> + <wsdl-port id="ID000311">ns1:echoPort</wsdl-port> + <service-endpoint-interface>org.apache.ws.echosample.Echo</service-endpoint-interface> + <service-impl-bean> + <servlet-link>echo</servlet-link> + </service-impl-bean> + </port-component> + </webservice-description> +</webservices> Added: geronimo/trunk/modules/axis/src/samples/echo-pojo/build.xml ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/samples/echo-pojo/build.xml Tue Nov 2 13:28:59 2004 @@ -0,0 +1,38 @@ +<?xml version="1.0"?> +<project basedir="." default="jar"> + <property name="src" location="."/> + <property name="build" location="build"/> + <property name="build.classes" location="${build}/WEB-INF/classes"/> + <property name="build.lib" location="${build}/lib"/> + <property name="lib" location="lib"/> + <property name="jar.dir" location="../../../target/samples/"/> + <target name="compile" depends="init" unless="jars.uptodate"> + <mkdir dir="${build.classes}"/> + <mkdir dir="${build.lib}"/> + <javac destdir="${build.classes}" debug="on"> + <classpath refid="maven.dependency.classpath"/> + <src path="${src}"/> + </javac> + </target> + <target name="jar" depends="compile" unless="jars.uptodate"> + <copy file="${basedir}/WEB-INF/webservices.xml" todir="${build.classes}/.."/> + <copy file="${basedir}/WEB-INF/web.xml" todir="${build.classes}/.."/> + <mkdir dir="${jar.dir}"/> + <jar jarfile="${jar.dir}/echo.war" basedir="${build}"> + <include name="**/*.class"/> + <include name="**/*.xml"/> + </jar> + <delete dir="${build}"/> + </target> + <target name="init"> + <uptodate property="jars.uptodate" targetfile="${jar.dir}/echo.war"> + <srcfiles dir="${src}"> + <include name="**/*.java"/> + <include name="**/*.xml"/> + <include name="**/*.wsdl"/> + <exclude name="${build}/**"/> + </srcfiles> + </uptodate> + <echo message="the files are up to date = ${jars.uptodate}"></echo> + </target> +</project> Added: geronimo/trunk/modules/axis/src/samples/echo-pojo/org/apache/ws/echosample/Echo.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/samples/echo-pojo/org/apache/ws/echosample/Echo.java Tue Nov 2 13:28:59 2004 @@ -0,0 +1,28 @@ +package org.apache.ws.echosample; + +public interface Echo extends java.rmi.Remote { + public void echoVoid() throws java.rmi.RemoteException; + + public int echoInt(int in) throws java.rmi.RemoteException; + + public double echoDouble(double in) throws java.rmi.RemoteException; + + public float echoFloat(float in) throws java.rmi.RemoteException; + + public boolean echoBoolean(boolean in) throws java.rmi.RemoteException; + + public String echoString(String in) throws java.rmi.RemoteException; + + public short echoShort(short in) throws java.rmi.RemoteException; + + public long echoLong(long in) throws java.rmi.RemoteException; + + //public char echoChar(char in); + public byte[] echoBytes(byte[] in) throws java.rmi.RemoteException; + + public void echoEvoid() throws java.rmi.RemoteException; + + public EchoStruct echoStruct(EchoStruct in) throws java.rmi.RemoteException; + //public EchoStruct[] echoAStruct(EchoStruct[] in)throws java.rmi.RemoteException; + +} Added: geronimo/trunk/modules/axis/src/samples/echo-pojo/org/apache/ws/echosample/EchoBean.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/samples/echo-pojo/org/apache/ws/echosample/EchoBean.java Tue Nov 2 13:28:59 2004 @@ -0,0 +1,67 @@ +package org.apache.ws.echosample; + +public class EchoBean implements Echo { + public void ejbCreate() { + } + + public void echoVoid() { + } + + public int echoInt(int in) { + return in; + } + + public double echoDouble(double in) { + return in; + } + + public float echoFloat(float in) { + return in; + } + + public boolean echoBoolean(boolean in) { + return in; + } + + public String echoString(String in) { + return in; + } + + public short echoShort(short in) { + return in; + } + + public long echoLong(long in) { + return in; + } + + public char echoChar(char in) { + return in; + } + + public byte[] echoBytes(byte[] in) { + return in; + } + + public void echoEvoid() { + } + + public EchoStruct echoStruct(EchoStruct in) { + return in; + } +// public EchoStruct[] echoAStruct(EchoStruct[] in){ +// return in; +// } + + public void ejbActivate() throws javax.ejb.EJBException, java.rmi.RemoteException { + } + + public void ejbPassivate() throws javax.ejb.EJBException, java.rmi.RemoteException { + } + + public void ejbRemove() throws javax.ejb.EJBException, java.rmi.RemoteException { + } + + public void setSessionContext(javax.ejb.SessionContext arg0) throws javax.ejb.EJBException, java.rmi.RemoteException { + } +} Added: geronimo/trunk/modules/axis/src/samples/echo-pojo/org/apache/ws/echosample/EchoStruct.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/samples/echo-pojo/org/apache/ws/echosample/EchoStruct.java Tue Nov 2 13:28:59 2004 @@ -0,0 +1,281 @@ +package org.apache.ws.echosample; + +import java.io.Serializable; + +public class EchoStruct implements Serializable { + private int intVal; + private double doubleVal; + private byte[] bytesVal; + private float floatVal; + private long longVal; + private short shortVal; + private boolean boolaenVal; + + private String strVal; + + private int[] intaVal; + private double[] doubleaVal; + private byte[][] bytesaVal; + private float[] floataVal; + private long[] longaVal; + private short[] shortaVal; + private boolean[] boolaenaVal; + + private String[] straVal; + + private SmallEchoStruct sturctVal; + private SmallEchoStruct sturctaVal; + + /** + * @return + */ + public boolean[] getBoolaenaVal() { + return boolaenaVal; + } + + /** + * @return + */ + public boolean isBoolaenVal() { + return boolaenVal; + } + + /** + * @return + */ + public byte[][] getBytesaVal() { + return bytesaVal; + } + + /** + * @return + */ + public byte[] getBytesVal() { + return bytesVal; + } + + /** + * @return + */ + public double[] getDoubleaVal() { + return doubleaVal; + } + + /** + * @return + */ + public double getDoubleVal() { + return doubleVal; + } + + /** + * @return + */ + public float[] getFloataVal() { + return floataVal; + } + + /** + * @return + */ + public float getFloatVal() { + return floatVal; + } + + /** + * @return + */ + public int[] getIntaVal() { + return intaVal; + } + + /** + * @return + */ + public int getIntVal() { + return intVal; + } + + /** + * @return + */ + public long[] getLongaVal() { + return longaVal; + } + + /** + * @return + */ + public long getLongVal() { + return longVal; + } + + /** + * @return + */ + public short[] getShortaVal() { + return shortaVal; + } + + /** + * @return + */ + public short getShortVal() { + return shortVal; + } + + /** + * @return + */ + public String[] getStraVal() { + return straVal; + } + + /** + * @return + */ + public String getStrVal() { + return strVal; + } + + /** + * @param bs + */ + public void setBoolaenaVal(boolean[] bs) { + boolaenaVal = bs; + } + + /** + * @param b + */ + public void setBoolaenVal(boolean b) { + boolaenVal = b; + } + + /** + * @param bs + */ + public void setBytesaVal(byte[][] bs) { + bytesaVal = bs; + } + + /** + * @param bs + */ + public void setBytesVal(byte[] bs) { + bytesVal = bs; + } + + /** + * @param ds + */ + public void setDoubleaVal(double[] ds) { + doubleaVal = ds; + } + + /** + * @param d + */ + public void setDoubleVal(double d) { + doubleVal = d; + } + + /** + * @param fs + */ + public void setFloataVal(float[] fs) { + floataVal = fs; + } + + /** + * @param f + */ + public void setFloatVal(float f) { + floatVal = f; + } + + /** + * @param is + */ + public void setIntaVal(int[] is) { + intaVal = is; + } + + /** + * @param i + */ + public void setIntVal(int i) { + intVal = i; + } + + /** + * @param ls + */ + public void setLongaVal(long[] ls) { + longaVal = ls; + } + + /** + * @param l + */ + public void setLongVal(long l) { + longVal = l; + } + + /** + * @param ses + */ + public void setShortaVal(short[] ses) { + shortaVal = ses; + } + + /** + * @param s + */ + public void setShortVal(short s) { + shortVal = s; + } + + /** + * @param strings + */ + public void setStraVal(String[] strings) { + straVal = strings; + } + + /** + * @param string + */ + public void setStrVal(String string) { + strVal = string; + } + + /** + * @return + */ + public SmallEchoStruct getSturctaVal() { + return sturctaVal; + } + + /** + * @return + */ + public SmallEchoStruct getSturctVal() { + return sturctVal; + } + + /** + * @param struct + */ + public void setSturctaVal(SmallEchoStruct struct) { + sturctaVal = struct; + } + + /** + * @param struct + */ + public void setSturctVal(SmallEchoStruct struct) { + sturctVal = struct; + } + +} Added: geronimo/trunk/modules/axis/src/samples/echo-pojo/org/apache/ws/echosample/SmallEchoStruct.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/samples/echo-pojo/org/apache/ws/echosample/SmallEchoStruct.java Tue Nov 2 13:28:59 2004 @@ -0,0 +1,37 @@ +package org.apache.ws.echosample; + +import java.io.Serializable; + +public class SmallEchoStruct implements Serializable { + private String val1; + private String val2; + + /** + * @return + */ + public String getVal1() { + return val1; + } + + /** + * @return + */ + public String getVal2() { + return val2; + } + + /** + * @param string + */ + public void setVal1(String string) { + val1 = string; + } + + /** + * @param string + */ + public void setVal2(String string) { + val2 = string; + } + +} Modified: geronimo/trunk/modules/axis/src/samples/echo/META-INF/ejb-jar.xml ============================================================================== --- geronimo/trunk/modules/axis/src/samples/echo/META-INF/ejb-jar.xml (original) +++ geronimo/trunk/modules/axis/src/samples/echo/META-INF/ejb-jar.xml Tue Nov 2 13:28:59 2004 @@ -1,22 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee - http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd" - version="2.1"> - <display-name>BookQuoteService</display-name> - <enterprise-beans> - <session> - <display-name>echo</display-name> - <ejb-name>echo</ejb-name> - <home>org.apache.ws.echosample.EchoHome</home> - <remote>org.apache.ws.echosample.EchoEJB</remote> - <ejb-class>org.apache.ws.echosample.EchoBean</ejb-class> - <session-type>Stateless</session-type> - <transaction-type>Bean</transaction-type> - </session> - </enterprise-beans> - <assembly-descriptor> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee + http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd" + version="2.1"> + <display-name>BookQuoteService</display-name> + <enterprise-beans> + <session> + <display-name>echo</display-name> + <ejb-name>echo</ejb-name> + <home>org.apache.ws.echosample.EchoHome</home> + <remote>org.apache.ws.echosample.EchoEJB</remote> + <ejb-class>org.apache.ws.echosample.EchoBean</ejb-class> + <session-type>Stateless</session-type> + <transaction-type>Bean</transaction-type> + </session> + </enterprise-beans> + <assembly-descriptor> <method-permission> <unchecked/> <method> @@ -24,5 +24,5 @@ <method-name>*</method-name> </method> </method-permission> - </assembly-descriptor> + </assembly-descriptor> </ejb-jar> Modified: geronimo/trunk/modules/axis/src/samples/echo/META-INF/webservice.xml ============================================================================== --- geronimo/trunk/modules/axis/src/samples/echo/META-INF/webservice.xml (original) +++ geronimo/trunk/modules/axis/src/samples/echo/META-INF/webservice.xml Tue Nov 2 13:28:59 2004 @@ -1,32 +1,30 @@ <?xml version="1.0" encoding="UTF-8"?> -<webservices xmlns="http://java.sun.com/xml/ns/j2ee" -xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" -xmlns:ns1="http://echosample.ws.apache.org" -xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee -http://www.ibm.com/standards/xml/webservices/j2ee/j2ee_web_services_1_1.xsd" version="1.1"> +<webservices xmlns="http://java.sun.com/xml/ns/j2ee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ns1="http://echosample.ws.apache.org" + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee + http://www.ibm.com/standards/xml/webservices/j2ee/j2ee_web_services_1_1.xsd" version="1.1"> <description>echo Service</description> - <display-name>echo</display-name> - <webservice-description > - <description>echo</description> - <display-name>echo</display-name> - <webservice-description-name >echoService</webservice-description-name> - <wsdl-file >echo.wsdl</wsdl-file> - <jaxrpc-mapping-file >echomapping.xml</jaxrpc-mapping-file> - <port-component > - <description >echo</description> - <display-name >echo</display-name> - - <icon xml:lang="en-us" id="ID000298"> - <small-icon>token</small-icon> - <large-icon>token</large-icon> - </icon> - - <port-component-name >echo</port-component-name> - <wsdl-port id="ID000311">ns1:echoPort</wsdl-port> - <service-endpoint-interface >org.apache.ws.echosample.Echo</service-endpoint-interface> - <service-impl-bean > - <ejb-link >echo</ejb-link> - </service-impl-bean> - </port-component> - </webservice-description> + <display-name>echo</display-name> + <webservice-description> + <description>echo</description> + <display-name>echo</display-name> + <webservice-description-name>echoService</webservice-description-name> + <wsdl-file>echo.wsdl</wsdl-file> + <jaxrpc-mapping-file>echomapping.xml</jaxrpc-mapping-file> + <port-component> + <description>echo</description> + <display-name>echo</display-name> + <icon xml:lang="en-us" id="ID000298"> + <small-icon>token</small-icon> + <large-icon>token</large-icon> + </icon> + <port-component-name>echo</port-component-name> + <wsdl-port id="ID000311">ns1:echoPort</wsdl-port> + <service-endpoint-interface>org.apache.ws.echosample.Echo</service-endpoint-interface> + <service-impl-bean> + <ejb-link>echo</ejb-link> + </service-impl-bean> + </port-component> + </webservice-description> </webservices> Modified: geronimo/trunk/modules/axis/src/samples/echo/build.xml ============================================================================== --- geronimo/trunk/modules/axis/src/samples/echo/build.xml (original) +++ geronimo/trunk/modules/axis/src/samples/echo/build.xml Tue Nov 2 13:28:59 2004 @@ -6,7 +6,6 @@ <property name="build.lib" location="${build}/lib"/> <property name="lib" location="lib"/> <property name="jar.dir" location="../../../target/samples/"/> - <target name="compile" depends="init" unless="jars.uptodate"> <mkdir dir="${build.classes}"/> <mkdir dir="${build.lib}"/> @@ -15,7 +14,6 @@ <src path="${src}"/> </javac> </target> - <target name="jar" depends="compile" unless="jars.uptodate"> <!--<echoproperties />--> <mkdir dir="${build.classes}/META-INF/"/> @@ -25,17 +23,14 @@ <jar jarfile="${jar.dir}/echo.jar" basedir="${build.classes}"> <include name="**"/> </jar> - <copy todir="${build.classes}/META-INF"> <fileset dir="${basedir}/META-INF/"> <include name="**/*.xml"/> <exclude name="build.xml"/> </fileset> </copy> - <delete dir="${build}"/> </target> - <target name="init"> <uptodate property="jars.uptodate" targetfile="${jar.dir}/echo.jar"> <srcfiles dir="${src}"> Modified: geronimo/trunk/modules/axis/src/samples/echo/org/apache/ws/echosample/Echo.java ============================================================================== --- geronimo/trunk/modules/axis/src/samples/echo/org/apache/ws/echosample/Echo.java (original) +++ geronimo/trunk/modules/axis/src/samples/echo/org/apache/ws/echosample/Echo.java Tue Nov 2 13:28:59 2004 @@ -1,17 +1,27 @@ package org.apache.ws.echosample; -public interface Echo extends java.rmi.Remote { - public void echoVoid()throws java.rmi.RemoteException; - public int echoInt(int in)throws java.rmi.RemoteException; - public double echoDouble(double in)throws java.rmi.RemoteException; - public float echoFloat(float in)throws java.rmi.RemoteException; - public boolean echoBoolean(boolean in)throws java.rmi.RemoteException; - public String echoString(String in)throws java.rmi.RemoteException; - public short echoShort(short in)throws java.rmi.RemoteException; - public long echoLong(long in)throws java.rmi.RemoteException; - //public char echoChar(char in); - public byte[] echoBytes(byte[] in)throws java.rmi.RemoteException; - public void echoEvoid()throws java.rmi.RemoteException; - public EchoStruct echoStruct(EchoStruct in)throws java.rmi.RemoteException; - //public EchoStruct[] echoAStruct(EchoStruct[] in)throws java.rmi.RemoteException; - + +public interface Echo extends java.rmi.Remote { + public void echoVoid() throws java.rmi.RemoteException; + + public int echoInt(int in) throws java.rmi.RemoteException; + + public double echoDouble(double in) throws java.rmi.RemoteException; + + public float echoFloat(float in) throws java.rmi.RemoteException; + + public boolean echoBoolean(boolean in) throws java.rmi.RemoteException; + + public String echoString(String in) throws java.rmi.RemoteException; + + public short echoShort(short in) throws java.rmi.RemoteException; + + public long echoLong(long in) throws java.rmi.RemoteException; + + //public char echoChar(char in); + public byte[] echoBytes(byte[] in) throws java.rmi.RemoteException; + + public void echoEvoid() throws java.rmi.RemoteException; + + public EchoStruct echoStruct(EchoStruct in) throws java.rmi.RemoteException; + //public EchoStruct[] echoAStruct(EchoStruct[] in)throws java.rmi.RemoteException; } Modified: geronimo/trunk/modules/axis/src/samples/echo/org/apache/ws/echosample/EchoBean.java ============================================================================== --- geronimo/trunk/modules/axis/src/samples/echo/org/apache/ws/echosample/EchoBean.java (original) +++ geronimo/trunk/modules/axis/src/samples/echo/org/apache/ws/echosample/EchoBean.java Tue Nov 2 13:28:59 2004 @@ -1,48 +1,67 @@ - package org.apache.ws.echosample; -public class EchoBean implements javax.ejb.SessionBean{ - public void ejbCreate() {} - - public void echoVoid(){} - public int echoInt(int in){ - return in; - } - public double echoDouble(double in){ - return in; - } - public float echoFloat(float in){ - return in; - } - public boolean echoBoolean(boolean in){ - return in; - } - public String echoString(String in){ - return in; - } - public short echoShort(short in){ - return in; - } - public long echoLong(long in){ - return in; - } - public char echoChar(char in){ - return in; - } - public byte[] echoBytes(byte[] in){ - return in; - } - public void echoEvoid(){ - - } - public EchoStruct echoStruct(EchoStruct in){ - return in; - } + +public class EchoBean implements javax.ejb.SessionBean { + public void ejbCreate() { + } + + public void echoVoid() { + } + + public int echoInt(int in) { + return in; + } + + public double echoDouble(double in) { + return in; + } + + public float echoFloat(float in) { + return in; + } + + public boolean echoBoolean(boolean in) { + return in; + } + + public String echoString(String in) { + return in; + } + + public short echoShort(short in) { + return in; + } + + public long echoLong(long in) { + return in; + } + + public char echoChar(char in) { + return in; + } + + public byte[] echoBytes(byte[] in) { + return in; + } + + public void echoEvoid() { + } + + public EchoStruct echoStruct(EchoStruct in) { + return in; + } // public EchoStruct[] echoAStruct(EchoStruct[] in){ // return in; // } - public void ejbActivate() throws javax.ejb.EJBException, java.rmi.RemoteException {} - public void ejbPassivate() throws javax.ejb.EJBException, java.rmi.RemoteException {} - public void ejbRemove() throws javax.ejb.EJBException, java.rmi.RemoteException {} - public void setSessionContext(javax.ejb.SessionContext arg0)throws javax.ejb.EJBException, java.rmi.RemoteException {} + public void ejbActivate() throws javax.ejb.EJBException, java.rmi.RemoteException { + } + + public void ejbPassivate() throws javax.ejb.EJBException, java.rmi.RemoteException { + } + + public void ejbRemove() throws javax.ejb.EJBException, java.rmi.RemoteException { + } + + public void setSessionContext(javax.ejb.SessionContext arg0) throws javax.ejb.EJBException, java.rmi.RemoteException { + } } Modified: geronimo/trunk/modules/axis/src/samples/echo/org/apache/ws/echosample/EchoStruct.java ============================================================================== --- geronimo/trunk/modules/axis/src/samples/echo/org/apache/ws/echosample/EchoStruct.java (original) +++ geronimo/trunk/modules/axis/src/samples/echo/org/apache/ws/echosample/EchoStruct.java Tue Nov 2 13:28:59 2004 @@ -2,30 +2,30 @@ import java.io.Serializable; -public class EchoStruct implements Serializable{ - private int intVal; - private double doubleVal; - private byte[] bytesVal; - private float floatVal; - private long longVal; - private short shortVal; - private boolean boolaenVal; - - private String strVal; - - private int[] intaVal; - private double[] doubleaVal; - private byte[][] bytesaVal; - private float[] floataVal; - private long[] longaVal; - private short[] shortaVal; - private boolean[] boolaenaVal; - - private String[] straVal; - - private SmallEchoStruct sturctVal; - private SmallEchoStruct sturctaVal; - +public class EchoStruct implements Serializable { + private int intVal; + private double doubleVal; + private byte[] bytesVal; + private float floatVal; + private long longVal; + private short shortVal; + private boolean boolaenVal; + + private String strVal; + + private int[] intaVal; + private double[] doubleaVal; + private byte[][] bytesaVal; + private float[] floataVal; + private long[] longaVal; + private short[] shortaVal; + private boolean[] boolaenaVal; + + private String[] straVal; + + private SmallEchoStruct sturctVal; + private SmallEchoStruct sturctaVal; + /** * @return */ @@ -54,9 +54,6 @@ return bytesVal; } - - - /** * @return */ @@ -169,7 +166,6 @@ bytesVal = bs; } - /** * @param ds */ Modified: geronimo/trunk/modules/axis/src/samples/echo/org/apache/ws/echosample/SmallEchoStruct.java ============================================================================== --- geronimo/trunk/modules/axis/src/samples/echo/org/apache/ws/echosample/SmallEchoStruct.java (original) +++ geronimo/trunk/modules/axis/src/samples/echo/org/apache/ws/echosample/SmallEchoStruct.java Tue Nov 2 13:28:59 2004 @@ -1,11 +1,11 @@ - package org.apache.ws.echosample; import java.io.Serializable; -public class SmallEchoStruct implements Serializable{ - private String val1; - private String val2; +public class SmallEchoStruct implements Serializable { + private String val1; + private String val2; + /** * @return */ Modified: geronimo/trunk/modules/axis/src/test-resources/deployables/axis/WEB-INF/geronimo-web.xml ============================================================================== --- geronimo/trunk/modules/axis/src/test-resources/deployables/axis/WEB-INF/geronimo-web.xml (original) +++ geronimo/trunk/modules/axis/src/test-resources/deployables/axis/WEB-INF/geronimo-web.xml Tue Nov 2 13:28:59 2004 @@ -15,11 +15,9 @@ See the License for the specific language governing permissions and limitations under the License. --> - <jetty:web-app xmlns:jetty="http://geronimo.apache.org/xml/ns/web/jetty" - configId="org/apache/geronimo/axis" - > + configId="org/apache/geronimo/axis"> <jetty:context-root>/axis</jetty:context-root> <jetty:context-priority-classloader>false</jetty:context-priority-classloader> </jetty:web-app> Modified: geronimo/trunk/modules/axis/src/test-resources/deployables/axis/WEB-INF/web.xml ============================================================================== --- geronimo/trunk/modules/axis/src/test-resources/deployables/axis/WEB-INF/web.xml (original) +++ geronimo/trunk/modules/axis/src/test-resources/deployables/axis/WEB-INF/web.xml Tue Nov 2 13:28:59 2004 @@ -2,72 +2,62 @@ <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> - <web-app> - <display-name>Apache-Axis</display-name> - + <display-name>Apache-Axis</display-name> <listener> <listener-class>org.apache.axis.transport.http.AxisHTTPSessionListener</listener-class> </listener> - - <servlet> - <servlet-name>AxisServlet</servlet-name> - <display-name>Apache-Axis Servlet</display-name> - <servlet-class> + <servlet> + <servlet-name>AxisServlet</servlet-name> + <display-name>Apache-Axis Servlet</display-name> + <servlet-class> org.apache.axis.transport.http.AxisServlet - </servlet-class> - </servlet> - - <servlet> - <servlet-name>AdminServlet</servlet-name> - <display-name>Axis Admin Servlet</display-name> - <servlet-class> + </servlet-class> + </servlet> + <servlet> + <servlet-name>AdminServlet</servlet-name> + <display-name>Axis Admin Servlet</display-name> + <servlet-class> org.apache.axis.transport.http.AdminServlet - </servlet-class> - <load-on-startup>100</load-on-startup> - </servlet> - - <servlet> - <servlet-name>SOAPMonitorService</servlet-name> - <display-name>SOAPMonitorService</display-name> - <servlet-class> + </servlet-class> + <load-on-startup>100</load-on-startup> + </servlet> + <servlet> + <servlet-name>SOAPMonitorService</servlet-name> + <display-name>SOAPMonitorService</display-name> + <servlet-class> org.apache.axis.monitor.SOAPMonitorService - </servlet-class> - <init-param> - <param-name>SOAPMonitorPort</param-name> - <param-value>5001</param-value> - </init-param> - <load-on-startup>100</load-on-startup> - </servlet> - - <servlet-mapping> - <servlet-name>AxisServlet</servlet-name> - <url-pattern>/servlet/AxisServlet</url-pattern> - </servlet-mapping> - - <servlet-mapping> - <servlet-name>AxisServlet</servlet-name> - <url-pattern>*.jws</url-pattern> - </servlet-mapping> - - <servlet-mapping> - <servlet-name>AxisServlet</servlet-name> - <url-pattern>/services/*</url-pattern> - </servlet-mapping> - - <servlet-mapping> - <servlet-name>SOAPMonitorService</servlet-name> - <url-pattern>/SOAPMonitor</url-pattern> - </servlet-mapping> - - <!-- uncomment this if you want the admin servlet --> - <!-- - <servlet-mapping> - <servlet-name>AdminServlet</servlet-name> - <url-pattern>/servlet/AdminServlet</url-pattern> - </servlet-mapping> - --> - + </servlet-class> + <init-param> + <param-name>SOAPMonitorPort</param-name> + <param-value>5001</param-value> + </init-param> + <load-on-startup>100</load-on-startup> + </servlet> + <servlet-mapping> + <servlet-name>AxisServlet</servlet-name> + <url-pattern>/servlet/AxisServlet</url-pattern> + </servlet-mapping> + <servlet-mapping> + <servlet-name>AxisServlet</servlet-name> + <url-pattern>*.jws</url-pattern> + </servlet-mapping> + <servlet-mapping> + <servlet-name>AxisServlet</servlet-name> + <url-pattern>/services/*</url-pattern> + </servlet-mapping> + <servlet-mapping> + <servlet-name>SOAPMonitorService</servlet-name> + <url-pattern>/SOAPMonitor</url-pattern> + </servlet-mapping> + + <!-- uncomment this if you want the admin servlet --> + <!-- + <servlet-mapping> + <servlet-name>AdminServlet</servlet-name> + <url-pattern>/servlet/AdminServlet</url-pattern> + </servlet-mapping> + --> <session-config> <!-- Default to 5 minute session timeouts --> <session-timeout>5</session-timeout> @@ -76,21 +66,17 @@ <!-- currently the W3C havent settled on a media type for WSDL; http://www.w3.org/TR/2003/WD-wsdl12-20030303/#ietf-draft for now we go with the basic 'it's XML' response --> - <mime-mapping> - <extension>wsdl</extension> - <mime-type>text/xml</mime-type> - </mime-mapping> - - - <mime-mapping> - <extension>xsd</extension> - <mime-type>text/xml</mime-type> - </mime-mapping> - - <welcome-file-list id="WelcomeFileList"> - <welcome-file>index.html</welcome-file> - <welcome-file>index.jsp</welcome-file> - <welcome-file>index.jws</welcome-file> - </welcome-file-list> - + <mime-mapping> + <extension>wsdl</extension> + <mime-type>text/xml</mime-type> + </mime-mapping> + <mime-mapping> + <extension>xsd</extension> + <mime-type>text/xml</mime-type> + </mime-mapping> + <welcome-file-list id="WelcomeFileList"> + <welcome-file>index.html</welcome-file> + <welcome-file>index.jsp</welcome-file> + <welcome-file>index.jws</welcome-file> + </welcome-file-list> </web-app> Modified: geronimo/trunk/modules/axis/src/test-resources/deployables/axis/index.html ============================================================================== --- geronimo/trunk/modules/axis/src/test-resources/deployables/axis/index.html (original) +++ geronimo/trunk/modules/axis/src/test-resources/deployables/axis/index.html Tue Nov 2 13:28:59 2004 @@ -1,46 +1,59 @@ <html> - -<head> -<meta http-equiv="Content-Type" -content="text/html; charset=iso-8859-1"> -<title>Apache-Axis</title> -</head> - -<body bgcolor="#FFFFFF"> - -<h1 align="center">Apache-AXIS</h1> - -<p>Hello! <em>Welcome</em> to Apache-Axis.</p> - -<p>What do you want to do today?</p> - -<ul> - <li><a href="happyaxis.jsp">Validate</a> - the local installation's configuration<br> - <i>see below if this does not work.</i></li> - <li><a href="servlet/AxisServlet">View</a> - the list of deployed Web services</li> - <li><a href="EchoHeaders.jws?method=list"> + <head> + <meta http-equiv="Content-Type" + content="text/html; charset=iso-8859-1"> + <title>Apache-Axis</title> + </head> + <body bgcolor="#FFFFFF"> + <h1 align="center">Apache-AXIS</h1> + <p>Hello! + <em>Welcome</em> to Apache-Axis. + </p> + <p>What do you want to do today?</p> + <ul> + <li> + <a href="happyaxis.jsp">Validate</a> + the local installation's configuration + <br> + <i>see below if this does not work.</i> + </li> + <li> + <a href="servlet/AxisServlet">View</a> + the list of deployed Web services + </li> + <li> + <a href="EchoHeaders.jws?method=list"> Call a local endpoint</a> that list's the caller's http headers (or see its - <a href="EchoHeaders.jws?wsdl">WSDL</a>). - <li><a href="http://xml.apache.org/axis">Visit</a> - the Apache-Axis Home Page</li> - <li><a href="servlet/AdminServlet">Administer Axis</a> <br> - [disabled by default for security reasons]</li> -</ul> + + <a href="EchoHeaders.jws?wsdl">WSDL</a>). + + <li> + <a href="http://xml.apache.org/axis">Visit</a> + the Apache-Axis Home Page + </li> + <li> + <a href="servlet/AdminServlet">Administer Axis</a> + <br> + [disabled by default for security reasons] + </li> + </ul> To enable the disabled features, uncomment the appropriate declarations in WEB-INF/web.xml in the webapplication and restart it. -<h3>Validating Axis</h3> + + <h3>Validating Axis</h3> If the "happyaxis" validation page displays an exception instead of a status page, the likely cause is that you have multiple XML parsers in your classpath. Clean up your classpath by eliminating extraneous parsers. -<p> + + <p> If you have problems getting Axis to work, consult the Axis -<a -href="http://nagoya.apache.org/wiki/apachewiki.cgi?AxisProjectPages">Wiki</a> + + <a + href="http://nagoya.apache.org/wiki/apachewiki.cgi?AxisProjectPages">Wiki</a> and then try the Axis user mailing list. -</body> + + </body> </html> Added: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AbstractWebServiceTest.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AbstractWebServiceTest.java Tue Nov 2 13:28:59 2004 @@ -0,0 +1,88 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.axis; + +import org.apache.geronimo.axis.testUtils.AxisGeronimoConstants; +import org.apache.geronimo.axis.testUtils.J2EEManager; +import org.apache.geronimo.gbean.WaitingException; +import org.apache.geronimo.gbean.jmx.GBeanMBean; +import org.apache.geronimo.kernel.Kernel; +import org.apache.geronimo.system.configuration.LocalConfigStore; +import org.apache.geronimo.transaction.OnlineUserTransaction; + +import javax.management.ObjectName; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.net.URI; +import java.net.URL; +import java.util.Collections; + +public class AbstractWebServiceTest extends AbstractTestCase { + protected ObjectName axisname; + protected Kernel kernel; + protected J2EEManager j2eeManager; + protected LocalConfigStore store; + protected File outFile = new File(AxisGeronimoConstants.AXIS_CONFIG_STORE); + + /** + * @param testName + */ + public AbstractWebServiceTest(String testName) throws FileNotFoundException, WaitingException, IOException { + super(testName); + j2eeManager = new J2EEManager(); + store = new LocalConfigStore(outFile); + store.doStart(); + } + + protected void setUp() throws Exception { + axisname = new ObjectName("test:name=AxisGBean"); + kernel = new Kernel("test.kernel", "test"); + kernel.boot(); + AxisGeronimoUtils.delete(outFile); + outFile.getParentFile().mkdirs(); + //start the J2EE server which would be started by the server plan + //in the real case + j2eeManager.startJ2EEContainer(kernel); + //start the Axis Serverlet which would be started by the service plan + org.apache.geronimo.jetty.JettyWebAppContext c = null; + GBeanMBean app = new GBeanMBean("org.apache.geronimo.jetty.JettyWebAppContext"); + URL url = + Thread.currentThread().getContextClassLoader().getResource("deployables/axis/"); + System.out.print(url); + app.setAttribute("uri", URI.create(url.toString())); + app.setAttribute("contextPath", "/axis"); + app.setAttribute("componentContext", null); + OnlineUserTransaction userTransaction = new OnlineUserTransaction(); + app.setAttribute("userTransaction", userTransaction); + app.setAttribute("webClassPath", new URI[0]); + app.setAttribute("contextPriorityClassLoader", Boolean.FALSE); + app.setReferencePatterns("JettyContainer", Collections.singleton(AxisGeronimoConstants.WEB_CONTAINER_NAME)); + app.setAttribute("configurationBaseUrl", Thread.currentThread().getContextClassLoader().getResource("deployables/")); + app.setReferencePattern("TransactionContextManager", AxisGeronimoConstants.TRANSACTION_CONTEXT_MANAGER_NAME); + app.setReferencePattern("TrackedConnectionAssociator", AxisGeronimoConstants.TRACKED_CONNECTION_ASSOCIATOR_NAME); + AxisGeronimoUtils.startGBean(AxisGeronimoConstants.APPLICATION_NAME, app, kernel); + + } + + protected void tearDown() throws Exception { + j2eeManager.stopJ2EEContainer(kernel); + kernel.shutdown(); + File file = new File(AxisGeronimoConstants.AXIS_CONFIG_STORE); + AxisGeronimoUtils.delete(file); + } + +} Modified: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisGBeanTest.java ============================================================================== --- geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisGBeanTest.java (original) +++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisGBeanTest.java Tue Nov 2 13:28:59 2004 @@ -41,7 +41,7 @@ } public void testStartAxisService() throws Exception { - String textFileurl = "http://localhost:" + AxisGeronimoConstants.AXIS_SERVICE_PORT + "/axis/index.html"; + String textFileurl = "http://localhost:" + AxisGeronimoUtils.AXIS_SERVICE_PORT + "/axis/index.html"; ClassLoader cl = getClass().getClassLoader(); ClassLoader myCl = new URLClassLoader(new URL[0], cl); GBeanMBean gbean = new GBeanMBean(AxisGbean.getGBeanInfo(), myCl); @@ -49,7 +49,6 @@ kernel.loadGBean(name, gbean); kernel.startGBean(name); System.out.println(kernel.getMBeanServer().getAttribute(name, "state")); - HttpURLConnection connection = (HttpURLConnection) new URL(textFileurl).openConnection(); BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); connection.getResponseCode(); @@ -59,7 +58,6 @@ line = reader.readLine(); } connection.disconnect(); - kernel.stopGBean(name); kernel.unloadGBean(name); } Modified: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/ComplexTypeWebServiceTest.java ============================================================================== --- geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/ComplexTypeWebServiceTest.java (original) +++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/ComplexTypeWebServiceTest.java Tue Nov 2 13:28:59 2004 @@ -16,6 +16,7 @@ package org.apache.geronimo.axis; import org.apache.axis.utils.ClassUtils; +import org.apache.geronimo.axis.testUtils.AxisGeronimoConstants; import org.apache.geronimo.gbean.jmx.GBeanMBean; import org.apache.geronimo.kernel.Kernel; @@ -44,7 +45,6 @@ GBeanMBean axisgbean = new GBeanMBean(AxisGbean.getGBeanInfo(), myCl); kernel.loadGBean(axisname, axisgbean); kernel.startGBean(axisname); - File jarfile = new File(getTestFile("target/generated/samples/echo-ewsimpl.jar")); kernel.getMBeanServer().invoke(axisname, "deployEWSModule", @@ -57,55 +57,19 @@ String.class.getName(), String.class.getName()}); -// //try invoke from this java -// ContainerIndex index = ContainerIndex.getInstance(); -// int length = index.length(); -// System.out.println("number of continers "+length); -// for(int i = 0;i<length;i++){ -// EJBContainer contianer = index.getContainer(i); -// if(contianer!= null){ -// String name = contianer.getEJBName(); -// System.out.println("found the ejb "+name); -// if("echo".equals(name)){ -// EJBHome statelessHome = contianer.getEJBHome(); -// Object stateless = statelessHome.getClass().getMethod("create", null).invoke(statelessHome, null); -// Method[] methods = stateless.getClass().getMethods(); -// -// for(int j = 0;j< methods.length;j++){ -// if(methods[j].getName().equals("echoStruct")){ -// Class[] classes = methods[j].getParameterTypes(); -// System.out.println(classes[0]); -// methods[j].invoke(stateless, new Object[]{null}); -// methods[j].invoke(stateless, new Object[]{classes[0].newInstance()}); -// } -// } -// } -// } -// } - //check the real web service invocations -// ClassLoader ocl = Thread.currentThread().getContextClassLoader(); -// URLClassLoader jarclassloder = new URLClassLoader(new URL[]{jarfile.toURL()}); -// Thread.currentThread().setContextClassLoader(jarclassloder); - -// Class echoLoacaterClass = Class.forName("org.apache.ws.echosample.EchoServiceLocator",true,jarclassloder); -// Class structClass = Class.forName("org.apache.ws.echosample.EchoStruct",true,jarclassloder); Class echoLoacaterClass = ClassUtils.forName("org.apache.ws.echosample.EchoServiceLocator"); Class structClass = ClassUtils.forName("org.apache.ws.echosample.EchoStruct"); - Object echoLoacater = echoLoacaterClass.newInstance(); Method getportMethod = echoLoacaterClass.getMethod("getechoPort", new Class[]{URL.class}); - URL serviceURL = new URL("http://localhost:" - + AxisGeronimoConstants.AXIS_SERVICE_PORT + + AxisGeronimoUtils.AXIS_SERVICE_PORT // + 5679 + "/axis/services/echoPort"); Object echoPort = getportMethod.invoke(echoLoacater, new Object[]{serviceURL}); Class echoClass = echoPort.getClass(); - Method echostuctMethod = echoClass.getMethod("echoStruct", new Class[]{structClass}); Object structval = structClass.newInstance(); - Object structret = echostuctMethod.invoke(echoPort, new Object[]{null}); structret = echostuctMethod.invoke(echoPort, new Object[]{structval}); assertEquals(structval, structret); Modified: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/EchoHeadersTest.java ============================================================================== --- geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/EchoHeadersTest.java (original) +++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/EchoHeadersTest.java Tue Nov 2 13:28:59 2004 @@ -51,14 +51,12 @@ name = new ObjectName("test:name=AxisGBean"); kernel = new Kernel("test.kernel", "test"); kernel.boot(); - ClassLoader cl = getClass().getClassLoader(); ClassLoader myCl = new URLClassLoader(new URL[]{}, cl); GBeanMBean gbean = new GBeanMBean(AxisGbean.getGBeanInfo(), myCl); gbean.setAttribute("Name", "Test"); kernel.loadGBean(name, gbean); kernel.startGBean(name); - Service service = new Service(); service.getEngine().setOption(AxisEngine.PROP_XML_ENCODING, "UTF-8"); call = (Call) service.createCall(); @@ -120,22 +118,17 @@ public void testSynchronization() throws Exception { SOAPConnectionFactory scFactory = SOAPConnectionFactory.newInstance(); SOAPConnection con = scFactory.createConnection(); - MessageFactory factory = MessageFactory.newInstance(); SOAPMessage message = factory.createMessage(); String requestEncoding = "UTF-16"; message.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, requestEncoding); - SOAPEnvelope envelope = message.getSOAPPart().getEnvelope(); SOAPBody body = envelope.getBody(); - Name bodyName = envelope.createName("echo"); SOAPBodyElement bodyElement = body.addBodyElement(bodyName); - Name name = envelope.createName("arg0"); SOAPElement symbol = bodyElement.addChildElement(name); symbol.addTextNode("Hello"); - URLEndpoint endpoint = new URLEndpoint("http://localhost:5678/axis/EchoHeaders.jws"); SOAPMessage response = con.call(message, endpoint); String responseEncoding = (String) response.getProperty(SOAPMessage.CHARACTER_SET_ENCODING); Modified: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/J2EEManagerTest.java ============================================================================== --- geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/J2EEManagerTest.java (original) +++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/J2EEManagerTest.java Tue Nov 2 13:28:59 2004 @@ -15,6 +15,7 @@ */ package org.apache.geronimo.axis; +import org.apache.geronimo.axis.testUtils.J2EEManager; import org.apache.geronimo.kernel.Kernel; import javax.management.ObjectName; Added: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/SimpleEJBWebServiceTest.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/SimpleEJBWebServiceTest.java Tue Nov 2 13:28:59 2004 @@ -0,0 +1,182 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.axis; + +import org.apache.geronimo.axis.testUtils.AxisGeronimoConstants; +import org.apache.geronimo.gbean.WaitingException; +import org.apache.geronimo.gbean.jmx.GBeanMBean; + +import javax.management.ObjectName; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStreamReader; +import java.lang.reflect.Method; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.Arrays; + +public class SimpleEJBWebServiceTest extends AbstractWebServiceTest { + public SimpleEJBWebServiceTest(String testName) throws FileNotFoundException, WaitingException, IOException { + super(testName); + } + + public void testLoad() throws Exception { + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + ClassLoader myCl = new URLClassLoader(new URL[]{}, cl); + + + //axis gbean + GBeanMBean axisgbean = new GBeanMBean(AxisGbean.getGBeanInfo(), myCl); + kernel.loadGBean(axisname, axisgbean); + kernel.startGBean(axisname); + File jarfile = new File(getTestFile("target/generated/samples/echo-jar/echo-ewsimpl.jar")); + WSConfigBuilder wsconfBuilder + = new WSConfigBuilder(AxisGeronimoConstants.J2EE_SERVER_NAME, + AxisGeronimoConstants.TRANSACTION_CONTEXT_MANAGER_NAME, + AxisGeronimoConstants.CONNECTION_TRACKER_NAME, + AxisGeronimoConstants.TRANSACTIONAL_TIMER_NAME, + AxisGeronimoConstants.NONTRANSACTIONAL_TIMER_NAME, + AxisGeronimoConstants.TRACKED_CONNECTION_ASSOCIATOR_NAME, + null, + kernel, + store); + File out = new File("target/temp"); + out.mkdirs(); + File ws = wsconfBuilder.installWebService(jarfile, out, Thread.currentThread().getContextClassLoader()); + GBeanMBean[] gbeans = wsconfBuilder.loadtheWSConfigurations(ws, jarfile); + ObjectName wsName = ObjectName.getInstance("test:configuration=" + "echo"); + ObjectName wsEJBName = ObjectName.getInstance("test:configuration=" + "echoEJB"); + AxisGeronimoUtils.startGBean(wsName, gbeans[0], kernel); + AxisGeronimoUtils.startGBean(wsEJBName, gbeans[1], kernel); + + + //let us try to brows the WSDL of the service + URL wsdlrequestUrl = new URL("http://localhost:" + + AxisGeronimoUtils.AXIS_SERVICE_PORT + + "/axis/services/echoPort?wsdl"); + //+"/axis/services/AdminService?wsdl"); + + HttpURLConnection connection = (HttpURLConnection) wsdlrequestUrl.openConnection(); + BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); + connection.getResponseCode(); + String line = reader.readLine(); + while (line != null) { + System.out.println(line); + line = reader.readLine(); + } + + + //invoke the ejb just in the same way it is invoked by the webservice + String msg = "Hi Hello"; + String result = + (String) AxisGeronimoUtils.invokeEJB("echo", + "echoString", + new Class[]{String.class}, + new Object[]{msg}); + System.out.println(result); + assertEquals(msg, result); + AxisGeronimoUtils.invokeEJB("echo", "echoVoid", new Class[]{ + }, new Object[]{ + }); + int valInt = 2345; + Integer intObj = + (Integer) AxisGeronimoUtils.invokeEJB("echo", + "echoInt", + null, + new Object[]{new Integer(valInt)}); + assertEquals(valInt, intObj.intValue()); + double valDouble = 2425.57; + Double doubleObj = + (Double) AxisGeronimoUtils.invokeEJB("echo", + "echoDouble", + null, + new Object[]{new Double(valDouble)}); + assertEquals(valDouble, doubleObj.doubleValue(), 3); + float valfloat = 2425.57f; + Float floatObj = + (Float) AxisGeronimoUtils.invokeEJB("echo", + "echoFloat", + null, + new Object[]{new Float(valfloat)}); + assertEquals(valfloat, floatObj.doubleValue(), 3); + boolean valBoolean = true; + Boolean booleanObj = + (Boolean) AxisGeronimoUtils.invokeEJB("echo", + "echoBoolean", + null, + new Object[]{new Boolean(valBoolean)}); + assertEquals(valBoolean, booleanObj.booleanValue()); + long valLong = 2425573566l; + Long longObj = + (Long) AxisGeronimoUtils.invokeEJB("echo", + "echoLong", + null, + new Object[]{new Long(valLong)}); + assertEquals(valLong, longObj.longValue()); + short valShort = 242; + Short shortObj = + (Short) AxisGeronimoUtils.invokeEJB("echo", + "echoShort", + null, + new Object[]{new Short(valShort)}); + assertEquals(valShort, shortObj.shortValue()); + byte[] byteVal = "Hi Hello".getBytes(); + byte[] byteValreturn = + (byte[]) AxisGeronimoUtils.invokeEJB("echo", + "echoBytes", + new Class[]{byte[].class}, + new Object[]{byteVal}); + assertTrue(Arrays.equals(byteVal, byteValreturn)); + + + + +// +// //check the real web service invocations + ClassLoader ocl = Thread.currentThread().getContextClassLoader(); + URLClassLoader jarclassloder = new URLClassLoader(new URL[]{jarfile.toURL()}); + Thread.currentThread().setContextClassLoader(jarclassloder); + Class echoLoacaterClass = Class.forName("org.apache.ws.echosample.EchoServiceLocator", true, jarclassloder); + Object echoLoacater = echoLoacaterClass.newInstance(); + Method getportMethod = echoLoacaterClass.getMethod("getechoPort", new Class[]{URL.class}); + URL serviceURL = new URL("http://localhost:" + + AxisGeronimoUtils.AXIS_SERVICE_PORT + + "/axis/services/echoPort"); + Object echoPort = getportMethod.invoke(echoLoacater, new Object[]{serviceURL}); + Class echoClass = echoPort.getClass(); + Method echoStringMethod = echoClass.getMethod("echoString", new Class[]{String.class}); + String val = "Hi"; + assertEquals(val, echoStringMethod.invoke(echoPort, new Object[]{val})); + Class structClass = Class.forName("org.apache.ws.echosample.EchoStruct", true, jarclassloder); + Method echostuctMethod = echoClass.getMethod("echoStruct", new Class[]{structClass}); + Object structval = structClass.newInstance(); + + Thread.currentThread().setContextClassLoader(ocl); + kernel.stopGBean(axisname); + kernel.unloadGBean(axisname); + } + + protected void tearDown() throws Exception { + j2eeManager.stopJ2EEContainer(kernel); + kernel.shutdown(); + File file = new File(AxisGeronimoConstants.AXIS_CONFIG_STORE); + AxisGeronimoUtils.delete(file); + } + +} Added: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/SimplePOJOWebServiceTest.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/SimplePOJOWebServiceTest.java Tue Nov 2 13:28:59 2004 @@ -0,0 +1,100 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.axis; + +import org.apache.axis.utils.ClassUtils; +import org.apache.geronimo.axis.testUtils.AxisGeronimoConstants; +import org.apache.geronimo.gbean.WaitingException; +import org.apache.geronimo.gbean.jmx.GBeanMBean; +import org.apache.geronimo.kernel.config.ConfigurationManager; + +import javax.management.ObjectName; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStreamReader; +import java.lang.reflect.Method; +import java.net.HttpURLConnection; +import java.net.URI; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.List; + +public class SimplePOJOWebServiceTest extends AbstractWebServiceTest { + public SimplePOJOWebServiceTest(String testName) throws FileNotFoundException, WaitingException, IOException { + super(testName); + } + + public void testPOJOWS() throws Exception { + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + ClassLoader myCl = new URLClassLoader(new URL[]{}, cl); + File jarfile = new File(getTestFile("target/generated/samples/echo-war/echo-ewsimpl.jar")); + + //axis gbean + GBeanMBean axisgbean = new GBeanMBean(AxisGbean.getGBeanInfo(), myCl); + kernel.loadGBean(axisname, axisgbean); + kernel.startGBean(axisname); + WSConfigBuilder wsconfBuilder + = new WSConfigBuilder(AxisGeronimoConstants.J2EE_SERVER_NAME, + AxisGeronimoConstants.TRANSACTION_CONTEXT_MANAGER_NAME, + AxisGeronimoConstants.CONNECTION_TRACKER_NAME, + AxisGeronimoConstants.TRANSACTIONAL_TIMER_NAME, + AxisGeronimoConstants.NONTRANSACTIONAL_TIMER_NAME, + AxisGeronimoConstants.TRACKED_CONNECTION_ASSOCIATOR_NAME, + null, + kernel, + store); + List uri = wsconfBuilder.buildConfiguration(null, jarfile, outFile); + GBeanMBean config = store.getConfiguration((URI) uri.get(0)); + ConfigurationManager configurationManager = kernel.getConfigurationManager(); + ObjectName configName = configurationManager.load(config, null); + kernel.getMBeanServer().invoke(configName, "startRecursive", null, null); + + //let us try to brows the WSDL of the service + URL wsdlrequestUrl = new URL("http://localhost:" + + AxisGeronimoUtils.AXIS_SERVICE_PORT + + "/axis/services/echoPort?wsdl"); + //+"/axis/services/AdminService?wsdl"); + + HttpURLConnection connection = (HttpURLConnection) wsdlrequestUrl.openConnection(); + BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); + connection.getResponseCode(); + String line = reader.readLine(); + while (line != null) { + System.out.println(line); + line = reader.readLine(); + } + Class echoLoacaterClass = ClassUtils.forName("org.apache.ws.echosample.EchoServiceLocator"); + Object echoLoacater = echoLoacaterClass.newInstance(); + Method getportMethod = echoLoacaterClass.getMethod("getechoPort", new Class[]{URL.class}); + URL serviceURL = new URL("http://localhost:" + + AxisGeronimoUtils.AXIS_SERVICE_PORT + // + 5679 + + "/axis/services/echoPort"); + Object echoPort = getportMethod.invoke(echoLoacater, new Object[]{serviceURL}); + Class echoClass = echoPort.getClass(); + Method echoStringMethod = echoClass.getMethod("echoString", new Class[]{String.class}); + String val = "Hi"; + assertEquals(val, echoStringMethod.invoke(echoPort, new Object[]{val})); + Class structClass = ClassUtils.forName("org.apache.ws.echosample.EchoStruct"); + Method echostuctMethod = echoClass.getMethod("echoStruct", new Class[]{structClass}); + Object structval = structClass.newInstance(); + kernel.stopGBean(axisname); + kernel.unloadGBean(axisname); + } + +} Added: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/WSConfigBuilderTest.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/WSConfigBuilderTest.java Tue Nov 2 13:28:59 2004 @@ -0,0 +1,66 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.axis; + +import org.apache.geronimo.axis.testUtils.AxisGeronimoConstants; +import org.apache.geronimo.axis.testUtils.J2EEManager; +import org.apache.geronimo.gbean.jmx.GBeanMBean; +import org.apache.geronimo.kernel.Kernel; + +import javax.management.ObjectName; +import java.io.File; + +public class WSConfigBuilderTest extends AbstractTestCase { + private ObjectName configBuilderName; + private Kernel kernel; + private J2EEManager j2eeManager; + + /** + * @param testName + */ + public WSConfigBuilderTest(String testName) { + super(testName); + j2eeManager = new J2EEManager(); + } + + public void testLoad() throws Exception { + kernel.getConfigurationManager().load(new File("modules/axis/test-resources/plans/plan1.xml").toURI()); + //axis gbean + GBeanMBean axisgbean = new GBeanMBean(WSConfigBuilder.getGBeanInfo()); + kernel.loadGBean(configBuilderName, axisgbean); + kernel.startGBean(configBuilderName); + kernel.stopGBean(configBuilderName); + kernel.unloadGBean(configBuilderName); + } + + protected void setUp() throws Exception { + File file = new File(AxisGeronimoConstants.AXIS_CONFIG_STORE); + configBuilderName = new ObjectName("test:name=AxisGBean"); + kernel = new Kernel("test.kernel", "test"); + kernel.boot(); + AxisGeronimoUtils.delete(file); + file.getParentFile().mkdirs(); + j2eeManager.startJ2EEContainer(kernel); + } + + protected void tearDown() throws Exception { + j2eeManager.stopJ2EEContainer(kernel); + kernel.shutdown(); + File file = new File(AxisGeronimoConstants.AXIS_CONFIG_STORE); + AxisGeronimoUtils.delete(file); + } + +} Added: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/preconditions/AdminClientDeploymentTest.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/preconditions/AdminClientDeploymentTest.java Tue Nov 2 13:28:59 2004 @@ -0,0 +1,84 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.axis.preconditions; + +import org.apache.axis.client.AdminClient; +import org.apache.axis.client.Call; +import org.apache.axis.utils.ClassUtils; +import org.apache.geronimo.axis.AbstractWebServiceTest; +import org.apache.geronimo.axis.AxisGeronimoUtils; +import org.apache.geronimo.gbean.WaitingException; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; + +/** + * <p>This test case shows the possible two ways of add a entry to the Axis + * server-config.wsdd Deployment Discrypter.</p> + */ + +public class AdminClientDeploymentTest extends AbstractWebServiceTest { + public AdminClientDeploymentTest(String testName) throws FileNotFoundException, WaitingException, IOException { + super(testName); + } + + public void testDeployWithAdminClientDinamically() throws Exception { + File jarFile = new File(outDir + "echo-jar/echo-ewsimpl.jar"); + URLClassLoader cl = new URLClassLoader(new URL[]{jarFile.toURL()}); + InputStream deplydd = cl.getResourceAsStream("deploy.wsdd"); + assertNotNull(deplydd); + ClassLoader parentClassLoder = ClassUtils.getDefaultClassLoader(); + ClassUtils.setDefaultClassLoader(cl); + AdminClient adminClient = new AdminClient(); + URL requestUrl = new URL("http://localhost:" + + AxisGeronimoUtils.AXIS_SERVICE_PORT + + "/axis/services/AdminService"); + Call call = adminClient.getCall(); + call.setTargetEndpointAddress(requestUrl); + String result = adminClient.process(null, deplydd); + URL wsdlrequestUrl = new URL("http://localhost:" + + AxisGeronimoUtils.AXIS_SERVICE_PORT + + "/axis/services/echoPort?wsdl"); + //+"/axis/services/AdminService?wsdl"); + + HttpURLConnection connection = (HttpURLConnection) wsdlrequestUrl.openConnection(); + BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); + connection.getResponseCode(); + String line = reader.readLine(); + while (line != null) { + System.out.println(line); + line = reader.readLine(); + } + } + + public void testURLFileTest() throws MalformedURLException { + ClassLoader contextLoader = Thread.currentThread().getContextClassLoader(); + URL url = contextLoader.getResource("deployables/axis/WEB-INF/web.xml"); + assertNotNull(url); + File file = new File(url.getFile()); + assertTrue(file.exists()); + assertTrue(url.sameFile(file.toURL())); + } + +} Added: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/preconditions/ClassLoadingTest.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/preconditions/ClassLoadingTest.java Tue Nov 2 13:28:59 2004 @@ -0,0 +1,54 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.geronimo.axis.preconditions; + +import org.apache.axis.utils.ClassUtils; +import org.apache.geronimo.axis.AbstractTestCase; + +import java.io.File; +import java.net.URL; +import java.net.URLClassLoader; + +/** + * @author [EMAIL PROTECTED] + */ +public class ClassLoadingTest extends AbstractTestCase { + /** + * @param testName + */ + public ClassLoadingTest(String testName) { + super(testName); + } + + public void testClassLoading() throws Exception { + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + Class class0 = Class.forName("org.apache.axis.utils.tcpmon", true, cl); + File jarfile = new File(getTestFile("target/generated/samples/echo-ewsimpl.jar")); + ClassLoader cl1 = new URLClassLoader(new URL[]{jarfile.toURL()}, cl); + ClassLoader cl2 = new URLClassLoader(new URL[]{jarfile.toURL()}, cl); + Class class1 = Class.forName("org.apache.ws.echosample.EchoStruct", true, cl1); + Class class2 = Class.forName("org.apache.ws.echosample.EchoStruct", true, cl2); + Class class3 = Class.forName("org.apache.ws.echosample.EchoStruct", true, cl1); + Class class4 = Class.forName("org.apache.axis.utils.tcpmon", true, cl1); + assertNotSame(class1, class2); + assertSame(class1, class3); + assertSame(class0, class4); + String className = "org.apache.ws.echosample.EchoPortSoapBindingImpl"; + ClassUtils.setClassLoader(className, cl1); + ClassUtils.forName(className); + } +} Added: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/preconditions/DynamicEJBDeploymentTest.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/preconditions/DynamicEJBDeploymentTest.java Tue Nov 2 13:28:59 2004 @@ -0,0 +1,109 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.geronimo.axis.preconditions; + +import org.apache.geronimo.axis.AbstractTestCase; +import org.apache.geronimo.axis.testUtils.J2EEManager; +import org.apache.geronimo.j2ee.deployment.EARConfigBuilder; +import org.apache.geronimo.kernel.Kernel; +import org.apache.geronimo.kernel.jmx.JMXUtil; +import org.apache.geronimo.kernel.management.State; +import org.openejb.deployment.OpenEJBModuleBuilder; + +import javax.management.ObjectName; +import java.io.File; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.jar.JarFile; + +/** + * <p>This test case show the infomation about openEJB that we assumed. And the + * simmlier code code is used in the real code. As the OpenEJB is developing and + * rapidly changing this test case act as a notifier for saying things has chaged</p> + */ +public class DynamicEJBDeploymentTest extends AbstractTestCase { + private static final String j2eeDomainName = "openejb.server"; + private static final String j2eeServerName = "TestOpenEJBServer"; + private static final ObjectName transactionManagerObjectName = JMXUtil.getObjectName(j2eeDomainName + ":type=TransactionManager"); + private static final ObjectName connectionTrackerObjectName = JMXUtil.getObjectName(j2eeDomainName + ":type=ConnectionTracker"); + private Kernel kernel; + private J2EEManager j2eeManager; + + /** + * @param testName + */ + public DynamicEJBDeploymentTest(String testName) { + super(testName); + } + + protected void setUp() throws Exception { + String str = System.getProperty(javax.naming.Context.URL_PKG_PREFIXES); + if (str == null) { + str = ":org.apache.geronimo.naming"; + } else { + str = str + ":org.apache.geronimo.naming"; + } + System.setProperty(javax.naming.Context.URL_PKG_PREFIXES, str); + kernel = new Kernel("blah"); + kernel.boot(); + j2eeManager = new J2EEManager(); + j2eeManager.startJ2EEContainer(kernel); + } + + public void testEJBJarDeploy() throws Exception { + OpenEJBModuleBuilder moduleBuilder = new OpenEJBModuleBuilder(); + File jarFile = new File(outDir + "echo-jar/echo-ewsimpl.jar"); + ClassLoader oldCl = Thread.currentThread().getContextClassLoader(); + ClassLoader cl = new URLClassLoader(new URL[]{jarFile.toURL()}, oldCl); + Thread.currentThread().setContextClassLoader(cl); + File carFile = File.createTempFile("OpenEJBTest", ".car"); + try { + EARConfigBuilder earConfigBuilder = + new EARConfigBuilder(new ObjectName(j2eeDomainName + ":j2eeType=J2EEServer,name=" + j2eeServerName), + transactionManagerObjectName, + connectionTrackerObjectName, + null, + null, + null, + moduleBuilder, + moduleBuilder, + null, + null, + null, + null, + null); + File unpackedDir = new File(tempDir, "OpenEJBTest-ear-Unpacked"); + JarFile jarFileModules = null; + try { + jarFileModules = new JarFile(jarFile); + Object plan = earConfigBuilder.getDeploymentPlan(null, jarFileModules); + earConfigBuilder.buildConfiguration(plan, jarFileModules, unpackedDir); + } finally { + if (jarFile != null) { + jarFileModules.close(); + } + } + } finally { + carFile.delete(); + } + } + + protected void tearDown() throws Exception { + j2eeManager.stopJ2EEContainer(kernel); + } +} + Added: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/preconditions/EWSTest.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/preconditions/EWSTest.java Tue Nov 2 13:28:59 2004 @@ -0,0 +1,49 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.axis.preconditions; + +import org.apache.geronimo.axis.AbstractTestCase; +import org.apache.geronimo.axis.GeronimoWsDeployContext; +import org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2ee; + +import java.io.File; + +/** + * <p>This test case represents the code generation with the EWS module. + * This test case needed the $JAVA_HOME/lib.tools.jar at the classapth.</p> + */ +public class EWSTest extends AbstractTestCase { + public EWSTest(String testName) { + super(testName); + } + + public void testEchoPOJO() throws Exception { + GeronimoWsDeployContext deployContext = + new GeronimoWsDeployContext(getTestFile("target/samples/echo.war"), + outDir + "/echo-war"); + Ws4J2ee ws4j2ee = new Ws4J2ee(deployContext, null); + ws4j2ee.generate(); + File out = new File(outDir + "/echo-war", "echo-ewsimpl.jar"); + assertTrue(out.exists()); + } + + protected void setUp() throws Exception { + new File(outDir).mkdirs(); + } + + protected void tearDown() throws Exception { + } +} Added: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/preconditions/GBeanConfigTest.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/preconditions/GBeanConfigTest.java Tue Nov 2 13:28:59 2004 @@ -0,0 +1,87 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.axis.preconditions; + +import org.apache.geronimo.axis.AbstractTestCase; +import org.apache.geronimo.axis.AxisGbean; +import org.apache.geronimo.axis.AxisGeronimoUtils; +import org.apache.geronimo.axis.ReferenceCollectionImpl; +import org.apache.geronimo.gbean.ReferenceCollection; +import org.apache.geronimo.gbean.jmx.GBeanMBean; +import org.apache.geronimo.kernel.Kernel; + +import javax.management.ObjectName; +import java.net.URL; +import java.net.URLClassLoader; + +/** + * <p> This test case start the AxisGbean and test retiving the index.html of the + * Axis Service</p> + */ +public class GBeanConfigTest extends AbstractTestCase { + private ObjectName name1; + private ObjectName name2; + private Kernel kernel; + + /** + * @param testName + */ + public GBeanConfigTest(String testName) { + super(testName); + } + + public void testStartAxisService() throws Exception { + String textFileurl = "http://localhost:" + AxisGeronimoUtils.AXIS_SERVICE_PORT + "/axis/index.html"; + ClassLoader cl = getClass().getClassLoader(); + ClassLoader myCl = new URLClassLoader(new URL[0], cl); + ReferenceCollection rc = new ReferenceCollectionImpl(); + GBeanMBean gbean2 = new GBeanMBean(AxisGbean.getGBeanInfo(), myCl); + gbean2.setAttribute("Name", "Test"); + kernel.loadGBean(name2, gbean2); + kernel.startGBean(name2); + + kernel.stopGBean(name2); + kernel.unloadGBean(name2); + kernel.stopGBean(name1); + kernel.unloadGBean(name1); + } + + public void testdependencies() throws Exception { + ClassLoader cl = getClass().getClassLoader(); + ClassLoader myCl = new URLClassLoader(new URL[0], cl); + ReferenceCollection rc = new ReferenceCollectionImpl(); + GBeanMBean gbean2 = new GBeanMBean(AxisGbean.getGBeanInfo(), myCl); + gbean2.setAttribute("Name", "Test"); + kernel.loadGBean(name2, gbean2); + kernel.startGBean(name2); + + kernel.stopGBean(name2); + kernel.unloadGBean(name2); + kernel.stopGBean(name1); + kernel.unloadGBean(name1); + } + + protected void setUp() throws Exception { + name1 = new ObjectName("test:name=WebServiceGBean"); + name2 = new ObjectName("test:name=AxisGBean"); + kernel = new Kernel("test.kernel", "test"); + kernel.boot(); + } + + protected void tearDown() throws Exception { + kernel.shutdown(); + } +} Added: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/AxisGeronimoConstants.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/AxisGeronimoConstants.java Tue Nov 2 13:28:59 2004 @@ -0,0 +1,52 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.axis.testUtils; + +import org.apache.geronimo.kernel.jmx.JMXUtil; + +import javax.management.ObjectName; + +public class AxisGeronimoConstants { + public static final String J2EE_DOMAIN_NAME = "openejb.server"; + public static final String J2EE_SERVER_PREFIX = "TestOpenEJBServer"; + public static final ObjectName APPLICATION_NAME + = JMXUtil.getObjectName("geronimo.jetty:app=test"); + public static final String AXIS_CONFIG_STORE = "target/config-store"; + public static final String TEMP_OUTPUT = "target/temp"; + + public static final ObjectName J2EE_SERVER_INFO = JMXUtil.getObjectName(J2EE_DOMAIN_NAME + ":type=ServerInfo"); + public static final ObjectName J2EE_SERVER_NAME = JMXUtil.getObjectName(J2EE_DOMAIN_NAME + ":j2eeType=J2EEServer,name=" + J2EE_SERVER_PREFIX); + public static final ObjectName CONNECTION_TRACKER_NAME = JMXUtil.getObjectName(J2EE_DOMAIN_NAME + ":type=ConnectionTracker"); + //////////// + public static final ObjectName CONNTECTION_TRACKING_COORDINATOR = JMXUtil.getObjectName("geronimo.test:role=ConnectionTrackingCoordinator"); + //////////// + + public static final ObjectName WEB_CONTAINER_NAME = JMXUtil.getObjectName("geronimo.jetty:role=Container"); + public static final ObjectName WEB_CONNECTOR_NAME = JMXUtil.getObjectName("geronimo.jetty:role=Connector"); + + public static final ObjectName EJB_CONTAINER_NAME = JMXUtil.getObjectName(J2EE_DOMAIN_NAME + ":type=ContainerIndex"); + + public static final ObjectName TRANSACTION_MANAGER_NAME = JMXUtil.getObjectName(J2EE_DOMAIN_NAME + ":type=TransactionManager"); + public static final ObjectName TRANSACTION_CONTEXT_MANAGER_NAME = JMXUtil.getObjectName(J2EE_SERVER_PREFIX + ":type=TransactionContextManager"); + public static final ObjectName TRACKED_CONNECTION_ASSOCIATOR_NAME = JMXUtil.getObjectName("geronimo.test:role=TrackedConnectionAssociator"); + public static final ObjectName WORKMANAGER_NAME = JMXUtil.getObjectName("geronimo.server:type=WorkManager,name=DefaultWorkManager"); + public static final ObjectName RESOURCE_ADAPTER_NAME = JMXUtil.getObjectName("openejb.server:j2eeType=ResourceAdapter,J2EEServer=TestOpenEJBServer,name=MockRA"); + public static final ObjectName ACTIVATIONSPEC_NAME = JMXUtil.getObjectName("geronimo.server:j2eeType=ActivationSpec,name=MockMDB"); + public static final ObjectName THREADPOOL_NAME = JMXUtil.getObjectName(J2EE_SERVER_PREFIX + ":type=ThreadPool,name=DefaultThreadPool"); + public static final ObjectName TRANSACTIONAL_TIMER_NAME = JMXUtil.getObjectName(J2EE_SERVER_PREFIX + ":type=ThreadPooledTimer,name=TransactionalThreaPooledTimer"); + public static final ObjectName NONTRANSACTIONAL_TIMER_NAME = JMXUtil.getObjectName(J2EE_SERVER_PREFIX + ":type=ThreadPooledTimer,name=NonTransactionalThreaPooledTimer"); + +} Added: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/J2EEManager.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/J2EEManager.java Tue Nov 2 13:28:59 2004 @@ -0,0 +1,183 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.geronimo.axis.testUtils; + +import org.apache.axis.AxisFault; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.geronimo.axis.AxisGeronimoUtils; +import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator; +import org.apache.geronimo.gbean.jmx.GBeanMBean; +import org.apache.geronimo.j2ee.management.impl.J2EEServerImpl; +import org.apache.geronimo.kernel.Kernel; +import org.apache.geronimo.pool.ThreadPool; +import org.apache.geronimo.system.serverinfo.ServerInfo; +import org.apache.geronimo.timer.vm.VMStoreThreadPooledNonTransactionalTimer; +import org.apache.geronimo.timer.vm.VMStoreThreadPooledTransactionalTimer; +import org.apache.geronimo.transaction.GeronimoTransactionManager; +import org.apache.geronimo.transaction.context.TransactionContextManager; + +import javax.management.ObjectName; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +public class J2EEManager { + public static final Log log = LogFactory.getLog(J2EEManager.class); + + public void init() throws AxisFault { + } + + public void startJ2EEContainer(Kernel kernel) throws AxisFault { + try { + String str = + System.getProperty(javax.naming.Context.URL_PKG_PREFIXES); + if (str == null) { + str = ":org.apache.geronimo.naming"; + } else { + str = str + ":org.apache.geronimo.naming"; + } + System.setProperty(javax.naming.Context.URL_PKG_PREFIXES, str); + setUpTransactionManager(kernel); + setUpTimer(kernel); + GBeanMBean serverInfoGBean = new GBeanMBean(ServerInfo.GBEAN_INFO); + serverInfoGBean.setAttribute("baseDirectory", "."); + AxisGeronimoUtils.startGBeanOnlyIfNotStarted(AxisGeronimoConstants.J2EE_SERVER_INFO, serverInfoGBean, kernel); + GBeanMBean j2eeServerGBean = new GBeanMBean(J2EEServerImpl.GBEAN_INFO); + j2eeServerGBean.setReferencePatterns("ServerInfo", Collections.singleton(AxisGeronimoConstants.J2EE_SERVER_INFO)); + AxisGeronimoUtils.startGBeanOnlyIfNotStarted(AxisGeronimoConstants.J2EE_SERVER_NAME, j2eeServerGBean, kernel); + + + // //load mock resource adapter for mdb + // setUpResourceAdapter(kernel); + startEJBContainer(kernel); + startWebContainer(kernel); + } catch (Exception e) { + throw AxisFault.makeFault(e); + } + } + + public void stopJ2EEContainer(Kernel kernel) throws AxisFault { + try { + stopWebContainer(kernel); + stopEJBContainer(kernel); + stopTransactionManager(kernel); + stopTimer(kernel); + AxisGeronimoUtils.stopGBean(AxisGeronimoConstants.J2EE_SERVER_INFO, kernel); + AxisGeronimoUtils.stopGBean(AxisGeronimoConstants.J2EE_SERVER_NAME, kernel); + } catch (Exception e) { + throw AxisFault.makeFault(e); + } + } + + private void setUpTransactionManager(Kernel kernel) throws AxisFault { + try { + GBeanMBean tmGBean = new GBeanMBean(GeronimoTransactionManager.GBEAN_INFO); + Set rmpatterns = new HashSet(); + rmpatterns.add(ObjectName.getInstance("geronimo.server:j2eeType=JCAManagedConnectionFactory,*")); + tmGBean.setAttribute("defaultTransactionTimeoutSeconds", new Integer(10)); + tmGBean.setReferencePatterns("ResourceManagers", rmpatterns); + AxisGeronimoUtils.startGBeanOnlyIfNotStarted(AxisGeronimoConstants.TRANSACTION_MANAGER_NAME, tmGBean, kernel); + GBeanMBean tcmGBean = new GBeanMBean(TransactionContextManager.GBEAN_INFO); + tcmGBean.setReferencePattern("TransactionManager", AxisGeronimoConstants.TRANSACTION_MANAGER_NAME); + AxisGeronimoUtils.startGBeanOnlyIfNotStarted(AxisGeronimoConstants.TRANSACTION_CONTEXT_MANAGER_NAME, tcmGBean, kernel); + GBeanMBean trackedConnectionAssociator = new GBeanMBean(ConnectionTrackingCoordinator.GBEAN_INFO); + AxisGeronimoUtils.startGBeanOnlyIfNotStarted(AxisGeronimoConstants.TRACKED_CONNECTION_ASSOCIATOR_NAME, trackedConnectionAssociator, kernel); + } catch (Exception e) { + throw AxisFault.makeFault(e); + } + } + + private void stopTransactionManager(Kernel kernel) throws AxisFault { + try { + AxisGeronimoUtils.stopGBean(AxisGeronimoConstants.TRANSACTION_MANAGER_NAME, kernel); + AxisGeronimoUtils.stopGBean(AxisGeronimoConstants.TRANSACTION_CONTEXT_MANAGER_NAME, kernel); + AxisGeronimoUtils.stopGBean(AxisGeronimoConstants.TRACKED_CONNECTION_ASSOCIATOR_NAME, kernel); + } catch (Exception e) { + throw AxisFault.makeFault(e); + } + } + + public static void setUpTimer(Kernel kernel) throws Exception { + GBeanMBean threadPoolGBean = new GBeanMBean(ThreadPool.GBEAN_INFO); + threadPoolGBean.setAttribute("keepAliveTime", new Integer(5000)); + threadPoolGBean.setAttribute("poolSize", new Integer(5)); + threadPoolGBean.setAttribute("poolName", "DefaultThreadPool"); + AxisGeronimoUtils.startGBeanOnlyIfNotStarted(AxisGeronimoConstants.THREADPOOL_NAME, threadPoolGBean, kernel); + GBeanMBean transactionalTimerGBean = new GBeanMBean(VMStoreThreadPooledTransactionalTimer.GBEAN_INFO); + transactionalTimerGBean.setAttribute("repeatCount", new Integer(5)); + transactionalTimerGBean.setReferencePattern("TransactionContextManager", AxisGeronimoConstants.TRANSACTION_CONTEXT_MANAGER_NAME); + transactionalTimerGBean.setReferencePattern("ThreadPool", AxisGeronimoConstants.THREADPOOL_NAME); + AxisGeronimoUtils.startGBeanOnlyIfNotStarted(AxisGeronimoConstants.TRANSACTIONAL_TIMER_NAME, transactionalTimerGBean, kernel); + GBeanMBean nonTransactionalTimerGBean = new GBeanMBean(VMStoreThreadPooledNonTransactionalTimer.GBEAN_INFO); + nonTransactionalTimerGBean.setReferencePattern("ThreadPool", AxisGeronimoConstants.THREADPOOL_NAME); + AxisGeronimoUtils.startGBeanOnlyIfNotStarted(AxisGeronimoConstants.NONTRANSACTIONAL_TIMER_NAME, nonTransactionalTimerGBean, kernel); + } + + private void stopTimer(Kernel kernel) throws AxisFault { + try { + AxisGeronimoUtils.stopGBean(AxisGeronimoConstants.THREADPOOL_NAME, kernel); + AxisGeronimoUtils.stopGBean(AxisGeronimoConstants.TRANSACTIONAL_TIMER_NAME, kernel); + AxisGeronimoUtils.stopGBean(AxisGeronimoConstants.NONTRANSACTIONAL_TIMER_NAME, kernel); + } catch (Exception e) { + throw AxisFault.makeFault(e); + } + } + + public void startWebContainer(Kernel kernel) throws Exception { + Set containerPatterns = Collections.singleton(AxisGeronimoConstants.WEB_CONTAINER_NAME); + GBeanMBean container = new GBeanMBean("org.apache.geronimo.jetty.JettyContainerImpl"); + GBeanMBean connector = new GBeanMBean("org.apache.geronimo.jetty.connector.HTTPConnector"); + connector.setAttribute("port", new Integer(AxisGeronimoUtils.AXIS_SERVICE_PORT)); + connector.setReferencePatterns("JettyContainer", containerPatterns); + AxisGeronimoUtils.startGBeanOnlyIfNotStarted(AxisGeronimoConstants.WEB_CONTAINER_NAME, container, kernel); + AxisGeronimoUtils.startGBeanOnlyIfNotStarted(AxisGeronimoConstants.WEB_CONNECTOR_NAME, connector, kernel); + } + + private void stopWebContainer(Kernel kernel) throws AxisFault { + try { + AxisGeronimoUtils.stopGBean(AxisGeronimoConstants.WEB_CONNECTOR_NAME, kernel); + AxisGeronimoUtils.stopGBean(AxisGeronimoConstants.WEB_CONTAINER_NAME, kernel); + } catch (Exception e) { + throw AxisFault.makeFault(e); + } + } + + public void startEJBContainer(Kernel kernel) throws Exception { + GBeanMBean containerIndexGBean = new GBeanMBean("org.openejb.ContainerIndex"); + Set ejbContainerNames = new HashSet(); + ejbContainerNames.add(ObjectName.getInstance(AxisGeronimoConstants.J2EE_DOMAIN_NAME + + ":j2eeType=StatelessSessionBean,*")); + ejbContainerNames.add(ObjectName.getInstance(AxisGeronimoConstants.J2EE_DOMAIN_NAME + + ":j2eeType=StatefulSessionBean,*")); + ejbContainerNames.add(ObjectName.getInstance(AxisGeronimoConstants.J2EE_DOMAIN_NAME + + ":j2eeType=EntityBean,*")); + containerIndexGBean.setReferencePatterns("EJBContainers", + ejbContainerNames); + AxisGeronimoUtils.startGBeanOnlyIfNotStarted(AxisGeronimoConstants.EJB_CONTAINER_NAME, + containerIndexGBean, kernel); + } + + private void stopEJBContainer(Kernel kernel) throws AxisFault { + try { + AxisGeronimoUtils.stopGBean(AxisGeronimoConstants.EJB_CONTAINER_NAME, kernel); + } catch (Exception e) { + throw AxisFault.makeFault(e); + } + } + +} Added: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/J2EEManagerTest.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/J2EEManagerTest.java Tue Nov 2 13:28:59 2004 @@ -0,0 +1,50 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.axis.testUtils; + +import org.apache.geronimo.axis.AbstractTestCase; +import org.apache.geronimo.kernel.Kernel; + +import javax.management.ObjectName; + +/** + * <p>This test case represents the code generation with the EWS module. + * This test case needed the $JAVA_HOME/lib.tools.jar at the classapth.</p> + */ +public class J2EEManagerTest extends AbstractTestCase { + private ObjectName name; + private Kernel kernel; + + public J2EEManagerTest(String testName) { + super(testName); + } + + public void testEcho() throws Exception { + J2EEManager j2eem = new J2EEManager(); + j2eem.startJ2EEContainer(kernel); + j2eem.stopJ2EEContainer(kernel); + } + + protected void setUp() throws Exception { + name = new ObjectName("test:name=AxisGBean"); + kernel = new Kernel("test.kernel", "test"); + kernel.boot(); + } + + protected void tearDown() throws Exception { + kernel.shutdown(); + } +} Added: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/JettyServiceWrapper.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/JettyServiceWrapper.java Tue Nov 2 13:28:59 2004 @@ -0,0 +1,98 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.geronimo.axis.testUtils; + +import org.apache.geronimo.axis.AxisGeronimoUtils; +import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator; +import org.apache.geronimo.gbean.jmx.GBeanMBean; +import org.apache.geronimo.jetty.JettyContainerImpl; +import org.apache.geronimo.jetty.connector.HTTPConnector; +import org.apache.geronimo.kernel.Kernel; +import org.apache.geronimo.transaction.GeronimoTransactionManager; +import org.apache.geronimo.transaction.context.TransactionContextManager; + +import javax.management.MBeanServer; +import javax.management.ObjectName; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +/** + * <p>This class wrap the Jetty service, This is a test utility only</p> + */ +public class JettyServiceWrapper { + private ObjectName containerName; + private Set containerPatterns; + private ObjectName tmName; + private ObjectName tcaName; + private ObjectName connectorName; + private ObjectName tcmName; + + private final MBeanServer mbServer; + + public JettyServiceWrapper(Kernel kernel) { + this.mbServer = kernel.getMBeanServer(); + containerName = AxisGeronimoConstants.WEB_CONTAINER_NAME; + containerPatterns = Collections.singleton(containerName); + connectorName = AxisGeronimoConstants.WEB_CONNECTOR_NAME; + tmName = AxisGeronimoConstants.TRANSACTION_MANAGER_NAME; + tcaName = AxisGeronimoConstants.CONNTECTION_TRACKING_COORDINATOR; + tcmName = AxisGeronimoConstants.TRANSACTION_CONTEXT_MANAGER_NAME; + } + + public void doStart() throws Exception { + GBeanMBean connector; + GBeanMBean tm; + GBeanMBean ctc; + GBeanMBean container; + container = new GBeanMBean(JettyContainerImpl.GBEAN_INFO); + connector = new GBeanMBean(HTTPConnector.GBEAN_INFO); + connector.setAttribute("port", new Integer(AxisGeronimoUtils.AXIS_SERVICE_PORT)); + connector.setReferencePatterns("JettyContainer", containerPatterns); + start(containerName, container); + start(connectorName, connector); + + tm = new GBeanMBean(GeronimoTransactionManager.GBEAN_INFO); + Set patterns = new HashSet(); + patterns.add(ObjectName.getInstance("geronimo.server:j2eeType=JCAManagedConnectionFactory,*")); + tm.setReferencePatterns("ResourceManagers", patterns); + start(tmName, tm); + GBeanMBean tcm = new GBeanMBean(TransactionContextManager.GBEAN_INFO); + tcm.setReferencePattern("TransactionManager", tmName); + start(tcmName, tcm); + ctc = new GBeanMBean(ConnectionTrackingCoordinator.GBEAN_INFO); + start(tcaName, ctc); + } + + public void doStop() throws Exception { + stop(tcaName); + stop(tmName); + stop(connectorName); + stop(containerName); + } + + private void start(ObjectName name, Object instance) throws Exception { + mbServer.registerMBean(instance, name); + mbServer.invoke(name, "start", null, null); + } + + private void stop(ObjectName name) throws Exception { + mbServer.invoke(name, "stop", null, null); + mbServer.unregisterMBean(name); + } + +} Added: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/TestServer.java ============================================================================== --- (empty file) +++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/TestServer.java Tue Nov 2 13:28:59 2004 @@ -0,0 +1,71 @@ +/** + * + * Copyright 2003-2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.geronimo.axis.testUtils; + +import org.apache.geronimo.axis.AxisGbean; +import org.apache.geronimo.gbean.jmx.GBeanMBean; +import org.apache.geronimo.kernel.Kernel; + +import javax.management.ObjectName; +import java.net.URL; +import java.net.URLClassLoader; + +/** + * <p>Simple stanalone Axis Service started via a GBean. This is a test utility only</p> + * + * @author [EMAIL PROTECTED] + */ + +public class TestServer { + private Kernel kernel; + private ObjectName name; + private JettyServiceWrapper jettyService; + + public TestServer() throws Exception { + name = new ObjectName("test:name=AxisGBean"); + kernel = new Kernel("test.kernel", "test"); + kernel.boot(); + } + + public void start() throws Exception { + jettyService = new JettyServiceWrapper(kernel); + jettyService.doStart(); + ClassLoader cl = getClass().getClassLoader(); + ClassLoader myCl = new URLClassLoader(new URL[0], cl); + GBeanMBean gbean = new GBeanMBean(AxisGbean.getGBeanInfo(), myCl); + gbean.setAttribute("Name", "Test"); + kernel.loadGBean(name, gbean); + kernel.startGBean(name); + } + + public void stop() throws Exception { + //System.out.println("Shutting down the kernel"); + kernel.stopGBean(name); + kernel.unloadGBean(name); + jettyService.doStop(); + kernel.shutdown(); + } + + public static void main(String[] args) throws Exception { + TestServer test = new TestServer(); + test.start(); + System.in.read(); + test.stop(); + } + +}