JBossWS SVN: r14145 - stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/as/webservices/main.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-04-18 09:48:40 -0400 (Mon, 18 Apr 2011)
New Revision: 14145
Modified:
stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/as/webservices/main/module.xml
Log:
[JBWS-3270] Remove stack specific dependencies from org.jboss.as.webservices.integration module
Modified: stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/as/webservices/main/module.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/as/webservices/main/module.xml 2011-04-18 13:22:44 UTC (rev 14144)
+++ stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/as/webservices/main/module.xml 2011-04-18 13:48:40 UTC (rev 14145)
@@ -49,10 +49,6 @@
<module name="org.jboss.common-core" />
<module name="org.jboss.ws.api" />
<module name="org.jboss.ws.common" />
- <module name="org.jboss.ws.cxf.jbossws-cxf-factories" services="import"/>
- <module name="org.jboss.ws.jaxws-client" services="import"/>
- <module name="org.jboss.ws.cxf.jbossws-cxf-server" services="import"/>
<module name="org.jboss.ws.spi" />
- <module name="org.springframework.spring" optional="true" />
</dependencies>
</module>
12 years, 1 month
JBossWS SVN: r14144 - in stack/cxf/trunk/modules: resources/src/main/resources/modules/org/jboss/ws/tools and 5 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-04-18 09:22:44 -0400 (Mon, 18 Apr 2011)
New Revision: 14144
Added:
stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/common/
stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/common/main/
stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/common/main/module.xml
Modified:
stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/common/main/module.xml
stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsconsume/main/module.xml
stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsprovide/main/module.xml
stack/cxf/trunk/modules/testsuite/pom.xml
Log:
[JBWS-3273] refactoring jbossws-common.jar -> jbossws-common-tools.jar AS7 modules
Modified: stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/common/main/module.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/common/main/module.xml 2011-04-18 13:22:10 UTC (rev 14143)
+++ stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/common/main/module.xml 2011-04-18 13:22:44 UTC (rev 14144)
@@ -29,7 +29,6 @@
</resources>
<dependencies>
- <module name="gnu.getopt"/>
<module name="javax.api"/>
<module name="javax.annotation.api"/>
<module name="javax.ejb.api"/>
@@ -37,12 +36,10 @@
<module name="javax.servlet.api"/>
<module name="javax.wsdl4j.api" />
<module name="javax.xml.ws.api"/>
- <module name="org.jboss.modules"/>
<module name="org.jboss.ws.api"/>
<module name="org.jboss.ws.spi"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.common-core"/>
- <module name="org.apache.log4j"/>
<module name="org.apache.xerces" services="import"/>
</dependencies>
Added: stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/common/main/module.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/common/main/module.xml (rev 0)
+++ stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/common/main/module.xml 2011-04-18 13:22:44 UTC (rev 14144)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file in the
+ ~ distribution for a full listing of individual contributors.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+
+<module xmlns="urn:jboss:module:1.0" name="org.jboss.ws.tools.common">
+
+ <resources>
+ <!-- Insert resources here -->
+ </resources>
+
+ <dependencies>
+ <module name="gnu.getopt"/>
+ <module name="org.apache.log4j"/>
+ <module name="org.jboss.modules"/>
+ <module name="org.jboss.ws.api"/>
+ </dependencies>
+
+</module>
Modified: stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsconsume/main/module.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsconsume/main/module.xml 2011-04-18 13:22:10 UTC (rev 14143)
+++ stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsconsume/main/module.xml 2011-04-18 13:22:44 UTC (rev 14144)
@@ -27,7 +27,7 @@
<main-class name="org.jboss.wsf.spi.tools.cmd.WSConsume"/>
<dependencies>
- <module name="org.jboss.ws.common"/>
+ <module name="org.jboss.ws.tools.common"/>
</dependencies>
</module>
Modified: stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsprovide/main/module.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsprovide/main/module.xml 2011-04-18 13:22:10 UTC (rev 14143)
+++ stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsprovide/main/module.xml 2011-04-18 13:22:44 UTC (rev 14144)
@@ -27,7 +27,7 @@
<main-class name="org.jboss.wsf.spi.tools.cmd.WSProvide"/>
<dependencies>
- <module name="org.jboss.ws.common"/>
+ <module name="org.jboss.ws.tools.common"/>
</dependencies>
</module>
Modified: stack/cxf/trunk/modules/testsuite/pom.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/pom.xml 2011-04-18 13:22:10 UTC (rev 14143)
+++ stack/cxf/trunk/modules/testsuite/pom.xml 2011-04-18 13:22:44 UTC (rev 14144)
@@ -46,6 +46,12 @@
<artifactId>jbossws-common-tools</artifactId>
</dependency>
<dependency>
+ <groupId>gnu-getopt</groupId>
+ <artifactId>getopt</artifactId>
+ <version>1.0.13</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb-api</artifactId>
</dependency>
12 years, 1 month
JBossWS SVN: r14143 - in stack/native/trunk/modules: resources/src/main/resources/modules/org/jboss/ws/tools and 6 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-04-18 09:22:10 -0400 (Mon, 18 Apr 2011)
New Revision: 14143
Added:
stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/common/
stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/common/main/
stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/common/main/module.xml
Modified:
stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/common/main/module.xml
stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsconsume/main/module.xml
stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsprovide/main/module.xml
stack/native/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
stack/native/trunk/modules/testsuite/pom.xml
Log:
[JBWS-3273] refactoring jbossws-common.jar -> jbossws-common-tools.jar AS7 modules
Modified: stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/common/main/module.xml
===================================================================
--- stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/common/main/module.xml 2011-04-18 13:07:20 UTC (rev 14142)
+++ stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/common/main/module.xml 2011-04-18 13:22:10 UTC (rev 14143)
@@ -29,7 +29,6 @@
</resources>
<dependencies>
- <module name="gnu.getopt"/>
<module name="javax.api"/>
<module name="javax.annotation.api"/>
<module name="javax.ejb.api"/>
@@ -38,12 +37,10 @@
<module name="javax.wsdl4j.api" />
<module name="javax.xml.ws.api"/>
<module name="org.jboss.jaxbintros"/>
- <module name="org.jboss.modules"/>
<module name="org.jboss.ws.api"/>
<module name="org.jboss.ws.spi"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.common-core"/>
- <module name="org.apache.log4j"/>
<module name="org.apache.xerces" services="import"/>
</dependencies>
</module>
Added: stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/common/main/module.xml
===================================================================
--- stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/common/main/module.xml (rev 0)
+++ stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/common/main/module.xml 2011-04-18 13:22:10 UTC (rev 14143)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file in the
+ ~ distribution for a full listing of individual contributors.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+
+<module xmlns="urn:jboss:module:1.0" name="org.jboss.ws.tools.common">
+
+ <resources>
+ <!-- Insert resources here -->
+ </resources>
+
+ <dependencies>
+ <module name="gnu.getopt"/>
+ <module name="org.apache.log4j"/>
+ <module name="org.jboss.modules"/>
+ <module name="org.jboss.ws.api"/>
+ </dependencies>
+
+</module>
Modified: stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsconsume/main/module.xml
===================================================================
--- stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsconsume/main/module.xml 2011-04-18 13:07:20 UTC (rev 14142)
+++ stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsconsume/main/module.xml 2011-04-18 13:22:10 UTC (rev 14143)
@@ -27,7 +27,7 @@
<main-class name="org.jboss.wsf.spi.tools.cmd.WSConsume"/>
<dependencies>
- <module name="org.jboss.ws.common"/>
+ <module name="org.jboss.ws.tools.common"/>
</dependencies>
</module>
Modified: stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsprovide/main/module.xml
===================================================================
--- stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsprovide/main/module.xml 2011-04-18 13:07:20 UTC (rev 14142)
+++ stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsprovide/main/module.xml 2011-04-18 13:22:10 UTC (rev 14143)
@@ -27,7 +27,7 @@
<main-class name="org.jboss.wsf.spi.tools.cmd.WSProvide"/>
<dependencies>
- <module name="org.jboss.ws.common"/>
+ <module name="org.jboss.ws.tools.common"/>
</dependencies>
</module>
Modified: stack/native/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
===================================================================
--- stack/native/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2011-04-18 13:07:20 UTC (rev 14142)
+++ stack/native/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2011-04-18 13:22:10 UTC (rev 14143)
@@ -380,6 +380,11 @@
<include name="**/jbossws-common.jar"/>
</fileset>
</copy>
+ <copy todir="@{targetdir}/org/jboss/ws/tools/common/main" flatten="false" overwrite="true">
+ <fileset dir="@{thirdpartydir}/lib">
+ <include name="**/jbossws-common-tools.jar"/>
+ </fileset>
+ </copy>
<copy todir="@{targetdir}/org/jboss/ws/spi/main" flatten="false" overwrite="true">
<fileset dir="@{thirdpartydir}/lib">
<include name="**/jbossws-spi.jar"/>
Modified: stack/native/trunk/modules/testsuite/pom.xml
===================================================================
--- stack/native/trunk/modules/testsuite/pom.xml 2011-04-18 13:07:20 UTC (rev 14142)
+++ stack/native/trunk/modules/testsuite/pom.xml 2011-04-18 13:22:10 UTC (rev 14143)
@@ -52,6 +52,12 @@
<artifactId>jbossws-common-tools</artifactId>
</dependency>
<dependency>
+ <groupId>gnu-getopt</groupId>
+ <artifactId>getopt</artifactId>
+ <version>1.0.13</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.5.0</version>
12 years, 1 month
JBossWS SVN: r14142 - in stack/cxf/trunk/modules/testsuite/cxf-tests: src/test/java/org/jboss/test/ws/jaxws/cxf/jaxbintros and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-04-18 09:07:20 -0400 (Mon, 18 Apr 2011)
New Revision: 14142
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jaxbintros/Helper.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jaxbintros/JAXBIntroServletTestCase.java
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jaxbintros/JAXBIntroTestCase.java
Log:
[JBWS-3274] Refactor jaxbintros cxf specific testcase
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2011-04-18 12:19:00 UTC (rev 14141)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2011-04-18 13:07:20 UTC (rev 14142)
@@ -113,6 +113,27 @@
<include name="**/*" />
</metainf>
</jar>
+ <war warfile="${tests.output.dir}/test-libs/jaxws-cxf-jaxbintros-client.war"
+ needxmlfile='false'>
+ <classes dir="${tests.output.dir}/test-classes">
+ <include name="org/jboss/test/ws/jaxws/cxf/jaxbintros/Helper.class"/>
+ <include name="org/jboss/test/ws/jaxws/cxf/jaxbintros/Endpoint.class"/>
+ <include name="org/jboss/test/ws/jaxws/cxf/jaxbintros/UserType.class"/>
+ <include name="org/jboss/test/ws/jaxws/cxf/jaxbintros/AnnotatedUserEndpoint.class"/>
+ <include name="org/jboss/test/ws/jaxws/cxf/jaxbintros/AnnotatedUserType.class"/>
+ <include name="test-resources/jaxws/cxf/jaxbintros/META-INF/jaxb-intros.xml"/>
+ </classes>
+ <classes dir="${tests.output.dir}/test-resources/jaxws/cxf/jaxbintros/META-INF">
+ <include name="jaxb-intros.xml"/>
+ </classes>
+ <classes dir="${tests.output.dir}/classes">
+ <include name="org/jboss/wsf/test/TestServlet.class"/>
+ <include name="org/jboss/wsf/test/ClientHelper.class"/>
+ </classes>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.cxf.jbossws-cxf-client services"/>
+ </manifest>
+ </war>
<!-- jaxws-cxf-jbws3060 -->
<jar destfile="${tests.output.dir}/test-libs/jaxws-cxf-jbws3060.jar">
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jaxbintros/Helper.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jaxbintros/Helper.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jaxbintros/Helper.java 2011-04-18 13:07:20 UTC (rev 14142)
@@ -0,0 +1,142 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.cxf.jaxbintros;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.configuration.Configurer;
+import org.jboss.jaxb.intros.BindingCustomizationFactory;
+import org.jboss.wsf.spi.binding.BindingCustomization;
+import org.jboss.wsf.spi.binding.JAXBBindingCustomization;
+import org.jboss.wsf.stack.cxf.client.configuration.JBossWSConfigurer;
+import org.jboss.wsf.test.ClientHelper;
+
+/**
+ * Test the JAXBIntroduction features.
+ *
+ * jaxb-intros.xml can reside under META-INF or WEB-INF and should be
+ * picked up by JAXBIntroduction deployment aspect on server side.
+ *
+ * @author alessio.soldano(a)jboss.com
+ */
+public class Helper implements ClientHelper
+{
+ private String endpointAddress;
+ private URL jaxbIntroUrl;
+
+ public Helper()
+ {
+
+ }
+
+ public Helper(String endpointAddress)
+ {
+ this.setTargetEndpoint(endpointAddress);
+ }
+
+ public boolean testEndpoint() throws Exception
+ {
+ Bus bus = setBindingCustomizationOnClientSide();
+ try
+ {
+ URL wsdlURL = new URL(endpointAddress + "?wsdl");
+ QName serviceName = new QName("http://org.jboss.ws/cxf/jaxbintros", "EndpointBeanService");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ Endpoint port = service.getPort(Endpoint.class);
+ UserType user = new UserType();
+ QName qname = new QName("ns", "local", "prefix");
+ user.setQname(qname);
+ user.setString("Foo");
+ UserType result = port.echo(user);
+ if (!"Foo".equals(result.getString())) {
+ return false;
+ }
+ if (!qname.equals(result.getQname())) {
+ return false;
+ }
+ }
+ finally
+ {
+ bus.shutdown(true);
+ }
+ return true;
+ }
+
+ public boolean testAnnotatedUserEndpoint() throws Exception
+ {
+ URL wsdlURL = new URL(endpointAddress + "?wsdl");
+ QName serviceName = new QName("http://org.jboss.ws/cxf/jaxbintros", "EndpointBeanService");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ AnnotatedUserEndpoint port = service.getPort(AnnotatedUserEndpoint.class);
+ AnnotatedUserType user = new AnnotatedUserType();
+ QName qname = new QName("ns", "local", "prefix");
+ user.setQname(qname);
+ user.setString("Foo");
+ AnnotatedUserType result = port.echo(user);
+ if (!"Foo".equals(result.getString())) {
+ return false;
+ }
+ if (!qname.equals(result.getQname())) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Setup binding customization on client side using the JBossWSConfigurer
+ *
+ * @throws Exception
+ */
+ @SuppressWarnings("unchecked")
+ private Bus setBindingCustomizationOnClientSide() throws Exception
+ {
+ BindingCustomization jaxbCustomizations = new JAXBBindingCustomization();
+ if (jaxbIntroUrl == null)
+ {
+ jaxbIntroUrl = Thread.currentThread().getContextClassLoader().getResource("jaxb-intros.xml");
+ }
+ BindingCustomizationFactory.populateBindingCustomization(jaxbIntroUrl.openStream(), jaxbCustomizations);
+
+ Bus bus = BusFactory.getThreadDefaultBus();
+ JBossWSConfigurer configurer = (JBossWSConfigurer)bus.getExtension(Configurer.class);
+ configurer.getCustomizer().setBindingCustomization(jaxbCustomizations);
+ return bus;
+ }
+
+ public void setJAXBIntroURL(URL url)
+ {
+ this.jaxbIntroUrl = url;
+ }
+
+ @Override
+ public void setTargetEndpoint(String address)
+ {
+ this.endpointAddress = address;
+ }
+}
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jaxbintros/JAXBIntroServletTestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jaxbintros/JAXBIntroServletTestCase.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jaxbintros/JAXBIntroServletTestCase.java 2011-04-18 13:07:20 UTC (rev 14142)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.cxf.jaxbintros;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import junit.framework.Test;
+
+import org.jboss.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.wsf.test.JBossWSTest;
+
+/**
+ * Test the JAXBIntroduction features.
+ *
+ * jaxb-intros.xml can reside under META-INF or WEB-INF and should be
+ * picked up by JAXBIntroduction deployment aspect on server side.
+ *
+ * @author alessio.soldano(a)jboss.com
+ */
+public class JAXBIntroServletTestCase extends JBossWSTest
+{
+
+ public static Test suite()
+ {
+ return new JBossWSCXFTestSetup(JAXBIntroServletTestCase.class, "jaxws-cxf-jaxbintros.jar, jaxws-cxf-jaxbintros-client.war");
+ }
+
+ /**
+ * Both client and server side use plain UserType class but have jaxbintros in place to deal with customizations
+ *
+ * @throws Exception
+ */
+ public void testEndpoint() throws Exception
+ {
+ assertEquals("1", runTestInContainer("testEndpoint"));
+ }
+
+ /**
+ * Client side uses the annotated user type class, server side uses the plain one but has jaxbintros in place
+ *
+ * @throws Exception
+ */
+ public void testAnnotatedUserEndpoint() throws Exception
+ {
+ assertEquals("1", runTestInContainer("testAnnotatedUserEndpoint"));
+ }
+
+ private String runTestInContainer(String test) throws Exception
+ {
+ URL url = new URL("http://" + getServerHost()
+ + ":8080/jaxws-cxf-jaxbintros-client?path=/jaxws-cxf-jaxbintros/EndpointService&method=" + test
+ + "&helper=" + Helper.class.getName());
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ return br.readLine();
+ }
+}
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jaxbintros/JAXBIntroTestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jaxbintros/JAXBIntroTestCase.java 2011-04-18 12:19:00 UTC (rev 14141)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jaxbintros/JAXBIntroTestCase.java 2011-04-18 13:07:20 UTC (rev 14142)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -21,22 +21,15 @@
*/
package org.jboss.test.ws.jaxws.cxf.jaxbintros;
+import java.net.MalformedURLException;
import java.net.URL;
import java.util.Iterator;
import javax.xml.namespace.QName;
-import javax.xml.ws.Service;
import junit.framework.Test;
-import org.apache.cxf.Bus;
-import org.apache.cxf.BusFactory;
-import org.apache.cxf.configuration.Configurer;
-import org.jboss.jaxb.intros.BindingCustomizationFactory;
import org.jboss.wsf.common.DOMUtils;
-import org.jboss.wsf.spi.binding.BindingCustomization;
-import org.jboss.wsf.spi.binding.JAXBBindingCustomization;
-import org.jboss.wsf.stack.cxf.client.configuration.JBossWSConfigurer;
import org.jboss.wsf.test.JBossWSCXFTestSetup;
import org.jboss.wsf.test.JBossWSTest;
import org.w3c.dom.Element;
@@ -53,8 +46,7 @@
{
private String endpointAddress = "http://" + getServerHost() + ":8080/jaxws-cxf-jaxbintros/EndpointService";
- private Bus bus;
- private JBossWSConfigurer configurer;
+ private Helper helper;
public static Test suite()
{
@@ -78,6 +70,16 @@
}
assertTrue("<xs:attribute name=\"string\" ..> not found in wsdl", attributeFound);
}
+
+ private Helper getHelper() throws MalformedURLException
+ {
+ if (helper == null)
+ {
+ helper = new Helper(endpointAddress);
+ helper.setJAXBIntroURL(getResourceURL("jaxws/cxf/jaxbintros/META-INF/jaxb-intros.xml"));
+ }
+ return helper;
+ }
/**
* Both client and server side use plain UserType class but have jaxbintros in place to deal with customizations
@@ -86,26 +88,7 @@
*/
public void testEndpoint() throws Exception
{
- try
- {
- URL wsdlURL = new URL(endpointAddress + "?wsdl");
- QName serviceName = new QName("http://org.jboss.ws/cxf/jaxbintros", "EndpointBeanService");
-
- setBindingCustomizationOnClientSide();
- Service service = Service.create(wsdlURL, serviceName);
- Endpoint port = service.getPort(Endpoint.class);
- UserType user = new UserType();
- QName qname = new QName("ns", "local", "prefix");
- user.setQname(qname);
- user.setString("Foo");
- UserType result = port.echo(user);
- assertEquals("Foo", result.getString());
- assertEquals(qname, result.getQname());
- }
- finally
- {
- unsetBindingCustomizationOnClientSide();
- }
+ assertTrue(getHelper().testEndpoint());
}
/**
@@ -115,39 +98,6 @@
*/
public void testAnnotatedUserEndpoint() throws Exception
{
- URL wsdlURL = new URL(endpointAddress + "?wsdl");
- QName serviceName = new QName("http://org.jboss.ws/cxf/jaxbintros", "EndpointBeanService");
-
- Service service = Service.create(wsdlURL, serviceName);
- AnnotatedUserEndpoint port = service.getPort(AnnotatedUserEndpoint.class);
- AnnotatedUserType user = new AnnotatedUserType();
- QName qname = new QName("ns", "local", "prefix");
- user.setQname(qname);
- user.setString("Foo");
- AnnotatedUserType result = port.echo(user);
- assertEquals("Foo", result.getString());
- assertEquals(qname, result.getQname());
+ assertTrue(getHelper().testAnnotatedUserEndpoint());
}
-
- /**
- * Setup binding customization on client side using the JBossWSConfigurer
- *
- * @throws Exception
- */
- @SuppressWarnings("unchecked")
- private void setBindingCustomizationOnClientSide() throws Exception
- {
- BindingCustomization jaxbCustomizations = new JAXBBindingCustomization();
- BindingCustomizationFactory.populateBindingCustomization(getResourceURL("jaxws/cxf/jaxbintros/META-INF/jaxb-intros.xml").openStream(), jaxbCustomizations);
-
- bus = BusFactory.getThreadDefaultBus();
- configurer = (JBossWSConfigurer)bus.getExtension(Configurer.class);
- configurer.getCustomizer().setBindingCustomization(jaxbCustomizations);
- }
-
- private void unsetBindingCustomizationOnClientSide()
- {
- if (configurer != null)
- configurer.getCustomizer().setBindingCustomization(null);
- }
}
12 years, 1 month
JBossWS SVN: r14141 - in stack/native/trunk: modules/client and 7 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-04-18 08:19:00 -0400 (Mon, 18 Apr 2011)
New Revision: 14141
Modified:
stack/native/trunk/modules/client/pom.xml
stack/native/trunk/modules/core/pom.xml
stack/native/trunk/modules/dist/pom.xml
stack/native/trunk/modules/dist/src/main/distro/build-deploy.xml
stack/native/trunk/modules/dist/src/main/distro/build-project-gen.xml
stack/native/trunk/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml
stack/native/trunk/modules/resources/src/main/resources/bin/wsconsume.bat
stack/native/trunk/modules/resources/src/main/resources/bin/wsconsume.sh
stack/native/trunk/modules/resources/src/main/resources/bin/wsprovide.bat
stack/native/trunk/modules/resources/src/main/resources/bin/wsprovide.sh
stack/native/trunk/modules/resources/src/main/resources/bin/wsrunclient.bat
stack/native/trunk/modules/resources/src/main/resources/bin/wsrunclient.sh
stack/native/trunk/modules/resources/src/main/resources/bin/wstools.bat
stack/native/trunk/modules/resources/src/main/resources/bin/wstools.sh
stack/native/trunk/modules/resources/src/main/resources/resources/deploy.conf
stack/native/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
stack/native/trunk/modules/testsuite/pom.xml
stack/native/trunk/pom.xml
Log:
[JBWS-3273] removing ANT & CMD tools from jbossws-common.jar to jbossws-common-tools.jar
Modified: stack/native/trunk/modules/client/pom.xml
===================================================================
--- stack/native/trunk/modules/client/pom.xml 2011-04-18 11:21:18 UTC (rev 14140)
+++ stack/native/trunk/modules/client/pom.xml 2011-04-18 12:19:00 UTC (rev 14141)
@@ -47,7 +47,7 @@
<configuration>
<archive>
<manifestEntries>
- <Class-Path>jbossws-api.jar jbossws-spi.jar jbossws-common.jar jbossws-native-core.jar jbossws-native-factories.jar jbossws-native-services.jar jaxrpc-api.jar jaxws-api.jar jsr181-api.jar saaj-api.jar activation.jar commons-logging.jar concurrent.jar javassist.jar jaxb-api.jar jaxb-impl.jar mail.jar jboss-logging-spi.jar jboss-logging-log4j.jar jcl-over-slf4j.jar slf4j-api.jar slf4j-jboss-logging.jar jbosssx-client.jar jboss-javaee.jar jboss-xml-binding.jar jbossxb.jar netty.jar wscommons-policy.jar stax-api.jar wsdl4j.jar</Class-Path>
+ <Class-Path>jbossws-api.jar jbossws-spi.jar jbossws-common.jar jbossws-common-tools.jar jbossws-native-core.jar jbossws-native-factories.jar jbossws-native-services.jar jaxrpc-api.jar jaxws-api.jar jsr181-api.jar saaj-api.jar activation.jar commons-logging.jar concurrent.jar javassist.jar jaxb-api.jar jaxb-impl.jar mail.jar jboss-logging-spi.jar jboss-logging-log4j.jar jcl-over-slf4j.jar slf4j-api.jar slf4j-jboss-logging.jar jbosssx-client.jar jboss-javaee.jar jboss-xml-binding.jar jbossxb.jar netty.jar wscommons-policy.jar stax-api.jar wsdl4j.jar</Class-Path>
</manifestEntries>
</archive>
</configuration>
Modified: stack/native/trunk/modules/core/pom.xml
===================================================================
--- stack/native/trunk/modules/core/pom.xml 2011-04-18 11:21:18 UTC (rev 14140)
+++ stack/native/trunk/modules/core/pom.xml 2011-04-18 12:19:00 UTC (rev 14141)
@@ -45,6 +45,11 @@
</dependency>
<!-- provided apis -->
<dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
<scope>provided</scope>
Modified: stack/native/trunk/modules/dist/pom.xml
===================================================================
--- stack/native/trunk/modules/dist/pom.xml 2011-04-18 11:21:18 UTC (rev 14140)
+++ stack/native/trunk/modules/dist/pom.xml 2011-04-18 12:19:00 UTC (rev 14141)
@@ -53,6 +53,12 @@
<classifier>jboss700</classifier>
</dependency>
+ <dependency>
+ <groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-common-tools</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
<!--test-suite-->
<dependency>
<groupId>org.jboss.ws</groupId>
Modified: stack/native/trunk/modules/dist/src/main/distro/build-deploy.xml
===================================================================
--- stack/native/trunk/modules/dist/src/main/distro/build-deploy.xml 2011-04-18 11:21:18 UTC (rev 14140)
+++ stack/native/trunk/modules/dist/src/main/distro/build-deploy.xml 2011-04-18 12:19:00 UTC (rev 14141)
@@ -100,12 +100,12 @@
<target name="deploy-structure-jboss700" depends="prepare-deploy">
<delete dir="${deploy.structure}"/>
- <path id="jbossws-common.path">
+ <path id="jbossws-common-tools.path">
<fileset dir="${deploy.artifacts.dir}">
- <include name="**/jbossws-common.jar"/>
+ <include name="**/jbossws-common-tools.jar"/>
</fileset>
</path>
- <taskdef name="installModules" classname="org.jboss.ws.tools.ant.InstallModulesTask" classpathref="jbossws-common.path"/>
+ <taskdef name="installModules" classname="org.jboss.ws.tools.ant.InstallModulesTask" classpathref="jbossws-common-tools.path"/>
<antcall target="deploy-jbossws-native-modules" inheritall="false">
<param name="installserver" value="${deploy.structure}"/>
Modified: stack/native/trunk/modules/dist/src/main/distro/build-project-gen.xml
===================================================================
--- stack/native/trunk/modules/dist/src/main/distro/build-project-gen.xml 2011-04-18 11:21:18 UTC (rev 14140)
+++ stack/native/trunk/modules/dist/src/main/distro/build-project-gen.xml 2011-04-18 12:19:00 UTC (rev 14141)
@@ -22,7 +22,7 @@
</filterset>
<path id="jbws-ant.path">
- <pathelement location="${jboss.client}/jbossws-common.jar" />
+ <pathelement location="${jboss.client}/jbossws-common-tools.jar" />
</path>
<taskdef name="pathFixer" classname="org.jboss.ws.tools.ant.FixPathTask" classpathref="jbws-ant.path"/>
<taskdef name="eclipseClasspathGenerator" classname="org.jboss.ws.tools.ant.EclipseClasspathTask" classpathref="jbws-ant.path"/>
Modified: stack/native/trunk/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml
===================================================================
--- stack/native/trunk/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml 2011-04-18 11:21:18 UTC (rev 14140)
+++ stack/native/trunk/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml 2011-04-18 12:19:00 UTC (rev 14141)
@@ -89,6 +89,7 @@
<include>org.jboss.jaxr:juddi-service:sar</include>
<include>apache-scout:scout:jar</include>
<include>juddi:juddi:jar</include>
+ <include>org.jboss.ws:jbossws-common-tools:jar</include>
<include>org.jboss.ws:jbossws-jboss600:jar</include>
<include>org.jboss:jbossxb:jar</include>
</includes>
Modified: stack/native/trunk/modules/resources/src/main/resources/bin/wsconsume.bat
===================================================================
--- stack/native/trunk/modules/resources/src/main/resources/bin/wsconsume.bat 2011-04-18 11:21:18 UTC (rev 14140)
+++ stack/native/trunk/modules/resources/src/main/resources/bin/wsconsume.bat 2011-04-18 12:19:00 UTC (rev 14141)
@@ -36,6 +36,7 @@
set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/jbossws-api.jar
set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/jbossws-spi.jar
set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/jbossws-common.jar
+set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/jbossws-common-tools.jar
rem Shared jaxws libs
set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/jaxws-tools.jar
Modified: stack/native/trunk/modules/resources/src/main/resources/bin/wsconsume.sh
===================================================================
--- stack/native/trunk/modules/resources/src/main/resources/bin/wsconsume.sh 2011-04-18 11:21:18 UTC (rev 14140)
+++ stack/native/trunk/modules/resources/src/main/resources/bin/wsconsume.sh 2011-04-18 12:19:00 UTC (rev 14141)
@@ -72,6 +72,7 @@
WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$JBOSS_HOME/client/jbossws-api.jar"
WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$JBOSS_HOME/client/jbossws-spi.jar"
WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$JBOSS_HOME/client/jbossws-common.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$JBOSS_HOME/client/jbossws-common-tools.jar"
# Shared jaxws libs
WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$JBOSS_HOME/client/jaxws-tools.jar"
Modified: stack/native/trunk/modules/resources/src/main/resources/bin/wsprovide.bat
===================================================================
--- stack/native/trunk/modules/resources/src/main/resources/bin/wsprovide.bat 2011-04-18 11:21:18 UTC (rev 14140)
+++ stack/native/trunk/modules/resources/src/main/resources/bin/wsprovide.bat 2011-04-18 12:19:00 UTC (rev 14141)
@@ -29,6 +29,7 @@
set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/jbossws-api.jar
set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/jbossws-spi.jar
set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/jbossws-common.jar
+set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/jbossws-common-tools.jar
set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/activation.jar
set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/getopt.jar
set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/jbossall-client.jar
Modified: stack/native/trunk/modules/resources/src/main/resources/bin/wsprovide.sh
===================================================================
--- stack/native/trunk/modules/resources/src/main/resources/bin/wsprovide.sh 2011-04-18 11:21:18 UTC (rev 14140)
+++ stack/native/trunk/modules/resources/src/main/resources/bin/wsprovide.sh 2011-04-18 12:19:00 UTC (rev 14141)
@@ -65,6 +65,7 @@
WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$JBOSS_HOME/client/jbossws-api.jar"
WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$JBOSS_HOME/client/jbossws-spi.jar"
WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$JBOSS_HOME/client/jbossws-common.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$JBOSS_HOME/client/jbossws-common-tools.jar"
WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$JBOSS_HOME/client/activation.jar"
WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$JBOSS_HOME/client/getopt.jar"
WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$JBOSS_HOME/client/jbossall-client.jar"
Modified: stack/native/trunk/modules/resources/src/main/resources/bin/wsrunclient.bat
===================================================================
--- stack/native/trunk/modules/resources/src/main/resources/bin/wsrunclient.bat 2011-04-18 11:21:18 UTC (rev 14140)
+++ stack/native/trunk/modules/resources/src/main/resources/bin/wsrunclient.bat 2011-04-18 12:19:00 UTC (rev 14141)
@@ -55,6 +55,7 @@
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/xercesImpl.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/jbossxb.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/jbossws-common.jar
+set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/jbossws-common-tools.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/jbossws-native-client.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/jbossws-native-core.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/jbossws-native-services.jar
Modified: stack/native/trunk/modules/resources/src/main/resources/bin/wsrunclient.sh
===================================================================
--- stack/native/trunk/modules/resources/src/main/resources/bin/wsrunclient.sh 2011-04-18 11:21:18 UTC (rev 14140)
+++ stack/native/trunk/modules/resources/src/main/resources/bin/wsrunclient.sh 2011-04-18 12:19:00 UTC (rev 14141)
@@ -87,6 +87,7 @@
WSRUNCLIENT_CLASSPATH="$WSRUNCLIENT_CLASSPATH:$JBOSS_HOME/client/xercesImpl.jar"
WSRUNCLIENT_CLASSPATH="$WSRUNCLIENT_CLASSPATH:$JBOSS_HOME/client/jbossxb.jar"
WSRUNCLIENT_CLASSPATH="$WSRUNCLIENT_CLASSPATH:$JBOSS_HOME/client/jbossws-common.jar"
+WSRUNCLIENT_CLASSPATH="$WSRUNCLIENT_CLASSPATH:$JBOSS_HOME/client/jbossws-common-tools.jar"
WSRUNCLIENT_CLASSPATH="$WSRUNCLIENT_CLASSPATH:$JBOSS_HOME/client/jbossws-native-client.jar"
WSRUNCLIENT_CLASSPATH="$WSRUNCLIENT_CLASSPATH:$JBOSS_HOME/client/jbossws-native-core.jar"
WSRUNCLIENT_CLASSPATH="$WSRUNCLIENT_CLASSPATH:$JBOSS_HOME/client/jbossws-native-services.jar"
Modified: stack/native/trunk/modules/resources/src/main/resources/bin/wstools.bat
===================================================================
--- stack/native/trunk/modules/resources/src/main/resources/bin/wstools.bat 2011-04-18 11:21:18 UTC (rev 14140)
+++ stack/native/trunk/modules/resources/src/main/resources/bin/wstools.bat 2011-04-18 12:19:00 UTC (rev 14141)
@@ -38,6 +38,7 @@
set WSTOOLS_CLASSPATH=%WSTOOLS_CLASSPATH%;%JBOSS_HOME%/client/concurrent.jar
set WSTOOLS_CLASSPATH=%WSTOOLS_CLASSPATH%;%JBOSS_HOME%/client/jbossws-spi.jar
set WSTOOLS_CLASSPATH=%WSTOOLS_CLASSPATH%;%JBOSS_HOME%/client/jbossws-common.jar
+set WSTOOLS_CLASSPATH=%WSTOOLS_CLASSPATH%;%JBOSS_HOME%/client/jbossws-common-tools.jar
set WSTOOLS_CLASSPATH=%WSTOOLS_CLASSPATH%;%JBOSS_HOME%/client/javassist.jar
set WSTOOLS_CLASSPATH=%WSTOOLS_CLASSPATH%;%JBOSS_HOME%/client/jboss-xml-binding.jar
set WSTOOLS_CLASSPATH=%WSTOOLS_CLASSPATH%;%JBOSS_HOME%/client/resolver.jar
Modified: stack/native/trunk/modules/resources/src/main/resources/bin/wstools.sh
===================================================================
--- stack/native/trunk/modules/resources/src/main/resources/bin/wstools.sh 2011-04-18 11:21:18 UTC (rev 14140)
+++ stack/native/trunk/modules/resources/src/main/resources/bin/wstools.sh 2011-04-18 12:19:00 UTC (rev 14141)
@@ -58,6 +58,7 @@
WSTOOLS_CLASSPATH="$WSTOOLS_CLASSPATH:$JBOSS_HOME/client/concurrent.jar"
WSTOOLS_CLASSPATH="$WSTOOLS_CLASSPATH:$JBOSS_HOME/client/jbossws-spi.jar"
WSTOOLS_CLASSPATH="$WSTOOLS_CLASSPATH:$JBOSS_HOME/client/jbossws-common.jar"
+WSTOOLS_CLASSPATH="$WSTOOLS_CLASSPATH:$JBOSS_HOME/client/jbossws-common-tools.jar"
WSTOOLS_CLASSPATH="$WSTOOLS_CLASSPATH:$JBOSS_HOME/client/javassist.jar"
WSTOOLS_CLASSPATH="$WSTOOLS_CLASSPATH:$JBOSS_HOME/client/jboss-xml-binding.jar"
WSTOOLS_CLASSPATH="$WSTOOLS_CLASSPATH:$JBOSS_HOME/client/resolver.jar"
Modified: stack/native/trunk/modules/resources/src/main/resources/resources/deploy.conf
===================================================================
--- stack/native/trunk/modules/resources/src/main/resources/resources/deploy.conf 2011-04-18 11:21:18 UTC (rev 14140)
+++ stack/native/trunk/modules/resources/src/main/resources/resources/deploy.conf 2011-04-18 12:19:00 UTC (rev 14141)
@@ -1 +1 @@
-bin/wsconsume.bat bin/wsconsume.sh bin/wsprovide.bat bin/wsprovide.sh bin/wsrunclient.bat bin/wsrunclient.sh bin/wstools.bat bin/wstools.sh client/jbossws-native-jaxws-ext.jar client/cxf-*.jar client/geronimo-*.jar client/jaxws-httpserver-httpspi.jar client/neethi.jar client/saaj-impl.jar client/spring-*.jar client/wss4j.jar client/XmlSchema.jar client/asm.jar client/jetty*.jar client/velocity.jar client/commons-collections.jar client/commons-lang.jar client/jettison.jar client/jaxb-api.jar client/FastInfoset.jar client/commons-beanutils.jar client/jaxb-impl.jar client/jaxb-xjc.jar client/jaxws-rt.jar client/jaxws-tools.jar client/policy.jar client/jbossws-cxf-* client/jbossws-native-jaxrpc.jar client/jaxrpc-api.jar client/jbossws-native-jaxws.jar client/jbossws-native-factories.jar client/jaxws-api.jar client/jsr181-api.jar client/jbossws-native-saaj.jar client/saaj-api.jar client/jbossws-native-client.jar client/jbossws-native-services.jar client/jbossws-common.jar client!
/jbossws-framework.jar client/jbossws-api.jar client/jbossws-spi.jar client/wscommons-policy.jar client/stax-ex.jar client/streambuffer.jar client/wsdl4j.jar lib/jaxb-api.jar lib/jaxb-impl.jar common/lib/jbossws-native-jaxws-ext.jar common/lib/cxf-*.jar common/lib/jaxws-httpserver-httpspi.jar common/lib/geronimo-*.jar common/lib/neethi.jar common/lib/saaj-impl.jar common/lib/spring-*.jar common/lib/wss4j.jar common/lib/XmlSchema.jar common/lib/asm.jar common/lib/FastInfoset.jar common/lib/jboss-jaxb-intros.jar common/lib/jettison.jar common/lib/wscommons-policy.jar common/lib/wsdl4j.jar common/lib/xmlsec.jar common/lib/jbossws-native-jaxrpc.jar common/lib/jaxrpc-api.jar common/lib/jbossws-native-jaxws.jar common/lib/jaxws-api.jar common/lib/jsr181-api.jar common/lib/jbossws-native-saaj.jar common/lib/saaj-api.jar common/lib/jbossws-common.jar common/lib/jbossws-framework.jar common/lib/jbossws-api.jar common/lib/jbossws-spi.jar common/lib/commons-beanutils.jar lib/endorsed/!
*jbossws* lib/endorsed/*jaxb*.jar lib/endorsed/*jaxws*.jar
+bin/wsconsume.bat bin/wsconsume.sh bin/wsprovide.bat bin/wsprovide.sh bin/wsrunclient.bat bin/wsrunclient.sh bin/wstools.bat bin/wstools.sh client/jbossws-native-jaxws-ext.jar client/cxf-*.jar client/geronimo-*.jar client/jaxws-httpserver-httpspi.jar client/neethi.jar client/saaj-impl.jar client/spring-*.jar client/wss4j.jar client/XmlSchema.jar client/asm.jar client/jetty*.jar client/velocity.jar client/commons-collections.jar client/commons-lang.jar client/jettison.jar client/jaxb-api.jar client/FastInfoset.jar client/commons-beanutils.jar client/jaxb-impl.jar client/jaxb-xjc.jar client/jaxws-rt.jar client/jaxws-tools.jar client/policy.jar client/jbossws-cxf-* client/jbossws-native-jaxrpc.jar client/jaxrpc-api.jar client/jbossws-native-jaxws.jar client/jbossws-native-factories.jar client/jaxws-api.jar client/jsr181-api.jar client/jbossws-native-saaj.jar client/saaj-api.jar client/jbossws-native-client.jar client/jbossws-native-services.jar client/jbossws-common.jar client!
/jbossws-common-tools.jar client/jbossws-framework.jar client/jbossws-api.jar client/jbossws-spi.jar client/wscommons-policy.jar client/stax-ex.jar client/streambuffer.jar client/wsdl4j.jar lib/jaxb-api.jar lib/jaxb-impl.jar common/lib/jbossws-native-jaxws-ext.jar common/lib/cxf-*.jar common/lib/jaxws-httpserver-httpspi.jar common/lib/geronimo-*.jar common/lib/neethi.jar common/lib/saaj-impl.jar common/lib/spring-*.jar common/lib/wss4j.jar common/lib/XmlSchema.jar common/lib/asm.jar common/lib/FastInfoset.jar common/lib/jboss-jaxb-intros.jar common/lib/jettison.jar common/lib/wscommons-policy.jar common/lib/wsdl4j.jar common/lib/xmlsec.jar common/lib/jbossws-native-jaxrpc.jar common/lib/jaxrpc-api.jar common/lib/jbossws-native-jaxws.jar common/lib/jaxws-api.jar common/lib/jsr181-api.jar common/lib/jbossws-native-saaj.jar common/lib/saaj-api.jar common/lib/jbossws-common.jar common/lib/jbossws-framework.jar common/lib/jbossws-api.jar common/lib/jbossws-spi.jar common/lib/com!
mons-beanutils.jar lib/endorsed/*jbossws* lib/endorsed/*jaxb*.!
jar lib/
endorsed/*jaxws*.jar
Modified: stack/native/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
===================================================================
--- stack/native/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2011-04-18 11:21:18 UTC (rev 14140)
+++ stack/native/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2011-04-18 12:19:00 UTC (rev 14141)
@@ -38,6 +38,7 @@
<include name="**/policy.jar"/>
<include name="**/jbossws-api.jar"/>
<include name="**/jbossws-common.jar"/>
+ <include name="**/jbossws-common-tools.jar"/>
<include name="**/jbossws-native-client.jar"/>
<include name="**/jbossws-native-core.jar"/>
<include name="**/jbossws-native-services.jar"/>
Modified: stack/native/trunk/modules/testsuite/pom.xml
===================================================================
--- stack/native/trunk/modules/testsuite/pom.xml 2011-04-18 11:21:18 UTC (rev 14140)
+++ stack/native/trunk/modules/testsuite/pom.xml 2011-04-18 12:19:00 UTC (rev 14141)
@@ -48,6 +48,10 @@
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-common-tools</artifactId>
+ </dependency>
+ <dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.5.0</version>
Modified: stack/native/trunk/pom.xml
===================================================================
--- stack/native/trunk/pom.xml 2011-04-18 11:21:18 UTC (rev 14140)
+++ stack/native/trunk/pom.xml 2011-04-18 12:19:00 UTC (rev 14141)
@@ -47,6 +47,7 @@
<properties>
<jbossws.spi.version>2.0.0-SNAPSHOT</jbossws.spi.version>
<jbossws.common.version>2.0.0-SNAPSHOT</jbossws.common.version>
+ <jbossws.common.tools.version>1.0.0-SNAPSHOT</jbossws.common.tools.version>
<jbossws.shared.testsuite.version>4.0.0-SNAPSHOT</jbossws.shared.testsuite.version>
<jbossws.jboss600.version>4.0.0-SNAPSHOT</jbossws.jboss600.version>
<!-- [JBWS-2505] -->
@@ -55,6 +56,7 @@
<jbossws.jboss601.version>3.2.1.GA</jbossws.jboss601.version>
-->
<!-- END -->
+ <ant.version>1.7.1</ant.version>
<codehaus.jettison.version>1.0-RC2</codehaus.jettison.version>
<commons.logging.version>1.1.1</commons.logging.version>
<javassist.version>3.12.1.GA</javassist.version>
@@ -94,6 +96,11 @@
</dependency>
<dependency>
<groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-common-tools</artifactId>
+ <version>${jbossws.common.tools.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ws</groupId>
<artifactId>jbossws-spi</artifactId>
<version>${jbossws.spi.version}</version>
</dependency>
@@ -134,6 +141,12 @@
<!-- END -->
<!-- provided apis -->
<dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>${ant.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1</version>
12 years, 1 month
JBossWS SVN: r14140 - stack/cxf/trunk.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-04-18 07:21:18 -0400 (Mon, 18 Apr 2011)
New Revision: 14140
Removed:
stack/cxf/trunk/src/
Log:
removing empty dirs
12 years, 1 month
JBossWS SVN: r14139 - in stack/cxf/trunk: modules/dist and 6 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-04-18 07:19:20 -0400 (Mon, 18 Apr 2011)
New Revision: 14139
Modified:
stack/cxf/trunk/modules/dist/management/pom.xml
stack/cxf/trunk/modules/dist/pom.xml
stack/cxf/trunk/modules/dist/src/main/distro/build-deploy.xml
stack/cxf/trunk/modules/dist/src/main/distro/build-project-gen.xml
stack/cxf/trunk/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml
stack/cxf/trunk/modules/resources/src/main/resources/bin/wsconsume.bat
stack/cxf/trunk/modules/resources/src/main/resources/bin/wsconsume.sh
stack/cxf/trunk/modules/resources/src/main/resources/bin/wsprovide.bat
stack/cxf/trunk/modules/resources/src/main/resources/bin/wsprovide.sh
stack/cxf/trunk/modules/resources/src/main/resources/bin/wsrunclient.bat
stack/cxf/trunk/modules/resources/src/main/resources/bin/wsrunclient.sh
stack/cxf/trunk/modules/resources/src/main/resources/resources/deploy.conf
stack/cxf/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
stack/cxf/trunk/modules/testsuite/pom.xml
stack/cxf/trunk/pom.xml
Log:
[JBWS-3273] removing ANT & CMD tools from jbossws-common.jar to jbossws-common-tools.jar
Modified: stack/cxf/trunk/modules/dist/management/pom.xml
===================================================================
--- stack/cxf/trunk/modules/dist/management/pom.xml 2011-04-18 11:14:04 UTC (rev 14138)
+++ stack/cxf/trunk/modules/dist/management/pom.xml 2011-04-18 11:19:20 UTC (rev 14139)
@@ -24,7 +24,7 @@
<scope>provided</scope>
<type>zip</type>
</dependency>
-</dependencies>
+ </dependencies>
<build>
<plugins>
Modified: stack/cxf/trunk/modules/dist/pom.xml
===================================================================
--- stack/cxf/trunk/modules/dist/pom.xml 2011-04-18 11:14:04 UTC (rev 14138)
+++ stack/cxf/trunk/modules/dist/pom.xml 2011-04-18 11:19:20 UTC (rev 14139)
@@ -46,6 +46,12 @@
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-common-tools</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
<!--test-suite-->
<dependency>
<groupId>org.jboss.ws</groupId>
Modified: stack/cxf/trunk/modules/dist/src/main/distro/build-deploy.xml
===================================================================
--- stack/cxf/trunk/modules/dist/src/main/distro/build-deploy.xml 2011-04-18 11:14:04 UTC (rev 14138)
+++ stack/cxf/trunk/modules/dist/src/main/distro/build-deploy.xml 2011-04-18 11:19:20 UTC (rev 14139)
@@ -104,7 +104,7 @@
<path id="jbossws-common.path">
<fileset dir="${deploy.artifacts.dir}">
- <include name="**/jbossws-common.jar"/>
+ <include name="**/jbossws-common-tools.jar"/>
</fileset>
</path>
<taskdef name="installModules" classname="org.jboss.ws.tools.ant.InstallModulesTask" classpathref="jbossws-common.path"/>
Modified: stack/cxf/trunk/modules/dist/src/main/distro/build-project-gen.xml
===================================================================
--- stack/cxf/trunk/modules/dist/src/main/distro/build-project-gen.xml 2011-04-18 11:14:04 UTC (rev 14138)
+++ stack/cxf/trunk/modules/dist/src/main/distro/build-project-gen.xml 2011-04-18 11:19:20 UTC (rev 14139)
@@ -22,7 +22,7 @@
</filterset>
<path id="jbws-ant.path">
- <pathelement location="${thirdparty.dir}/jbossws-common.jar" />
+ <pathelement location="${thirdparty.dir}/jbossws-common-tools.jar" />
</path>
<taskdef name="pathFixer" classname="org.jboss.ws.tools.ant.FixPathTask" classpathref="jbws-ant.path"/>
<taskdef name="eclipseClasspathGenerator" classname="org.jboss.ws.tools.ant.EclipseClasspathTask" classpathref="jbws-ant.path"/>
Modified: stack/cxf/trunk/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml
===================================================================
--- stack/cxf/trunk/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml 2011-04-18 11:14:04 UTC (rev 14138)
+++ stack/cxf/trunk/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml 2011-04-18 11:19:20 UTC (rev 14139)
@@ -93,6 +93,7 @@
<include>org.jboss.jaxr:juddi-service:sar</include>
<include>apache-scout:scout:jar</include>
<include>juddi:juddi:jar</include>
+ <include>org.jboss.ws:jbossws-common-tools:jar</include>
<include>org.jboss.ws:jbossws-jboss600:jar</include>
<include>org.jboss.as:jboss-as-webservices-tests-integration:jar</include>
</includes>
Modified: stack/cxf/trunk/modules/resources/src/main/resources/bin/wsconsume.bat
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/bin/wsconsume.bat 2011-04-18 11:14:04 UTC (rev 14138)
+++ stack/cxf/trunk/modules/resources/src/main/resources/bin/wsconsume.bat 2011-04-18 11:19:20 UTC (rev 14139)
@@ -33,6 +33,7 @@
set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/jbossws-api.jar
set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/jbossws-spi.jar
set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/jbossws-common.jar
+set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/jbossws-common-tools.jar
rem CXF XJC patched plugins
set WSCONSUME_CLASSPATH=%WSCONSUME_CLASSPATH%;%JBOSS_HOME%/client/cxf-xjc-boolean.jar
Modified: stack/cxf/trunk/modules/resources/src/main/resources/bin/wsconsume.sh
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/bin/wsconsume.sh 2011-04-18 11:14:04 UTC (rev 14138)
+++ stack/cxf/trunk/modules/resources/src/main/resources/bin/wsconsume.sh 2011-04-18 11:19:20 UTC (rev 14139)
@@ -84,6 +84,7 @@
WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/jbossws-api.jar"
WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/jbossws-spi.jar"
WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/jbossws-common.jar"
+WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/jbossws-common-tools.jar"
# CXF XJC patched plugins
WSCONSUME_CLASSPATH="$WSCONSUME_CLASSPATH:$LIBDIR/cxf-xjc-boolean.jar"
Modified: stack/cxf/trunk/modules/resources/src/main/resources/bin/wsprovide.bat
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/bin/wsprovide.bat 2011-04-18 11:14:04 UTC (rev 14138)
+++ stack/cxf/trunk/modules/resources/src/main/resources/bin/wsprovide.bat 2011-04-18 11:19:20 UTC (rev 14139)
@@ -26,6 +26,7 @@
set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/jbossws-api.jar
set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/jbossws-spi.jar
set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/jbossws-common.jar
+set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/jbossws-common-tool.jar
set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/activation.jar
set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/getopt.jar
set WSPROVIDE_CLASSPATH=%WSPROVIDE_CLASSPATH%;%JBOSS_HOME%/client/jbossall-client.jar
Modified: stack/cxf/trunk/modules/resources/src/main/resources/bin/wsprovide.sh
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/bin/wsprovide.sh 2011-04-18 11:14:04 UTC (rev 14138)
+++ stack/cxf/trunk/modules/resources/src/main/resources/bin/wsprovide.sh 2011-04-18 11:19:20 UTC (rev 14139)
@@ -80,6 +80,7 @@
WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/jbossws-api.jar"
WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/jbossws-spi.jar"
WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/jbossws-common.jar"
+WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/jbossws-common-tools.jar"
WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/activation.jar"
WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/getopt.jar"
WSPROVIDE_CLASSPATH="$WSPROVIDE_CLASSPATH:$LIBDIR/jbossall-client.jar"
Modified: stack/cxf/trunk/modules/resources/src/main/resources/bin/wsrunclient.bat
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/bin/wsrunclient.bat 2011-04-18 11:14:04 UTC (rev 14138)
+++ stack/cxf/trunk/modules/resources/src/main/resources/bin/wsrunclient.bat 2011-04-18 11:19:20 UTC (rev 14139)
@@ -51,6 +51,7 @@
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/jboss-xml-binding.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/jbossxb.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/jbossws-common.jar
+set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/jbossws-common-tools.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/jbossws-api.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/jbossws-spi.jar
set WSRUNCLIENT_CLASSPATH=%WSRUNCLIENT_CLASSPATH%;%JBOSS_HOME%/client/FastInfoset.jar
Modified: stack/cxf/trunk/modules/resources/src/main/resources/bin/wsrunclient.sh
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/bin/wsrunclient.sh 2011-04-18 11:14:04 UTC (rev 14138)
+++ stack/cxf/trunk/modules/resources/src/main/resources/bin/wsrunclient.sh 2011-04-18 11:19:20 UTC (rev 14139)
@@ -83,6 +83,7 @@
WSRUNCLIENT_CLASSPATH="$WSRUNCLIENT_CLASSPATH:$JBOSS_HOME/client/jboss-xml-binding.jar"
WSRUNCLIENT_CLASSPATH="$WSRUNCLIENT_CLASSPATH:$JBOSS_HOME/client/jbossxb.jar"
WSRUNCLIENT_CLASSPATH="$WSRUNCLIENT_CLASSPATH:$JBOSS_HOME/client/jbossws-common.jar"
+WSRUNCLIENT_CLASSPATH="$WSRUNCLIENT_CLASSPATH:$JBOSS_HOME/client/jbossws-common-tools.jar"
WSRUNCLIENT_CLASSPATH="$WSRUNCLIENT_CLASSPATH:$JBOSS_HOME/client/jbossws-api.jar"
WSRUNCLIENT_CLASSPATH="$WSRUNCLIENT_CLASSPATH:$JBOSS_HOME/client/jbossws-spi.jar"
WSRUNCLIENT_CLASSPATH="$WSRUNCLIENT_CLASSPATH:$JBOSS_HOME/client/FastInfoset.jar"
Modified: stack/cxf/trunk/modules/resources/src/main/resources/resources/deploy.conf
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/resources/deploy.conf 2011-04-18 11:14:04 UTC (rev 14138)
+++ stack/cxf/trunk/modules/resources/src/main/resources/resources/deploy.conf 2011-04-18 11:19:20 UTC (rev 14139)
@@ -1 +1 @@
-bin/wsconsume.bat bin/wsconsume.sh bin/wsprovide.bat bin/wsprovide.sh bin/wsrunclient.bat bin/wsrunclient.sh bin/wstools.bat bin/wstools.sh client/jbossws-native-jaxws-ext.jar client/cxf-*.jar client/geronimo-*.jar client/jaxws-httpserver-httpspi.jar client/neethi.jar client/saaj-impl.jar client/spring-*.jar client/wss4j.jar client/XmlSchema.jar client/asm.jar client/jetty*.jar client/velocity.jar client/commons-collections.jar client/commons-lang.jar client/jettison.jar client/jaxb-api.jar client/FastInfoset.jar client/commons-beanutils.jar client/jaxb-impl.jar client/jaxb-xjc.jar client/jaxws-rt.jar client/jaxws-tools.jar client/policy.jar client/jbossws-cxf-* client/jbossws-native-jaxrpc.jar client/jaxrpc-api.jar client/jbossws-native-jaxws.jar client/jbossws-native-factories.jar client/jaxws-api.jar client/jsr181-api.jar client/jbossws-native-saaj.jar client/saaj-api.jar client/jbossws-native-client.jar client/jbossws-native-services.jar client/jbossws-common.jar client!
/jbossws-framework.jar client/jbossws-api.jar client/jbossws-spi.jar client/wscommons-policy.jar client/stax-ex.jar client/streambuffer.jar client/wsdl4j.jar lib/jaxb-api.jar lib/jaxb-impl.jar common/lib/jbossws-native-jaxws-ext.jar common/lib/cxf-*.jar common/lib/jaxws-httpserver-httpspi.jar common/lib/geronimo-*.jar common/lib/neethi.jar common/lib/saaj-impl.jar common/lib/spring-*.jar common/lib/wss4j.jar common/lib/XmlSchema.jar common/lib/asm.jar common/lib/FastInfoset.jar common/lib/jboss-jaxb-intros.jar common/lib/jettison.jar common/lib/wscommons-policy.jar common/lib/wsdl4j.jar common/lib/xmlsec.jar common/lib/jbossws-native-jaxrpc.jar common/lib/jaxrpc-api.jar common/lib/jbossws-native-jaxws.jar common/lib/jaxws-api.jar common/lib/jsr181-api.jar common/lib/jbossws-native-saaj.jar common/lib/saaj-api.jar common/lib/jbossws-common.jar common/lib/jbossws-framework.jar common/lib/jbossws-api.jar common/lib/jbossws-spi.jar common/lib/commons-beanutils.jar lib/endorsed/!
*jbossws* lib/endorsed/*jaxb*.jar lib/endorsed/*jaxws*.jar
+bin/wsconsume.bat bin/wsconsume.sh bin/wsprovide.bat bin/wsprovide.sh bin/wsrunclient.bat bin/wsrunclient.sh bin/wstools.bat bin/wstools.sh client/jbossws-native-jaxws-ext.jar client/cxf-*.jar client/geronimo-*.jar client/jaxws-httpserver-httpspi.jar client/neethi.jar client/saaj-impl.jar client/spring-*.jar client/wss4j.jar client/XmlSchema.jar client/asm.jar client/jetty*.jar client/velocity.jar client/commons-collections.jar client/commons-lang.jar client/jettison.jar client/jaxb-api.jar client/FastInfoset.jar client/commons-beanutils.jar client/jaxb-impl.jar client/jaxb-xjc.jar client/jaxws-rt.jar client/jaxws-tools.jar client/policy.jar client/jbossws-cxf-* client/jbossws-native-jaxrpc.jar client/jaxrpc-api.jar client/jbossws-native-jaxws.jar client/jbossws-native-factories.jar client/jaxws-api.jar client/jsr181-api.jar client/jbossws-native-saaj.jar client/saaj-api.jar client/jbossws-native-client.jar client/jbossws-native-services.jar client/jbossws-common.jar client!
/jbossws-common-tools.jar client/jbossws-framework.jar client/jbossws-api.jar client/jbossws-spi.jar client/wscommons-policy.jar client/stax-ex.jar client/streambuffer.jar client/wsdl4j.jar lib/jaxb-api.jar lib/jaxb-impl.jar common/lib/jbossws-native-jaxws-ext.jar common/lib/cxf-*.jar common/lib/jaxws-httpserver-httpspi.jar common/lib/geronimo-*.jar common/lib/neethi.jar common/lib/saaj-impl.jar common/lib/spring-*.jar common/lib/wss4j.jar common/lib/XmlSchema.jar common/lib/asm.jar common/lib/FastInfoset.jar common/lib/jboss-jaxb-intros.jar common/lib/jettison.jar common/lib/wscommons-policy.jar common/lib/wsdl4j.jar common/lib/xmlsec.jar common/lib/jbossws-native-jaxrpc.jar common/lib/jaxrpc-api.jar common/lib/jbossws-native-jaxws.jar common/lib/jaxws-api.jar common/lib/jsr181-api.jar common/lib/jbossws-native-saaj.jar common/lib/saaj-api.jar common/lib/jbossws-common.jar common/lib/jbossws-framework.jar common/lib/jbossws-api.jar common/lib/jbossws-spi.jar common/lib/com!
mons-beanutils.jar lib/endorsed/*jbossws* lib/endorsed/*jaxb*.!
jar lib/
endorsed/*jaxws*.jar
Modified: stack/cxf/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2011-04-18 11:14:04 UTC (rev 14138)
+++ stack/cxf/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2011-04-18 11:19:20 UTC (rev 14139)
@@ -38,6 +38,7 @@
<include name="**/jsr181-api.jar"/>
<include name="**/jbossws-api.jar"/>
<include name="**/jbossws-common.jar"/>
+ <include name="**/jbossws-common-tools.jar"/>
<include name="**/jbossws-cxf-client*.jar"/>
<include name="**/jbossws-spi.jar"/>
<include name="**/jbossws-cxf-transports-httpserver.jar"/>
@@ -366,6 +367,11 @@
<include name="**/jbossws-common.jar"/>
</fileset>
</copy>
+ <copy todir="@{targetdir}/org/jboss/ws/tools/common/main" flatten="false" overwrite="true">
+ <fileset dir="@{thirdpartydir}/lib">
+ <include name="**/jbossws-common-tools.jar"/>
+ </fileset>
+ </copy>
<copy todir="@{targetdir}/org/jboss/ws/spi/main" flatten="false" overwrite="true">
<fileset dir="@{thirdpartydir}/lib">
<include name="**/jbossws-spi.jar"/>
Modified: stack/cxf/trunk/modules/testsuite/pom.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/pom.xml 2011-04-18 11:14:04 UTC (rev 14138)
+++ stack/cxf/trunk/modules/testsuite/pom.xml 2011-04-18 11:19:20 UTC (rev 14139)
@@ -42,6 +42,10 @@
<artifactId>jbossws-common</artifactId>
</dependency>
<dependency>
+ <groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-common-tools</artifactId>
+ </dependency>
+ <dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb-api</artifactId>
</dependency>
Modified: stack/cxf/trunk/pom.xml
===================================================================
--- stack/cxf/trunk/pom.xml 2011-04-18 11:14:04 UTC (rev 14138)
+++ stack/cxf/trunk/pom.xml 2011-04-18 11:19:20 UTC (rev 14139)
@@ -47,6 +47,7 @@
<properties>
<jbossws.spi.version>2.0.0-SNAPSHOT</jbossws.spi.version>
<jbossws.common.version>2.0.0-SNAPSHOT</jbossws.common.version>
+ <jbossws.common.tools.version>1.0.0-SNAPSHOT</jbossws.common.tools.version>
<jbossws.shared.testsuite.version>4.0.0-SNAPSHOT</jbossws.shared.testsuite.version>
<jbossws.jboss600.version>4.0.0-SNAPSHOT</jbossws.jboss600.version>
<!-- JBWS-2505 -->
@@ -103,6 +104,11 @@
</dependency>
<dependency>
<groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-common-tools</artifactId>
+ <version>${jbossws.common.tools.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ws</groupId>
<artifactId>jbossws-spi</artifactId>
<version>${jbossws.spi.version}</version>
</dependency>
12 years, 1 month
JBossWS SVN: r14138 - common-tools/trunk.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-04-18 07:14:04 -0400 (Mon, 18 Apr 2011)
New Revision: 14138
Modified:
common-tools/trunk/
Log:
updating svn:ignore property
Property changes on: common-tools/trunk
___________________________________________________________________
Added: svn:ignore
+ target
.classpath
.project
.settings
12 years, 1 month
JBossWS SVN: r14137 - in common-tools: trunk and 25 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-04-18 07:09:04 -0400 (Mon, 18 Apr 2011)
New Revision: 14137
Added:
common-tools/trunk/
common-tools/trunk/pom.xml
common-tools/trunk/src/
common-tools/trunk/src/main/
common-tools/trunk/src/main/java/
common-tools/trunk/src/main/java/org/
common-tools/trunk/src/main/java/org/jboss/
common-tools/trunk/src/main/java/org/jboss/ws/
common-tools/trunk/src/main/java/org/jboss/ws/tools/
common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/
common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/EclipseClasspathTask.java
common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/EclipseJUnitTestsTask.java
common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/EclipseProjectTask.java
common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/FixPathTask.java
common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/InstallModulesTask.java
common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/PathWriterTask.java
common-tools/trunk/src/main/java/org/jboss/wsf/
common-tools/trunk/src/main/java/org/jboss/wsf/spi/
common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/
common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/ant/
common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/ant/AntTaskHelper.java
common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/ant/SecurityActions.java
common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/ant/WSConsumeTask.java
common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/ant/WSProvideTask.java
common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/cmd/
common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/cmd/SecurityActions.java
common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/cmd/WSConsume.java
common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/cmd/WSProvide.java
common-tools/trunk/src/main/java/org/jboss/wsf/spi/util/
common-tools/trunk/src/main/java/org/jboss/wsf/spi/util/Log4JUtil.java
common-tools/trunk/src/main/java/org/jboss/wsf/spi/util/Log4jOutputStream.java
common-tools/trunk/src/test/
common-tools/trunk/src/test/java/
common-tools/trunk/src/test/java/org/
common-tools/trunk/src/test/java/org/jboss/
common-tools/trunk/src/test/java/org/jboss/test/
common-tools/trunk/src/test/java/org/jboss/test/wsf/
common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/
common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/
common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/AntConsumeTestCase.java
common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/AntProvideTestCase.java
common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/BuildFileTest.java
common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CalculatorBean.java
common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTestCase.java
common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTracker.java
common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTrackerFactory.java
common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTestCase.java
common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTracker.java
common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTrackerFactory.java
common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CommandlineTestBase.java
common-tools/trunk/src/test/resources/
common-tools/trunk/src/test/resources/smoke/
common-tools/trunk/src/test/resources/smoke/tools/
common-tools/trunk/src/test/resources/smoke/tools/consume-test.xml
common-tools/trunk/src/test/resources/smoke/tools/provide-test.xml
Removed:
common-tools/pom.xml
common-tools/src/
Log:
[JBWS-3273] refactoring - introducing trunk
Deleted: common-tools/pom.xml
===================================================================
--- common-tools/pom.xml 2011-04-18 11:04:20 UTC (rev 14136)
+++ common-tools/pom.xml 2011-04-18 11:09:04 UTC (rev 14137)
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <name>JBoss Web Services - Tools Integration</name>
- <groupId>org.jboss.ws</groupId>
- <artifactId>jbossws-common-tools</artifactId>
- <packaging>jar</packaging>
- <description>JBossWS Common Tools</description>
-
- <version>1.0.0-SNAPSHOT</version>
-
- <parent>
- <groupId>org.jboss.ws</groupId>
- <artifactId>jbossws-parent</artifactId>
- <version>1.0.10-SNAPSHOT</version>
- </parent>
-
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossws/tools/trunk</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossws/tools/trunk</developerConnection>
- <url>http://fisheye.jboss.com/viewrep/JBossWS/tools/trunk</url>
- </scm>
-
- <properties>
- <jbossws.spi.version>2.0.0-SNAPSHOT</jbossws.spi.version>
- <ant.version>1.7.1</ant.version>
- <getopt.version>1.0.13</getopt.version>
- <junit.version>3.8.2</junit.version>
- <log4j.version>1.2.14</log4j.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- <version>${ant.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.ws</groupId>
- <artifactId>jbossws-spi</artifactId>
- <version>${jbossws.spi.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>gnu-getopt</groupId>
- <artifactId>getopt</artifactId>
- <version>${getopt.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>${log4j.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
-</project>
Added: common-tools/trunk/pom.xml
===================================================================
--- common-tools/trunk/pom.xml (rev 0)
+++ common-tools/trunk/pom.xml 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>JBoss Web Services - Tools Integration</name>
+ <groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-common-tools</artifactId>
+ <packaging>jar</packaging>
+ <description>JBossWS Common Tools</description>
+
+ <version>1.0.0-SNAPSHOT</version>
+
+ <parent>
+ <groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-parent</artifactId>
+ <version>1.0.10-SNAPSHOT</version>
+ </parent>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossws/tools/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossws/tools/trunk</developerConnection>
+ <url>http://fisheye.jboss.com/viewrep/JBossWS/tools/trunk</url>
+ </scm>
+
+ <properties>
+ <jbossws.spi.version>2.0.0-SNAPSHOT</jbossws.spi.version>
+ <ant.version>1.7.1</ant.version>
+ <getopt.version>1.0.13</getopt.version>
+ <junit.version>3.8.2</junit.version>
+ <log4j.version>1.2.14</log4j.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>${ant.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-spi</artifactId>
+ <version>${jbossws.spi.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>gnu-getopt</groupId>
+ <artifactId>getopt</artifactId>
+ <version>${getopt.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4j.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Added: common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/EclipseClasspathTask.java
===================================================================
--- common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/EclipseClasspathTask.java (rev 0)
+++ common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/EclipseClasspathTask.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,184 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.tools.ant;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.Path;
+
+/**
+ * An Ant task creating a simple Eclipse .classpath file using the provided
+ * Ant's path id.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 15-Feb-2008
+ */
+public class EclipseClasspathTask extends Task
+{
+ private String pathId;
+ private String excludesFile;
+ private String outputFile;
+ private String srcPath;
+ private String srcOutput;
+
+ @Override
+ public void execute() throws BuildException
+ {
+ Project project = getProject();
+ Path path = (Path)project.getReference(pathId);
+ String[] pathElements = path.list();
+ try
+ {
+ List<String> excludes = getExcludes();
+ StringBuffer sb = new StringBuffer();
+ generateContent(sb, excludes, pathElements);
+ File file = outputFile != null ? new File(outputFile) : new File(getProject().getBaseDir(), ".classpath");
+ BufferedWriter out = new BufferedWriter(new FileWriter(file));
+ out.write(sb.toString());
+ out.close();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new BuildException(e);
+ }
+ }
+
+ private void generateContent(StringBuffer sb, List<String> excludes, String[] libs)
+ {
+ sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+ sb.append("<classpath>\n");
+ sb.append("<classpathentry ");
+ if (excludes != null && !excludes.isEmpty())
+ {
+ sb.append("excluding=\"");
+ for (Iterator<String> it = excludes.iterator(); it.hasNext();)
+ {
+ sb.append(it.next());
+ if (it.hasNext())
+ sb.append("|");
+ }
+ sb.append("\" ");
+ }
+ sb.append("kind=\"src\" ");
+ if (srcOutput != null)
+ {
+ sb.append("output=\"");
+ sb.append(srcOutput);
+ sb.append("\" ");
+ }
+ if (srcPath != null)
+ {
+ sb.append("path=\"");
+ sb.append(srcPath);
+ sb.append("\" ");
+ }
+ sb.append("/>\n");
+ sb.append("<classpathentry kind=\"con\" path=\"org.eclipse.jdt.launching.JRE_CONTAINER\"/>\n");
+ for (int i = 0; i < libs.length; i++)
+ {
+ if (new File(libs[i]).exists() && libs[i].endsWith(".jar")) //jar files only can be used as lib entry
+ {
+ sb.append("<classpathentry kind=\"lib\" path=\"");
+ sb.append(absoluteToRelativePath(libs[i]));
+ sb.append("\"/>\n");
+ }
+ }
+ sb.append("<classpathentry kind=\"output\" path=\"bin\"/>\n");
+ sb.append("</classpath>");
+ }
+
+ private List<String> getExcludes() throws IOException
+ {
+ List<String> excludes = new LinkedList<String>();
+ if (excludesFile != null)
+ {
+ BufferedReader in = null;
+ try
+ {
+ in = new BufferedReader(new FileReader(excludesFile));
+ String str;
+ while ((str = in.readLine()) != null)
+ {
+ if (str.length() > 0 && !str.startsWith("#"))
+ excludes.add(str);
+ }
+ }
+ finally
+ {
+ if (in != null)
+ in.close();
+ }
+ }
+ return excludes;
+ }
+
+ private String absoluteToRelativePath(String absolutePath)
+ {
+ String baseDir = getProject().getBaseDir().toString();
+ String result = absolutePath;
+ if (absolutePath.startsWith(baseDir))
+ {
+ result = absolutePath.substring(baseDir.length());
+ if (result.startsWith("\\") || result.startsWith("/"))
+ result = result.substring(1);
+ }
+ return result;
+ }
+
+ public void setPathId(String pathId)
+ {
+ this.pathId = pathId;
+ }
+
+ public void setExcludesFile(String excludesFile)
+ {
+ this.excludesFile = excludesFile;
+ }
+
+ public void setOutputFile(String outputFile)
+ {
+ this.outputFile = outputFile;
+ }
+
+ public void setSrcPath(String srcPath)
+ {
+ this.srcPath = srcPath;
+ }
+
+ public void setSrcOutput(String srcOutput)
+ {
+ this.srcOutput = srcOutput;
+ }
+
+}
Added: common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/EclipseJUnitTestsTask.java
===================================================================
--- common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/EclipseJUnitTestsTask.java (rev 0)
+++ common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/EclipseJUnitTestsTask.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,266 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.tools.ant;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.FileSet;
+
+/**
+ * An Ant task creating Eclipse's launch configuration files for the JUnit tests
+ * of the test-suite.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 18-Feb-2008
+ */
+public class EclipseJUnitTestsTask extends Task
+{
+ private String projectName;
+ private String projectWorkingDir; // the Eclipse project working dir, i.e. the output dir
+ private String testResourcesDir; //the dir containing the resources files
+ private String testLibsDir; //the dir containing the libs files
+ private String srcDir; // the tests src dir
+ private String integrationTarget;
+ private String jbossHome;
+ private String endorsedDir;
+ private String namingProviderUrl;
+ private String securityPolicy;
+ private FileSet fileset;
+
+ @Override
+ public void execute() throws BuildException
+ {
+ try
+ {
+ DirectoryScanner dsc = fileset.getDirectoryScanner(getProject());
+ String[] classes = dsc.getIncludedFiles();
+ for (int i = 0; i < classes.length; i++)
+ {
+ String clazz = classes[i];
+ File file = new File(getProject().getBaseDir(), pathToClassName(clazz) + ".launch");
+ BufferedWriter out = new BufferedWriter(new FileWriter(file));
+ out.write(getSingleTestConf(clazz).toString());
+ out.close();
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new BuildException(e);
+ }
+ }
+
+ public FileSet createFileset()
+ {
+ this.fileset = new FileSet();
+ return fileset;
+ }
+
+ private static String pathToFullClassName(String path)
+ {
+ // remove ".class" and replace slashes and backslashes with a dot
+ return path.substring(0, path.length() - 6).replaceAll("\\\\", ".").replaceAll("/", ".");
+ }
+
+ private static String pathToClassName(String path)
+ {
+ String fullClassName = pathToFullClassName(path);
+ return fullClassName.substring(fullClassName.lastIndexOf(".") + 1);
+ }
+
+ private LaunchConfiguration getSingleTestConf(String clazz)
+ {
+ LaunchConfiguration conf = new LaunchConfiguration();
+ conf.addEntryToListAttribute("org.eclipse.debug.core.MAPPED_RESOURCE_PATHS", "/" + projectName + "/" + absoluteToRelativePath(srcDir) + "/"
+ + clazz.substring(0, clazz.length() - 6) + ".java");
+ conf.addEntryToListAttribute("org.eclipse.debug.core.MAPPED_RESOURCE_TYPES", "1");
+ conf.putBooleanAttribute("org.eclipse.debug.core.appendEnvironmentVariables", true);
+ conf.putBooleanAttribute("org.eclipse.jdt.junit.KEEPRUNNING_ATTR", false);
+ conf.putStringAttribute("org.eclipse.jdt.junit.CONTAINER", "");
+ conf.putStringAttribute("org.eclipse.jdt.junit.TESTNAME", "");
+ conf.putStringAttribute("org.eclipse.jdt.junit.TEST_KIND", "org.eclipse.jdt.junit.loader.junit3");
+ conf.putStringAttribute("org.eclipse.jdt.launching.MAIN_TYPE", pathToFullClassName(clazz));
+ conf.putStringAttribute("org.eclipse.jdt.launching.PROJECT_ATTR", projectName);
+ // computing the userDir; please note we get the relative path since we use the Eclipse $workspace_loc variable
+ String userDir = "${workspace_loc:" + projectName + "}/" + absoluteToRelativePath(projectWorkingDir);
+ String resourcesDir = "${workspace_loc:" + projectName + "}/" + absoluteToRelativePath(testResourcesDir);
+ String libsDir = "${workspace_loc:" + projectName + "}/" + absoluteToRelativePath(testLibsDir);
+ conf.putStringAttribute("org.eclipse.jdt.launching.VM_ARGUMENTS", getVMArguments(userDir, resourcesDir, libsDir));
+ conf.putStringAttribute("org.eclipse.jdt.launching.WORKING_DIRECTORY", userDir);
+ return conf;
+ }
+
+ private String getVMArguments(String userDir, String resourcesDir, String libsDir)
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("-Djbossws.integration.target=").append(integrationTarget);
+ sb.append(" -ea ");
+ sb.append("-Dtest.execution.dir=").append(userDir);
+ sb.append(" -Djava.endorsed.dirs=").append(endorsedDir);
+ sb.append(" ");
+ sb.append("-Djava.naming.provider.url=").append(namingProviderUrl);
+ sb.append(" -Djava.protocol.handler.pkgs=org.jboss.virtual.protocol ");
+ sb.append("-Djava.security.policy=").append(absoluteToRelativePath(securityPolicy));
+ sb.append(" -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory ");
+ sb.append("-Duser.dir=").append(userDir);
+ sb.append(" -Djboss.home=").append(jbossHome);
+ sb.append(" -Djdk.home=${env_var:JAVA_HOME}");
+ sb.append(" -Dtest.archive.directory=").append(libsDir);
+ sb.append(" -Dtest.resources.directory=").append(resourcesDir);
+ sb.append(" -Dbinary.distribution=true");
+ return sb.toString();
+ }
+
+ private String absoluteToRelativePath(String absolutePath)
+ {
+ String baseDir = getProject().getBaseDir().toString();
+ if (!absolutePath.startsWith(baseDir))
+ throw new IllegalArgumentException("The provided absolute path is outside the current basedir: " + baseDir);
+ return absolutePath.substring(baseDir.length() + 1);
+ }
+
+ public void setSrcDir(String srcDir)
+ {
+ this.srcDir = srcDir;
+ }
+
+ public void setProjectName(String projectName)
+ {
+ this.projectName = projectName;
+ }
+
+ public void setProjectWorkingDir(String projectWorkingDir)
+ {
+ this.projectWorkingDir = projectWorkingDir;
+ }
+
+ public void setIntegrationTarget(String integrationTarget)
+ {
+ this.integrationTarget = integrationTarget;
+ }
+
+ public void setJbossHome(String jbossHome)
+ {
+ this.jbossHome = jbossHome;
+ }
+
+ public void setNamingProviderUrl(String namingProviderUrl)
+ {
+ this.namingProviderUrl = namingProviderUrl;
+ }
+
+ public void setSecurityPolicy(String securityPolicy)
+ {
+ this.securityPolicy = securityPolicy;
+ }
+
+ public void setEndorsedDir(String endorsedDir)
+ {
+ this.endorsedDir = endorsedDir;
+ }
+
+ public void setTestResourcesDir(String testResourcesDir)
+ {
+ this.testResourcesDir = testResourcesDir;
+ }
+
+ public void setTestLibsDir(String testLibsDir)
+ {
+ this.testLibsDir = testLibsDir;
+ }
+
+ private class LaunchConfiguration
+ {
+ private Map<String, String> booleanAttributes = new LinkedHashMap<String, String>();
+ private Map<String, String> stringAttributes = new LinkedHashMap<String, String>();
+ private Map<String, List<String>> listAttributes = new LinkedHashMap<String, List<String>>();
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+ sb.append("<launchConfiguration type=\"org.eclipse.jdt.junit.launchconfig\">\n");
+ for (String key : listAttributes.keySet())
+ {
+ sb.append("<listAttribute key=\"").append(key).append("\">\n");
+ for (String value : listAttributes.get(key))
+ {
+ sb.append("<listEntry value=\"").append(value).append("\"/>\n");
+ }
+ sb.append("</listAttribute>\n");
+ }
+ for (String key : booleanAttributes.keySet())
+ {
+ sb.append("<booleanAttribute key=\"").append(key);
+ sb.append("\" value=\"").append(booleanAttributes.get(key)).append("\"/>\n");
+ }
+ for (String key : stringAttributes.keySet())
+ {
+ sb.append("<stringAttribute key=\"").append(key);
+ sb.append("\" value=\"").append(stringAttributes.get(key)).append("\"/>\n");
+ }
+ sb.append("</launchConfiguration>");
+ return sb.toString();
+ }
+
+ public Map<String, String> getBooleanAttributes()
+ {
+ return booleanAttributes;
+ }
+
+ public void putBooleanAttribute(String name, boolean value)
+ {
+ this.booleanAttributes.put(name, String.valueOf(value));
+ }
+
+ public Map<String, String> getStringAttributes()
+ {
+ return stringAttributes;
+ }
+
+ public void putStringAttribute(String name, String value)
+ {
+ this.stringAttributes.put(name, value);
+ }
+
+ public Map<String, List<String>> getListAttributes()
+ {
+ return listAttributes;
+ }
+
+ public void addEntryToListAttribute(String attribute, String entryValue)
+ {
+ if (!listAttributes.containsKey(attribute))
+ listAttributes.put(attribute, new LinkedList<String>());
+ listAttributes.get(attribute).add(entryValue);
+ }
+ }
+}
Added: common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/EclipseProjectTask.java
===================================================================
--- common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/EclipseProjectTask.java (rev 0)
+++ common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/EclipseProjectTask.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.tools.ant;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+/**
+ * An Ant task creating a simple Eclipse .project file using the provided project name.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 18-Feb-2008
+ */
+public class EclipseProjectTask extends Task
+{
+ private String projectName;
+ private String outputFile;
+
+ @Override
+ public void execute() throws BuildException
+ {
+ try
+ {
+ StringBuffer sb = new StringBuffer();
+ generateContent(sb);
+ File file;
+ if (outputFile != null)
+ file = new File(outputFile);
+ else
+ file = new File(getProject().getBaseDir(), ".project");
+ BufferedWriter out = new BufferedWriter(new FileWriter(file));
+ out.write(sb.toString());
+ out.close();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new BuildException(e);
+ }
+ }
+
+ private void generateContent(StringBuffer sb)
+ {
+ sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+ sb.append("<projectDescription>\n <name>");
+ sb.append(projectName);
+ sb.append("</name>\n" +
+ " <comment></comment>\n" +
+ " <projects>\n" +
+ " </projects>\n" +
+ " <buildSpec>\n" +
+ " <buildCommand>\n" +
+ " <name>org.eclipse.jdt.core.javabuilder</name>\n" +
+ " <arguments>\n" +
+ " </arguments>\n" +
+ " </buildCommand>\n" +
+ " </buildSpec>\n" +
+ " <natures>\n" +
+ " <nature>org.eclipse.jdt.core.javanature</nature>\n" +
+ " </natures>\n" +
+ "</projectDescription>");
+ }
+
+ public void setProjectName(String projectName)
+ {
+ this.projectName = projectName;
+ }
+
+ public void setOutputFile(String outputFile)
+ {
+ this.outputFile = outputFile;
+ }
+}
Added: common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/FixPathTask.java
===================================================================
--- common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/FixPathTask.java (rev 0)
+++ common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/FixPathTask.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.tools.ant;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+public class FixPathTask extends Task
+{
+ private String propertyName;
+
+ @Override
+ public void execute() throws BuildException
+ {
+ String path = getProject().getProperty(propertyName);
+
+ if (path != null)
+ {
+ getProject().setProperty(propertyName, path.replace('\\', '/'));
+ }
+ }
+
+ public void setProperty(String propertyName)
+ {
+ this.propertyName = propertyName;
+ }
+}
Added: common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/InstallModulesTask.java
===================================================================
--- common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/InstallModulesTask.java (rev 0)
+++ common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/InstallModulesTask.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,153 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.tools.ant;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.FilenameFilter;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.FileSet;
+
+/**
+ * An Ant task for installing AS7 module.xml files; reads the contents of the provided
+ * module.xml files, computes the module path from their full paths, updates the contents
+ * with the resource libs found at the corresponding module in the target dir location
+ * and finally write the destination module.xml files in the target module dir.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 03-Feb-2011
+ *
+ */
+public class InstallModulesTask extends Task
+{
+ private String targetDir; //the target directory where modules are installed
+ private FileSet fileset; //the fileset of module.xml files to be processed
+
+ @Override
+ public void execute() throws BuildException
+ {
+ try
+ {
+ DirectoryScanner dsc = fileset.getDirectoryScanner(getProject());
+ File baseDir = dsc.getBasedir();
+ String[] files = dsc.getIncludedFiles();
+ for (int i = 0; i < files.length; i++)
+ {
+ String currentFile = files[i];
+ File moduleXml = new File(baseDir, currentFile);
+ String modulePath = currentFile.substring(0, currentFile.lastIndexOf(File.separator));
+ File libDir = new File(targetDir, modulePath);
+ File destFile = new File(targetDir, currentFile);
+ System.out.println("Processing descriptor for module " + modulePath);
+ System.out.println("* Source module descriptor: " + moduleXml);
+ System.out.println("* Destination module descriptor: " + destFile);
+ String c = readFileContents(moduleXml);
+ if (libDir.exists())
+ {
+ String[] libs = libDir.list(new FilenameFilter()
+ {
+ @Override
+ public boolean accept(File dir, String name)
+ {
+ return name.endsWith(".jar") || name.endsWith(".ear") || name.endsWith(".sar")
+ || name.endsWith(".war");
+ }
+ });
+ BufferedWriter out = new BufferedWriter(new FileWriter(destFile));
+ out.write(updateContents(c, libs));
+ out.close();
+ }
+ else
+ {
+ libDir.mkdirs();
+ BufferedWriter out = new BufferedWriter(new FileWriter(destFile));
+ out.write(c);
+ out.close();
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new BuildException(e);
+ }
+ }
+
+ private static String readFileContents(File file) throws Exception
+ {
+ StringBuilder sb = new StringBuilder();
+ BufferedReader in = null;
+ try
+ {
+ in = new BufferedReader(new FileReader(file));
+ String line;
+ while ((line = in.readLine()) != null)
+ {
+ sb.append(line);
+ sb.append("\n");
+ }
+ }
+ finally
+ {
+ if (in != null)
+ {
+ try
+ {
+ in.close();
+ }
+ catch (Exception e)
+ {
+ //ignore
+ }
+ }
+ }
+ return sb.toString();
+ }
+
+ private static String updateContents(String contents, String[] libs)
+ {
+ StringBuilder sb = new StringBuilder();
+ for (String f : libs) {
+ sb.append("<resource-root path=\"");
+ sb.append(f);
+ sb.append("\"/>\n ");
+ }
+ return contents.replaceFirst("<!-- Insert resources here -->", sb.toString());
+ }
+
+ public FileSet createFileset()
+ {
+ this.fileset = new FileSet();
+ return fileset;
+ }
+
+ public void setTargetDir(String targetDir)
+ {
+ this.targetDir = targetDir;
+ }
+}
Added: common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/PathWriterTask.java
===================================================================
--- common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/PathWriterTask.java (rev 0)
+++ common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/PathWriterTask.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.tools.ant;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.Path;
+
+/**
+ * An Ant task that writes a given path element to a file, so that
+ * it can be easily imported by other build files.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 13-Mar-2008
+ */
+public class PathWriterTask extends Task
+{
+ private String pathId;
+ private String outputFile;
+ private String variables; //to perform path substitution, i.e. jboss.home <--> /dati/jboss-4.2.3.GA
+
+ @Override
+ public void execute() throws BuildException
+ {
+ Project project = getProject();
+ Path path = (Path)project.getReference(pathId);
+ String[] pathElements = path.list();
+ try
+ {
+ StringBuffer sb = new StringBuffer();
+ generateContent(sb, pathElements);
+ BufferedWriter out = new BufferedWriter(new FileWriter(new File(outputFile)));
+ out.write(sb.toString());
+ out.close();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new BuildException(e);
+ }
+ }
+
+ private void generateContent(StringBuffer sb, String[] libs)
+ {
+ sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+ sb.append("<project>\n");
+ sb.append("<path id=\"");
+ sb.append(pathId);
+ sb.append("\">");
+ for (int i = 0; i < libs.length; i++)
+ {
+ sb.append("<pathelement location=\"");
+ sb.append(getPath(libs[i]));
+ sb.append("\"/>\n");
+ }
+ sb.append("</path>");
+ sb.append("</project>\n");
+ }
+
+ private String getPath(String absolutePath)
+ {
+ StringTokenizer st = new StringTokenizer(variables, ";:, ", false);
+ while (st.hasMoreTokens())
+ {
+ String v = st.nextToken();
+ String value = getProject().getProperty(v);
+ if (absolutePath.contains(value))
+ {
+ int begin = absolutePath.indexOf(value);
+ int end = begin + value.length();
+ absolutePath = absolutePath.substring(0, begin) + "${" + v + "}" + absolutePath.substring(end);
+ }
+ }
+ return absolutePath;
+ }
+
+ public void setPathId(String pathId)
+ {
+ this.pathId = pathId;
+ }
+
+ public void setOutputFile(String outputFile)
+ {
+ this.outputFile = outputFile;
+ }
+
+ public void setVariables(String variables)
+ {
+ this.variables = variables;
+ }
+
+}
Added: common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/ant/AntTaskHelper.java
===================================================================
--- common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/ant/AntTaskHelper.java (rev 0)
+++ common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/ant/AntTaskHelper.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.spi.tools.ant;
+
+import org.apache.tools.ant.types.CommandlineJava.SysProperties;
+import org.apache.tools.ant.types.Environment.Variable;
+
+/**
+ * Helper class for ANT tasks.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+final class AntTaskHelper
+{
+ /**
+ * Constructor.
+ */
+ private AntTaskHelper()
+ {
+ // forbidden constructor
+ }
+
+ /**
+ * Converts array of JVM arguments to ANT SysProperties object.
+ *
+ * @param arguments to be converted.
+ * @return ANT SysProperties object.
+ */
+ static SysProperties toSystemProperties(final String[] arguments)
+ {
+ final SysProperties retVal = new SysProperties();
+
+ if (arguments != null && arguments.length != 0)
+ {
+ for (final String argument : arguments)
+ {
+ if (argument.startsWith("-D"))
+ {
+ Variable var = AntTaskHelper.toVariable(argument);
+ retVal.addVariable(var);
+ }
+ }
+ }
+
+ return retVal;
+ }
+
+ /**
+ * Converts JVM property of format -Dkey=value to ANT Variable object.
+ *
+ * @param argument to be converted
+ * @return ANT Variable object
+ */
+ private static Variable toVariable(final String argument)
+ {
+ final Variable retVal = new Variable();
+ final int equalSignIndex = argument.indexOf('=');
+
+ if (equalSignIndex == -1)
+ {
+ final String key = argument.substring(2);
+ retVal.setKey(key);
+ }
+ else
+ {
+ final String key = argument.substring(2, equalSignIndex);
+ retVal.setKey(key);
+ final String value = argument.substring(equalSignIndex + 1);
+ retVal.setValue(value);
+ }
+
+ return retVal;
+ }
+}
Added: common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/ant/SecurityActions.java
===================================================================
--- common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/ant/SecurityActions.java (rev 0)
+++ common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/ant/SecurityActions.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,137 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.spi.tools.ant;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+/**
+ * Security actions for this package
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 19-Jun-2009
+ *
+ */
+class SecurityActions
+{
+ /**
+ * Get context classloader.
+ *
+ * @return the current context classloader
+ */
+ static ClassLoader getContextClassLoader()
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ else
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+ }
+
+ /**
+ * Set context classloader.
+ *
+ * @param cl the classloader
+ * @return previous context classloader
+ * @throws Throwable for any error
+ */
+ static ClassLoader setContextClassLoader(final ClassLoader cl)
+ {
+ if (System.getSecurityManager() == null)
+ {
+ ClassLoader result = Thread.currentThread().getContextClassLoader();
+ if (cl != null)
+ Thread.currentThread().setContextClassLoader(cl);
+ return result;
+ }
+ else
+ {
+ try
+ {
+ return AccessController.doPrivileged(new PrivilegedExceptionAction<ClassLoader>() {
+ public ClassLoader run() throws Exception
+ {
+ try
+ {
+ ClassLoader result = Thread.currentThread().getContextClassLoader();
+ if (cl != null)
+ Thread.currentThread().setContextClassLoader(cl);
+ return result;
+ }
+ catch (Exception e)
+ {
+ throw e;
+ }
+ catch (Error e)
+ {
+ throw e;
+ }
+ catch (Throwable e)
+ {
+ throw new RuntimeException("Error setting context classloader", e);
+ }
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw new RuntimeException("Error running privileged action", e.getCause());
+ }
+ }
+ }
+
+ /**
+ * Get classloader from class.
+ *
+ * @param clazz the class
+ * @return class's classloader
+ */
+ static ClassLoader getClassLoader(final Class<?> clazz)
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ return clazz.getClassLoader();
+ }
+ else
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run()
+ {
+ return clazz.getClassLoader();
+ }
+ });
+ }
+ }
+
+}
Added: common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/ant/WSConsumeTask.java
===================================================================
--- common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/ant/WSConsumeTask.java (rev 0)
+++ common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/ant/WSConsumeTask.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,366 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.spi.tools.ant;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tools.ant.AntClassLoader;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.ExecuteJava;
+import org.apache.tools.ant.taskdefs.LogOutputStream;
+import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.types.CommandlineJava;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.CommandlineJava.SysProperties;
+import org.jboss.wsf.spi.tools.WSContractConsumer;
+
+/**
+ * Ant task which consumes a Web Service contract.
+ *
+ * <table border="1">
+ * <tr align="left" BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><th>Attribute</th><th>Description</th><th>Default</th></tr>
+ * <tr><td>fork</td><td>Whether or not to run the generation task in a separate VM.</td><td>true</td></tr>
+ * <tr><td>keep</td><td>Keep/Enable Java source code generation.</td><td>false</td></tr>
+ * <tr><td>catalog</td><td> Oasis XML Catalog file for entity resolution</td><td>none</td></tr>
+ * <tr><td>package</td><td> The target Java package for generated code.</td><td>generated</td></tr>
+ * <tr><td>binding</td><td>A JAX-WS or JAXB binding file</td><td>none</td></tr>
+ * <tr><td>wsdlLocation</td><td>Value to use for @(a)WebService.wsdlLocation</td><td>generated</td></tr>
+ * <tr><td>destdir</td><td>The output directory for generated artifacts.</td><td>"output"</td></tr>
+ * <tr><td>sourcedestdir</td><td>The output directory for Java source.</td><td>value of destdir</td></tr>
+ * <tr><td>extension</td><td>Enable SOAP 1.2 binding extension.</td><td>false</td></tr>
+ * <tr><td>target</td><td>The JAX-WS specification target. Allowed values are 2.0, 2.1 and 2.2</td><td></td></tr>
+ * <tr><td>verbose</td><td>Enables more informational output about cmd progress.</td><td>false</td><tr>
+ * <tr><td>wsdl*</td><td>The WSDL file or URL</td><td>n/a</td><tr>
+ * </table>
+ * <b>* = required.</b>
+ *
+ * <p>Example:
+ *
+ * <pre>
+ * <WSConsumeTask
+ * fork="true"
+ * verbose="true"
+ * destdir="output"
+ * sourcedestdir="gen-src"
+ * keep="true"
+ * wsdllocation="handEdited.wsdl"
+ * wsdl="foo.wsdl">
+ * <binding dir="binding-files" includes="*.xml" excludes="bad.xml"/>
+ * </wsimport>
+ * </pre>
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public class WSConsumeTask extends Task
+{
+ private CommandlineJava command = new CommandlineJava();
+ private String wsdl;
+ private File destdir;
+ private File sourcedestdir;
+ private List<File> bindingFiles = new ArrayList<File>();
+ private File catalog;
+ private String wsdlLocation;
+ private String targetPackage;
+ private boolean keep;
+ private boolean extension;
+ private boolean verbose;
+ private boolean fork;
+ private boolean debug;
+ private boolean nocompile;
+ private boolean additionalHeaders;
+ private String target;
+
+ // Not actually used right now
+ public void setDebug(boolean debug)
+ {
+ this.debug = debug;
+ }
+
+ public Commandline.Argument createJvmarg()
+ {
+ return command.createVmArgument();
+ }
+
+ public void setBinding(File bindingFile)
+ {
+ bindingFiles.add(bindingFile);
+ }
+
+ public void setCatalog(File catalog)
+ {
+ this.catalog = catalog;
+ }
+
+ public void setDestdir(File destdir)
+ {
+ this.destdir = destdir;
+ }
+
+ public void setFork(boolean fork)
+ {
+ this.fork = fork;
+ }
+
+ public void setKeep(boolean keep)
+ {
+ this.keep = keep;
+ }
+
+ public void setExtension(boolean extension)
+ {
+ this.extension = extension;
+ }
+
+ public void setAdditionalHeaders(boolean additionalHeaders)
+ {
+ this.additionalHeaders = additionalHeaders;
+ }
+
+ public void setSourcedestdir(File sourcedestdir)
+ {
+ this.sourcedestdir = sourcedestdir;
+ }
+
+ public void setTarget(String target)
+ {
+ this.target = target;
+ }
+
+ public void setPackage(String targetPackage)
+ {
+ this.targetPackage = targetPackage;
+ }
+
+ public void setVerbose(boolean verbose)
+ {
+ this.verbose = verbose;
+ }
+
+ public void setNoCompile(boolean nocompile)
+ {
+ this.nocompile = nocompile;
+ }
+
+ public void setWsdl(String wsdl)
+ {
+ this.wsdl = wsdl;
+ }
+
+ public void setWsdlLocation(String wsdlLocation)
+ {
+ this.wsdlLocation = wsdlLocation;
+ }
+
+ public void addConfiguredBinding(FileSet fs)
+ {
+ DirectoryScanner ds = fs.getDirectoryScanner(getProject());
+ File baseDir = ds.getBasedir();
+ for (String file : ds.getIncludedFiles())
+ {
+ bindingFiles.add(new File(baseDir, file));
+ }
+ }
+
+ public void executeNonForked()
+ {
+ ClassLoader prevCL = SecurityActions.getContextClassLoader();
+ ClassLoader antLoader = SecurityActions.getClassLoader(this.getClass());
+ SecurityActions.setContextClassLoader(antLoader);
+ try
+ {
+ WSContractConsumer consumer = WSContractConsumer.newInstance();
+ consumer.setGenerateSource(keep);
+ consumer.setExtension(extension);
+ consumer.setAdditionalHeaders(additionalHeaders);
+ consumer.setNoCompile(nocompile);
+ if (destdir != null)
+ consumer.setOutputDirectory(destdir);
+ if (sourcedestdir != null)
+ consumer.setSourceDirectory(sourcedestdir);
+ if (targetPackage != null)
+ consumer.setTargetPackage(targetPackage);
+ if (wsdlLocation != null)
+ consumer.setWsdlLocation(wsdlLocation);
+ if (catalog != null)
+ {
+ if (catalog.exists() && catalog.isFile())
+ {
+ consumer.setCatalog(catalog);
+ }
+ else
+ {
+ log("Catalog file not found: " + catalog, Project.MSG_WARN);
+ }
+ }
+ if (bindingFiles != null && bindingFiles.size() > 0)
+ consumer.setBindingFiles(bindingFiles);
+ if (target != null)
+ consumer.setTarget(target);
+
+ log("Consuming wsdl: " + wsdl, Project.MSG_INFO);
+
+ if (verbose)
+ {
+ consumer.setMessageStream(new PrintStream(new LogOutputStream(this, Project.MSG_INFO)));
+ }
+
+ try
+ {
+ consumer.setAdditionalCompilerClassPath(getTaskClassPathStrings());
+ consumer.consume(wsdl);
+ }
+ catch (Throwable e)
+ {
+ throw new BuildException(e, getLocation());
+ }
+ }
+ finally
+ {
+ SecurityActions.setContextClassLoader(prevCL);
+ }
+ }
+
+ public void execute() throws BuildException
+ {
+ if (wsdl == null)
+ throw new BuildException("The wsdl attribute must be specified!", getLocation());
+
+ if (fork)
+ executeForked();
+ else executeNonForked();
+ }
+
+ private Path getTaskClassPath()
+ {
+ // Why is everything in the Ant API a big hack???
+ ClassLoader cl = SecurityActions.getClassLoader(this.getClass());
+ if (cl instanceof AntClassLoader)
+ {
+ return new Path(getProject(), ((AntClassLoader)cl).getClasspath());
+ }
+
+ return new Path(getProject());
+ }
+
+ private List<String> getTaskClassPathStrings()
+ {
+ // Why is everything in the Ant API a big hack???
+ List<String> strings = new ArrayList<String>();
+ ClassLoader cl = SecurityActions.getClassLoader(this.getClass());
+ if (cl instanceof AntClassLoader)
+ {
+ for (String string : ((AntClassLoader)cl).getClasspath().split(File.pathSeparator))
+ strings.add(string);
+ }
+
+ return strings;
+ }
+
+ private void executeForked() throws BuildException
+ {
+ command.setClassname(org.jboss.wsf.spi.tools.cmd.WSConsume.class.getName());
+
+ Path path = command.createClasspath(getProject());
+ path.append(getTaskClassPath());
+
+ if (keep)
+ command.createArgument().setValue("-k");
+
+ if (extension)
+ command.createArgument().setValue("-e");
+
+ if (additionalHeaders)
+ command.createArgument().setValue("-a");
+
+ for (File file : bindingFiles)
+ {
+ command.createArgument().setValue("-b");
+ command.createArgument().setFile(file);
+ }
+
+ if (catalog != null)
+ {
+ command.createArgument().setValue("-c");
+ command.createArgument().setFile(catalog);
+ }
+
+ if (targetPackage != null)
+ {
+ command.createArgument().setValue("-p");
+ command.createArgument().setValue(targetPackage);
+ }
+
+ if (wsdlLocation != null)
+ {
+ command.createArgument().setValue("-w");
+ command.createArgument().setValue(wsdlLocation);
+ }
+
+ if (destdir != null)
+ {
+ command.createArgument().setValue("-o");
+ command.createArgument().setFile(destdir);
+ }
+
+ if (sourcedestdir != null)
+ {
+ command.createArgument().setValue("-s");
+ command.createArgument().setFile(sourcedestdir);
+ }
+
+ if (target != null)
+ {
+ command.createArgument().setValue("-t");
+ command.createArgument().setValue(target);
+ }
+
+ if (verbose)
+ command.createArgument().setValue("-v");
+
+ command.createArgument().setValue(wsdl);
+
+ log("Consuming wsdl: " + wsdl, Project.MSG_INFO);
+
+ if (verbose)
+ log("Command invoked: " + command.getJavaCommand().toString());
+
+ ExecuteJava execute = new ExecuteJava();
+ execute.setClasspath(path);
+ execute.setJavaCommand(command.getJavaCommand());
+
+ // propagate system properties (useful e.g. for endorsing)
+ String[] arguments = command.getVmCommand().getArguments();
+ SysProperties properties = AntTaskHelper.toSystemProperties(arguments);
+ execute.setSystemProperties(properties);
+
+ if (execute.fork(this) != 0)
+ throw new BuildException("Could not invoke WSConsumeTask", getLocation());
+ }
+}
Added: common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/ant/WSProvideTask.java
===================================================================
--- common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/ant/WSProvideTask.java (rev 0)
+++ common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/ant/WSProvideTask.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,331 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.spi.tools.ant;
+
+import org.apache.tools.ant.AntClassLoader;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.ExecuteJava;
+import org.apache.tools.ant.taskdefs.LogOutputStream;
+import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.types.CommandlineJava;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Reference;
+import org.apache.tools.ant.types.CommandlineJava.SysProperties;
+import org.apache.tools.ant.types.Environment.Variable;
+import org.jboss.wsf.spi.tools.WSContractProvider;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.net.URLClassLoader;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.util.StringTokenizer;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Ant task which invokes provides a Web Service contract and portable JAX-WS wrapper classes.
+ *
+ * <table border="1">
+ * <tr align="left" BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><th>Attribute</th><th>Description</th><th>Default</th></tr>
+ * <tr><td>fork</td><td>Whether or not to run the generation task in a separate VM.</td><td>true</td></tr>
+ * <tr><td>keep</td><td>Keep/Enable Java source code generation.</td><td>false</td></tr>
+ * <tr><td>destdir</td><td>The output directory for generated artifacts.</td><td>"output"</td></tr>
+ * <tr><td>resourcedestdir</td><td>The output directory for resource artifacts (WSDL/XSD).</td><td>value of destdir</td></tr>
+ * <tr><td>sourcedestdir</td><td>The output directory for Java source.</td><td>value of destdir</td></tr>
+ * <tr><td>genwsdl</td><td>Whether or not to generate WSDL.</td><td>false</td><tr>
+ * <tr><td>extension</td><td>Enable SOAP 1.2 binding extension.</td><td>false</td></tr>
+ * <tr><td>verbose</td><td>Enables more informational output about cmd progress.</td><td>false</td><tr>
+ * <tr><td>sei</td><td>Service Endpoint Implementation.</td><td></td><tr>
+ * <tr><td>classpath</td><td>The classpath that contains the service endpoint implementation.</td><td>""</tr>
+ * </table>
+ * <b>* = required.</b>
+ *
+ * <p>Example:
+ *
+ * <pre>
+ * <target name="test-wsproivde" depends="init">
+ * <taskdef name="WSProvideTask" classname="org.jboss.wsf.spi.tools.ant.WSProvideTask">
+ * <classpath refid="core.classpath"/>
+ * </taskdef>
+ * <WSProvideTask
+ * fork="false"
+ * keep="true"
+ * destdir="out"
+ * resourcedestdir="out-resource"
+ * sourcedestdir="out-source"
+ * genwsdl="true"
+ * extension="true"
+ * verbose="true"
+ * sei="org.jboss.test.ws.jaxws.jsr181.soapbinding.DocWrappedServiceImpl">
+ * <classpath>
+ * <pathelement path="${tests.output.dir}/classes"/>
+ * </classpath>
+ * </WSProvideTask>
+ * </target>
+ * </pre>
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public class WSProvideTask extends Task
+{
+ private Path classpath = new Path(getProject());
+ private CommandlineJava command = new CommandlineJava();
+ private String sei;
+ private File destdir;
+ private File resourcedestdir;
+ private File sourcedestdir;
+ private boolean keep;
+ private boolean extension;
+ private boolean genwsdl;
+ private boolean verbose;
+ private boolean fork;
+ private boolean debug;
+
+ // Not actually used right now
+ public void setDebug(boolean debug)
+ {
+ this.debug = debug;
+ }
+
+ public Commandline.Argument createJvmarg()
+ {
+ return command.createVmArgument();
+ }
+
+ public void setClasspath(Path classpath)
+ {
+ this.classpath = classpath;
+ }
+
+ public void setClasspathRef(Reference ref)
+ {
+ createClasspath().setRefid(ref);
+ }
+
+ public Path createClasspath()
+ {
+ return classpath;
+ }
+
+ public void setDestdir(File destdir)
+ {
+ this.destdir = destdir;
+ }
+
+ public void setExtension(boolean extension)
+ {
+ this.extension = extension;
+ }
+
+ public void setProtocol(String protocol)
+ {
+ if (protocol != null)
+ {
+ this.extension = protocol.toLowerCase().indexOf("Xsoap1.2") != -1;
+ }
+ }
+
+ public void setKeep(boolean keep)
+ {
+ this.keep = keep;
+ }
+
+ public void setSei(String sei)
+ {
+ this.sei = sei;
+ }
+
+ public void setFork(boolean fork)
+ {
+ this.fork = fork;
+ }
+
+ public void setResourcedestdir(File resourcedestdir)
+ {
+ this.resourcedestdir = resourcedestdir;
+ }
+
+ public void setSourcedestdir(File sourcedestdir)
+ {
+ this.sourcedestdir = sourcedestdir;
+ }
+
+ public void setVerbose(boolean verbose)
+ {
+ this.verbose = verbose;
+ }
+
+ public void setGenwsdl(boolean genwsdl)
+ {
+ this.genwsdl = genwsdl;
+ }
+
+ private ClassLoader getClasspathLoader(ClassLoader parent)
+ {
+ AntClassLoader antLoader = new AntClassLoader(parent, getProject(), classpath, false);
+
+ // It's necessary to wrap it into an URLLoader in order to extract that information
+ // within the actual provider impl.
+ // See SunRIProviderImpl for instance
+ List<URL> urls = new ArrayList<URL>();
+ StringTokenizer tok = new StringTokenizer(antLoader.getClasspath(), File.separator);
+ while(tok.hasMoreTokens())
+ {
+ try
+ {
+ String path = tok.nextToken();
+ if(!path.startsWith("file://"))
+ path = "file://"+path;
+
+ urls.add(new URL(path));
+ }
+ catch (MalformedURLException e)
+ {
+ throw new IllegalArgumentException("Failed to wrap classloader", e);
+ }
+
+ }
+
+ ClassLoader wrapper = new URLClassLoader(urls.toArray(new URL[0]), antLoader);
+ return wrapper;
+ }
+
+ public void executeNonForked()
+ {
+ ClassLoader prevCL = SecurityActions.getContextClassLoader();
+ ClassLoader antLoader = SecurityActions.getClassLoader(this.getClass());
+ SecurityActions.setContextClassLoader(antLoader);
+ try
+ {
+ WSContractProvider gen = WSContractProvider.newInstance(
+ getClasspathLoader(antLoader)
+ );
+ if (verbose)
+ gen.setMessageStream(new PrintStream(new LogOutputStream(this, Project.MSG_INFO)));
+ gen.setGenerateSource(keep);
+ gen.setGenerateWsdl(genwsdl);
+ gen.setExtension(extension);
+
+ if (destdir != null)
+ gen.setOutputDirectory(destdir);
+ if (resourcedestdir != null)
+ gen.setResourceDirectory(resourcedestdir);
+ if (sourcedestdir != null)
+ gen.setSourceDirectory(sourcedestdir);
+
+ log("Generating from endpoint: " + sei, Project.MSG_INFO);
+
+ gen.provide(sei);
+ }
+ catch(Throwable t)
+ {
+ throw new BuildException(t, getLocation());
+ }
+ finally
+ {
+ SecurityActions.setContextClassLoader(prevCL);
+ }
+ }
+
+ public void execute() throws BuildException
+ {
+ if (sei == null)
+ throw new BuildException("The sei attribute must be specified!", getLocation());
+
+ if (fork)
+ executeForked();
+ else
+ executeNonForked();
+ }
+
+ private Path getTaskClassPath()
+ {
+ // Why is everything in the Ant API a big hack???
+ ClassLoader cl = this.getClass().getClassLoader();
+ if (cl instanceof AntClassLoader)
+ {
+ return new Path(getProject(), ((AntClassLoader)cl).getClasspath());
+ }
+
+ return new Path(getProject());
+ }
+
+ private void executeForked() throws BuildException
+ {
+ command.setClassname(org.jboss.wsf.spi.tools.cmd.WSProvide.class.getName());
+
+ Path path = command.createClasspath(getProject());
+ path.append(getTaskClassPath());
+ path.append(classpath);
+
+ if (keep)
+ command.createArgument().setValue("-k");
+
+ if (genwsdl)
+ command.createArgument().setValue("-w");
+
+ if (extension)
+ command.createArgument().setValue("-e");
+
+ if (destdir != null)
+ {
+ command.createArgument().setValue("-o");
+ command.createArgument().setFile(destdir);
+ }
+ if (resourcedestdir != null)
+ {
+ command.createArgument().setValue("-r");
+ command.createArgument().setFile(resourcedestdir);
+ }
+ if (sourcedestdir != null)
+ {
+ command.createArgument().setValue("-s");
+ command.createArgument().setFile(sourcedestdir);
+ }
+
+ if (!verbose)
+ command.createArgument().setValue("-q");
+
+ // Always dump traces
+ command.createArgument().setValue("-t");
+ command.createArgument().setValue(sei);
+
+ if (verbose)
+ log("Command invoked: " + command.getJavaCommand().toString());
+
+ ExecuteJava execute = new ExecuteJava();
+ execute.setClasspath(path);
+ execute.setJavaCommand(command.getJavaCommand());
+
+ // propagate system properties (useful e.g. for endorsing)
+ String[] arguments = command.getVmCommand().getArguments();
+ SysProperties properties = AntTaskHelper.toSystemProperties(arguments);
+ execute.setSystemProperties(properties);
+
+ if (execute.fork(this) != 0)
+ throw new BuildException("Could not invoke WSProvideTask", getLocation());
+ }
+}
Added: common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/cmd/SecurityActions.java
===================================================================
--- common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/cmd/SecurityActions.java (rev 0)
+++ common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/cmd/SecurityActions.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,177 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.spi.tools.cmd;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+/**
+ * Security actions for this package
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 19-Jun-2009
+ *
+ */
+class SecurityActions
+{
+ /**
+ * Get context classloader.
+ *
+ * @return the current context classloader
+ */
+ static ClassLoader getContextClassLoader()
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ else
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+ }
+
+ /**
+ * Set context classloader.
+ *
+ * @param classLoader the classloader
+ */
+ static void setContextClassLoader(final ClassLoader classLoader)
+ {
+ if (System.getSecurityManager() == null)
+ {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ }
+ else
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Object>()
+ {
+ public Object run()
+ {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ return null;
+ }
+ });
+ }
+ }
+
+ static ClassLoader getModulesClassLoader()
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ return getModulesClassLoaderInternal();
+ }
+ else
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run()
+ {
+ return getModulesClassLoaderInternal();
+ }
+ });
+ }
+ }
+
+ private static ClassLoader getModulesClassLoaderInternal()
+ {
+ // TODO: use SPI class loader facade, not reflection!
+ try {
+ Class<?> moduleClass = Class.forName("org.jboss.modules.Module");
+ Class<?> moduleIdentifierClass = Class.forName("org.jboss.modules.ModuleIdentifier");
+ Class<?> moduleLoaderClass = Class.forName("org.jboss.modules.ModuleLoader");
+ Object moduleLoader = moduleClass.getMethod("getBootModuleLoader").invoke(null);
+ Object moduleIdentifier = moduleIdentifierClass.getMethod("create", String.class).invoke(null, "org.jboss.as.webservices.server.integration");
+ Object module = moduleLoaderClass.getMethod("loadModule", moduleIdentifierClass).invoke(moduleLoader, moduleIdentifier);
+ return (ClassLoader)moduleClass.getMethod("getClassLoader").invoke(module);
+ } catch (Exception e) {
+ //ignore, JBoss Modules might not be available at all
+ return null;
+ }
+ }
+
+ /**
+ * Load a class using the provided classloader
+ *
+ * @param name
+ * @return
+ * @throws PrivilegedActionException
+ */
+ static Class<?> loadClass(final ClassLoader cl, final String name) throws PrivilegedActionException, ClassNotFoundException
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ return cl.loadClass(name);
+ }
+ else
+ {
+ return AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>() {
+ public Class<?> run() throws PrivilegedActionException
+ {
+ try
+ {
+ return cl.loadClass(name);
+ }
+ catch (Exception e)
+ {
+ throw new PrivilegedActionException(e);
+ }
+ }
+ });
+ }
+ }
+
+ /**
+ * Get a system property
+ *
+ * @param name
+ * @param defaultValue
+ * @return
+ */
+ static String getSystemProperty(final String name, final String defaultValue)
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ return System.getProperty(name, defaultValue);
+ }
+ else
+ {
+ PrivilegedAction<String> action = new PrivilegedAction<String>() {
+ public String run()
+ {
+ return System.getProperty(name, defaultValue);
+ }
+ };
+ return AccessController.doPrivileged(action);
+ }
+ }
+}
Added: common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/cmd/WSConsume.java
===================================================================
--- common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/cmd/WSConsume.java (rev 0)
+++ common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/cmd/WSConsume.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,335 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.spi.tools.cmd;
+
+import gnu.getopt.Getopt;
+import gnu.getopt.LongOpt;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+
+import org.jboss.wsf.spi.tools.WSContractConsumer;
+import org.jboss.wsf.spi.util.Log4JUtil;
+import org.jboss.wsf.spi.util.Log4jOutputStream;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * WSConsumeTask is a cmd line tool that generates portable JAX-WS artifacts
+ * from a WSDL file.
+ *
+ * <pre>
+ * usage: WSConsumeTask [options] <wsdl-url>
+ * options:
+ * <table>
+ * <tr><td>-h, --help </td><td>Show this help message</td></tr>
+ * <tr><td>-b, --binding=<file> </td><td>One or more JAX-WS or JAXB binding files</td></tr>
+ * <tr><td>-k, --keep </td><td>Keep/Generate Java source</td></tr>
+ * <tr><td>-c, --catalog=<file> </td><td>Oasis XML Catalog file for entity resolution</td></tr>
+ * <tr><td>-p, --package=<name> </td><td>The target package for generated source</td></tr>
+ * <tr><td>-w, --wsdlLocation=<loc> </td><td>Value to use for @(a)WebService.wsdlLocation</td></tr>
+ * <tr><td>-o, --output=<directory> </td><td>The directory to put generated artifacts</td></tr>
+ * <tr><td>-s, --source=<directory> </td><td>The directory to put Java source</td></tr>
+ * <tr><td>-t, --target=<2.0|2.1|2.2></td><td>The target specification target</td></tr>
+ * <tr><td>-n, --nocompile </td><td>Do not compile generated sources</td></tr>
+ * <tr><td>-q, --quiet </td><td>Be somewhat more quiet</td></tr>
+ * <tr><td>-v, --verbose </td><td>Show full exception stack traces</td></tr>
+ * <tr><td>-l, --load-consumer </td><td>Load the consumer and exit (debug utility)</td></tr>
+ * <tr><td>-e, --extension </td><td>Enable SOAP 1.2 binding extension</td></tr>
+ * <tr><td>-a, --additionalHeaders </td><td>Enable SOAP 1.2 binding extension</td></tr>
+ * </table>
+ * </pre>
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
+ */
+public class WSConsume
+{
+ private static final ClassLoader MODULES_LOADER = SecurityActions.getModulesClassLoader();
+ private List<File> bindingFiles = new ArrayList<File>();
+ private File outputDir = new File("output");
+ private boolean generateSource;
+ private File catalog;
+ private String targetPackage;
+ private String wsdlLocation;
+ private boolean quiet;
+ private boolean verbose;
+ private boolean loadConsumer;
+ private boolean extension;
+ private boolean additionalHeaders;
+ private boolean noCompile;
+ private File sourceDir;
+ private String target;
+
+ public static final String PROGRAM_NAME = SecurityActions.getSystemProperty("program.name", WSConsume.class.getName());
+
+ public static void main(String[] args)
+ {
+ if (MODULES_LOADER != null)
+ {
+ final ClassLoader origLoader = SecurityActions.getContextClassLoader();
+ try
+ {
+ SecurityActions.setContextClassLoader(MODULES_LOADER);
+ mainInternal(args);
+ }
+ finally
+ {
+ SecurityActions.setContextClassLoader(origLoader);
+ }
+ }
+ else
+ {
+ mainInternal(args);
+ }
+ }
+
+ private static void mainInternal(final String[] args)
+ {
+ WSConsume importer = new WSConsume();
+ URL wsdl = importer.parseArguments(args);
+ System.exit(importer.importServices(wsdl));
+ }
+
+ private URL parseArguments(String[] args)
+ {
+ String shortOpts = "b:c:p:w:o:s:t:khqvlnea";
+ LongOpt[] longOpts =
+ {
+ new LongOpt("binding", LongOpt.REQUIRED_ARGUMENT, null, 'b'),
+ new LongOpt("catalog", LongOpt.REQUIRED_ARGUMENT, null, 'c'),
+ new LongOpt("package", LongOpt.REQUIRED_ARGUMENT, null, 'p'),
+ new LongOpt("wsdlLocation", LongOpt.REQUIRED_ARGUMENT, null, 'w'),
+ new LongOpt("output", LongOpt.REQUIRED_ARGUMENT, null, 'o'),
+ new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, 's'),
+ new LongOpt("target", LongOpt.REQUIRED_ARGUMENT, null, 't'),
+ new LongOpt("keep", LongOpt.NO_ARGUMENT, null, 'k'),
+ new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h'),
+ new LongOpt("quiet", LongOpt.NO_ARGUMENT, null, 'q'),
+ new LongOpt("verbose", LongOpt.NO_ARGUMENT, null, 'v'),
+ new LongOpt("nocompile", LongOpt.NO_ARGUMENT, null, 'n'),
+ new LongOpt("extension", LongOpt.NO_ARGUMENT, null, 'e'),
+ new LongOpt("additionalHeaders", LongOpt.NO_ARGUMENT, null, 'a'),
+ new LongOpt("load-consumer", LongOpt.NO_ARGUMENT, null, 'l'),
+ };
+
+ Getopt getopt = new Getopt(PROGRAM_NAME, args, shortOpts, longOpts);
+ int c;
+ while ((c = getopt.getopt()) != -1)
+ {
+ switch (c)
+ {
+ case 'b':
+ bindingFiles.add(new File(getopt.getOptarg()));
+ break;
+ case 'k':
+ generateSource = true;
+ break;
+ case 'c':
+ catalog = new File(getopt.getOptarg());
+ break;
+ case 'p':
+ targetPackage = getopt.getOptarg();
+ break;
+ case 'w':
+ wsdlLocation = getopt.getOptarg();
+ break;
+ case 'o':
+ outputDir = new File(getopt.getOptarg());
+ break;
+ case 's':
+ sourceDir = new File(getopt.getOptarg());
+ break;
+ case 't':
+ target = getopt.getOptarg();
+ break;
+ case 'q':
+ quiet = true;
+ break;
+ case 'v':
+ verbose = true;
+ break;
+ case 'l':
+ loadConsumer = true;
+ break;
+ case 'e':
+ extension = true;
+ break;
+ case 'a':
+ additionalHeaders = true;
+ break;
+ case 'n':
+ noCompile = true;
+ break;
+ case 'h':
+ printHelp();
+ System.exit(0);
+ case '?':
+ System.exit(1);
+ }
+ }
+
+ // debug output
+ if(loadConsumer)
+ {
+ WSContractConsumer importer = WSContractConsumer.newInstance();
+ System.out.println("WSContractConsumer instance: " + importer.getClass().getCanonicalName());
+ System.exit(0);
+ }
+
+ int wsdlPos = getopt.getOptind();
+ if (wsdlPos >= args.length)
+ {
+ System.err.println("Error: WSDL URL was not specified!");
+ printHelp();
+ System.exit(1);
+ }
+
+ URL url = null;
+ try
+ {
+ try
+ {
+ url = new URL(args[wsdlPos]);
+ }
+ catch (MalformedURLException e)
+ {
+ File file = new File(args[wsdlPos]);
+ url = file.toURI().toURL();
+ }
+ }
+ catch (MalformedURLException e)
+ {
+ System.err.println("Error: Invalid URI: " + args[wsdlPos]);
+ System.exit(1);
+ }
+
+ return url;
+ }
+
+
+ private int importServices(URL wsdl)
+ {
+ WSContractConsumer consumer = WSContractConsumer.newInstance();
+
+ consumer.setGenerateSource(generateSource);
+ consumer.setOutputDirectory(outputDir);
+ consumer.setExtension(extension);
+ consumer.setAdditionalHeaders(additionalHeaders);
+ if (sourceDir != null)
+ consumer.setSourceDirectory(sourceDir);
+
+ if (! quiet)
+ {
+ PrintStream ps;
+ if (Log4JUtil.isLog4jConfigurationAvailable())
+ {
+ ps = new PrintStream(new Log4jOutputStream(Logger.getLogger("WSConsume"), Level.INFO));
+ }
+ else
+ {
+ ps = System.out;
+ ps.println("Could not find log4j.xml configuration, logging to console.\n");
+ }
+ consumer.setMessageStream(ps);
+ }
+
+ if (catalog != null)
+ {
+ if (catalog.exists() && catalog.isFile())
+ {
+ consumer.setCatalog(catalog);
+ }
+ else
+ {
+ System.err.println("Warning: catalog file not found: " + catalog);
+ }
+ }
+
+ if (targetPackage != null)
+ consumer.setTargetPackage(targetPackage);
+
+ if (wsdlLocation != null)
+ consumer.setWsdlLocation(wsdlLocation);
+
+ if (bindingFiles != null && bindingFiles.size() > 0)
+ consumer.setBindingFiles(bindingFiles);
+
+ if(target!=null)
+ consumer.setTarget(target);
+
+ if (noCompile)
+ consumer.setNoCompile(noCompile);
+
+ try
+ {
+ consumer.consume(wsdl);
+ return 0;
+ }
+ catch (Throwable t)
+ {
+ System.err.println("Error: Could not import. (use --verbose to see full traces)");
+ if (!verbose)
+ {
+ String message = t.getMessage();
+ if (message == null)
+ message = t.getClass().getSimpleName();
+ System.err.println("Error: " + message);
+ }
+ else
+ {
+ t.printStackTrace(System.err);
+ }
+
+ }
+
+ return 1;
+ }
+
+ private static void printHelp()
+ {
+ PrintStream out = System.out;
+ out.println("WSConsumeTask is a cmd line tool that generates portable JAX-WS artifacts from a WSDL file.\n");
+ out.println("usage: " + PROGRAM_NAME + " [options] <wsdl-url>\n");
+ out.println("options: ");
+ out.println(" -h, --help Show this help message");
+ out.println(" -b, --binding=<file> One or more JAX-WS or JAXB binding files ");
+ out.println(" -k, --keep Keep/Generate Java source");
+ out.println(" -c --catalog=<file> Oasis XML Catalog file for entity resolution");
+ out.println(" -p --package=<name> The target package for generated source");
+ out.println(" -w --wsdlLocation=<loc> Value to use for @WebService.wsdlLocation");
+ out.println(" -o, --output=<directory> The directory to put generated artifacts");
+ out.println(" -s, --source=<directory> The directory to put Java source");
+ out.println(" -t, --target=<2.0|2.1|2.2> The JAX-WS specification target");
+ out.println(" -q, --quiet Be somewhat more quiet");
+ out.println(" -v, --verbose Show full exception stack traces");
+ out.println(" -l, --load-consumer Load the consumer and exit (debug utility)");
+ out.println(" -e, --extension Enable SOAP 1.2 binding extension");
+ out.println(" -a, --additionalHeaders Enable processing of implicit SOAP headers");
+ out.println(" -n, --nocompile Do not compile generated sources");
+ out.flush();
+ }
+}
Added: common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/cmd/WSProvide.java
===================================================================
--- common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/cmd/WSProvide.java (rev 0)
+++ common-tools/trunk/src/main/java/org/jboss/wsf/spi/tools/cmd/WSProvide.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,269 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.spi.tools.cmd;
+
+import gnu.getopt.Getopt;
+import gnu.getopt.LongOpt;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+
+import org.jboss.wsf.spi.tools.WSContractProvider;
+import org.jboss.wsf.spi.util.Log4JUtil;
+import org.jboss.wsf.spi.util.Log4jOutputStream;
+
+/**
+ * WSProvideTask is a cmd line tool that generates portable JAX-WS artifacts
+ * for a service endpoint implementation.
+ *
+ * <pre>
+ * usage: WSProvideTask [options] <endpoint class name>
+ * options:
+ * <table>
+ * <tr><td>-h, --help </td><td>Show this help message</td></tr>
+ * <tr><td>-k, --keep </td><td>Keep/Generate Java source</td></tr>
+ * <tr><td>-w, --wsdl </td><td>Enable WSDL file generation</td></tr>
+ * <tr><td>-c, --classpath=<path< </td><td>The classpath that contains the endpoint</td></tr>
+ * <tr><td>-o, --output=<directory> </td><td>The directory to put generated artifacts</td></tr>
+ * <tr><td>-r, --resource=<directory></td><td>The directory to put resource artifacts</td></tr>
+ * <tr><td>-s, --source=<directory> </td><td>The directory to put Java source</td></tr>
+ * <tr><td>-q, --quiet </td><td>Be somewhat more quiet</td></tr>
+ * <tr><td>-t, --show-traces </td><td>Show full exception stack traces</td></tr>
+ * <tr><td>-l, --load-provider </td><td>Load the provider and exit (debug utility)</td></tr>
+ * <tr><td>-e, --extension </td><td>Enable SOAP 1.2 binding extension</td></tr>
+ * </pre>
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
+ */
+public class WSProvide
+{
+ private static final ClassLoader MODULES_LOADER = SecurityActions.getModulesClassLoader();
+ private ClassLoader loader = MODULES_LOADER != null ? MODULES_LOADER : SecurityActions.getContextClassLoader();
+ private File outputDir = new File("output");
+ private boolean generateSource;
+ private boolean generateWsdl;
+ private boolean extension;
+ private boolean quiet;
+ private boolean showTraces;
+ private boolean loadProvider;
+ private File resourceDir;
+ private File sourceDir;
+
+ public static final String PROGRAM_NAME = SecurityActions.getSystemProperty("program.name", WSProvide.class.getSimpleName());
+
+ public static void main(String[] args)
+ {
+ WSProvide generate = new WSProvide();
+ String endpoint = generate.parseArguments(args);
+ System.exit(generate.generate(endpoint));
+ }
+
+ private String parseArguments(String[] args)
+ {
+ String shortOpts = "hwko:r:s:c:qtle";
+ LongOpt[] longOpts =
+ {
+ new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h'),
+ new LongOpt("wsdl", LongOpt.NO_ARGUMENT, null, 'w'),
+ new LongOpt("keep", LongOpt.NO_ARGUMENT, null, 'k'),
+ new LongOpt("output", LongOpt.REQUIRED_ARGUMENT, null, 'o'),
+ new LongOpt("resource", LongOpt.REQUIRED_ARGUMENT, null, 'r'),
+ new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, 's'),
+ new LongOpt("classpath", LongOpt.REQUIRED_ARGUMENT, null, 'c'),
+ new LongOpt("quiet", LongOpt.NO_ARGUMENT, null, 'q'),
+ new LongOpt("show-traces", LongOpt.NO_ARGUMENT, null, 't'),
+ new LongOpt("load-provider", LongOpt.NO_ARGUMENT, null, 'l'),
+ new LongOpt("extension", LongOpt.NO_ARGUMENT, null, 'e'),
+ };
+
+ Getopt getopt = new Getopt(PROGRAM_NAME, args, shortOpts, longOpts);
+ int c;
+ while ((c = getopt.getopt()) != -1)
+ {
+ switch (c)
+ {
+ case 'k':
+ generateSource = true;
+ break;
+ case 's':
+ sourceDir = new File(getopt.getOptarg());
+ break;
+ case 'r':
+ resourceDir = new File(getopt.getOptarg());
+ break;
+ case 'w':
+ generateWsdl = true;
+ break;
+ case 't':
+ showTraces = true;
+ break;
+ case 'o':
+ outputDir = new File(getopt.getOptarg());
+ break;
+ case 'q':
+ quiet = true;
+ break;
+ case 'c':
+ processClassPath(getopt.getOptarg());
+ break;
+ case 'l':
+ loadProvider = true;
+ break;
+ case 'e':
+ extension = true;
+ break;
+ case 'h':
+ printHelp();
+ System.exit(0);
+ case '?':
+ System.exit(1);
+ }
+ }
+
+ // debug output
+ if(loadProvider)
+ {
+ WSContractProvider gen = WSContractProvider.newInstance(loader);
+ System.out.println("WSContractProvider instance: " + gen.getClass().getCanonicalName());
+ System.exit(0);
+ }
+
+ int endpointPos = getopt.getOptind();
+ if (endpointPos >= args.length)
+ {
+ System.err.println("Error: endpoint implementation was not specified!");
+ printHelp();
+ System.exit(1);
+ }
+
+ return args[endpointPos];
+ }
+
+
+ private int generate(String endpoint)
+ {
+ try
+ {
+ SecurityActions.loadClass(loader, endpoint);
+ }
+ catch (Exception e)
+ {
+ System.err.println("Error: Could not load class [" + endpoint + "]. Did you specify a valid --classpath?");
+ return 1;
+ }
+
+ WSContractProvider gen = WSContractProvider.newInstance(loader);
+ gen.setGenerateWsdl(generateWsdl);
+ gen.setGenerateSource(generateSource);
+ gen.setOutputDirectory(outputDir);
+ gen.setExtension(extension);
+ if (resourceDir != null)
+ gen.setResourceDirectory(resourceDir);
+ if (sourceDir != null)
+ gen.setSourceDirectory(sourceDir);
+
+ if (! quiet)
+ {
+ PrintStream ps;
+ if (Log4JUtil.isLog4jConfigurationAvailable())
+ {
+ ps = new PrintStream(new Log4jOutputStream(Logger.getLogger("WSProvide"), Level.INFO));
+ }
+ else
+ {
+ ps = System.out;
+ ps.println("Could not find log4j.xml configuration, logging to console.\n");
+ }
+ gen.setMessageStream(ps);
+ }
+
+ try
+ {
+ gen.provide(endpoint);
+ return 0;
+ }
+ catch (Throwable t)
+ {
+ System.err.println("Error: Could not generate. (use --show-traces to see full traces)");
+ if (!showTraces)
+ {
+ String message = t.getMessage();
+ if (message == null)
+ message = t.getClass().getSimpleName();
+ System.err.println("Error: " + message);
+ }
+ else
+ {
+ t.printStackTrace(System.err);
+ }
+
+ }
+
+ return 1;
+ }
+
+ private void processClassPath(String classPath)
+ {
+ String[] entries = classPath.split(File.pathSeparator);
+ List<URL> urls= new ArrayList<URL>(entries.length);
+ for (String entry : entries)
+ {
+ try
+ {
+ urls.add(new File(entry).toURI().toURL());
+ }
+ catch (MalformedURLException e)
+ {
+ System.err.println("Error: a classpath entry was malformed: " + entry);
+ }
+ }
+ loader = new URLClassLoader(urls.toArray(new URL[0]), loader);
+ }
+
+ private static void printHelp()
+ {
+ PrintStream out = System.out;
+ out.println("WSProvideTask generates portable JAX-WS artifacts for an endpoint implementation.\n");
+ out.println("usage: " + PROGRAM_NAME + " [options] <endpoint class name>\n");
+ out.println("options: ");
+ out.println(" -h, --help Show this help message");
+ out.println(" -k, --keep Keep/Generate Java source");
+ out.println(" -w, --wsdl Enable WSDL file generation");
+ out.println(" -c, --classpath=<path> The classpath that contains the endpoint");
+ out.println(" -o, --output=<directory> The directory to put generated artifacts");
+ out.println(" -r, --resource=<directory> The directory to put resource artifacts");
+ out.println(" -s, --source=<directory> The directory to put Java source");
+ out.println(" -e, --extension Enable SOAP 1.2 binding extension");
+ out.println(" -q, --quiet Be somewhat more quiet");
+ out.println(" -t, --show-traces Show full exception stack traces");
+ out.println(" -l, --load-provider Load the provider and exit (debug utility)");
+ out.flush();
+ }
+}
Added: common-tools/trunk/src/main/java/org/jboss/wsf/spi/util/Log4JUtil.java
===================================================================
--- common-tools/trunk/src/main/java/org/jboss/wsf/spi/util/Log4JUtil.java (rev 0)
+++ common-tools/trunk/src/main/java/org/jboss/wsf/spi/util/Log4JUtil.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.spi.util;
+
+import java.net.URL;
+
+import org.apache.log4j.helpers.Loader;
+
+/**
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 10-Jun-2010
+ *
+ */
+public class Log4JUtil
+{
+ public static final String LOG4J_CONFIGURATION = "log4j.configuration";
+ public static final String LOG4J_PROPERTIES = "log4j.properties";
+
+ /**
+ * Returns true if a log4j configuration can be found given the current environment.
+ * See http://logging.apache.org/log4j/1.2/manual.html (Default Initialization Procedure)
+ * @return
+ */
+ public static boolean isLog4jConfigurationAvailable()
+ {
+ String log4jConfiguration = System.getProperty(LOG4J_CONFIGURATION);
+ String resource = log4jConfiguration != null ? log4jConfiguration : LOG4J_PROPERTIES;
+ URL url = null;
+ try
+ {
+ url = new URL(resource);
+ }
+ catch (Exception e1)
+ {
+ try
+ {
+ url = Loader.getResource(resource);
+ }
+ catch (Exception e2)
+ {
+ //ignore
+ }
+ }
+ return url != null;
+ }
+}
Added: common-tools/trunk/src/main/java/org/jboss/wsf/spi/util/Log4jOutputStream.java
===================================================================
--- common-tools/trunk/src/main/java/org/jboss/wsf/spi/util/Log4jOutputStream.java (rev 0)
+++ common-tools/trunk/src/main/java/org/jboss/wsf/spi/util/Log4jOutputStream.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,220 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.spi.util;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import org.apache.log4j.Category;
+import org.apache.log4j.Priority;
+
+/**
+ * An OutputStream that flushes out to a Category.<p>
+ * A simple port of <a href="mailto://Jim.Moore@rocketmail.com">Jim Moore</a>'s
+ * LoggingOutputStream contribution to log4j.
+ *
+ * Note that no data is written out to the Category until the stream is
+ * flushed or closed.<p>
+ *
+ * Example:<pre>
+ * // make sure everything sent to System.err is logged
+ * System.setErr(new PrintStream(new LoggingOutputStream(Category.getRoot(), Priority.WARN), true));
+ *
+ * // make sure everything sent to System.out is also logged
+ * System.setOut(new PrintStream(new LoggingOutputStream(Category.getRoot(), Priority.INFO), true));
+ * </pre>
+ *
+ */
+public class Log4jOutputStream extends OutputStream
+{
+ protected static final String LINE_SEPERATOR = System.getProperty("line.separator");
+
+ /**
+ * Used to maintain the contract of {@link #close()}.
+ */
+ protected boolean hasBeenClosed = false;
+
+ /**
+ * The internal buffer where data is stored.
+ */
+ protected byte[] buf;
+
+ /**
+ * The number of valid bytes in the buffer. This value is always
+ * in the range <tt>0</tt> through <tt>buf.length</tt>; elements
+ * <tt>buf[0]</tt> through <tt>buf[count-1]</tt> contain valid
+ * byte data.
+ */
+ protected int count;
+
+ /**
+ * Remembers the size of the buffer for speed.
+ */
+ private int bufLength;
+
+ /**
+ * The default number of bytes in the buffer. =2048
+ */
+ public static final int DEFAULT_BUFFER_LENGTH = 2048;
+
+ /**
+ * The category to write to.
+ */
+ protected Category category;
+
+ /**
+ * The priority to use when writing to the Category.
+ */
+ protected Priority priority;
+
+ @SuppressWarnings("unused")
+ private Log4jOutputStream()
+ {
+ // illegal
+ }
+
+ /**
+ * Creates the LoggingOutputStream to flush to the given Category.
+ *
+ * @param cat the Category to write to
+ *
+ * @param priority the Priority to use when writing to the Category
+ *
+ * @exception IllegalArgumentException
+ * if cat == null or priority == null
+ */
+ public Log4jOutputStream(Category cat, Priority priority) throws IllegalArgumentException
+ {
+ if (cat == null)
+ {
+ throw new IllegalArgumentException("cat == null");
+ }
+ if (priority == null)
+ {
+ throw new IllegalArgumentException("priority == null");
+ }
+
+ this.priority = priority;
+ category = cat;
+ bufLength = DEFAULT_BUFFER_LENGTH;
+ buf = new byte[DEFAULT_BUFFER_LENGTH];
+ count = 0;
+ }
+
+ /**
+ * Closes this output stream and releases any system resources
+ * associated with this stream. The general contract of <code>close</code>
+ * is that it closes the output stream. A closed stream cannot perform
+ * output operations and cannot be reopened.
+ */
+ public void close()
+ {
+ flush();
+ hasBeenClosed = true;
+ }
+
+ /**
+ * Writes the specified byte to this output stream. The general
+ * contract for <code>write</code> is that one byte is written
+ * to the output stream. The byte to be written is the eight
+ * low-order bits of the argument <code>b</code>. The 24
+ * high-order bits of <code>b</code> are ignored.
+ *
+ * @param b the <code>byte</code> to write
+ *
+ * @exception IOException
+ * if an I/O error occurs. In particular,
+ * an <code>IOException</code> may be thrown if the
+ * output stream has been closed.
+ */
+ public void write(final int b) throws IOException
+ {
+ if (hasBeenClosed)
+ {
+ throw new IOException("The stream has been closed.");
+ }
+
+ // don't log nulls
+ if (b == 0)
+ {
+ return;
+ }
+
+ // would this be writing past the buffer?
+ if (count == bufLength)
+ {
+ // grow the buffer
+ final int newBufLength = bufLength + DEFAULT_BUFFER_LENGTH;
+ final byte[] newBuf = new byte[newBufLength];
+
+ System.arraycopy(buf, 0, newBuf, 0, bufLength);
+
+ buf = newBuf;
+ bufLength = newBufLength;
+ }
+
+ buf[count] = (byte)b;
+ count++;
+ }
+
+ /**
+ * Flushes this output stream and forces any buffered output bytes
+ * to be written out. The general contract of <code>flush</code> is
+ * that calling it is an indication that, if any bytes previously
+ * written have been buffered by the implementation of the output
+ * stream, such bytes should immediately be written to their
+ * intended destination.
+ */
+ public void flush()
+ {
+ if (count == 0)
+ {
+ return;
+ }
+
+ // don't print out blank lines; flushing from PrintStream puts out these
+ if (count == LINE_SEPERATOR.length())
+ {
+ if (((char)buf[0]) == LINE_SEPERATOR.charAt(0) && ((count == 1) || // <- Unix & Mac, -> Windows
+ ((count == 2) && ((char)buf[1]) == LINE_SEPERATOR.charAt(1))))
+ {
+ reset();
+ return;
+ }
+ }
+
+ final byte[] theBytes = new byte[count];
+
+ System.arraycopy(buf, 0, theBytes, 0, count);
+
+ category.log(priority, new String(theBytes));
+
+ reset();
+ }
+
+ private void reset()
+ {
+ // not resetting the buffer -- assuming that if it grew that it
+ // will likely grow similarly again
+ count = 0;
+ }
+
+}
Added: common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/AntConsumeTestCase.java
===================================================================
--- common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/AntConsumeTestCase.java (rev 0)
+++ common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/AntConsumeTestCase.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.wsf.spi.tools;
+
+/**
+ * Test the WSConsumeTask.
+ * This test needs to be executed in 'SPI_HOME/output/tests',
+ * because it works with relative paths.
+ *
+ * @author Heiko.Braun(a)jboss.com
+ */
+public class AntConsumeTestCase extends BuildFileTest
+{
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ // cleanup events
+ CmdConsumeTracker.LAST_EVENT = "";
+
+ // enforce loading of the tracker implemenation
+ System.setProperty("org.jboss.wsf.spi.tools.ConsumerFactoryImpl", "org.jboss.test.wsf.spi.tools.CmdConsumeTrackerFactory");
+
+ configureProject("src/test/resources/smoke/tools/consume-test.xml");
+ }
+
+ public void testPlainInvocation()
+ {
+ executeTarget("plainInvocation");
+ assertTrue("consume() not invoked", CmdConsumeTracker.LAST_EVENT.indexOf("consume") != -1);
+ }
+
+}
Added: common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/AntProvideTestCase.java
===================================================================
--- common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/AntProvideTestCase.java (rev 0)
+++ common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/AntProvideTestCase.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.wsf.spi.tools;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ */
+public class AntProvideTestCase extends BuildFileTest
+{
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ // cleanup events
+ CmdProvideTracker.LAST_EVENT = "";
+
+ // enforce loading of the tracker implemenation
+ System.setProperty("org.jboss.wsf.spi.tools.ProviderFactoryImpl", "org.jboss.test.wsf.spi.tools.CmdProvideTrackerFactory");
+
+ configureProject("src/test/resources/smoke/tools/provide-test.xml");
+ }
+
+ public void testPlainInvocation()
+ {
+ executeTarget("plainInvocation");
+ assertTrue("provide() not invoked", CmdProvideTracker.LAST_EVENT.indexOf("provide") != -1);
+ }
+
+ public void testIncludeWSDL()
+ {
+ executeTarget("includeWSDL");
+ assertTrue("setGenerateWsdl() not invoked", CmdProvideTracker.LAST_EVENT.indexOf("setGenerateWsdl") != -1);
+ }
+
+ public void testExtraClasspath()
+ {
+ executeTarget("extraClasspath");
+
+ }
+
+}
Added: common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/BuildFileTest.java
===================================================================
--- common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/BuildFileTest.java (rev 0)
+++ common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/BuildFileTest.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,543 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jboss.test.wsf.spi.tools;
+
+import junit.framework.TestCase;
+import org.apache.tools.ant.BuildEvent;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildListener;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.ProjectHelper;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.net.URL;
+
+/**
+ * A BuildFileTest is a TestCase which executes targets from an Ant buildfile
+ * for testing.
+ *
+ * This class provides a number of utility methods for particular build file
+ * tests which extend this class.
+ *
+ * @author Apache Ant contributors
+ */
+public abstract class BuildFileTest extends TestCase {
+
+ protected Project project;
+
+ private StringBuffer logBuffer;
+ private StringBuffer fullLogBuffer;
+ private StringBuffer outBuffer;
+ private StringBuffer errBuffer;
+ private BuildException buildException;
+
+ /**
+ * Default constructor for the BuildFileTest object.
+ */
+ public BuildFileTest() {
+ super();
+ }
+
+ /**
+ * Constructor for the BuildFileTest object.
+ *
+ * @param name string to pass up to TestCase constructor
+ */
+ public BuildFileTest(String name) {
+ super(name);
+ }
+
+ /**
+ * Automatically calls the target called "tearDown"
+ * from the build file tested if it exits.
+ *
+ * This allows to use Ant tasks directly in the build file
+ * to clean up after each test. Note that no "setUp" target
+ * is automatically called, since it's trivial to have a
+ * test target depend on it.
+ */
+ protected void tearDown() throws Exception {
+ if (project == null) {
+ /*
+ * Maybe the BuildFileTest was subclassed and there is
+ * no initialized project. So we could avoid getting a
+ * NPE.
+ * If there is an initialized project getTargets() does
+ * not return null as it is initialized by an empty
+ * HashSet.
+ */
+ return;
+ }
+ final String tearDown = "tearDown";
+ if (project.getTargets().containsKey(tearDown)) {
+ project.executeTarget(tearDown);
+ }
+ }
+
+ /**
+ * run a target, expect for any build exception
+ *
+ * @param target target to run
+ * @param cause information string to reader of report
+ */
+ public void expectBuildException(String target, String cause) {
+ expectSpecificBuildException(target, cause, null);
+ }
+
+ /**
+ * Assert that only the given message has been logged with a
+ * priority <= INFO when running the given target.
+ */
+ public void expectLog(String target, String log) {
+ executeTarget(target);
+ String realLog = getLog();
+ assertEquals(log, realLog);
+ }
+
+ /**
+ * Assert that the given substring is in the log messages.
+ */
+ public void assertLogContaining(String substring) {
+ String realLog = getLog();
+ assertTrue("expecting log to contain \"" + substring + "\" log was \""
+ + realLog + "\"",
+ realLog.indexOf(substring) >= 0);
+ }
+
+ /**
+ * Assert that the given substring is in the output messages.
+ * @since Ant1.7
+ */
+ public void assertOutputContaining(String substring) {
+ String realOutput = getOutput();
+ assertTrue("expecting output to contain \"" + substring
+ + "\" output was \"" + realOutput + "\"",
+ realOutput.indexOf(substring) >= 0);
+ }
+
+ /**
+ * Assert that the given message has been logged with a priority
+ * <= INFO when running the given target.
+ */
+ public void expectLogContaining(String target, String log) {
+ executeTarget(target);
+ assertLogContaining(log);
+ }
+
+ /**
+ * Gets the log the BuildFileTest object.
+ * Only valid if configureProject() has been called.
+ *
+ * @pre logBuffer!=null
+ * @return The log value
+ */
+ public String getLog() {
+ return logBuffer.toString();
+ }
+
+ /**
+ * Assert that the given message has been logged with a priority
+ * >= VERBOSE when running the given target.
+ */
+ public void expectDebuglog(String target, String log) {
+ executeTarget(target);
+ String realLog = getFullLog();
+ assertEquals(log, realLog);
+ }
+
+ /**
+ * Assert that the given substring is in the log messages.
+ */
+ public void assertDebuglogContaining(String substring) {
+ String realLog = getFullLog();
+ assertTrue("expecting debug log to contain \"" + substring
+ + "\" log was \""
+ + realLog + "\"",
+ realLog.indexOf(substring) >= 0);
+ }
+
+ /**
+ * Gets the log the BuildFileTest object.
+ *
+ * Only valid if configureProject() has been called.
+ *
+ * @pre fullLogBuffer!=null
+ * @return The log value
+ */
+ public String getFullLog() {
+ return fullLogBuffer.toString();
+ }
+
+ /**
+ * execute the target, verify output matches expectations
+ *
+ * @param target target to execute
+ * @param output output to look for
+ */
+ public void expectOutput(String target, String output) {
+ executeTarget(target);
+ String realOutput = getOutput();
+ assertEquals(output, realOutput.trim());
+ }
+
+ /**
+ * Executes the target, verify output matches expectations
+ * and that we got the named error at the end
+ *
+ * @param target target to execute
+ * @param output output to look for
+ * @param error Description of Parameter
+ */
+ public void expectOutputAndError(String target, String output, String error) {
+ executeTarget(target);
+ String realOutput = getOutput();
+ assertEquals(output, realOutput);
+ String realError = getError();
+ assertEquals(error, realError);
+ }
+
+ public String getOutput() {
+ return cleanBuffer(outBuffer);
+ }
+
+ public String getError() {
+ return cleanBuffer(errBuffer);
+ }
+
+ public BuildException getBuildException() {
+ return buildException;
+ }
+
+ private String cleanBuffer(StringBuffer buffer) {
+ StringBuffer cleanedBuffer = new StringBuffer();
+ boolean cr = false;
+ for (int i = 0; i < buffer.length(); i++) {
+ char ch = buffer.charAt(i);
+ if (ch == '\r') {
+ cr = true;
+ continue;
+ }
+
+ if (!cr) {
+ cleanedBuffer.append(ch);
+ } else {
+ cleanedBuffer.append(ch);
+ }
+ }
+ return cleanedBuffer.toString();
+ }
+
+ /**
+ * Sets up to run the named project
+ *
+ * @param filename name of project file to run
+ */
+ public void configureProject(String filename) throws BuildException {
+ configureProject(filename, Project.MSG_DEBUG);
+ }
+
+ /**
+ * Sets up to run the named project
+ *
+ * @param filename name of project file to run
+ */
+ public void configureProject(String filename, int logLevel)
+ throws BuildException {
+ logBuffer = new StringBuffer();
+ fullLogBuffer = new StringBuffer();
+ project = new Project();
+ project.init();
+ File antFile = new File(System.getProperty("root"), filename);
+ project.setUserProperty("ant.file" , antFile.getAbsolutePath());
+ project.addBuildListener(new AntTestListener(logLevel));
+ ProjectHelper.configureProject(project, antFile);
+ }
+
+ /**
+ * Executes a target we have set up
+ *
+ * @pre configureProject has been called
+ * @param targetName target to run
+ */
+ public void executeTarget(String targetName) {
+ PrintStream sysOut = System.out;
+ PrintStream sysErr = System.err;
+ try {
+ sysOut.flush();
+ sysErr.flush();
+ outBuffer = new StringBuffer();
+ PrintStream out = new PrintStream(new AntOutputStream(outBuffer));
+ System.setOut(out);
+ errBuffer = new StringBuffer();
+ PrintStream err = new PrintStream(new AntOutputStream(errBuffer));
+ System.setErr(err);
+ logBuffer = new StringBuffer();
+ fullLogBuffer = new StringBuffer();
+ buildException = null;
+ project.executeTarget(targetName);
+ } finally {
+ System.setOut(sysOut);
+ System.setErr(sysErr);
+ }
+
+ }
+
+ /**
+ * Get the project which has been configured for a test.
+ *
+ * @return the Project instance for this test.
+ */
+ public Project getProject() {
+ return project;
+ }
+
+ /**
+ * Gets the directory of the project.
+ *
+ * @return the base dir of the project
+ */
+ public File getProjectDir() {
+ return project.getBaseDir();
+ }
+
+ /**
+ * Runs a target, wait for a build exception.
+ *
+ * @param target target to run
+ * @param cause information string to reader of report
+ * @param msg the message value of the build exception we are waiting
+ * for set to null for any build exception to be valid
+ */
+ public void expectSpecificBuildException(String target, String cause, String msg) {
+ try {
+ executeTarget(target);
+ } catch (org.apache.tools.ant.BuildException ex) {
+ buildException = ex;
+ if ((null != msg) && (!ex.getMessage().equals(msg))) {
+ fail("Should throw BuildException because '" + cause
+ + "' with message '" + msg
+ + "' (actual message '" + ex.getMessage() + "' instead)");
+ }
+ return;
+ }
+ fail("Should throw BuildException because: " + cause);
+ }
+
+ /**
+ * run a target, expect an exception string
+ * containing the substring we look for (case sensitive match)
+ *
+ * @param target target to run
+ * @param cause information string to reader of report
+ * @param contains substring of the build exception to look for
+ */
+ public void expectBuildExceptionContaining(String target, String cause, String contains) {
+ try {
+ executeTarget(target);
+ } catch (org.apache.tools.ant.BuildException ex) {
+ buildException = ex;
+ if ((null != contains) && (ex.getMessage().indexOf(contains) == -1)) {
+ fail("Should throw BuildException because '" + cause + "' with message containing '" + contains + "' (actual message '" + ex.getMessage() + "' instead)");
+ }
+ return;
+ }
+ fail("Should throw BuildException because: " + cause);
+ }
+
+ /**
+ * call a target, verify property is as expected
+ *
+ * @param target build file target
+ * @param property property name
+ * @param value expected value
+ */
+ public void expectPropertySet(String target, String property, String value) {
+ executeTarget(target);
+ assertPropertyEquals(property, value);
+ }
+
+ /**
+ * assert that a property equals a value; comparison is case sensitive.
+ *
+ * @param property property name
+ * @param value expected value
+ */
+ public void assertPropertyEquals(String property, String value) {
+ String result = project.getProperty(property);
+ assertEquals("property " + property,value,result);
+ }
+
+ /**
+ * assert that a property equals "true".
+ *
+ * @param property property name
+ */
+ public void assertPropertySet(String property) {
+ assertPropertyEquals(property, "true");
+ }
+
+ /**
+ * assert that a property is null.
+ *
+ * @param property property name
+ */
+ public void assertPropertyUnset(String property) {
+ assertPropertyEquals(property, null);
+ }
+
+ /**
+ * call a target, verify named property is "true".
+ *
+ * @param target build file target
+ * @param property property name
+ */
+ public void expectPropertySet(String target, String property) {
+ expectPropertySet(target, property, "true");
+ }
+
+ /**
+ * Call a target, verify property is null.
+ *
+ * @param target build file target
+ * @param property property name
+ */
+ public void expectPropertyUnset(String target, String property) {
+ expectPropertySet(target, property, null);
+ }
+
+ /**
+ * Retrieve a resource from the caller classloader to avoid
+ * assuming a vm working directory. The resource path must be
+ * relative to the package name or absolute from the root path.
+ *
+ * @param resource the resource to retrieve its url.
+ * @throws junit.framework.AssertionFailedError if the resource is not found.
+ */
+ public URL getResource(String resource){
+ URL url = getClass().getResource(resource);
+ assertNotNull("Could not find resource :" + resource, url);
+ return url;
+ }
+
+ /**
+ * an output stream which saves stuff to our buffer.
+ */
+ private static class AntOutputStream extends java.io.OutputStream {
+ private StringBuffer buffer;
+
+ public AntOutputStream( StringBuffer buffer ) {
+ this.buffer = buffer;
+ }
+
+ public void write(int b) {
+ buffer.append((char)b);
+ }
+ }
+
+ /**
+ * Our own personal build listener.
+ */
+ private class AntTestListener implements BuildListener
+ {
+ private int logLevel;
+
+ /**
+ * Constructs a test listener which will ignore log events
+ * above the given level.
+ */
+ public AntTestListener(int logLevel) {
+ this.logLevel = logLevel;
+ }
+
+ /**
+ * Fired before any targets are started.
+ */
+ public void buildStarted(BuildEvent event) {
+ }
+
+ /**
+ * Fired after the last target has finished. This event
+ * will still be thrown if an error occurred during the build.
+ *
+ * @see BuildEvent#getException()
+ */
+ public void buildFinished(BuildEvent event) {
+ }
+
+ /**
+ * Fired when a target is started.
+ *
+ * @see BuildEvent#getTarget()
+ */
+ public void targetStarted(BuildEvent event) {
+ System.out.println("targetStarted " + event.getTarget().getName());
+ }
+
+ /**
+ * Fired when a target has finished. This event will
+ * still be thrown if an error occurred during the build.
+ *
+ * @see BuildEvent#getException()
+ */
+ public void targetFinished(BuildEvent event) {
+ System.out.println("targetFinished " + event.getTarget().getName());
+ }
+
+ /**
+ * Fired when a task is started.
+ *
+ * @see BuildEvent#getTask()
+ */
+ public void taskStarted(BuildEvent event) {
+ //System.out.println("taskStarted " + event.getTask().getTaskName());
+ }
+
+ /**
+ * Fired when a task has finished. This event will still
+ * be throw if an error occurred during the build.
+ *
+ * @see BuildEvent#getException()
+ */
+ public void taskFinished(BuildEvent event) {
+ //System.out.println("taskFinished " + event.getTask().getTaskName());
+ }
+
+ /**
+ * Fired whenever a message is logged.
+ *
+ * @see BuildEvent#getMessage()
+ * @see BuildEvent#getPriority()
+ */
+ public void messageLogged(BuildEvent event) {
+ if (event.getPriority() > logLevel) {
+ // ignore event
+ return;
+ }
+
+ if (event.getPriority() == Project.MSG_INFO ||
+ event.getPriority() == Project.MSG_WARN ||
+ event.getPriority() == Project.MSG_ERR) {
+ logBuffer.append(event.getMessage());
+ }
+ fullLogBuffer.append(event.getMessage());
+ }
+ }
+
+}
+
Added: common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CalculatorBean.java
===================================================================
--- common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CalculatorBean.java (rev 0)
+++ common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CalculatorBean.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.wsf.spi.tools;
+
+// We just need to load it, therefore we skip the JSR 181 annotations here
+public class CalculatorBean
+{
+ public int add(int a, int b)
+ {
+ return a+b;
+ }
+
+ public int subtract(int a, int b)
+ {
+ return a-b;
+ }
+}
Added: common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTestCase.java
===================================================================
--- common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTestCase.java (rev 0)
+++ common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTestCase.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.wsf.spi.tools;
+
+import org.jboss.wsf.spi.tools.cmd.WSConsume;
+
+/**
+ * Test the command line interface to WSConsume.
+ *
+ * @author Heiko.Braun(a)jboss.com
+ */
+public class CmdConsumeTestCase extends CommandlineTestBase
+{
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ // cleanup events
+ CmdConsumeTracker.LAST_EVENT = "";
+
+ // enforce loading of the tracker implemenation
+ System.setProperty(
+ "org.jboss.wsf.spi.tools.ConsumerFactoryImpl",
+ "org.jboss.test.wsf.spi.tools.CmdConsumeTrackerFactory"
+ );
+ }
+
+ public void testInvalidBindingOption() throws Exception
+ {
+ executeCmd("-b", true);
+ }
+
+ public void testValidBindingOption() throws Exception
+ {
+ executeCmd("-b binding-file.xml Service.wsdl", false);
+ assertTrue("setBindingFiles() not invoked", CmdConsumeTracker.LAST_EVENT.indexOf("setBindingFiles")!=-1);
+ }
+
+ public void testMissingOptions() throws Exception
+ {
+ executeCmd(null, true);
+ }
+
+ // TODO: add arbitrary combinations on a case by case basis
+
+
+ void runDelegate(String[] args) throws Exception
+ {
+ WSConsume.main(args);
+ }
+}
Added: common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTracker.java
===================================================================
--- common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTracker.java (rev 0)
+++ common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTracker.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.wsf.spi.tools;
+
+import org.jboss.wsf.spi.tools.WSContractConsumer;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.util.List;
+import java.net.URL;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ */
+public class CmdConsumeTracker extends WSContractConsumer
+{
+ public static String LAST_EVENT = "";
+
+ @Override
+ public void setBindingFiles(List<File> bindingFiles)
+ {
+ LAST_EVENT += "setBindingFiles";
+ }
+
+ @Override
+ public void setCatalog(File catalog)
+ {
+ LAST_EVENT += "setCatalog";
+ }
+
+ @Override
+ public void setOutputDirectory(File directory)
+ {
+ LAST_EVENT += "setOutputDirectory";
+ }
+
+ @Override
+ public void setSourceDirectory(File directory)
+ {
+ LAST_EVENT += "setSourceDirectory";
+ }
+
+ @Override
+ public void setGenerateSource(boolean generateSource)
+ {
+ LAST_EVENT += "setGenerateSource";
+ }
+
+ @Override
+ public void setTargetPackage(String targetPackage)
+ {
+ LAST_EVENT += "setTargetPackage";
+ }
+
+ @Override
+ public void setWsdlLocation(String wsdlLocation)
+ {
+ LAST_EVENT += "setWsdlLocation";
+ }
+
+ @Override
+ public void setMessageStream(PrintStream messageStream)
+ {
+ LAST_EVENT += "setMessageStream";
+ }
+
+ @Override
+ public void setAdditionalCompilerClassPath(List<String> classPath)
+ {
+ LAST_EVENT += "setAdditionalCompilerClassPath";
+ }
+
+ @Override
+ public void setAdditionalHeaders(boolean additionalHeaders)
+ {
+ LAST_EVENT += "setAdditionalHeaders";
+ }
+
+ @Override
+ public void setTarget(String target)
+ {
+ LAST_EVENT += "setTarget";
+ }
+
+ @Override
+ public void consume(URL wsdl)
+ {
+ LAST_EVENT += "consume";
+ }
+
+ @Override
+ public void setExtension(boolean extension)
+ {
+ LAST_EVENT += "setExtension";
+ }
+
+ @Override
+ public void setNoCompile(boolean nocompile)
+ {
+ LAST_EVENT += "setNoCompile";
+ }
+}
Added: common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTrackerFactory.java
===================================================================
--- common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTrackerFactory.java (rev 0)
+++ common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTrackerFactory.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.wsf.spi.tools;
+
+import org.jboss.wsf.spi.tools.WSContractConsumerFactory;
+import org.jboss.wsf.spi.tools.WSContractConsumer;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ */
+public class CmdConsumeTrackerFactory implements WSContractConsumerFactory
+{
+
+ public WSContractConsumer createConsumer()
+ {
+ return new CmdConsumeTracker();
+ }
+}
Added: common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTestCase.java
===================================================================
--- common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTestCase.java (rev 0)
+++ common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTestCase.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.wsf.spi.tools;
+
+import org.jboss.wsf.spi.tools.cmd.WSProvide;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ */
+public class CmdProvideTestCase extends CommandlineTestBase
+{
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ // clear events
+ CmdProvideTracker.LAST_EVENT = "";
+
+ // enforce loading of the tracker implemenation
+ System.setProperty(
+ "org.jboss.wsf.spi.tools.ProviderFactoryImpl",
+ "org.jboss.test.wsf.spi.tools.CmdProvideTrackerFactory"
+ );
+ }
+
+ /** <pre>
+ * usage: WSProvideTask [options] <endpoint class name>
+ * options:
+ * -h, --help Show this help message
+ * -k, --keep Keep/Generate Java source
+ * -w, --wsdl Enable WSDL file generation
+ * -c, --classpath=<path< The classpath that contains the endpoint
+ * -o, --output=<directory> The directory to put generated artifacts
+ * -r, --resource=<directory> The directory to put resource artifacts
+ * -s, --source=<directory> The directory to put Java source
+ * -q, --quiet Be somewhat more quiet
+ * -t, --show-traces Show full exception stack traces
+ * -l, --load-provider Load the provider and exit (debug utility)
+ * </pre>
+ * */
+
+ public void testMissingOptions() throws Exception
+ {
+ executeCmd(null, true);
+ }
+
+ public void testValidOutputDir() throws Exception
+ {
+ executeCmd("-o outputDir org.jboss.test.wsf.spi.tools.CalculatorBean", false);
+ assertTrue("setOutputDirectory() not invoked", CmdProvideTracker.LAST_EVENT.indexOf("setOutputDirectory")!=-1);
+ }
+
+ void runDelegate(String[] args) throws Exception
+ {
+ WSProvide.main(args);
+ }
+}
Added: common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTracker.java
===================================================================
--- common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTracker.java (rev 0)
+++ common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTracker.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.wsf.spi.tools;
+
+import org.jboss.wsf.spi.tools.WSContractProvider;
+
+import java.io.File;
+import java.io.PrintStream;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ */
+public class CmdProvideTracker extends WSContractProvider
+{
+
+ public static String LAST_EVENT = "";
+
+ public void setGenerateWsdl(boolean generateWsdl)
+ {
+ LAST_EVENT += "setGenerateWsdl";
+ }
+
+ public void setExtension(boolean extension)
+ {
+ LAST_EVENT += "setExtension";
+ }
+
+ public void setGenerateSource(boolean generateSource)
+ {
+ LAST_EVENT += "setGenerateSource";
+ }
+
+ public void setOutputDirectory(File directory)
+ {
+ LAST_EVENT += "setOutputDirectory";
+ }
+
+ public void setResourceDirectory(File directory)
+ {
+ LAST_EVENT += "setResourceDirectory";
+ }
+
+ public void setSourceDirectory(File directory)
+ {
+ LAST_EVENT += "setSourceDirectory";
+ }
+
+ public void setClassLoader(ClassLoader loader)
+ {
+ LAST_EVENT += "setClassLoader";
+ }
+
+ public void provide(String endpointClass)
+ {
+ LAST_EVENT += "provide";
+ }
+
+ public void provide(Class<?> endpointClass)
+ {
+ LAST_EVENT += "provide";
+ }
+
+ public void setMessageStream(PrintStream messageStream)
+ {
+ LAST_EVENT += "setMessageStream";
+ }
+}
Added: common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTrackerFactory.java
===================================================================
--- common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTrackerFactory.java (rev 0)
+++ common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTrackerFactory.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.wsf.spi.tools;
+
+import org.jboss.wsf.spi.tools.WSContractProviderFactory;
+import org.jboss.wsf.spi.tools.WSContractProvider;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ */
+public class CmdProvideTrackerFactory implements WSContractProviderFactory
+{
+
+ public WSContractProvider createProvider(ClassLoader loader)
+ {
+ return new CmdProvideTracker();
+ }
+}
Added: common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CommandlineTestBase.java
===================================================================
--- common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CommandlineTestBase.java (rev 0)
+++ common-tools/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CommandlineTestBase.java 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.wsf.spi.tools;
+
+import junit.framework.TestCase;
+
+import java.security.Permission;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ */
+public abstract class CommandlineTestBase extends TestCase
+{
+ SecurityManager systemDefault = System.getSecurityManager();
+ SecurityManager interceptor = new InterceptedSecurity();
+
+ protected void swapSecurityManager()
+ {
+ if(System.getSecurityManager() instanceof InterceptedSecurity)
+ System.setSecurityManager(systemDefault);
+ else
+ System.setSecurityManager(interceptor);
+ }
+
+ class InterceptedSecurity extends SecurityManager
+ {
+ private final SecurityManager parent = systemDefault;
+
+ public void checkPermission(Permission perm)
+ {
+ if (parent != null)
+ {
+ parent.checkPermission(perm);
+ }
+ }
+
+ public void checkExit(int status)
+ {
+ String msg = (status == 0) ? "Delegate did exit without errors" : "Delegate did exit with an error";
+ throw new InterceptedExit(msg, status);
+ }
+ }
+
+ static protected class InterceptedExit extends SecurityException
+ {
+ private static final long serialVersionUID = 1L;
+ private int exitCode;
+
+ public InterceptedExit(String s, int code)
+ {
+ super(s);
+ this.exitCode = code;
+ }
+
+
+ public int getExitCode()
+ {
+ return exitCode;
+ }
+ }
+
+ protected void executeCmd(String arguments, boolean expectedException) throws Exception
+ {
+ swapSecurityManager();
+
+ String[] args = arguments!=null ? arguments.split("\\s"): new String[0];
+ try
+ {
+ runDelegate(args);
+ if(expectedException)
+ fail("Did expect exception on args: " +args);
+ }
+ catch (CommandlineTestBase.InterceptedExit e)
+ {
+ boolean positivStatus = (e.getExitCode() == 0);
+ if( (expectedException && positivStatus)
+ || (!expectedException && !positivStatus) )
+ {
+ String s = expectedException ? "Did expect an exception, but " : "Did not expect an exception, but ";
+ String s2 = positivStatus ? "status was positiv" : "status was negativ";
+ throw new Exception(s+s2);
+ }
+
+ }
+ finally
+ {
+ swapSecurityManager();
+ }
+ }
+
+ // the actual tools execution
+ abstract void runDelegate(String[] args) throws Exception;
+
+}
Added: common-tools/trunk/src/test/resources/smoke/tools/consume-test.xml
===================================================================
--- common-tools/trunk/src/test/resources/smoke/tools/consume-test.xml (rev 0)
+++ common-tools/trunk/src/test/resources/smoke/tools/consume-test.xml 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <!--
+ An example build file that used to test the WSConsume Task
+ -->
+
+<project name="consume-test" basedir=".">
+
+ <property name="spi.dir" value="@SPI_DIR@"/>
+
+ <!-- Define the JAX-WS wsconsume task -->
+ <taskdef name="wsconsume" classname="org.jboss.wsf.spi.tools.ant.WSConsumeTask">
+ <classpath>
+ <pathelement location="${spi.dir}/output/lib/jbossws-spi.jar"/>
+ </classpath>
+ </taskdef>
+
+ <target name="plainInvocation">
+ <wsconsume wsdl="Service.wsdl" verbose="true"/>
+ </target>
+
+</project>
\ No newline at end of file
Added: common-tools/trunk/src/test/resources/smoke/tools/provide-test.xml
===================================================================
--- common-tools/trunk/src/test/resources/smoke/tools/provide-test.xml (rev 0)
+++ common-tools/trunk/src/test/resources/smoke/tools/provide-test.xml 2011-04-18 11:09:04 UTC (rev 14137)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ An example build file that used to test the WSConsume Task
+-->
+
+<project name="provide-test" basedir=".">
+
+ <property name="spi.dir" value="@SPI_DIR@"/>
+
+ <!-- Define the JAX-WS wsconsume task -->
+ <taskdef name="wsprovide" classname="org.jboss.wsf.spi.tools.ant.WSProvideTask">
+ <classpath>
+ <pathelement location="${spi.dir}/output/lib/jbossws-spi.jar"/>
+ </classpath>
+ </taskdef>
+
+ <target name="plainInvocation">
+ <wsprovide genwsdl="false" sei="org.jboss.test.wsf.spi.smoke.tools.CalculatorBean"/>
+ </target>
+
+ <target name="includeWSDL">
+ <wsprovide genwsdl="true" sei="org.jboss.test.wsf.spi.smoke.tools.CalculatorBean"/>
+ </target>
+
+ <target name="extraClasspath">
+ <wsprovide genwsdl="false" sei="org.jboss.test.wsf.spi.smoke.tools.CalculatorBean">
+ <classpath>
+ <pathelement location="${spi.dir}/output/test/classes"/>
+ </classpath>
+ </wsprovide>
+ </target>
+</project>
\ No newline at end of file
12 years, 1 month
JBossWS SVN: r14136 - common-tools and 25 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2011-04-18 07:04:20 -0400 (Mon, 18 Apr 2011)
New Revision: 14136
Added:
common-tools/
common-tools/pom.xml
common-tools/src/
common-tools/src/main/
common-tools/src/main/java/
common-tools/src/main/java/org/
common-tools/src/main/java/org/jboss/
common-tools/src/main/java/org/jboss/ws/
common-tools/src/main/java/org/jboss/ws/tools/
common-tools/src/main/java/org/jboss/ws/tools/ant/
common-tools/src/main/java/org/jboss/ws/tools/ant/EclipseClasspathTask.java
common-tools/src/main/java/org/jboss/ws/tools/ant/EclipseJUnitTestsTask.java
common-tools/src/main/java/org/jboss/ws/tools/ant/EclipseProjectTask.java
common-tools/src/main/java/org/jboss/ws/tools/ant/FixPathTask.java
common-tools/src/main/java/org/jboss/ws/tools/ant/InstallModulesTask.java
common-tools/src/main/java/org/jboss/ws/tools/ant/PathWriterTask.java
common-tools/src/main/java/org/jboss/wsf/
common-tools/src/main/java/org/jboss/wsf/spi/
common-tools/src/main/java/org/jboss/wsf/spi/tools/
common-tools/src/main/java/org/jboss/wsf/spi/tools/ant/
common-tools/src/main/java/org/jboss/wsf/spi/tools/ant/AntTaskHelper.java
common-tools/src/main/java/org/jboss/wsf/spi/tools/ant/SecurityActions.java
common-tools/src/main/java/org/jboss/wsf/spi/tools/ant/WSConsumeTask.java
common-tools/src/main/java/org/jboss/wsf/spi/tools/ant/WSProvideTask.java
common-tools/src/main/java/org/jboss/wsf/spi/tools/cmd/
common-tools/src/main/java/org/jboss/wsf/spi/tools/cmd/SecurityActions.java
common-tools/src/main/java/org/jboss/wsf/spi/tools/cmd/WSConsume.java
common-tools/src/main/java/org/jboss/wsf/spi/tools/cmd/WSProvide.java
common-tools/src/main/java/org/jboss/wsf/spi/util/
common-tools/src/main/java/org/jboss/wsf/spi/util/Log4JUtil.java
common-tools/src/main/java/org/jboss/wsf/spi/util/Log4jOutputStream.java
common-tools/src/test/
common-tools/src/test/java/
common-tools/src/test/java/org/
common-tools/src/test/java/org/jboss/
common-tools/src/test/java/org/jboss/test/
common-tools/src/test/java/org/jboss/test/wsf/
common-tools/src/test/java/org/jboss/test/wsf/spi/
common-tools/src/test/java/org/jboss/test/wsf/spi/tools/
common-tools/src/test/java/org/jboss/test/wsf/spi/tools/AntConsumeTestCase.java
common-tools/src/test/java/org/jboss/test/wsf/spi/tools/AntProvideTestCase.java
common-tools/src/test/java/org/jboss/test/wsf/spi/tools/BuildFileTest.java
common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CalculatorBean.java
common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTestCase.java
common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTracker.java
common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTrackerFactory.java
common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTestCase.java
common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTracker.java
common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTrackerFactory.java
common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CommandlineTestBase.java
common-tools/src/test/resources/
common-tools/src/test/resources/smoke/
common-tools/src/test/resources/smoke/tools/
common-tools/src/test/resources/smoke/tools/consume-test.xml
common-tools/src/test/resources/smoke/tools/provide-test.xml
Log:
[JBWS-3273] introducing new SVN module for JBossWS ANT & CMD line tools - jbossws-tools
Added: common-tools/pom.xml
===================================================================
--- common-tools/pom.xml (rev 0)
+++ common-tools/pom.xml 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>JBoss Web Services - Tools Integration</name>
+ <groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-common-tools</artifactId>
+ <packaging>jar</packaging>
+ <description>JBossWS Common Tools</description>
+
+ <version>1.0.0-SNAPSHOT</version>
+
+ <parent>
+ <groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-parent</artifactId>
+ <version>1.0.10-SNAPSHOT</version>
+ </parent>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossws/tools/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossws/tools/trunk</developerConnection>
+ <url>http://fisheye.jboss.com/viewrep/JBossWS/tools/trunk</url>
+ </scm>
+
+ <properties>
+ <jbossws.spi.version>2.0.0-SNAPSHOT</jbossws.spi.version>
+ <ant.version>1.7.1</ant.version>
+ <getopt.version>1.0.13</getopt.version>
+ <junit.version>3.8.2</junit.version>
+ <log4j.version>1.2.14</log4j.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>${ant.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-spi</artifactId>
+ <version>${jbossws.spi.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>gnu-getopt</groupId>
+ <artifactId>getopt</artifactId>
+ <version>${getopt.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4j.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Added: common-tools/src/main/java/org/jboss/ws/tools/ant/EclipseClasspathTask.java
===================================================================
--- common-tools/src/main/java/org/jboss/ws/tools/ant/EclipseClasspathTask.java (rev 0)
+++ common-tools/src/main/java/org/jboss/ws/tools/ant/EclipseClasspathTask.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,184 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.tools.ant;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.Path;
+
+/**
+ * An Ant task creating a simple Eclipse .classpath file using the provided
+ * Ant's path id.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 15-Feb-2008
+ */
+public class EclipseClasspathTask extends Task
+{
+ private String pathId;
+ private String excludesFile;
+ private String outputFile;
+ private String srcPath;
+ private String srcOutput;
+
+ @Override
+ public void execute() throws BuildException
+ {
+ Project project = getProject();
+ Path path = (Path)project.getReference(pathId);
+ String[] pathElements = path.list();
+ try
+ {
+ List<String> excludes = getExcludes();
+ StringBuffer sb = new StringBuffer();
+ generateContent(sb, excludes, pathElements);
+ File file = outputFile != null ? new File(outputFile) : new File(getProject().getBaseDir(), ".classpath");
+ BufferedWriter out = new BufferedWriter(new FileWriter(file));
+ out.write(sb.toString());
+ out.close();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new BuildException(e);
+ }
+ }
+
+ private void generateContent(StringBuffer sb, List<String> excludes, String[] libs)
+ {
+ sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+ sb.append("<classpath>\n");
+ sb.append("<classpathentry ");
+ if (excludes != null && !excludes.isEmpty())
+ {
+ sb.append("excluding=\"");
+ for (Iterator<String> it = excludes.iterator(); it.hasNext();)
+ {
+ sb.append(it.next());
+ if (it.hasNext())
+ sb.append("|");
+ }
+ sb.append("\" ");
+ }
+ sb.append("kind=\"src\" ");
+ if (srcOutput != null)
+ {
+ sb.append("output=\"");
+ sb.append(srcOutput);
+ sb.append("\" ");
+ }
+ if (srcPath != null)
+ {
+ sb.append("path=\"");
+ sb.append(srcPath);
+ sb.append("\" ");
+ }
+ sb.append("/>\n");
+ sb.append("<classpathentry kind=\"con\" path=\"org.eclipse.jdt.launching.JRE_CONTAINER\"/>\n");
+ for (int i = 0; i < libs.length; i++)
+ {
+ if (new File(libs[i]).exists() && libs[i].endsWith(".jar")) //jar files only can be used as lib entry
+ {
+ sb.append("<classpathentry kind=\"lib\" path=\"");
+ sb.append(absoluteToRelativePath(libs[i]));
+ sb.append("\"/>\n");
+ }
+ }
+ sb.append("<classpathentry kind=\"output\" path=\"bin\"/>\n");
+ sb.append("</classpath>");
+ }
+
+ private List<String> getExcludes() throws IOException
+ {
+ List<String> excludes = new LinkedList<String>();
+ if (excludesFile != null)
+ {
+ BufferedReader in = null;
+ try
+ {
+ in = new BufferedReader(new FileReader(excludesFile));
+ String str;
+ while ((str = in.readLine()) != null)
+ {
+ if (str.length() > 0 && !str.startsWith("#"))
+ excludes.add(str);
+ }
+ }
+ finally
+ {
+ if (in != null)
+ in.close();
+ }
+ }
+ return excludes;
+ }
+
+ private String absoluteToRelativePath(String absolutePath)
+ {
+ String baseDir = getProject().getBaseDir().toString();
+ String result = absolutePath;
+ if (absolutePath.startsWith(baseDir))
+ {
+ result = absolutePath.substring(baseDir.length());
+ if (result.startsWith("\\") || result.startsWith("/"))
+ result = result.substring(1);
+ }
+ return result;
+ }
+
+ public void setPathId(String pathId)
+ {
+ this.pathId = pathId;
+ }
+
+ public void setExcludesFile(String excludesFile)
+ {
+ this.excludesFile = excludesFile;
+ }
+
+ public void setOutputFile(String outputFile)
+ {
+ this.outputFile = outputFile;
+ }
+
+ public void setSrcPath(String srcPath)
+ {
+ this.srcPath = srcPath;
+ }
+
+ public void setSrcOutput(String srcOutput)
+ {
+ this.srcOutput = srcOutput;
+ }
+
+}
Added: common-tools/src/main/java/org/jboss/ws/tools/ant/EclipseJUnitTestsTask.java
===================================================================
--- common-tools/src/main/java/org/jboss/ws/tools/ant/EclipseJUnitTestsTask.java (rev 0)
+++ common-tools/src/main/java/org/jboss/ws/tools/ant/EclipseJUnitTestsTask.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,266 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.tools.ant;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.FileSet;
+
+/**
+ * An Ant task creating Eclipse's launch configuration files for the JUnit tests
+ * of the test-suite.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 18-Feb-2008
+ */
+public class EclipseJUnitTestsTask extends Task
+{
+ private String projectName;
+ private String projectWorkingDir; // the Eclipse project working dir, i.e. the output dir
+ private String testResourcesDir; //the dir containing the resources files
+ private String testLibsDir; //the dir containing the libs files
+ private String srcDir; // the tests src dir
+ private String integrationTarget;
+ private String jbossHome;
+ private String endorsedDir;
+ private String namingProviderUrl;
+ private String securityPolicy;
+ private FileSet fileset;
+
+ @Override
+ public void execute() throws BuildException
+ {
+ try
+ {
+ DirectoryScanner dsc = fileset.getDirectoryScanner(getProject());
+ String[] classes = dsc.getIncludedFiles();
+ for (int i = 0; i < classes.length; i++)
+ {
+ String clazz = classes[i];
+ File file = new File(getProject().getBaseDir(), pathToClassName(clazz) + ".launch");
+ BufferedWriter out = new BufferedWriter(new FileWriter(file));
+ out.write(getSingleTestConf(clazz).toString());
+ out.close();
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new BuildException(e);
+ }
+ }
+
+ public FileSet createFileset()
+ {
+ this.fileset = new FileSet();
+ return fileset;
+ }
+
+ private static String pathToFullClassName(String path)
+ {
+ // remove ".class" and replace slashes and backslashes with a dot
+ return path.substring(0, path.length() - 6).replaceAll("\\\\", ".").replaceAll("/", ".");
+ }
+
+ private static String pathToClassName(String path)
+ {
+ String fullClassName = pathToFullClassName(path);
+ return fullClassName.substring(fullClassName.lastIndexOf(".") + 1);
+ }
+
+ private LaunchConfiguration getSingleTestConf(String clazz)
+ {
+ LaunchConfiguration conf = new LaunchConfiguration();
+ conf.addEntryToListAttribute("org.eclipse.debug.core.MAPPED_RESOURCE_PATHS", "/" + projectName + "/" + absoluteToRelativePath(srcDir) + "/"
+ + clazz.substring(0, clazz.length() - 6) + ".java");
+ conf.addEntryToListAttribute("org.eclipse.debug.core.MAPPED_RESOURCE_TYPES", "1");
+ conf.putBooleanAttribute("org.eclipse.debug.core.appendEnvironmentVariables", true);
+ conf.putBooleanAttribute("org.eclipse.jdt.junit.KEEPRUNNING_ATTR", false);
+ conf.putStringAttribute("org.eclipse.jdt.junit.CONTAINER", "");
+ conf.putStringAttribute("org.eclipse.jdt.junit.TESTNAME", "");
+ conf.putStringAttribute("org.eclipse.jdt.junit.TEST_KIND", "org.eclipse.jdt.junit.loader.junit3");
+ conf.putStringAttribute("org.eclipse.jdt.launching.MAIN_TYPE", pathToFullClassName(clazz));
+ conf.putStringAttribute("org.eclipse.jdt.launching.PROJECT_ATTR", projectName);
+ // computing the userDir; please note we get the relative path since we use the Eclipse $workspace_loc variable
+ String userDir = "${workspace_loc:" + projectName + "}/" + absoluteToRelativePath(projectWorkingDir);
+ String resourcesDir = "${workspace_loc:" + projectName + "}/" + absoluteToRelativePath(testResourcesDir);
+ String libsDir = "${workspace_loc:" + projectName + "}/" + absoluteToRelativePath(testLibsDir);
+ conf.putStringAttribute("org.eclipse.jdt.launching.VM_ARGUMENTS", getVMArguments(userDir, resourcesDir, libsDir));
+ conf.putStringAttribute("org.eclipse.jdt.launching.WORKING_DIRECTORY", userDir);
+ return conf;
+ }
+
+ private String getVMArguments(String userDir, String resourcesDir, String libsDir)
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("-Djbossws.integration.target=").append(integrationTarget);
+ sb.append(" -ea ");
+ sb.append("-Dtest.execution.dir=").append(userDir);
+ sb.append(" -Djava.endorsed.dirs=").append(endorsedDir);
+ sb.append(" ");
+ sb.append("-Djava.naming.provider.url=").append(namingProviderUrl);
+ sb.append(" -Djava.protocol.handler.pkgs=org.jboss.virtual.protocol ");
+ sb.append("-Djava.security.policy=").append(absoluteToRelativePath(securityPolicy));
+ sb.append(" -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory ");
+ sb.append("-Duser.dir=").append(userDir);
+ sb.append(" -Djboss.home=").append(jbossHome);
+ sb.append(" -Djdk.home=${env_var:JAVA_HOME}");
+ sb.append(" -Dtest.archive.directory=").append(libsDir);
+ sb.append(" -Dtest.resources.directory=").append(resourcesDir);
+ sb.append(" -Dbinary.distribution=true");
+ return sb.toString();
+ }
+
+ private String absoluteToRelativePath(String absolutePath)
+ {
+ String baseDir = getProject().getBaseDir().toString();
+ if (!absolutePath.startsWith(baseDir))
+ throw new IllegalArgumentException("The provided absolute path is outside the current basedir: " + baseDir);
+ return absolutePath.substring(baseDir.length() + 1);
+ }
+
+ public void setSrcDir(String srcDir)
+ {
+ this.srcDir = srcDir;
+ }
+
+ public void setProjectName(String projectName)
+ {
+ this.projectName = projectName;
+ }
+
+ public void setProjectWorkingDir(String projectWorkingDir)
+ {
+ this.projectWorkingDir = projectWorkingDir;
+ }
+
+ public void setIntegrationTarget(String integrationTarget)
+ {
+ this.integrationTarget = integrationTarget;
+ }
+
+ public void setJbossHome(String jbossHome)
+ {
+ this.jbossHome = jbossHome;
+ }
+
+ public void setNamingProviderUrl(String namingProviderUrl)
+ {
+ this.namingProviderUrl = namingProviderUrl;
+ }
+
+ public void setSecurityPolicy(String securityPolicy)
+ {
+ this.securityPolicy = securityPolicy;
+ }
+
+ public void setEndorsedDir(String endorsedDir)
+ {
+ this.endorsedDir = endorsedDir;
+ }
+
+ public void setTestResourcesDir(String testResourcesDir)
+ {
+ this.testResourcesDir = testResourcesDir;
+ }
+
+ public void setTestLibsDir(String testLibsDir)
+ {
+ this.testLibsDir = testLibsDir;
+ }
+
+ private class LaunchConfiguration
+ {
+ private Map<String, String> booleanAttributes = new LinkedHashMap<String, String>();
+ private Map<String, String> stringAttributes = new LinkedHashMap<String, String>();
+ private Map<String, List<String>> listAttributes = new LinkedHashMap<String, List<String>>();
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+ sb.append("<launchConfiguration type=\"org.eclipse.jdt.junit.launchconfig\">\n");
+ for (String key : listAttributes.keySet())
+ {
+ sb.append("<listAttribute key=\"").append(key).append("\">\n");
+ for (String value : listAttributes.get(key))
+ {
+ sb.append("<listEntry value=\"").append(value).append("\"/>\n");
+ }
+ sb.append("</listAttribute>\n");
+ }
+ for (String key : booleanAttributes.keySet())
+ {
+ sb.append("<booleanAttribute key=\"").append(key);
+ sb.append("\" value=\"").append(booleanAttributes.get(key)).append("\"/>\n");
+ }
+ for (String key : stringAttributes.keySet())
+ {
+ sb.append("<stringAttribute key=\"").append(key);
+ sb.append("\" value=\"").append(stringAttributes.get(key)).append("\"/>\n");
+ }
+ sb.append("</launchConfiguration>");
+ return sb.toString();
+ }
+
+ public Map<String, String> getBooleanAttributes()
+ {
+ return booleanAttributes;
+ }
+
+ public void putBooleanAttribute(String name, boolean value)
+ {
+ this.booleanAttributes.put(name, String.valueOf(value));
+ }
+
+ public Map<String, String> getStringAttributes()
+ {
+ return stringAttributes;
+ }
+
+ public void putStringAttribute(String name, String value)
+ {
+ this.stringAttributes.put(name, value);
+ }
+
+ public Map<String, List<String>> getListAttributes()
+ {
+ return listAttributes;
+ }
+
+ public void addEntryToListAttribute(String attribute, String entryValue)
+ {
+ if (!listAttributes.containsKey(attribute))
+ listAttributes.put(attribute, new LinkedList<String>());
+ listAttributes.get(attribute).add(entryValue);
+ }
+ }
+}
Added: common-tools/src/main/java/org/jboss/ws/tools/ant/EclipseProjectTask.java
===================================================================
--- common-tools/src/main/java/org/jboss/ws/tools/ant/EclipseProjectTask.java (rev 0)
+++ common-tools/src/main/java/org/jboss/ws/tools/ant/EclipseProjectTask.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.tools.ant;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+/**
+ * An Ant task creating a simple Eclipse .project file using the provided project name.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 18-Feb-2008
+ */
+public class EclipseProjectTask extends Task
+{
+ private String projectName;
+ private String outputFile;
+
+ @Override
+ public void execute() throws BuildException
+ {
+ try
+ {
+ StringBuffer sb = new StringBuffer();
+ generateContent(sb);
+ File file;
+ if (outputFile != null)
+ file = new File(outputFile);
+ else
+ file = new File(getProject().getBaseDir(), ".project");
+ BufferedWriter out = new BufferedWriter(new FileWriter(file));
+ out.write(sb.toString());
+ out.close();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new BuildException(e);
+ }
+ }
+
+ private void generateContent(StringBuffer sb)
+ {
+ sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+ sb.append("<projectDescription>\n <name>");
+ sb.append(projectName);
+ sb.append("</name>\n" +
+ " <comment></comment>\n" +
+ " <projects>\n" +
+ " </projects>\n" +
+ " <buildSpec>\n" +
+ " <buildCommand>\n" +
+ " <name>org.eclipse.jdt.core.javabuilder</name>\n" +
+ " <arguments>\n" +
+ " </arguments>\n" +
+ " </buildCommand>\n" +
+ " </buildSpec>\n" +
+ " <natures>\n" +
+ " <nature>org.eclipse.jdt.core.javanature</nature>\n" +
+ " </natures>\n" +
+ "</projectDescription>");
+ }
+
+ public void setProjectName(String projectName)
+ {
+ this.projectName = projectName;
+ }
+
+ public void setOutputFile(String outputFile)
+ {
+ this.outputFile = outputFile;
+ }
+}
Added: common-tools/src/main/java/org/jboss/ws/tools/ant/FixPathTask.java
===================================================================
--- common-tools/src/main/java/org/jboss/ws/tools/ant/FixPathTask.java (rev 0)
+++ common-tools/src/main/java/org/jboss/ws/tools/ant/FixPathTask.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.tools.ant;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+public class FixPathTask extends Task
+{
+ private String propertyName;
+
+ @Override
+ public void execute() throws BuildException
+ {
+ String path = getProject().getProperty(propertyName);
+
+ if (path != null)
+ {
+ getProject().setProperty(propertyName, path.replace('\\', '/'));
+ }
+ }
+
+ public void setProperty(String propertyName)
+ {
+ this.propertyName = propertyName;
+ }
+}
Added: common-tools/src/main/java/org/jboss/ws/tools/ant/InstallModulesTask.java
===================================================================
--- common-tools/src/main/java/org/jboss/ws/tools/ant/InstallModulesTask.java (rev 0)
+++ common-tools/src/main/java/org/jboss/ws/tools/ant/InstallModulesTask.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,153 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.tools.ant;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.FilenameFilter;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.FileSet;
+
+/**
+ * An Ant task for installing AS7 module.xml files; reads the contents of the provided
+ * module.xml files, computes the module path from their full paths, updates the contents
+ * with the resource libs found at the corresponding module in the target dir location
+ * and finally write the destination module.xml files in the target module dir.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 03-Feb-2011
+ *
+ */
+public class InstallModulesTask extends Task
+{
+ private String targetDir; //the target directory where modules are installed
+ private FileSet fileset; //the fileset of module.xml files to be processed
+
+ @Override
+ public void execute() throws BuildException
+ {
+ try
+ {
+ DirectoryScanner dsc = fileset.getDirectoryScanner(getProject());
+ File baseDir = dsc.getBasedir();
+ String[] files = dsc.getIncludedFiles();
+ for (int i = 0; i < files.length; i++)
+ {
+ String currentFile = files[i];
+ File moduleXml = new File(baseDir, currentFile);
+ String modulePath = currentFile.substring(0, currentFile.lastIndexOf(File.separator));
+ File libDir = new File(targetDir, modulePath);
+ File destFile = new File(targetDir, currentFile);
+ System.out.println("Processing descriptor for module " + modulePath);
+ System.out.println("* Source module descriptor: " + moduleXml);
+ System.out.println("* Destination module descriptor: " + destFile);
+ String c = readFileContents(moduleXml);
+ if (libDir.exists())
+ {
+ String[] libs = libDir.list(new FilenameFilter()
+ {
+ @Override
+ public boolean accept(File dir, String name)
+ {
+ return name.endsWith(".jar") || name.endsWith(".ear") || name.endsWith(".sar")
+ || name.endsWith(".war");
+ }
+ });
+ BufferedWriter out = new BufferedWriter(new FileWriter(destFile));
+ out.write(updateContents(c, libs));
+ out.close();
+ }
+ else
+ {
+ libDir.mkdirs();
+ BufferedWriter out = new BufferedWriter(new FileWriter(destFile));
+ out.write(c);
+ out.close();
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new BuildException(e);
+ }
+ }
+
+ private static String readFileContents(File file) throws Exception
+ {
+ StringBuilder sb = new StringBuilder();
+ BufferedReader in = null;
+ try
+ {
+ in = new BufferedReader(new FileReader(file));
+ String line;
+ while ((line = in.readLine()) != null)
+ {
+ sb.append(line);
+ sb.append("\n");
+ }
+ }
+ finally
+ {
+ if (in != null)
+ {
+ try
+ {
+ in.close();
+ }
+ catch (Exception e)
+ {
+ //ignore
+ }
+ }
+ }
+ return sb.toString();
+ }
+
+ private static String updateContents(String contents, String[] libs)
+ {
+ StringBuilder sb = new StringBuilder();
+ for (String f : libs) {
+ sb.append("<resource-root path=\"");
+ sb.append(f);
+ sb.append("\"/>\n ");
+ }
+ return contents.replaceFirst("<!-- Insert resources here -->", sb.toString());
+ }
+
+ public FileSet createFileset()
+ {
+ this.fileset = new FileSet();
+ return fileset;
+ }
+
+ public void setTargetDir(String targetDir)
+ {
+ this.targetDir = targetDir;
+ }
+}
Added: common-tools/src/main/java/org/jboss/ws/tools/ant/PathWriterTask.java
===================================================================
--- common-tools/src/main/java/org/jboss/ws/tools/ant/PathWriterTask.java (rev 0)
+++ common-tools/src/main/java/org/jboss/ws/tools/ant/PathWriterTask.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.tools.ant;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.Path;
+
+/**
+ * An Ant task that writes a given path element to a file, so that
+ * it can be easily imported by other build files.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 13-Mar-2008
+ */
+public class PathWriterTask extends Task
+{
+ private String pathId;
+ private String outputFile;
+ private String variables; //to perform path substitution, i.e. jboss.home <--> /dati/jboss-4.2.3.GA
+
+ @Override
+ public void execute() throws BuildException
+ {
+ Project project = getProject();
+ Path path = (Path)project.getReference(pathId);
+ String[] pathElements = path.list();
+ try
+ {
+ StringBuffer sb = new StringBuffer();
+ generateContent(sb, pathElements);
+ BufferedWriter out = new BufferedWriter(new FileWriter(new File(outputFile)));
+ out.write(sb.toString());
+ out.close();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new BuildException(e);
+ }
+ }
+
+ private void generateContent(StringBuffer sb, String[] libs)
+ {
+ sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+ sb.append("<project>\n");
+ sb.append("<path id=\"");
+ sb.append(pathId);
+ sb.append("\">");
+ for (int i = 0; i < libs.length; i++)
+ {
+ sb.append("<pathelement location=\"");
+ sb.append(getPath(libs[i]));
+ sb.append("\"/>\n");
+ }
+ sb.append("</path>");
+ sb.append("</project>\n");
+ }
+
+ private String getPath(String absolutePath)
+ {
+ StringTokenizer st = new StringTokenizer(variables, ";:, ", false);
+ while (st.hasMoreTokens())
+ {
+ String v = st.nextToken();
+ String value = getProject().getProperty(v);
+ if (absolutePath.contains(value))
+ {
+ int begin = absolutePath.indexOf(value);
+ int end = begin + value.length();
+ absolutePath = absolutePath.substring(0, begin) + "${" + v + "}" + absolutePath.substring(end);
+ }
+ }
+ return absolutePath;
+ }
+
+ public void setPathId(String pathId)
+ {
+ this.pathId = pathId;
+ }
+
+ public void setOutputFile(String outputFile)
+ {
+ this.outputFile = outputFile;
+ }
+
+ public void setVariables(String variables)
+ {
+ this.variables = variables;
+ }
+
+}
Added: common-tools/src/main/java/org/jboss/wsf/spi/tools/ant/AntTaskHelper.java
===================================================================
--- common-tools/src/main/java/org/jboss/wsf/spi/tools/ant/AntTaskHelper.java (rev 0)
+++ common-tools/src/main/java/org/jboss/wsf/spi/tools/ant/AntTaskHelper.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.spi.tools.ant;
+
+import org.apache.tools.ant.types.CommandlineJava.SysProperties;
+import org.apache.tools.ant.types.Environment.Variable;
+
+/**
+ * Helper class for ANT tasks.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+final class AntTaskHelper
+{
+ /**
+ * Constructor.
+ */
+ private AntTaskHelper()
+ {
+ // forbidden constructor
+ }
+
+ /**
+ * Converts array of JVM arguments to ANT SysProperties object.
+ *
+ * @param arguments to be converted.
+ * @return ANT SysProperties object.
+ */
+ static SysProperties toSystemProperties(final String[] arguments)
+ {
+ final SysProperties retVal = new SysProperties();
+
+ if (arguments != null && arguments.length != 0)
+ {
+ for (final String argument : arguments)
+ {
+ if (argument.startsWith("-D"))
+ {
+ Variable var = AntTaskHelper.toVariable(argument);
+ retVal.addVariable(var);
+ }
+ }
+ }
+
+ return retVal;
+ }
+
+ /**
+ * Converts JVM property of format -Dkey=value to ANT Variable object.
+ *
+ * @param argument to be converted
+ * @return ANT Variable object
+ */
+ private static Variable toVariable(final String argument)
+ {
+ final Variable retVal = new Variable();
+ final int equalSignIndex = argument.indexOf('=');
+
+ if (equalSignIndex == -1)
+ {
+ final String key = argument.substring(2);
+ retVal.setKey(key);
+ }
+ else
+ {
+ final String key = argument.substring(2, equalSignIndex);
+ retVal.setKey(key);
+ final String value = argument.substring(equalSignIndex + 1);
+ retVal.setValue(value);
+ }
+
+ return retVal;
+ }
+}
Added: common-tools/src/main/java/org/jboss/wsf/spi/tools/ant/SecurityActions.java
===================================================================
--- common-tools/src/main/java/org/jboss/wsf/spi/tools/ant/SecurityActions.java (rev 0)
+++ common-tools/src/main/java/org/jboss/wsf/spi/tools/ant/SecurityActions.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,137 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.spi.tools.ant;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+/**
+ * Security actions for this package
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 19-Jun-2009
+ *
+ */
+class SecurityActions
+{
+ /**
+ * Get context classloader.
+ *
+ * @return the current context classloader
+ */
+ static ClassLoader getContextClassLoader()
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ else
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+ }
+
+ /**
+ * Set context classloader.
+ *
+ * @param cl the classloader
+ * @return previous context classloader
+ * @throws Throwable for any error
+ */
+ static ClassLoader setContextClassLoader(final ClassLoader cl)
+ {
+ if (System.getSecurityManager() == null)
+ {
+ ClassLoader result = Thread.currentThread().getContextClassLoader();
+ if (cl != null)
+ Thread.currentThread().setContextClassLoader(cl);
+ return result;
+ }
+ else
+ {
+ try
+ {
+ return AccessController.doPrivileged(new PrivilegedExceptionAction<ClassLoader>() {
+ public ClassLoader run() throws Exception
+ {
+ try
+ {
+ ClassLoader result = Thread.currentThread().getContextClassLoader();
+ if (cl != null)
+ Thread.currentThread().setContextClassLoader(cl);
+ return result;
+ }
+ catch (Exception e)
+ {
+ throw e;
+ }
+ catch (Error e)
+ {
+ throw e;
+ }
+ catch (Throwable e)
+ {
+ throw new RuntimeException("Error setting context classloader", e);
+ }
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw new RuntimeException("Error running privileged action", e.getCause());
+ }
+ }
+ }
+
+ /**
+ * Get classloader from class.
+ *
+ * @param clazz the class
+ * @return class's classloader
+ */
+ static ClassLoader getClassLoader(final Class<?> clazz)
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ return clazz.getClassLoader();
+ }
+ else
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run()
+ {
+ return clazz.getClassLoader();
+ }
+ });
+ }
+ }
+
+}
Added: common-tools/src/main/java/org/jboss/wsf/spi/tools/ant/WSConsumeTask.java
===================================================================
--- common-tools/src/main/java/org/jboss/wsf/spi/tools/ant/WSConsumeTask.java (rev 0)
+++ common-tools/src/main/java/org/jboss/wsf/spi/tools/ant/WSConsumeTask.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,366 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.spi.tools.ant;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tools.ant.AntClassLoader;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.ExecuteJava;
+import org.apache.tools.ant.taskdefs.LogOutputStream;
+import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.types.CommandlineJava;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.CommandlineJava.SysProperties;
+import org.jboss.wsf.spi.tools.WSContractConsumer;
+
+/**
+ * Ant task which consumes a Web Service contract.
+ *
+ * <table border="1">
+ * <tr align="left" BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><th>Attribute</th><th>Description</th><th>Default</th></tr>
+ * <tr><td>fork</td><td>Whether or not to run the generation task in a separate VM.</td><td>true</td></tr>
+ * <tr><td>keep</td><td>Keep/Enable Java source code generation.</td><td>false</td></tr>
+ * <tr><td>catalog</td><td> Oasis XML Catalog file for entity resolution</td><td>none</td></tr>
+ * <tr><td>package</td><td> The target Java package for generated code.</td><td>generated</td></tr>
+ * <tr><td>binding</td><td>A JAX-WS or JAXB binding file</td><td>none</td></tr>
+ * <tr><td>wsdlLocation</td><td>Value to use for @(a)WebService.wsdlLocation</td><td>generated</td></tr>
+ * <tr><td>destdir</td><td>The output directory for generated artifacts.</td><td>"output"</td></tr>
+ * <tr><td>sourcedestdir</td><td>The output directory for Java source.</td><td>value of destdir</td></tr>
+ * <tr><td>extension</td><td>Enable SOAP 1.2 binding extension.</td><td>false</td></tr>
+ * <tr><td>target</td><td>The JAX-WS specification target. Allowed values are 2.0, 2.1 and 2.2</td><td></td></tr>
+ * <tr><td>verbose</td><td>Enables more informational output about cmd progress.</td><td>false</td><tr>
+ * <tr><td>wsdl*</td><td>The WSDL file or URL</td><td>n/a</td><tr>
+ * </table>
+ * <b>* = required.</b>
+ *
+ * <p>Example:
+ *
+ * <pre>
+ * <WSConsumeTask
+ * fork="true"
+ * verbose="true"
+ * destdir="output"
+ * sourcedestdir="gen-src"
+ * keep="true"
+ * wsdllocation="handEdited.wsdl"
+ * wsdl="foo.wsdl">
+ * <binding dir="binding-files" includes="*.xml" excludes="bad.xml"/>
+ * </wsimport>
+ * </pre>
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public class WSConsumeTask extends Task
+{
+ private CommandlineJava command = new CommandlineJava();
+ private String wsdl;
+ private File destdir;
+ private File sourcedestdir;
+ private List<File> bindingFiles = new ArrayList<File>();
+ private File catalog;
+ private String wsdlLocation;
+ private String targetPackage;
+ private boolean keep;
+ private boolean extension;
+ private boolean verbose;
+ private boolean fork;
+ private boolean debug;
+ private boolean nocompile;
+ private boolean additionalHeaders;
+ private String target;
+
+ // Not actually used right now
+ public void setDebug(boolean debug)
+ {
+ this.debug = debug;
+ }
+
+ public Commandline.Argument createJvmarg()
+ {
+ return command.createVmArgument();
+ }
+
+ public void setBinding(File bindingFile)
+ {
+ bindingFiles.add(bindingFile);
+ }
+
+ public void setCatalog(File catalog)
+ {
+ this.catalog = catalog;
+ }
+
+ public void setDestdir(File destdir)
+ {
+ this.destdir = destdir;
+ }
+
+ public void setFork(boolean fork)
+ {
+ this.fork = fork;
+ }
+
+ public void setKeep(boolean keep)
+ {
+ this.keep = keep;
+ }
+
+ public void setExtension(boolean extension)
+ {
+ this.extension = extension;
+ }
+
+ public void setAdditionalHeaders(boolean additionalHeaders)
+ {
+ this.additionalHeaders = additionalHeaders;
+ }
+
+ public void setSourcedestdir(File sourcedestdir)
+ {
+ this.sourcedestdir = sourcedestdir;
+ }
+
+ public void setTarget(String target)
+ {
+ this.target = target;
+ }
+
+ public void setPackage(String targetPackage)
+ {
+ this.targetPackage = targetPackage;
+ }
+
+ public void setVerbose(boolean verbose)
+ {
+ this.verbose = verbose;
+ }
+
+ public void setNoCompile(boolean nocompile)
+ {
+ this.nocompile = nocompile;
+ }
+
+ public void setWsdl(String wsdl)
+ {
+ this.wsdl = wsdl;
+ }
+
+ public void setWsdlLocation(String wsdlLocation)
+ {
+ this.wsdlLocation = wsdlLocation;
+ }
+
+ public void addConfiguredBinding(FileSet fs)
+ {
+ DirectoryScanner ds = fs.getDirectoryScanner(getProject());
+ File baseDir = ds.getBasedir();
+ for (String file : ds.getIncludedFiles())
+ {
+ bindingFiles.add(new File(baseDir, file));
+ }
+ }
+
+ public void executeNonForked()
+ {
+ ClassLoader prevCL = SecurityActions.getContextClassLoader();
+ ClassLoader antLoader = SecurityActions.getClassLoader(this.getClass());
+ SecurityActions.setContextClassLoader(antLoader);
+ try
+ {
+ WSContractConsumer consumer = WSContractConsumer.newInstance();
+ consumer.setGenerateSource(keep);
+ consumer.setExtension(extension);
+ consumer.setAdditionalHeaders(additionalHeaders);
+ consumer.setNoCompile(nocompile);
+ if (destdir != null)
+ consumer.setOutputDirectory(destdir);
+ if (sourcedestdir != null)
+ consumer.setSourceDirectory(sourcedestdir);
+ if (targetPackage != null)
+ consumer.setTargetPackage(targetPackage);
+ if (wsdlLocation != null)
+ consumer.setWsdlLocation(wsdlLocation);
+ if (catalog != null)
+ {
+ if (catalog.exists() && catalog.isFile())
+ {
+ consumer.setCatalog(catalog);
+ }
+ else
+ {
+ log("Catalog file not found: " + catalog, Project.MSG_WARN);
+ }
+ }
+ if (bindingFiles != null && bindingFiles.size() > 0)
+ consumer.setBindingFiles(bindingFiles);
+ if (target != null)
+ consumer.setTarget(target);
+
+ log("Consuming wsdl: " + wsdl, Project.MSG_INFO);
+
+ if (verbose)
+ {
+ consumer.setMessageStream(new PrintStream(new LogOutputStream(this, Project.MSG_INFO)));
+ }
+
+ try
+ {
+ consumer.setAdditionalCompilerClassPath(getTaskClassPathStrings());
+ consumer.consume(wsdl);
+ }
+ catch (Throwable e)
+ {
+ throw new BuildException(e, getLocation());
+ }
+ }
+ finally
+ {
+ SecurityActions.setContextClassLoader(prevCL);
+ }
+ }
+
+ public void execute() throws BuildException
+ {
+ if (wsdl == null)
+ throw new BuildException("The wsdl attribute must be specified!", getLocation());
+
+ if (fork)
+ executeForked();
+ else executeNonForked();
+ }
+
+ private Path getTaskClassPath()
+ {
+ // Why is everything in the Ant API a big hack???
+ ClassLoader cl = SecurityActions.getClassLoader(this.getClass());
+ if (cl instanceof AntClassLoader)
+ {
+ return new Path(getProject(), ((AntClassLoader)cl).getClasspath());
+ }
+
+ return new Path(getProject());
+ }
+
+ private List<String> getTaskClassPathStrings()
+ {
+ // Why is everything in the Ant API a big hack???
+ List<String> strings = new ArrayList<String>();
+ ClassLoader cl = SecurityActions.getClassLoader(this.getClass());
+ if (cl instanceof AntClassLoader)
+ {
+ for (String string : ((AntClassLoader)cl).getClasspath().split(File.pathSeparator))
+ strings.add(string);
+ }
+
+ return strings;
+ }
+
+ private void executeForked() throws BuildException
+ {
+ command.setClassname(org.jboss.wsf.spi.tools.cmd.WSConsume.class.getName());
+
+ Path path = command.createClasspath(getProject());
+ path.append(getTaskClassPath());
+
+ if (keep)
+ command.createArgument().setValue("-k");
+
+ if (extension)
+ command.createArgument().setValue("-e");
+
+ if (additionalHeaders)
+ command.createArgument().setValue("-a");
+
+ for (File file : bindingFiles)
+ {
+ command.createArgument().setValue("-b");
+ command.createArgument().setFile(file);
+ }
+
+ if (catalog != null)
+ {
+ command.createArgument().setValue("-c");
+ command.createArgument().setFile(catalog);
+ }
+
+ if (targetPackage != null)
+ {
+ command.createArgument().setValue("-p");
+ command.createArgument().setValue(targetPackage);
+ }
+
+ if (wsdlLocation != null)
+ {
+ command.createArgument().setValue("-w");
+ command.createArgument().setValue(wsdlLocation);
+ }
+
+ if (destdir != null)
+ {
+ command.createArgument().setValue("-o");
+ command.createArgument().setFile(destdir);
+ }
+
+ if (sourcedestdir != null)
+ {
+ command.createArgument().setValue("-s");
+ command.createArgument().setFile(sourcedestdir);
+ }
+
+ if (target != null)
+ {
+ command.createArgument().setValue("-t");
+ command.createArgument().setValue(target);
+ }
+
+ if (verbose)
+ command.createArgument().setValue("-v");
+
+ command.createArgument().setValue(wsdl);
+
+ log("Consuming wsdl: " + wsdl, Project.MSG_INFO);
+
+ if (verbose)
+ log("Command invoked: " + command.getJavaCommand().toString());
+
+ ExecuteJava execute = new ExecuteJava();
+ execute.setClasspath(path);
+ execute.setJavaCommand(command.getJavaCommand());
+
+ // propagate system properties (useful e.g. for endorsing)
+ String[] arguments = command.getVmCommand().getArguments();
+ SysProperties properties = AntTaskHelper.toSystemProperties(arguments);
+ execute.setSystemProperties(properties);
+
+ if (execute.fork(this) != 0)
+ throw new BuildException("Could not invoke WSConsumeTask", getLocation());
+ }
+}
Added: common-tools/src/main/java/org/jboss/wsf/spi/tools/ant/WSProvideTask.java
===================================================================
--- common-tools/src/main/java/org/jboss/wsf/spi/tools/ant/WSProvideTask.java (rev 0)
+++ common-tools/src/main/java/org/jboss/wsf/spi/tools/ant/WSProvideTask.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,331 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.spi.tools.ant;
+
+import org.apache.tools.ant.AntClassLoader;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.ExecuteJava;
+import org.apache.tools.ant.taskdefs.LogOutputStream;
+import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.types.CommandlineJava;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Reference;
+import org.apache.tools.ant.types.CommandlineJava.SysProperties;
+import org.apache.tools.ant.types.Environment.Variable;
+import org.jboss.wsf.spi.tools.WSContractProvider;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.net.URLClassLoader;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.util.StringTokenizer;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Ant task which invokes provides a Web Service contract and portable JAX-WS wrapper classes.
+ *
+ * <table border="1">
+ * <tr align="left" BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><th>Attribute</th><th>Description</th><th>Default</th></tr>
+ * <tr><td>fork</td><td>Whether or not to run the generation task in a separate VM.</td><td>true</td></tr>
+ * <tr><td>keep</td><td>Keep/Enable Java source code generation.</td><td>false</td></tr>
+ * <tr><td>destdir</td><td>The output directory for generated artifacts.</td><td>"output"</td></tr>
+ * <tr><td>resourcedestdir</td><td>The output directory for resource artifacts (WSDL/XSD).</td><td>value of destdir</td></tr>
+ * <tr><td>sourcedestdir</td><td>The output directory for Java source.</td><td>value of destdir</td></tr>
+ * <tr><td>genwsdl</td><td>Whether or not to generate WSDL.</td><td>false</td><tr>
+ * <tr><td>extension</td><td>Enable SOAP 1.2 binding extension.</td><td>false</td></tr>
+ * <tr><td>verbose</td><td>Enables more informational output about cmd progress.</td><td>false</td><tr>
+ * <tr><td>sei</td><td>Service Endpoint Implementation.</td><td></td><tr>
+ * <tr><td>classpath</td><td>The classpath that contains the service endpoint implementation.</td><td>""</tr>
+ * </table>
+ * <b>* = required.</b>
+ *
+ * <p>Example:
+ *
+ * <pre>
+ * <target name="test-wsproivde" depends="init">
+ * <taskdef name="WSProvideTask" classname="org.jboss.wsf.spi.tools.ant.WSProvideTask">
+ * <classpath refid="core.classpath"/>
+ * </taskdef>
+ * <WSProvideTask
+ * fork="false"
+ * keep="true"
+ * destdir="out"
+ * resourcedestdir="out-resource"
+ * sourcedestdir="out-source"
+ * genwsdl="true"
+ * extension="true"
+ * verbose="true"
+ * sei="org.jboss.test.ws.jaxws.jsr181.soapbinding.DocWrappedServiceImpl">
+ * <classpath>
+ * <pathelement path="${tests.output.dir}/classes"/>
+ * </classpath>
+ * </WSProvideTask>
+ * </target>
+ * </pre>
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public class WSProvideTask extends Task
+{
+ private Path classpath = new Path(getProject());
+ private CommandlineJava command = new CommandlineJava();
+ private String sei;
+ private File destdir;
+ private File resourcedestdir;
+ private File sourcedestdir;
+ private boolean keep;
+ private boolean extension;
+ private boolean genwsdl;
+ private boolean verbose;
+ private boolean fork;
+ private boolean debug;
+
+ // Not actually used right now
+ public void setDebug(boolean debug)
+ {
+ this.debug = debug;
+ }
+
+ public Commandline.Argument createJvmarg()
+ {
+ return command.createVmArgument();
+ }
+
+ public void setClasspath(Path classpath)
+ {
+ this.classpath = classpath;
+ }
+
+ public void setClasspathRef(Reference ref)
+ {
+ createClasspath().setRefid(ref);
+ }
+
+ public Path createClasspath()
+ {
+ return classpath;
+ }
+
+ public void setDestdir(File destdir)
+ {
+ this.destdir = destdir;
+ }
+
+ public void setExtension(boolean extension)
+ {
+ this.extension = extension;
+ }
+
+ public void setProtocol(String protocol)
+ {
+ if (protocol != null)
+ {
+ this.extension = protocol.toLowerCase().indexOf("Xsoap1.2") != -1;
+ }
+ }
+
+ public void setKeep(boolean keep)
+ {
+ this.keep = keep;
+ }
+
+ public void setSei(String sei)
+ {
+ this.sei = sei;
+ }
+
+ public void setFork(boolean fork)
+ {
+ this.fork = fork;
+ }
+
+ public void setResourcedestdir(File resourcedestdir)
+ {
+ this.resourcedestdir = resourcedestdir;
+ }
+
+ public void setSourcedestdir(File sourcedestdir)
+ {
+ this.sourcedestdir = sourcedestdir;
+ }
+
+ public void setVerbose(boolean verbose)
+ {
+ this.verbose = verbose;
+ }
+
+ public void setGenwsdl(boolean genwsdl)
+ {
+ this.genwsdl = genwsdl;
+ }
+
+ private ClassLoader getClasspathLoader(ClassLoader parent)
+ {
+ AntClassLoader antLoader = new AntClassLoader(parent, getProject(), classpath, false);
+
+ // It's necessary to wrap it into an URLLoader in order to extract that information
+ // within the actual provider impl.
+ // See SunRIProviderImpl for instance
+ List<URL> urls = new ArrayList<URL>();
+ StringTokenizer tok = new StringTokenizer(antLoader.getClasspath(), File.separator);
+ while(tok.hasMoreTokens())
+ {
+ try
+ {
+ String path = tok.nextToken();
+ if(!path.startsWith("file://"))
+ path = "file://"+path;
+
+ urls.add(new URL(path));
+ }
+ catch (MalformedURLException e)
+ {
+ throw new IllegalArgumentException("Failed to wrap classloader", e);
+ }
+
+ }
+
+ ClassLoader wrapper = new URLClassLoader(urls.toArray(new URL[0]), antLoader);
+ return wrapper;
+ }
+
+ public void executeNonForked()
+ {
+ ClassLoader prevCL = SecurityActions.getContextClassLoader();
+ ClassLoader antLoader = SecurityActions.getClassLoader(this.getClass());
+ SecurityActions.setContextClassLoader(antLoader);
+ try
+ {
+ WSContractProvider gen = WSContractProvider.newInstance(
+ getClasspathLoader(antLoader)
+ );
+ if (verbose)
+ gen.setMessageStream(new PrintStream(new LogOutputStream(this, Project.MSG_INFO)));
+ gen.setGenerateSource(keep);
+ gen.setGenerateWsdl(genwsdl);
+ gen.setExtension(extension);
+
+ if (destdir != null)
+ gen.setOutputDirectory(destdir);
+ if (resourcedestdir != null)
+ gen.setResourceDirectory(resourcedestdir);
+ if (sourcedestdir != null)
+ gen.setSourceDirectory(sourcedestdir);
+
+ log("Generating from endpoint: " + sei, Project.MSG_INFO);
+
+ gen.provide(sei);
+ }
+ catch(Throwable t)
+ {
+ throw new BuildException(t, getLocation());
+ }
+ finally
+ {
+ SecurityActions.setContextClassLoader(prevCL);
+ }
+ }
+
+ public void execute() throws BuildException
+ {
+ if (sei == null)
+ throw new BuildException("The sei attribute must be specified!", getLocation());
+
+ if (fork)
+ executeForked();
+ else
+ executeNonForked();
+ }
+
+ private Path getTaskClassPath()
+ {
+ // Why is everything in the Ant API a big hack???
+ ClassLoader cl = this.getClass().getClassLoader();
+ if (cl instanceof AntClassLoader)
+ {
+ return new Path(getProject(), ((AntClassLoader)cl).getClasspath());
+ }
+
+ return new Path(getProject());
+ }
+
+ private void executeForked() throws BuildException
+ {
+ command.setClassname(org.jboss.wsf.spi.tools.cmd.WSProvide.class.getName());
+
+ Path path = command.createClasspath(getProject());
+ path.append(getTaskClassPath());
+ path.append(classpath);
+
+ if (keep)
+ command.createArgument().setValue("-k");
+
+ if (genwsdl)
+ command.createArgument().setValue("-w");
+
+ if (extension)
+ command.createArgument().setValue("-e");
+
+ if (destdir != null)
+ {
+ command.createArgument().setValue("-o");
+ command.createArgument().setFile(destdir);
+ }
+ if (resourcedestdir != null)
+ {
+ command.createArgument().setValue("-r");
+ command.createArgument().setFile(resourcedestdir);
+ }
+ if (sourcedestdir != null)
+ {
+ command.createArgument().setValue("-s");
+ command.createArgument().setFile(sourcedestdir);
+ }
+
+ if (!verbose)
+ command.createArgument().setValue("-q");
+
+ // Always dump traces
+ command.createArgument().setValue("-t");
+ command.createArgument().setValue(sei);
+
+ if (verbose)
+ log("Command invoked: " + command.getJavaCommand().toString());
+
+ ExecuteJava execute = new ExecuteJava();
+ execute.setClasspath(path);
+ execute.setJavaCommand(command.getJavaCommand());
+
+ // propagate system properties (useful e.g. for endorsing)
+ String[] arguments = command.getVmCommand().getArguments();
+ SysProperties properties = AntTaskHelper.toSystemProperties(arguments);
+ execute.setSystemProperties(properties);
+
+ if (execute.fork(this) != 0)
+ throw new BuildException("Could not invoke WSProvideTask", getLocation());
+ }
+}
Added: common-tools/src/main/java/org/jboss/wsf/spi/tools/cmd/SecurityActions.java
===================================================================
--- common-tools/src/main/java/org/jboss/wsf/spi/tools/cmd/SecurityActions.java (rev 0)
+++ common-tools/src/main/java/org/jboss/wsf/spi/tools/cmd/SecurityActions.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,177 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.spi.tools.cmd;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+/**
+ * Security actions for this package
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 19-Jun-2009
+ *
+ */
+class SecurityActions
+{
+ /**
+ * Get context classloader.
+ *
+ * @return the current context classloader
+ */
+ static ClassLoader getContextClassLoader()
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ else
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+ }
+
+ /**
+ * Set context classloader.
+ *
+ * @param classLoader the classloader
+ */
+ static void setContextClassLoader(final ClassLoader classLoader)
+ {
+ if (System.getSecurityManager() == null)
+ {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ }
+ else
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Object>()
+ {
+ public Object run()
+ {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ return null;
+ }
+ });
+ }
+ }
+
+ static ClassLoader getModulesClassLoader()
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ return getModulesClassLoaderInternal();
+ }
+ else
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run()
+ {
+ return getModulesClassLoaderInternal();
+ }
+ });
+ }
+ }
+
+ private static ClassLoader getModulesClassLoaderInternal()
+ {
+ // TODO: use SPI class loader facade, not reflection!
+ try {
+ Class<?> moduleClass = Class.forName("org.jboss.modules.Module");
+ Class<?> moduleIdentifierClass = Class.forName("org.jboss.modules.ModuleIdentifier");
+ Class<?> moduleLoaderClass = Class.forName("org.jboss.modules.ModuleLoader");
+ Object moduleLoader = moduleClass.getMethod("getBootModuleLoader").invoke(null);
+ Object moduleIdentifier = moduleIdentifierClass.getMethod("create", String.class).invoke(null, "org.jboss.as.webservices.server.integration");
+ Object module = moduleLoaderClass.getMethod("loadModule", moduleIdentifierClass).invoke(moduleLoader, moduleIdentifier);
+ return (ClassLoader)moduleClass.getMethod("getClassLoader").invoke(module);
+ } catch (Exception e) {
+ //ignore, JBoss Modules might not be available at all
+ return null;
+ }
+ }
+
+ /**
+ * Load a class using the provided classloader
+ *
+ * @param name
+ * @return
+ * @throws PrivilegedActionException
+ */
+ static Class<?> loadClass(final ClassLoader cl, final String name) throws PrivilegedActionException, ClassNotFoundException
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ return cl.loadClass(name);
+ }
+ else
+ {
+ return AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>() {
+ public Class<?> run() throws PrivilegedActionException
+ {
+ try
+ {
+ return cl.loadClass(name);
+ }
+ catch (Exception e)
+ {
+ throw new PrivilegedActionException(e);
+ }
+ }
+ });
+ }
+ }
+
+ /**
+ * Get a system property
+ *
+ * @param name
+ * @param defaultValue
+ * @return
+ */
+ static String getSystemProperty(final String name, final String defaultValue)
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ return System.getProperty(name, defaultValue);
+ }
+ else
+ {
+ PrivilegedAction<String> action = new PrivilegedAction<String>() {
+ public String run()
+ {
+ return System.getProperty(name, defaultValue);
+ }
+ };
+ return AccessController.doPrivileged(action);
+ }
+ }
+}
Added: common-tools/src/main/java/org/jboss/wsf/spi/tools/cmd/WSConsume.java
===================================================================
--- common-tools/src/main/java/org/jboss/wsf/spi/tools/cmd/WSConsume.java (rev 0)
+++ common-tools/src/main/java/org/jboss/wsf/spi/tools/cmd/WSConsume.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,335 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.spi.tools.cmd;
+
+import gnu.getopt.Getopt;
+import gnu.getopt.LongOpt;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+
+import org.jboss.wsf.spi.tools.WSContractConsumer;
+import org.jboss.wsf.spi.util.Log4JUtil;
+import org.jboss.wsf.spi.util.Log4jOutputStream;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * WSConsumeTask is a cmd line tool that generates portable JAX-WS artifacts
+ * from a WSDL file.
+ *
+ * <pre>
+ * usage: WSConsumeTask [options] <wsdl-url>
+ * options:
+ * <table>
+ * <tr><td>-h, --help </td><td>Show this help message</td></tr>
+ * <tr><td>-b, --binding=<file> </td><td>One or more JAX-WS or JAXB binding files</td></tr>
+ * <tr><td>-k, --keep </td><td>Keep/Generate Java source</td></tr>
+ * <tr><td>-c, --catalog=<file> </td><td>Oasis XML Catalog file for entity resolution</td></tr>
+ * <tr><td>-p, --package=<name> </td><td>The target package for generated source</td></tr>
+ * <tr><td>-w, --wsdlLocation=<loc> </td><td>Value to use for @(a)WebService.wsdlLocation</td></tr>
+ * <tr><td>-o, --output=<directory> </td><td>The directory to put generated artifacts</td></tr>
+ * <tr><td>-s, --source=<directory> </td><td>The directory to put Java source</td></tr>
+ * <tr><td>-t, --target=<2.0|2.1|2.2></td><td>The target specification target</td></tr>
+ * <tr><td>-n, --nocompile </td><td>Do not compile generated sources</td></tr>
+ * <tr><td>-q, --quiet </td><td>Be somewhat more quiet</td></tr>
+ * <tr><td>-v, --verbose </td><td>Show full exception stack traces</td></tr>
+ * <tr><td>-l, --load-consumer </td><td>Load the consumer and exit (debug utility)</td></tr>
+ * <tr><td>-e, --extension </td><td>Enable SOAP 1.2 binding extension</td></tr>
+ * <tr><td>-a, --additionalHeaders </td><td>Enable SOAP 1.2 binding extension</td></tr>
+ * </table>
+ * </pre>
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
+ */
+public class WSConsume
+{
+ private static final ClassLoader MODULES_LOADER = SecurityActions.getModulesClassLoader();
+ private List<File> bindingFiles = new ArrayList<File>();
+ private File outputDir = new File("output");
+ private boolean generateSource;
+ private File catalog;
+ private String targetPackage;
+ private String wsdlLocation;
+ private boolean quiet;
+ private boolean verbose;
+ private boolean loadConsumer;
+ private boolean extension;
+ private boolean additionalHeaders;
+ private boolean noCompile;
+ private File sourceDir;
+ private String target;
+
+ public static final String PROGRAM_NAME = SecurityActions.getSystemProperty("program.name", WSConsume.class.getName());
+
+ public static void main(String[] args)
+ {
+ if (MODULES_LOADER != null)
+ {
+ final ClassLoader origLoader = SecurityActions.getContextClassLoader();
+ try
+ {
+ SecurityActions.setContextClassLoader(MODULES_LOADER);
+ mainInternal(args);
+ }
+ finally
+ {
+ SecurityActions.setContextClassLoader(origLoader);
+ }
+ }
+ else
+ {
+ mainInternal(args);
+ }
+ }
+
+ private static void mainInternal(final String[] args)
+ {
+ WSConsume importer = new WSConsume();
+ URL wsdl = importer.parseArguments(args);
+ System.exit(importer.importServices(wsdl));
+ }
+
+ private URL parseArguments(String[] args)
+ {
+ String shortOpts = "b:c:p:w:o:s:t:khqvlnea";
+ LongOpt[] longOpts =
+ {
+ new LongOpt("binding", LongOpt.REQUIRED_ARGUMENT, null, 'b'),
+ new LongOpt("catalog", LongOpt.REQUIRED_ARGUMENT, null, 'c'),
+ new LongOpt("package", LongOpt.REQUIRED_ARGUMENT, null, 'p'),
+ new LongOpt("wsdlLocation", LongOpt.REQUIRED_ARGUMENT, null, 'w'),
+ new LongOpt("output", LongOpt.REQUIRED_ARGUMENT, null, 'o'),
+ new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, 's'),
+ new LongOpt("target", LongOpt.REQUIRED_ARGUMENT, null, 't'),
+ new LongOpt("keep", LongOpt.NO_ARGUMENT, null, 'k'),
+ new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h'),
+ new LongOpt("quiet", LongOpt.NO_ARGUMENT, null, 'q'),
+ new LongOpt("verbose", LongOpt.NO_ARGUMENT, null, 'v'),
+ new LongOpt("nocompile", LongOpt.NO_ARGUMENT, null, 'n'),
+ new LongOpt("extension", LongOpt.NO_ARGUMENT, null, 'e'),
+ new LongOpt("additionalHeaders", LongOpt.NO_ARGUMENT, null, 'a'),
+ new LongOpt("load-consumer", LongOpt.NO_ARGUMENT, null, 'l'),
+ };
+
+ Getopt getopt = new Getopt(PROGRAM_NAME, args, shortOpts, longOpts);
+ int c;
+ while ((c = getopt.getopt()) != -1)
+ {
+ switch (c)
+ {
+ case 'b':
+ bindingFiles.add(new File(getopt.getOptarg()));
+ break;
+ case 'k':
+ generateSource = true;
+ break;
+ case 'c':
+ catalog = new File(getopt.getOptarg());
+ break;
+ case 'p':
+ targetPackage = getopt.getOptarg();
+ break;
+ case 'w':
+ wsdlLocation = getopt.getOptarg();
+ break;
+ case 'o':
+ outputDir = new File(getopt.getOptarg());
+ break;
+ case 's':
+ sourceDir = new File(getopt.getOptarg());
+ break;
+ case 't':
+ target = getopt.getOptarg();
+ break;
+ case 'q':
+ quiet = true;
+ break;
+ case 'v':
+ verbose = true;
+ break;
+ case 'l':
+ loadConsumer = true;
+ break;
+ case 'e':
+ extension = true;
+ break;
+ case 'a':
+ additionalHeaders = true;
+ break;
+ case 'n':
+ noCompile = true;
+ break;
+ case 'h':
+ printHelp();
+ System.exit(0);
+ case '?':
+ System.exit(1);
+ }
+ }
+
+ // debug output
+ if(loadConsumer)
+ {
+ WSContractConsumer importer = WSContractConsumer.newInstance();
+ System.out.println("WSContractConsumer instance: " + importer.getClass().getCanonicalName());
+ System.exit(0);
+ }
+
+ int wsdlPos = getopt.getOptind();
+ if (wsdlPos >= args.length)
+ {
+ System.err.println("Error: WSDL URL was not specified!");
+ printHelp();
+ System.exit(1);
+ }
+
+ URL url = null;
+ try
+ {
+ try
+ {
+ url = new URL(args[wsdlPos]);
+ }
+ catch (MalformedURLException e)
+ {
+ File file = new File(args[wsdlPos]);
+ url = file.toURI().toURL();
+ }
+ }
+ catch (MalformedURLException e)
+ {
+ System.err.println("Error: Invalid URI: " + args[wsdlPos]);
+ System.exit(1);
+ }
+
+ return url;
+ }
+
+
+ private int importServices(URL wsdl)
+ {
+ WSContractConsumer consumer = WSContractConsumer.newInstance();
+
+ consumer.setGenerateSource(generateSource);
+ consumer.setOutputDirectory(outputDir);
+ consumer.setExtension(extension);
+ consumer.setAdditionalHeaders(additionalHeaders);
+ if (sourceDir != null)
+ consumer.setSourceDirectory(sourceDir);
+
+ if (! quiet)
+ {
+ PrintStream ps;
+ if (Log4JUtil.isLog4jConfigurationAvailable())
+ {
+ ps = new PrintStream(new Log4jOutputStream(Logger.getLogger("WSConsume"), Level.INFO));
+ }
+ else
+ {
+ ps = System.out;
+ ps.println("Could not find log4j.xml configuration, logging to console.\n");
+ }
+ consumer.setMessageStream(ps);
+ }
+
+ if (catalog != null)
+ {
+ if (catalog.exists() && catalog.isFile())
+ {
+ consumer.setCatalog(catalog);
+ }
+ else
+ {
+ System.err.println("Warning: catalog file not found: " + catalog);
+ }
+ }
+
+ if (targetPackage != null)
+ consumer.setTargetPackage(targetPackage);
+
+ if (wsdlLocation != null)
+ consumer.setWsdlLocation(wsdlLocation);
+
+ if (bindingFiles != null && bindingFiles.size() > 0)
+ consumer.setBindingFiles(bindingFiles);
+
+ if(target!=null)
+ consumer.setTarget(target);
+
+ if (noCompile)
+ consumer.setNoCompile(noCompile);
+
+ try
+ {
+ consumer.consume(wsdl);
+ return 0;
+ }
+ catch (Throwable t)
+ {
+ System.err.println("Error: Could not import. (use --verbose to see full traces)");
+ if (!verbose)
+ {
+ String message = t.getMessage();
+ if (message == null)
+ message = t.getClass().getSimpleName();
+ System.err.println("Error: " + message);
+ }
+ else
+ {
+ t.printStackTrace(System.err);
+ }
+
+ }
+
+ return 1;
+ }
+
+ private static void printHelp()
+ {
+ PrintStream out = System.out;
+ out.println("WSConsumeTask is a cmd line tool that generates portable JAX-WS artifacts from a WSDL file.\n");
+ out.println("usage: " + PROGRAM_NAME + " [options] <wsdl-url>\n");
+ out.println("options: ");
+ out.println(" -h, --help Show this help message");
+ out.println(" -b, --binding=<file> One or more JAX-WS or JAXB binding files ");
+ out.println(" -k, --keep Keep/Generate Java source");
+ out.println(" -c --catalog=<file> Oasis XML Catalog file for entity resolution");
+ out.println(" -p --package=<name> The target package for generated source");
+ out.println(" -w --wsdlLocation=<loc> Value to use for @WebService.wsdlLocation");
+ out.println(" -o, --output=<directory> The directory to put generated artifacts");
+ out.println(" -s, --source=<directory> The directory to put Java source");
+ out.println(" -t, --target=<2.0|2.1|2.2> The JAX-WS specification target");
+ out.println(" -q, --quiet Be somewhat more quiet");
+ out.println(" -v, --verbose Show full exception stack traces");
+ out.println(" -l, --load-consumer Load the consumer and exit (debug utility)");
+ out.println(" -e, --extension Enable SOAP 1.2 binding extension");
+ out.println(" -a, --additionalHeaders Enable processing of implicit SOAP headers");
+ out.println(" -n, --nocompile Do not compile generated sources");
+ out.flush();
+ }
+}
Added: common-tools/src/main/java/org/jboss/wsf/spi/tools/cmd/WSProvide.java
===================================================================
--- common-tools/src/main/java/org/jboss/wsf/spi/tools/cmd/WSProvide.java (rev 0)
+++ common-tools/src/main/java/org/jboss/wsf/spi/tools/cmd/WSProvide.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,269 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.spi.tools.cmd;
+
+import gnu.getopt.Getopt;
+import gnu.getopt.LongOpt;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+
+import org.jboss.wsf.spi.tools.WSContractProvider;
+import org.jboss.wsf.spi.util.Log4JUtil;
+import org.jboss.wsf.spi.util.Log4jOutputStream;
+
+/**
+ * WSProvideTask is a cmd line tool that generates portable JAX-WS artifacts
+ * for a service endpoint implementation.
+ *
+ * <pre>
+ * usage: WSProvideTask [options] <endpoint class name>
+ * options:
+ * <table>
+ * <tr><td>-h, --help </td><td>Show this help message</td></tr>
+ * <tr><td>-k, --keep </td><td>Keep/Generate Java source</td></tr>
+ * <tr><td>-w, --wsdl </td><td>Enable WSDL file generation</td></tr>
+ * <tr><td>-c, --classpath=<path< </td><td>The classpath that contains the endpoint</td></tr>
+ * <tr><td>-o, --output=<directory> </td><td>The directory to put generated artifacts</td></tr>
+ * <tr><td>-r, --resource=<directory></td><td>The directory to put resource artifacts</td></tr>
+ * <tr><td>-s, --source=<directory> </td><td>The directory to put Java source</td></tr>
+ * <tr><td>-q, --quiet </td><td>Be somewhat more quiet</td></tr>
+ * <tr><td>-t, --show-traces </td><td>Show full exception stack traces</td></tr>
+ * <tr><td>-l, --load-provider </td><td>Load the provider and exit (debug utility)</td></tr>
+ * <tr><td>-e, --extension </td><td>Enable SOAP 1.2 binding extension</td></tr>
+ * </pre>
+ *
+ * @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
+ */
+public class WSProvide
+{
+ private static final ClassLoader MODULES_LOADER = SecurityActions.getModulesClassLoader();
+ private ClassLoader loader = MODULES_LOADER != null ? MODULES_LOADER : SecurityActions.getContextClassLoader();
+ private File outputDir = new File("output");
+ private boolean generateSource;
+ private boolean generateWsdl;
+ private boolean extension;
+ private boolean quiet;
+ private boolean showTraces;
+ private boolean loadProvider;
+ private File resourceDir;
+ private File sourceDir;
+
+ public static final String PROGRAM_NAME = SecurityActions.getSystemProperty("program.name", WSProvide.class.getSimpleName());
+
+ public static void main(String[] args)
+ {
+ WSProvide generate = new WSProvide();
+ String endpoint = generate.parseArguments(args);
+ System.exit(generate.generate(endpoint));
+ }
+
+ private String parseArguments(String[] args)
+ {
+ String shortOpts = "hwko:r:s:c:qtle";
+ LongOpt[] longOpts =
+ {
+ new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h'),
+ new LongOpt("wsdl", LongOpt.NO_ARGUMENT, null, 'w'),
+ new LongOpt("keep", LongOpt.NO_ARGUMENT, null, 'k'),
+ new LongOpt("output", LongOpt.REQUIRED_ARGUMENT, null, 'o'),
+ new LongOpt("resource", LongOpt.REQUIRED_ARGUMENT, null, 'r'),
+ new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, 's'),
+ new LongOpt("classpath", LongOpt.REQUIRED_ARGUMENT, null, 'c'),
+ new LongOpt("quiet", LongOpt.NO_ARGUMENT, null, 'q'),
+ new LongOpt("show-traces", LongOpt.NO_ARGUMENT, null, 't'),
+ new LongOpt("load-provider", LongOpt.NO_ARGUMENT, null, 'l'),
+ new LongOpt("extension", LongOpt.NO_ARGUMENT, null, 'e'),
+ };
+
+ Getopt getopt = new Getopt(PROGRAM_NAME, args, shortOpts, longOpts);
+ int c;
+ while ((c = getopt.getopt()) != -1)
+ {
+ switch (c)
+ {
+ case 'k':
+ generateSource = true;
+ break;
+ case 's':
+ sourceDir = new File(getopt.getOptarg());
+ break;
+ case 'r':
+ resourceDir = new File(getopt.getOptarg());
+ break;
+ case 'w':
+ generateWsdl = true;
+ break;
+ case 't':
+ showTraces = true;
+ break;
+ case 'o':
+ outputDir = new File(getopt.getOptarg());
+ break;
+ case 'q':
+ quiet = true;
+ break;
+ case 'c':
+ processClassPath(getopt.getOptarg());
+ break;
+ case 'l':
+ loadProvider = true;
+ break;
+ case 'e':
+ extension = true;
+ break;
+ case 'h':
+ printHelp();
+ System.exit(0);
+ case '?':
+ System.exit(1);
+ }
+ }
+
+ // debug output
+ if(loadProvider)
+ {
+ WSContractProvider gen = WSContractProvider.newInstance(loader);
+ System.out.println("WSContractProvider instance: " + gen.getClass().getCanonicalName());
+ System.exit(0);
+ }
+
+ int endpointPos = getopt.getOptind();
+ if (endpointPos >= args.length)
+ {
+ System.err.println("Error: endpoint implementation was not specified!");
+ printHelp();
+ System.exit(1);
+ }
+
+ return args[endpointPos];
+ }
+
+
+ private int generate(String endpoint)
+ {
+ try
+ {
+ SecurityActions.loadClass(loader, endpoint);
+ }
+ catch (Exception e)
+ {
+ System.err.println("Error: Could not load class [" + endpoint + "]. Did you specify a valid --classpath?");
+ return 1;
+ }
+
+ WSContractProvider gen = WSContractProvider.newInstance(loader);
+ gen.setGenerateWsdl(generateWsdl);
+ gen.setGenerateSource(generateSource);
+ gen.setOutputDirectory(outputDir);
+ gen.setExtension(extension);
+ if (resourceDir != null)
+ gen.setResourceDirectory(resourceDir);
+ if (sourceDir != null)
+ gen.setSourceDirectory(sourceDir);
+
+ if (! quiet)
+ {
+ PrintStream ps;
+ if (Log4JUtil.isLog4jConfigurationAvailable())
+ {
+ ps = new PrintStream(new Log4jOutputStream(Logger.getLogger("WSProvide"), Level.INFO));
+ }
+ else
+ {
+ ps = System.out;
+ ps.println("Could not find log4j.xml configuration, logging to console.\n");
+ }
+ gen.setMessageStream(ps);
+ }
+
+ try
+ {
+ gen.provide(endpoint);
+ return 0;
+ }
+ catch (Throwable t)
+ {
+ System.err.println("Error: Could not generate. (use --show-traces to see full traces)");
+ if (!showTraces)
+ {
+ String message = t.getMessage();
+ if (message == null)
+ message = t.getClass().getSimpleName();
+ System.err.println("Error: " + message);
+ }
+ else
+ {
+ t.printStackTrace(System.err);
+ }
+
+ }
+
+ return 1;
+ }
+
+ private void processClassPath(String classPath)
+ {
+ String[] entries = classPath.split(File.pathSeparator);
+ List<URL> urls= new ArrayList<URL>(entries.length);
+ for (String entry : entries)
+ {
+ try
+ {
+ urls.add(new File(entry).toURI().toURL());
+ }
+ catch (MalformedURLException e)
+ {
+ System.err.println("Error: a classpath entry was malformed: " + entry);
+ }
+ }
+ loader = new URLClassLoader(urls.toArray(new URL[0]), loader);
+ }
+
+ private static void printHelp()
+ {
+ PrintStream out = System.out;
+ out.println("WSProvideTask generates portable JAX-WS artifacts for an endpoint implementation.\n");
+ out.println("usage: " + PROGRAM_NAME + " [options] <endpoint class name>\n");
+ out.println("options: ");
+ out.println(" -h, --help Show this help message");
+ out.println(" -k, --keep Keep/Generate Java source");
+ out.println(" -w, --wsdl Enable WSDL file generation");
+ out.println(" -c, --classpath=<path> The classpath that contains the endpoint");
+ out.println(" -o, --output=<directory> The directory to put generated artifacts");
+ out.println(" -r, --resource=<directory> The directory to put resource artifacts");
+ out.println(" -s, --source=<directory> The directory to put Java source");
+ out.println(" -e, --extension Enable SOAP 1.2 binding extension");
+ out.println(" -q, --quiet Be somewhat more quiet");
+ out.println(" -t, --show-traces Show full exception stack traces");
+ out.println(" -l, --load-provider Load the provider and exit (debug utility)");
+ out.flush();
+ }
+}
Added: common-tools/src/main/java/org/jboss/wsf/spi/util/Log4JUtil.java
===================================================================
--- common-tools/src/main/java/org/jboss/wsf/spi/util/Log4JUtil.java (rev 0)
+++ common-tools/src/main/java/org/jboss/wsf/spi/util/Log4JUtil.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.spi.util;
+
+import java.net.URL;
+
+import org.apache.log4j.helpers.Loader;
+
+/**
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 10-Jun-2010
+ *
+ */
+public class Log4JUtil
+{
+ public static final String LOG4J_CONFIGURATION = "log4j.configuration";
+ public static final String LOG4J_PROPERTIES = "log4j.properties";
+
+ /**
+ * Returns true if a log4j configuration can be found given the current environment.
+ * See http://logging.apache.org/log4j/1.2/manual.html (Default Initialization Procedure)
+ * @return
+ */
+ public static boolean isLog4jConfigurationAvailable()
+ {
+ String log4jConfiguration = System.getProperty(LOG4J_CONFIGURATION);
+ String resource = log4jConfiguration != null ? log4jConfiguration : LOG4J_PROPERTIES;
+ URL url = null;
+ try
+ {
+ url = new URL(resource);
+ }
+ catch (Exception e1)
+ {
+ try
+ {
+ url = Loader.getResource(resource);
+ }
+ catch (Exception e2)
+ {
+ //ignore
+ }
+ }
+ return url != null;
+ }
+}
Added: common-tools/src/main/java/org/jboss/wsf/spi/util/Log4jOutputStream.java
===================================================================
--- common-tools/src/main/java/org/jboss/wsf/spi/util/Log4jOutputStream.java (rev 0)
+++ common-tools/src/main/java/org/jboss/wsf/spi/util/Log4jOutputStream.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,220 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.spi.util;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import org.apache.log4j.Category;
+import org.apache.log4j.Priority;
+
+/**
+ * An OutputStream that flushes out to a Category.<p>
+ * A simple port of <a href="mailto://Jim.Moore@rocketmail.com">Jim Moore</a>'s
+ * LoggingOutputStream contribution to log4j.
+ *
+ * Note that no data is written out to the Category until the stream is
+ * flushed or closed.<p>
+ *
+ * Example:<pre>
+ * // make sure everything sent to System.err is logged
+ * System.setErr(new PrintStream(new LoggingOutputStream(Category.getRoot(), Priority.WARN), true));
+ *
+ * // make sure everything sent to System.out is also logged
+ * System.setOut(new PrintStream(new LoggingOutputStream(Category.getRoot(), Priority.INFO), true));
+ * </pre>
+ *
+ */
+public class Log4jOutputStream extends OutputStream
+{
+ protected static final String LINE_SEPERATOR = System.getProperty("line.separator");
+
+ /**
+ * Used to maintain the contract of {@link #close()}.
+ */
+ protected boolean hasBeenClosed = false;
+
+ /**
+ * The internal buffer where data is stored.
+ */
+ protected byte[] buf;
+
+ /**
+ * The number of valid bytes in the buffer. This value is always
+ * in the range <tt>0</tt> through <tt>buf.length</tt>; elements
+ * <tt>buf[0]</tt> through <tt>buf[count-1]</tt> contain valid
+ * byte data.
+ */
+ protected int count;
+
+ /**
+ * Remembers the size of the buffer for speed.
+ */
+ private int bufLength;
+
+ /**
+ * The default number of bytes in the buffer. =2048
+ */
+ public static final int DEFAULT_BUFFER_LENGTH = 2048;
+
+ /**
+ * The category to write to.
+ */
+ protected Category category;
+
+ /**
+ * The priority to use when writing to the Category.
+ */
+ protected Priority priority;
+
+ @SuppressWarnings("unused")
+ private Log4jOutputStream()
+ {
+ // illegal
+ }
+
+ /**
+ * Creates the LoggingOutputStream to flush to the given Category.
+ *
+ * @param cat the Category to write to
+ *
+ * @param priority the Priority to use when writing to the Category
+ *
+ * @exception IllegalArgumentException
+ * if cat == null or priority == null
+ */
+ public Log4jOutputStream(Category cat, Priority priority) throws IllegalArgumentException
+ {
+ if (cat == null)
+ {
+ throw new IllegalArgumentException("cat == null");
+ }
+ if (priority == null)
+ {
+ throw new IllegalArgumentException("priority == null");
+ }
+
+ this.priority = priority;
+ category = cat;
+ bufLength = DEFAULT_BUFFER_LENGTH;
+ buf = new byte[DEFAULT_BUFFER_LENGTH];
+ count = 0;
+ }
+
+ /**
+ * Closes this output stream and releases any system resources
+ * associated with this stream. The general contract of <code>close</code>
+ * is that it closes the output stream. A closed stream cannot perform
+ * output operations and cannot be reopened.
+ */
+ public void close()
+ {
+ flush();
+ hasBeenClosed = true;
+ }
+
+ /**
+ * Writes the specified byte to this output stream. The general
+ * contract for <code>write</code> is that one byte is written
+ * to the output stream. The byte to be written is the eight
+ * low-order bits of the argument <code>b</code>. The 24
+ * high-order bits of <code>b</code> are ignored.
+ *
+ * @param b the <code>byte</code> to write
+ *
+ * @exception IOException
+ * if an I/O error occurs. In particular,
+ * an <code>IOException</code> may be thrown if the
+ * output stream has been closed.
+ */
+ public void write(final int b) throws IOException
+ {
+ if (hasBeenClosed)
+ {
+ throw new IOException("The stream has been closed.");
+ }
+
+ // don't log nulls
+ if (b == 0)
+ {
+ return;
+ }
+
+ // would this be writing past the buffer?
+ if (count == bufLength)
+ {
+ // grow the buffer
+ final int newBufLength = bufLength + DEFAULT_BUFFER_LENGTH;
+ final byte[] newBuf = new byte[newBufLength];
+
+ System.arraycopy(buf, 0, newBuf, 0, bufLength);
+
+ buf = newBuf;
+ bufLength = newBufLength;
+ }
+
+ buf[count] = (byte)b;
+ count++;
+ }
+
+ /**
+ * Flushes this output stream and forces any buffered output bytes
+ * to be written out. The general contract of <code>flush</code> is
+ * that calling it is an indication that, if any bytes previously
+ * written have been buffered by the implementation of the output
+ * stream, such bytes should immediately be written to their
+ * intended destination.
+ */
+ public void flush()
+ {
+ if (count == 0)
+ {
+ return;
+ }
+
+ // don't print out blank lines; flushing from PrintStream puts out these
+ if (count == LINE_SEPERATOR.length())
+ {
+ if (((char)buf[0]) == LINE_SEPERATOR.charAt(0) && ((count == 1) || // <- Unix & Mac, -> Windows
+ ((count == 2) && ((char)buf[1]) == LINE_SEPERATOR.charAt(1))))
+ {
+ reset();
+ return;
+ }
+ }
+
+ final byte[] theBytes = new byte[count];
+
+ System.arraycopy(buf, 0, theBytes, 0, count);
+
+ category.log(priority, new String(theBytes));
+
+ reset();
+ }
+
+ private void reset()
+ {
+ // not resetting the buffer -- assuming that if it grew that it
+ // will likely grow similarly again
+ count = 0;
+ }
+
+}
Added: common-tools/src/test/java/org/jboss/test/wsf/spi/tools/AntConsumeTestCase.java
===================================================================
--- common-tools/src/test/java/org/jboss/test/wsf/spi/tools/AntConsumeTestCase.java (rev 0)
+++ common-tools/src/test/java/org/jboss/test/wsf/spi/tools/AntConsumeTestCase.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.wsf.spi.tools;
+
+/**
+ * Test the WSConsumeTask.
+ * This test needs to be executed in 'SPI_HOME/output/tests',
+ * because it works with relative paths.
+ *
+ * @author Heiko.Braun(a)jboss.com
+ */
+public class AntConsumeTestCase extends BuildFileTest
+{
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ // cleanup events
+ CmdConsumeTracker.LAST_EVENT = "";
+
+ // enforce loading of the tracker implemenation
+ System.setProperty("org.jboss.wsf.spi.tools.ConsumerFactoryImpl", "org.jboss.test.wsf.spi.tools.CmdConsumeTrackerFactory");
+
+ configureProject("src/test/resources/smoke/tools/consume-test.xml");
+ }
+
+ public void testPlainInvocation()
+ {
+ executeTarget("plainInvocation");
+ assertTrue("consume() not invoked", CmdConsumeTracker.LAST_EVENT.indexOf("consume") != -1);
+ }
+
+}
Added: common-tools/src/test/java/org/jboss/test/wsf/spi/tools/AntProvideTestCase.java
===================================================================
--- common-tools/src/test/java/org/jboss/test/wsf/spi/tools/AntProvideTestCase.java (rev 0)
+++ common-tools/src/test/java/org/jboss/test/wsf/spi/tools/AntProvideTestCase.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.wsf.spi.tools;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ */
+public class AntProvideTestCase extends BuildFileTest
+{
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ // cleanup events
+ CmdProvideTracker.LAST_EVENT = "";
+
+ // enforce loading of the tracker implemenation
+ System.setProperty("org.jboss.wsf.spi.tools.ProviderFactoryImpl", "org.jboss.test.wsf.spi.tools.CmdProvideTrackerFactory");
+
+ configureProject("src/test/resources/smoke/tools/provide-test.xml");
+ }
+
+ public void testPlainInvocation()
+ {
+ executeTarget("plainInvocation");
+ assertTrue("provide() not invoked", CmdProvideTracker.LAST_EVENT.indexOf("provide") != -1);
+ }
+
+ public void testIncludeWSDL()
+ {
+ executeTarget("includeWSDL");
+ assertTrue("setGenerateWsdl() not invoked", CmdProvideTracker.LAST_EVENT.indexOf("setGenerateWsdl") != -1);
+ }
+
+ public void testExtraClasspath()
+ {
+ executeTarget("extraClasspath");
+
+ }
+
+}
Added: common-tools/src/test/java/org/jboss/test/wsf/spi/tools/BuildFileTest.java
===================================================================
--- common-tools/src/test/java/org/jboss/test/wsf/spi/tools/BuildFileTest.java (rev 0)
+++ common-tools/src/test/java/org/jboss/test/wsf/spi/tools/BuildFileTest.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,543 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jboss.test.wsf.spi.tools;
+
+import junit.framework.TestCase;
+import org.apache.tools.ant.BuildEvent;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildListener;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.ProjectHelper;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.net.URL;
+
+/**
+ * A BuildFileTest is a TestCase which executes targets from an Ant buildfile
+ * for testing.
+ *
+ * This class provides a number of utility methods for particular build file
+ * tests which extend this class.
+ *
+ * @author Apache Ant contributors
+ */
+public abstract class BuildFileTest extends TestCase {
+
+ protected Project project;
+
+ private StringBuffer logBuffer;
+ private StringBuffer fullLogBuffer;
+ private StringBuffer outBuffer;
+ private StringBuffer errBuffer;
+ private BuildException buildException;
+
+ /**
+ * Default constructor for the BuildFileTest object.
+ */
+ public BuildFileTest() {
+ super();
+ }
+
+ /**
+ * Constructor for the BuildFileTest object.
+ *
+ * @param name string to pass up to TestCase constructor
+ */
+ public BuildFileTest(String name) {
+ super(name);
+ }
+
+ /**
+ * Automatically calls the target called "tearDown"
+ * from the build file tested if it exits.
+ *
+ * This allows to use Ant tasks directly in the build file
+ * to clean up after each test. Note that no "setUp" target
+ * is automatically called, since it's trivial to have a
+ * test target depend on it.
+ */
+ protected void tearDown() throws Exception {
+ if (project == null) {
+ /*
+ * Maybe the BuildFileTest was subclassed and there is
+ * no initialized project. So we could avoid getting a
+ * NPE.
+ * If there is an initialized project getTargets() does
+ * not return null as it is initialized by an empty
+ * HashSet.
+ */
+ return;
+ }
+ final String tearDown = "tearDown";
+ if (project.getTargets().containsKey(tearDown)) {
+ project.executeTarget(tearDown);
+ }
+ }
+
+ /**
+ * run a target, expect for any build exception
+ *
+ * @param target target to run
+ * @param cause information string to reader of report
+ */
+ public void expectBuildException(String target, String cause) {
+ expectSpecificBuildException(target, cause, null);
+ }
+
+ /**
+ * Assert that only the given message has been logged with a
+ * priority <= INFO when running the given target.
+ */
+ public void expectLog(String target, String log) {
+ executeTarget(target);
+ String realLog = getLog();
+ assertEquals(log, realLog);
+ }
+
+ /**
+ * Assert that the given substring is in the log messages.
+ */
+ public void assertLogContaining(String substring) {
+ String realLog = getLog();
+ assertTrue("expecting log to contain \"" + substring + "\" log was \""
+ + realLog + "\"",
+ realLog.indexOf(substring) >= 0);
+ }
+
+ /**
+ * Assert that the given substring is in the output messages.
+ * @since Ant1.7
+ */
+ public void assertOutputContaining(String substring) {
+ String realOutput = getOutput();
+ assertTrue("expecting output to contain \"" + substring
+ + "\" output was \"" + realOutput + "\"",
+ realOutput.indexOf(substring) >= 0);
+ }
+
+ /**
+ * Assert that the given message has been logged with a priority
+ * <= INFO when running the given target.
+ */
+ public void expectLogContaining(String target, String log) {
+ executeTarget(target);
+ assertLogContaining(log);
+ }
+
+ /**
+ * Gets the log the BuildFileTest object.
+ * Only valid if configureProject() has been called.
+ *
+ * @pre logBuffer!=null
+ * @return The log value
+ */
+ public String getLog() {
+ return logBuffer.toString();
+ }
+
+ /**
+ * Assert that the given message has been logged with a priority
+ * >= VERBOSE when running the given target.
+ */
+ public void expectDebuglog(String target, String log) {
+ executeTarget(target);
+ String realLog = getFullLog();
+ assertEquals(log, realLog);
+ }
+
+ /**
+ * Assert that the given substring is in the log messages.
+ */
+ public void assertDebuglogContaining(String substring) {
+ String realLog = getFullLog();
+ assertTrue("expecting debug log to contain \"" + substring
+ + "\" log was \""
+ + realLog + "\"",
+ realLog.indexOf(substring) >= 0);
+ }
+
+ /**
+ * Gets the log the BuildFileTest object.
+ *
+ * Only valid if configureProject() has been called.
+ *
+ * @pre fullLogBuffer!=null
+ * @return The log value
+ */
+ public String getFullLog() {
+ return fullLogBuffer.toString();
+ }
+
+ /**
+ * execute the target, verify output matches expectations
+ *
+ * @param target target to execute
+ * @param output output to look for
+ */
+ public void expectOutput(String target, String output) {
+ executeTarget(target);
+ String realOutput = getOutput();
+ assertEquals(output, realOutput.trim());
+ }
+
+ /**
+ * Executes the target, verify output matches expectations
+ * and that we got the named error at the end
+ *
+ * @param target target to execute
+ * @param output output to look for
+ * @param error Description of Parameter
+ */
+ public void expectOutputAndError(String target, String output, String error) {
+ executeTarget(target);
+ String realOutput = getOutput();
+ assertEquals(output, realOutput);
+ String realError = getError();
+ assertEquals(error, realError);
+ }
+
+ public String getOutput() {
+ return cleanBuffer(outBuffer);
+ }
+
+ public String getError() {
+ return cleanBuffer(errBuffer);
+ }
+
+ public BuildException getBuildException() {
+ return buildException;
+ }
+
+ private String cleanBuffer(StringBuffer buffer) {
+ StringBuffer cleanedBuffer = new StringBuffer();
+ boolean cr = false;
+ for (int i = 0; i < buffer.length(); i++) {
+ char ch = buffer.charAt(i);
+ if (ch == '\r') {
+ cr = true;
+ continue;
+ }
+
+ if (!cr) {
+ cleanedBuffer.append(ch);
+ } else {
+ cleanedBuffer.append(ch);
+ }
+ }
+ return cleanedBuffer.toString();
+ }
+
+ /**
+ * Sets up to run the named project
+ *
+ * @param filename name of project file to run
+ */
+ public void configureProject(String filename) throws BuildException {
+ configureProject(filename, Project.MSG_DEBUG);
+ }
+
+ /**
+ * Sets up to run the named project
+ *
+ * @param filename name of project file to run
+ */
+ public void configureProject(String filename, int logLevel)
+ throws BuildException {
+ logBuffer = new StringBuffer();
+ fullLogBuffer = new StringBuffer();
+ project = new Project();
+ project.init();
+ File antFile = new File(System.getProperty("root"), filename);
+ project.setUserProperty("ant.file" , antFile.getAbsolutePath());
+ project.addBuildListener(new AntTestListener(logLevel));
+ ProjectHelper.configureProject(project, antFile);
+ }
+
+ /**
+ * Executes a target we have set up
+ *
+ * @pre configureProject has been called
+ * @param targetName target to run
+ */
+ public void executeTarget(String targetName) {
+ PrintStream sysOut = System.out;
+ PrintStream sysErr = System.err;
+ try {
+ sysOut.flush();
+ sysErr.flush();
+ outBuffer = new StringBuffer();
+ PrintStream out = new PrintStream(new AntOutputStream(outBuffer));
+ System.setOut(out);
+ errBuffer = new StringBuffer();
+ PrintStream err = new PrintStream(new AntOutputStream(errBuffer));
+ System.setErr(err);
+ logBuffer = new StringBuffer();
+ fullLogBuffer = new StringBuffer();
+ buildException = null;
+ project.executeTarget(targetName);
+ } finally {
+ System.setOut(sysOut);
+ System.setErr(sysErr);
+ }
+
+ }
+
+ /**
+ * Get the project which has been configured for a test.
+ *
+ * @return the Project instance for this test.
+ */
+ public Project getProject() {
+ return project;
+ }
+
+ /**
+ * Gets the directory of the project.
+ *
+ * @return the base dir of the project
+ */
+ public File getProjectDir() {
+ return project.getBaseDir();
+ }
+
+ /**
+ * Runs a target, wait for a build exception.
+ *
+ * @param target target to run
+ * @param cause information string to reader of report
+ * @param msg the message value of the build exception we are waiting
+ * for set to null for any build exception to be valid
+ */
+ public void expectSpecificBuildException(String target, String cause, String msg) {
+ try {
+ executeTarget(target);
+ } catch (org.apache.tools.ant.BuildException ex) {
+ buildException = ex;
+ if ((null != msg) && (!ex.getMessage().equals(msg))) {
+ fail("Should throw BuildException because '" + cause
+ + "' with message '" + msg
+ + "' (actual message '" + ex.getMessage() + "' instead)");
+ }
+ return;
+ }
+ fail("Should throw BuildException because: " + cause);
+ }
+
+ /**
+ * run a target, expect an exception string
+ * containing the substring we look for (case sensitive match)
+ *
+ * @param target target to run
+ * @param cause information string to reader of report
+ * @param contains substring of the build exception to look for
+ */
+ public void expectBuildExceptionContaining(String target, String cause, String contains) {
+ try {
+ executeTarget(target);
+ } catch (org.apache.tools.ant.BuildException ex) {
+ buildException = ex;
+ if ((null != contains) && (ex.getMessage().indexOf(contains) == -1)) {
+ fail("Should throw BuildException because '" + cause + "' with message containing '" + contains + "' (actual message '" + ex.getMessage() + "' instead)");
+ }
+ return;
+ }
+ fail("Should throw BuildException because: " + cause);
+ }
+
+ /**
+ * call a target, verify property is as expected
+ *
+ * @param target build file target
+ * @param property property name
+ * @param value expected value
+ */
+ public void expectPropertySet(String target, String property, String value) {
+ executeTarget(target);
+ assertPropertyEquals(property, value);
+ }
+
+ /**
+ * assert that a property equals a value; comparison is case sensitive.
+ *
+ * @param property property name
+ * @param value expected value
+ */
+ public void assertPropertyEquals(String property, String value) {
+ String result = project.getProperty(property);
+ assertEquals("property " + property,value,result);
+ }
+
+ /**
+ * assert that a property equals "true".
+ *
+ * @param property property name
+ */
+ public void assertPropertySet(String property) {
+ assertPropertyEquals(property, "true");
+ }
+
+ /**
+ * assert that a property is null.
+ *
+ * @param property property name
+ */
+ public void assertPropertyUnset(String property) {
+ assertPropertyEquals(property, null);
+ }
+
+ /**
+ * call a target, verify named property is "true".
+ *
+ * @param target build file target
+ * @param property property name
+ */
+ public void expectPropertySet(String target, String property) {
+ expectPropertySet(target, property, "true");
+ }
+
+ /**
+ * Call a target, verify property is null.
+ *
+ * @param target build file target
+ * @param property property name
+ */
+ public void expectPropertyUnset(String target, String property) {
+ expectPropertySet(target, property, null);
+ }
+
+ /**
+ * Retrieve a resource from the caller classloader to avoid
+ * assuming a vm working directory. The resource path must be
+ * relative to the package name or absolute from the root path.
+ *
+ * @param resource the resource to retrieve its url.
+ * @throws junit.framework.AssertionFailedError if the resource is not found.
+ */
+ public URL getResource(String resource){
+ URL url = getClass().getResource(resource);
+ assertNotNull("Could not find resource :" + resource, url);
+ return url;
+ }
+
+ /**
+ * an output stream which saves stuff to our buffer.
+ */
+ private static class AntOutputStream extends java.io.OutputStream {
+ private StringBuffer buffer;
+
+ public AntOutputStream( StringBuffer buffer ) {
+ this.buffer = buffer;
+ }
+
+ public void write(int b) {
+ buffer.append((char)b);
+ }
+ }
+
+ /**
+ * Our own personal build listener.
+ */
+ private class AntTestListener implements BuildListener
+ {
+ private int logLevel;
+
+ /**
+ * Constructs a test listener which will ignore log events
+ * above the given level.
+ */
+ public AntTestListener(int logLevel) {
+ this.logLevel = logLevel;
+ }
+
+ /**
+ * Fired before any targets are started.
+ */
+ public void buildStarted(BuildEvent event) {
+ }
+
+ /**
+ * Fired after the last target has finished. This event
+ * will still be thrown if an error occurred during the build.
+ *
+ * @see BuildEvent#getException()
+ */
+ public void buildFinished(BuildEvent event) {
+ }
+
+ /**
+ * Fired when a target is started.
+ *
+ * @see BuildEvent#getTarget()
+ */
+ public void targetStarted(BuildEvent event) {
+ System.out.println("targetStarted " + event.getTarget().getName());
+ }
+
+ /**
+ * Fired when a target has finished. This event will
+ * still be thrown if an error occurred during the build.
+ *
+ * @see BuildEvent#getException()
+ */
+ public void targetFinished(BuildEvent event) {
+ System.out.println("targetFinished " + event.getTarget().getName());
+ }
+
+ /**
+ * Fired when a task is started.
+ *
+ * @see BuildEvent#getTask()
+ */
+ public void taskStarted(BuildEvent event) {
+ //System.out.println("taskStarted " + event.getTask().getTaskName());
+ }
+
+ /**
+ * Fired when a task has finished. This event will still
+ * be throw if an error occurred during the build.
+ *
+ * @see BuildEvent#getException()
+ */
+ public void taskFinished(BuildEvent event) {
+ //System.out.println("taskFinished " + event.getTask().getTaskName());
+ }
+
+ /**
+ * Fired whenever a message is logged.
+ *
+ * @see BuildEvent#getMessage()
+ * @see BuildEvent#getPriority()
+ */
+ public void messageLogged(BuildEvent event) {
+ if (event.getPriority() > logLevel) {
+ // ignore event
+ return;
+ }
+
+ if (event.getPriority() == Project.MSG_INFO ||
+ event.getPriority() == Project.MSG_WARN ||
+ event.getPriority() == Project.MSG_ERR) {
+ logBuffer.append(event.getMessage());
+ }
+ fullLogBuffer.append(event.getMessage());
+ }
+ }
+
+}
+
Added: common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CalculatorBean.java
===================================================================
--- common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CalculatorBean.java (rev 0)
+++ common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CalculatorBean.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.wsf.spi.tools;
+
+// We just need to load it, therefore we skip the JSR 181 annotations here
+public class CalculatorBean
+{
+ public int add(int a, int b)
+ {
+ return a+b;
+ }
+
+ public int subtract(int a, int b)
+ {
+ return a-b;
+ }
+}
Added: common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTestCase.java
===================================================================
--- common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTestCase.java (rev 0)
+++ common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTestCase.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.wsf.spi.tools;
+
+import org.jboss.wsf.spi.tools.cmd.WSConsume;
+
+/**
+ * Test the command line interface to WSConsume.
+ *
+ * @author Heiko.Braun(a)jboss.com
+ */
+public class CmdConsumeTestCase extends CommandlineTestBase
+{
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ // cleanup events
+ CmdConsumeTracker.LAST_EVENT = "";
+
+ // enforce loading of the tracker implemenation
+ System.setProperty(
+ "org.jboss.wsf.spi.tools.ConsumerFactoryImpl",
+ "org.jboss.test.wsf.spi.tools.CmdConsumeTrackerFactory"
+ );
+ }
+
+ public void testInvalidBindingOption() throws Exception
+ {
+ executeCmd("-b", true);
+ }
+
+ public void testValidBindingOption() throws Exception
+ {
+ executeCmd("-b binding-file.xml Service.wsdl", false);
+ assertTrue("setBindingFiles() not invoked", CmdConsumeTracker.LAST_EVENT.indexOf("setBindingFiles")!=-1);
+ }
+
+ public void testMissingOptions() throws Exception
+ {
+ executeCmd(null, true);
+ }
+
+ // TODO: add arbitrary combinations on a case by case basis
+
+
+ void runDelegate(String[] args) throws Exception
+ {
+ WSConsume.main(args);
+ }
+}
Added: common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTracker.java
===================================================================
--- common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTracker.java (rev 0)
+++ common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTracker.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.wsf.spi.tools;
+
+import org.jboss.wsf.spi.tools.WSContractConsumer;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.util.List;
+import java.net.URL;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ */
+public class CmdConsumeTracker extends WSContractConsumer
+{
+ public static String LAST_EVENT = "";
+
+ @Override
+ public void setBindingFiles(List<File> bindingFiles)
+ {
+ LAST_EVENT += "setBindingFiles";
+ }
+
+ @Override
+ public void setCatalog(File catalog)
+ {
+ LAST_EVENT += "setCatalog";
+ }
+
+ @Override
+ public void setOutputDirectory(File directory)
+ {
+ LAST_EVENT += "setOutputDirectory";
+ }
+
+ @Override
+ public void setSourceDirectory(File directory)
+ {
+ LAST_EVENT += "setSourceDirectory";
+ }
+
+ @Override
+ public void setGenerateSource(boolean generateSource)
+ {
+ LAST_EVENT += "setGenerateSource";
+ }
+
+ @Override
+ public void setTargetPackage(String targetPackage)
+ {
+ LAST_EVENT += "setTargetPackage";
+ }
+
+ @Override
+ public void setWsdlLocation(String wsdlLocation)
+ {
+ LAST_EVENT += "setWsdlLocation";
+ }
+
+ @Override
+ public void setMessageStream(PrintStream messageStream)
+ {
+ LAST_EVENT += "setMessageStream";
+ }
+
+ @Override
+ public void setAdditionalCompilerClassPath(List<String> classPath)
+ {
+ LAST_EVENT += "setAdditionalCompilerClassPath";
+ }
+
+ @Override
+ public void setAdditionalHeaders(boolean additionalHeaders)
+ {
+ LAST_EVENT += "setAdditionalHeaders";
+ }
+
+ @Override
+ public void setTarget(String target)
+ {
+ LAST_EVENT += "setTarget";
+ }
+
+ @Override
+ public void consume(URL wsdl)
+ {
+ LAST_EVENT += "consume";
+ }
+
+ @Override
+ public void setExtension(boolean extension)
+ {
+ LAST_EVENT += "setExtension";
+ }
+
+ @Override
+ public void setNoCompile(boolean nocompile)
+ {
+ LAST_EVENT += "setNoCompile";
+ }
+}
Added: common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTrackerFactory.java
===================================================================
--- common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTrackerFactory.java (rev 0)
+++ common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTrackerFactory.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.wsf.spi.tools;
+
+import org.jboss.wsf.spi.tools.WSContractConsumerFactory;
+import org.jboss.wsf.spi.tools.WSContractConsumer;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ */
+public class CmdConsumeTrackerFactory implements WSContractConsumerFactory
+{
+
+ public WSContractConsumer createConsumer()
+ {
+ return new CmdConsumeTracker();
+ }
+}
Added: common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTestCase.java
===================================================================
--- common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTestCase.java (rev 0)
+++ common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTestCase.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.wsf.spi.tools;
+
+import org.jboss.wsf.spi.tools.cmd.WSProvide;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ */
+public class CmdProvideTestCase extends CommandlineTestBase
+{
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ // clear events
+ CmdProvideTracker.LAST_EVENT = "";
+
+ // enforce loading of the tracker implemenation
+ System.setProperty(
+ "org.jboss.wsf.spi.tools.ProviderFactoryImpl",
+ "org.jboss.test.wsf.spi.tools.CmdProvideTrackerFactory"
+ );
+ }
+
+ /** <pre>
+ * usage: WSProvideTask [options] <endpoint class name>
+ * options:
+ * -h, --help Show this help message
+ * -k, --keep Keep/Generate Java source
+ * -w, --wsdl Enable WSDL file generation
+ * -c, --classpath=<path< The classpath that contains the endpoint
+ * -o, --output=<directory> The directory to put generated artifacts
+ * -r, --resource=<directory> The directory to put resource artifacts
+ * -s, --source=<directory> The directory to put Java source
+ * -q, --quiet Be somewhat more quiet
+ * -t, --show-traces Show full exception stack traces
+ * -l, --load-provider Load the provider and exit (debug utility)
+ * </pre>
+ * */
+
+ public void testMissingOptions() throws Exception
+ {
+ executeCmd(null, true);
+ }
+
+ public void testValidOutputDir() throws Exception
+ {
+ executeCmd("-o outputDir org.jboss.test.wsf.spi.tools.CalculatorBean", false);
+ assertTrue("setOutputDirectory() not invoked", CmdProvideTracker.LAST_EVENT.indexOf("setOutputDirectory")!=-1);
+ }
+
+ void runDelegate(String[] args) throws Exception
+ {
+ WSProvide.main(args);
+ }
+}
Added: common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTracker.java
===================================================================
--- common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTracker.java (rev 0)
+++ common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTracker.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.wsf.spi.tools;
+
+import org.jboss.wsf.spi.tools.WSContractProvider;
+
+import java.io.File;
+import java.io.PrintStream;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ */
+public class CmdProvideTracker extends WSContractProvider
+{
+
+ public static String LAST_EVENT = "";
+
+ public void setGenerateWsdl(boolean generateWsdl)
+ {
+ LAST_EVENT += "setGenerateWsdl";
+ }
+
+ public void setExtension(boolean extension)
+ {
+ LAST_EVENT += "setExtension";
+ }
+
+ public void setGenerateSource(boolean generateSource)
+ {
+ LAST_EVENT += "setGenerateSource";
+ }
+
+ public void setOutputDirectory(File directory)
+ {
+ LAST_EVENT += "setOutputDirectory";
+ }
+
+ public void setResourceDirectory(File directory)
+ {
+ LAST_EVENT += "setResourceDirectory";
+ }
+
+ public void setSourceDirectory(File directory)
+ {
+ LAST_EVENT += "setSourceDirectory";
+ }
+
+ public void setClassLoader(ClassLoader loader)
+ {
+ LAST_EVENT += "setClassLoader";
+ }
+
+ public void provide(String endpointClass)
+ {
+ LAST_EVENT += "provide";
+ }
+
+ public void provide(Class<?> endpointClass)
+ {
+ LAST_EVENT += "provide";
+ }
+
+ public void setMessageStream(PrintStream messageStream)
+ {
+ LAST_EVENT += "setMessageStream";
+ }
+}
Added: common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTrackerFactory.java
===================================================================
--- common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTrackerFactory.java (rev 0)
+++ common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTrackerFactory.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.wsf.spi.tools;
+
+import org.jboss.wsf.spi.tools.WSContractProviderFactory;
+import org.jboss.wsf.spi.tools.WSContractProvider;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ */
+public class CmdProvideTrackerFactory implements WSContractProviderFactory
+{
+
+ public WSContractProvider createProvider(ClassLoader loader)
+ {
+ return new CmdProvideTracker();
+ }
+}
Added: common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CommandlineTestBase.java
===================================================================
--- common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CommandlineTestBase.java (rev 0)
+++ common-tools/src/test/java/org/jboss/test/wsf/spi/tools/CommandlineTestBase.java 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.wsf.spi.tools;
+
+import junit.framework.TestCase;
+
+import java.security.Permission;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ */
+public abstract class CommandlineTestBase extends TestCase
+{
+ SecurityManager systemDefault = System.getSecurityManager();
+ SecurityManager interceptor = new InterceptedSecurity();
+
+ protected void swapSecurityManager()
+ {
+ if(System.getSecurityManager() instanceof InterceptedSecurity)
+ System.setSecurityManager(systemDefault);
+ else
+ System.setSecurityManager(interceptor);
+ }
+
+ class InterceptedSecurity extends SecurityManager
+ {
+ private final SecurityManager parent = systemDefault;
+
+ public void checkPermission(Permission perm)
+ {
+ if (parent != null)
+ {
+ parent.checkPermission(perm);
+ }
+ }
+
+ public void checkExit(int status)
+ {
+ String msg = (status == 0) ? "Delegate did exit without errors" : "Delegate did exit with an error";
+ throw new InterceptedExit(msg, status);
+ }
+ }
+
+ static protected class InterceptedExit extends SecurityException
+ {
+ private static final long serialVersionUID = 1L;
+ private int exitCode;
+
+ public InterceptedExit(String s, int code)
+ {
+ super(s);
+ this.exitCode = code;
+ }
+
+
+ public int getExitCode()
+ {
+ return exitCode;
+ }
+ }
+
+ protected void executeCmd(String arguments, boolean expectedException) throws Exception
+ {
+ swapSecurityManager();
+
+ String[] args = arguments!=null ? arguments.split("\\s"): new String[0];
+ try
+ {
+ runDelegate(args);
+ if(expectedException)
+ fail("Did expect exception on args: " +args);
+ }
+ catch (CommandlineTestBase.InterceptedExit e)
+ {
+ boolean positivStatus = (e.getExitCode() == 0);
+ if( (expectedException && positivStatus)
+ || (!expectedException && !positivStatus) )
+ {
+ String s = expectedException ? "Did expect an exception, but " : "Did not expect an exception, but ";
+ String s2 = positivStatus ? "status was positiv" : "status was negativ";
+ throw new Exception(s+s2);
+ }
+
+ }
+ finally
+ {
+ swapSecurityManager();
+ }
+ }
+
+ // the actual tools execution
+ abstract void runDelegate(String[] args) throws Exception;
+
+}
Added: common-tools/src/test/resources/smoke/tools/consume-test.xml
===================================================================
--- common-tools/src/test/resources/smoke/tools/consume-test.xml (rev 0)
+++ common-tools/src/test/resources/smoke/tools/consume-test.xml 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <!--
+ An example build file that used to test the WSConsume Task
+ -->
+
+<project name="consume-test" basedir=".">
+
+ <property name="spi.dir" value="@SPI_DIR@"/>
+
+ <!-- Define the JAX-WS wsconsume task -->
+ <taskdef name="wsconsume" classname="org.jboss.wsf.spi.tools.ant.WSConsumeTask">
+ <classpath>
+ <pathelement location="${spi.dir}/output/lib/jbossws-spi.jar"/>
+ </classpath>
+ </taskdef>
+
+ <target name="plainInvocation">
+ <wsconsume wsdl="Service.wsdl" verbose="true"/>
+ </target>
+
+</project>
\ No newline at end of file
Added: common-tools/src/test/resources/smoke/tools/provide-test.xml
===================================================================
--- common-tools/src/test/resources/smoke/tools/provide-test.xml (rev 0)
+++ common-tools/src/test/resources/smoke/tools/provide-test.xml 2011-04-18 11:04:20 UTC (rev 14136)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ An example build file that used to test the WSConsume Task
+-->
+
+<project name="provide-test" basedir=".">
+
+ <property name="spi.dir" value="@SPI_DIR@"/>
+
+ <!-- Define the JAX-WS wsconsume task -->
+ <taskdef name="wsprovide" classname="org.jboss.wsf.spi.tools.ant.WSProvideTask">
+ <classpath>
+ <pathelement location="${spi.dir}/output/lib/jbossws-spi.jar"/>
+ </classpath>
+ </taskdef>
+
+ <target name="plainInvocation">
+ <wsprovide genwsdl="false" sei="org.jboss.test.wsf.spi.smoke.tools.CalculatorBean"/>
+ </target>
+
+ <target name="includeWSDL">
+ <wsprovide genwsdl="true" sei="org.jboss.test.wsf.spi.smoke.tools.CalculatorBean"/>
+ </target>
+
+ <target name="extraClasspath">
+ <wsprovide genwsdl="false" sei="org.jboss.test.wsf.spi.smoke.tools.CalculatorBean">
+ <classpath>
+ <pathelement location="${spi.dir}/output/test/classes"/>
+ </classpath>
+ </wsprovide>
+ </target>
+</project>
\ No newline at end of file
12 years, 1 month