Author: heiko.braun(a)jboss.com
Date: 2007-09-19 15:19:52 -0400 (Wed, 19 Sep 2007)
New Revision: 4594
Added:
stack/native/trunk/src/main/java/org/jboss/wsf/stack/jbws/JAXBIntroDeploymentAspect.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/AnnotatedUserType.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/AnnotationReaderTestCase.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/JAXBIntroTestCase.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/ProviderBeanJAXB.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/UserType.java
stack/native/trunk/src/test/resources/jaxws/jaxbintros/
stack/native/trunk/src/test/resources/jaxws/jaxbintros/WEB-INF/
stack/native/trunk/src/test/resources/jaxws/jaxbintros/WEB-INF/Provider.wsdl
stack/native/trunk/src/test/resources/jaxws/jaxbintros/WEB-INF/jaxb-intros.xml
stack/native/trunk/src/test/resources/jaxws/jaxbintros/WEB-INF/web.xml
stack/native/trunk/src/test/resources/jaxws/jaxbintros/WEB-INF/wsdl/
stack/native/trunk/src/test/resources/jaxws/jaxbintros/WEB-INF/wsdl/Provider.wsdl
Modified:
stack/native/trunk/ant-import-tests/build-jars-jaxws.xml
stack/native/trunk/ant-import-tests/build-testsuite.xml
stack/native/trunk/ant-import/build-thirdparty.xml
stack/native/trunk/build.xml
stack/native/trunk/src/main/resources/jbossws-native-config.xml
stack/native/trunk/version.properties
Log:
Added a JAXBIntroduction test case
Modified: stack/native/trunk/ant-import/build-thirdparty.xml
===================================================================
--- stack/native/trunk/ant-import/build-thirdparty.xml 2007-09-19 19:08:10 UTC (rev 4593)
+++ stack/native/trunk/ant-import/build-thirdparty.xml 2007-09-19 19:19:52 UTC (rev 4594)
@@ -87,6 +87,7 @@
<get
src="${jboss.repository}/jboss/jboss-vfs/${jboss-vfs}/lib/jboss-vfs-sources.jar"
dest="${thirdparty.dir}/jboss-vfs-sources.jar" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/jboss/jbossxb/${jboss-jbossxb-jboss42}/lib/jboss-xml-binding.jar"
dest="${thirdparty.dir}/jboss-xml-binding.jar" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/jboss/jbossxb/${jboss-jbossxb-jboss42}/lib/jboss-xml-binding-sources.jar"
dest="${thirdparty.dir}/jboss-xml-binding-sources.jar"
usetimestamp="true" verbose="true"/>
+ <get
src="${jboss.repository}/jboss/jaxbintros/${jaxbintros}/lib/jboss-jaxb-intros.jar"
dest="${thirdparty.dir}/jboss-jaxb-intros.jar" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/jboss/microcontainer/${jboss-microcontainer}/lib/jboss-container.jar"
dest="${thirdparty.dir}/jboss-container.jar" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/jboss/microcontainer/${jboss-microcontainer}/lib/jboss-dependency.jar"
dest="${thirdparty.dir}/jboss-dependency.jar" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/jboss/microcontainer/${jboss-microcontainer}/lib/jboss-deployers.jar"
dest="${thirdparty.dir}/jboss-deployers.jar" usetimestamp="true"
verbose="true"/>
@@ -164,6 +165,7 @@
<pathelement location="${thirdparty.dir}/xalan.jar"/>
<pathelement location="${thirdparty.dir}/xmlsec.jar"/>
<pathelement location="${thirdparty.dir}/xercesImpl.jar"/>
+ <pathelement location="${thirdparty.dir}/jboss-jaxb-intros.jar"/>
</path>
</target>
Modified: stack/native/trunk/ant-import-tests/build-jars-jaxws.xml
===================================================================
--- stack/native/trunk/ant-import-tests/build-jars-jaxws.xml 2007-09-19 19:08:10 UTC (rev
4593)
+++ stack/native/trunk/ant-import-tests/build-jars-jaxws.xml 2007-09-19 19:19:52 UTC (rev
4594)
@@ -119,7 +119,19 @@
</classes>
</war>
- <!-- jaxws-jbws771 -->
+ <!-- jaxws-jaxbintros -->
+ <war warfile="${tests.output.dir}/libs/jaxws-jaxbintros.war"
webxml="${tests.output.dir}/resources/jaxws/jaxbintros/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/classes">
+ <include name="org/jboss/test/ws/jaxws/jaxbintros/**/*.class"/>
+ </classes>
+
+ <webinf
dir="${tests.output.dir}/resources/jaxws/jaxbintros/WEB-INF">
+ <include name="*.xml"/>
+ <include name="**/*.wsdl"/>
+ </webinf>
+ </war>
+
+ <!-- jaxws-jbws771 -->
<jar destfile="${tests.output.dir}/libs/jaxws-jbws771.jar">
<fileset dir="${tests.output.dir}/classes">
<include name="org/jboss/test/ws/jaxws/jbws771/*.class"/>
Modified: stack/native/trunk/ant-import-tests/build-testsuite.xml
===================================================================
--- stack/native/trunk/ant-import-tests/build-testsuite.xml 2007-09-19 19:08:10 UTC (rev
4593)
+++ stack/native/trunk/ant-import-tests/build-testsuite.xml 2007-09-19 19:19:52 UTC (rev
4594)
@@ -46,6 +46,7 @@
<pathelement location="${core.dir}/thirdparty/wsdl4j.jar"/>
<pathelement location="${core.dir}/thirdparty/wstx.jar"/>
<pathelement location="${core.dir}/thirdparty/xmlunit.jar"/>
+ <pathelement
location="${core.dir}/thirdparty/jboss-jaxb-intros.jar"/>
</path>
<!-- The jBPM BPEL classpath -->
Modified: stack/native/trunk/build.xml
===================================================================
--- stack/native/trunk/build.xml 2007-09-19 19:08:10 UTC (rev 4593)
+++ stack/native/trunk/build.xml 2007-09-19 19:19:52 UTC (rev 4594)
@@ -233,6 +233,7 @@
<include name="wsdl4j.jar"/>
<include name="xmlsec.jar"/>
<include name="wstx.jar"/>
+ <include name="jboss-jaxb-intros.jar"/>
</fileset>
<metainf dir="${core.dir}/src/main/resources/standard-config">
<include name="standard-*-config.xml"/>
@@ -281,6 +282,7 @@
<include name="wsdl4j.jar"/>
<include name="xmlsec.jar"/>
<include name="wstx.jar"/>
+ <include name="jboss-jaxb-intros.jar"/>
</fileset>
<fileset dir="${core.output.lib.dir}/jbossws-native42">
<include name="jbossws.beans/**"/>
@@ -328,6 +330,7 @@
<include name="wsdl4j.jar"/>
<include name="xmlsec.jar"/>
<include name="wstx.jar"/>
+ <include name="jboss-jaxb-intros.jar"/>
</fileset>
<fileset dir="${core.output.lib.dir}/jbossws-native40">
<include name="jbossws.beans/**"/>
Added:
stack/native/trunk/src/main/java/org/jboss/wsf/stack/jbws/JAXBIntroDeploymentAspect.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/wsf/stack/jbws/JAXBIntroDeploymentAspect.java
(rev 0)
+++
stack/native/trunk/src/main/java/org/jboss/wsf/stack/jbws/JAXBIntroDeploymentAspect.java 2007-09-19
19:19:52 UTC (rev 4594)
@@ -0,0 +1,96 @@
+/*
+ * 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.wsf.stack.jbws;
+
+import com.sun.xml.bind.api.JAXBRIContext;
+import org.jboss.jaxb.intros.IntroductionsAnnotationReader;
+import org.jboss.jaxb.intros.IntroductionsConfigParser;
+import org.jboss.jaxb.intros.configmodel.JaxbIntros;
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxws.JAXBBindingCustomization;
+import org.jboss.wsf.spi.binding.BindingCustomization;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+import org.jboss.wsf.spi.deployment.Endpoint;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ * @version $Revision$
+ */
+public class JAXBIntroDeploymentAspect extends DeploymentAspect
+{
+ private static Logger logger = Logger.getLogger(JAXBIntroDeploymentAspect.class);
+
+ public void create(Deployment deployment)
+ {
+
+ InputStream introsConfigStream = null;
+
+ try { // META-INF first
+ ClassLoader classLoader = deployment.getRuntimeClassLoader();
+ introsConfigStream =
classLoader.getResource("META-INF/jaxb-intros.xml").openStream();
+ } catch (Exception e) {}
+
+ if(null == introsConfigStream)
+ {
+ try { // WEB-INF second
+
+ ClassLoader classLoader = deployment.getRuntimeClassLoader();
+ introsConfigStream =
classLoader.getResource("WEB-INF/jaxb-intros.xml").openStream();
+ } catch (Exception e) {
+ return;
+ }
+ }
+
+ try {
+ if(introsConfigStream != null) {
+ JaxbIntros jaxbIntros =
IntroductionsConfigParser.parseConfig(introsConfigStream);
+ IntroductionsAnnotationReader annotationReader = new
IntroductionsAnnotationReader(jaxbIntros);
+ String defaultNamespace = jaxbIntros.getDefaultNamespace();
+ BindingCustomization jaxbCustomizations = new JAXBBindingCustomization();
+
+ jaxbCustomizations.put(JAXBRIContext.ANNOTATION_READER, annotationReader);
+ if(defaultNamespace != null) {
+ jaxbCustomizations.put(JAXBRIContext.DEFAULT_NAMESPACE_REMAP,
defaultNamespace);
+ }
+
+ // ServerEndpointMetaData#getBindingCustomization becomes the consumer later
on
+ for(Endpoint endpoint : deployment.getService().getEndpoints())
+ {
+ endpoint.addAttachment(BindingCustomization.class, jaxbCustomizations);
+ }
+
+ }
+ } finally {
+ if(introsConfigStream != null) {
+ try {
+ introsConfigStream.close();
+ } catch (IOException e) {
+ logger.error("[" + deployment.getService().getContextRoot() +
"] Error closing JAXB Introductions Configurations stream ", e);
+ }
+ }
+ }
+ }
+}
Property changes on:
stack/native/trunk/src/main/java/org/jboss/wsf/stack/jbws/JAXBIntroDeploymentAspect.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: stack/native/trunk/src/main/resources/jbossws-native-config.xml
===================================================================
--- stack/native/trunk/src/main/resources/jbossws-native-config.xml 2007-09-19 19:08:10
UTC (rev 4593)
+++ stack/native/trunk/src/main/resources/jbossws-native-config.xml 2007-09-19 19:19:52
UTC (rev 4594)
@@ -73,8 +73,12 @@
<property name="requires">RuntimeLoader, ContainerMetaData,
URLPattern, VFSRoot</property>
<property name="provides">UnifiedMetaDataModel</property>
</bean>
-
- <!-- Deployment aspect installers -->
+
+ <bean name="WSJAXBIntroDeploymentAspect"
class="org.jboss.wsf.stack.jbws.JAXBIntroDeploymentAspect">
+ <property name="requires">UnifiedMetaDataModel,
RuntimeLoader</property>
+ </bean>
+
+ <!-- Deployment aspect installers -->
<!-- Phase 1 -->
<bean name="WSNativeDeploymentAspectInstallerPreJSE"
class="org.jboss.wsf.framework.deployment.DeploymentAspectInstaller">
<property name="manager"><inject
bean="WSDeploymentAspectManagerPreJSE"/></property>
@@ -98,6 +102,7 @@
<inject bean="WSNativeServiceEndpointInvokerDeploymentAspect"/>
<inject bean="WSNativeUnifiedMetaDataDeploymentAspect"/>
<inject bean="WSNativeEagerInitializeDeploymentAspect"/>
+ <inject bean="WSJAXBIntroDeploymentAspect"/>
</set>
</property>
<depends>WSDeploymentAspectInstallerPostJSE</depends>
@@ -115,6 +120,7 @@
<inject bean="WSNativePublishContractDeploymentAspect"/>
<inject bean="WSNativeServiceEndpointInvokerDeploymentAspect"/>
<inject bean="WSNativeUnifiedMetaDataDeploymentAspect"/>
+ <inject bean="WSJAXBIntroDeploymentAspect"/>
</set>
</property>
<depends>WSDeploymentAspectInstallerEJB</depends>
@@ -132,6 +138,7 @@
<inject bean="WSNativePublishContractDeploymentAspect"/>
<inject bean="WSNativeServiceEndpointInvokerDeploymentAspect"/>
<inject bean="WSNativeUnifiedMetaDataDeploymentAspect"/>
+ <inject bean="WSJAXBIntroDeploymentAspect"/>
</set>
</property>
<depends>WSDeploymentAspectInstallerEndpointAPI</depends>
Added:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/AnnotatedUserType.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/AnnotatedUserType.java
(rev 0)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/AnnotatedUserType.java 2007-09-19
19:19:52 UTC (rev 4594)
@@ -0,0 +1,116 @@
+/*
+ * 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.ws.jaxws.jaxbintros;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.namespace.QName;
+
+/**
+ * <p>Java class for UserType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within
this class.
+ *
+ * <pre>
+ * <complexType name="UserType">
+ * <complexContent>
+ * <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="string"
type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="qname"
type="{http://www.w3.org/2001/XMLSchema}QName"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlRootElement(namespace = "http://org.jboss.ws/provider", name =
"user")
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "UserType", propOrder = { "string", "qname"
})
+public class AnnotatedUserType
+{
+
+ @XmlAttribute(required = true)
+ protected String string;
+ @XmlElement(required = true)
+ protected QName qname;
+
+ /**
+ * Gets the value of the string property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getString()
+ {
+ return string;
+ }
+
+ /**
+ * Sets the value of the string property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setString(String value)
+ {
+ this.string = value;
+ }
+
+ /**
+ * Gets the value of the qname property.
+ *
+ * @return
+ * possible object is
+ * {@link javax.xml.namespace.QName }
+ *
+ */
+ public QName getQname()
+ {
+ return qname;
+ }
+
+ /**
+ * Sets the value of the qname property.
+ *
+ * @param value
+ * allowed object is
+ * {@link javax.xml.namespace.QName }
+ *
+ */
+ public void setQname(QName value)
+ {
+ this.qname = value;
+ }
+
+}
+
Property changes on:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/AnnotatedUserType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/AnnotationReaderTestCase.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/AnnotationReaderTestCase.java
(rev 0)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/AnnotationReaderTestCase.java 2007-09-19
19:19:52 UTC (rev 4594)
@@ -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.ws.jaxws.jaxbintros;
+
+import com.sun.xml.bind.api.JAXBRIContext;
+import junit.framework.TestCase;
+import org.jboss.jaxb.intros.IntroductionsAnnotationReader;
+import org.jboss.jaxb.intros.IntroductionsConfigParser;
+import org.jboss.jaxb.intros.configmodel.JaxbIntros;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.transform.stream.StreamSource;
+import java.io.ByteArrayInputStream;
+import java.io.FileInputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ * @version $Revision$
+ */
+public class AnnotationReaderTestCase extends TestCase
+{
+ public void testUnmarshal() throws Exception
+ {
+ String reqString =
+ " <ns1:user xmlns:ns1='http://org.jboss.ws/provider'
string='Kermit'>" +
+ " <qname>The Frog</qname>" +
+ " </ns1:user>";
+
+ JaxbIntros config = IntroductionsConfigParser.parseConfig(
+ new
FileInputStream("resources/jaxws/jaxbintros/WEB-INF/jaxb-intros.xml")
+ );
+
+ IntroductionsAnnotationReader reader = new IntroductionsAnnotationReader(config);
+ Map<String, Object> jaxbConfig = new HashMap<String, Object>();
+
+ jaxbConfig.put(JAXBRIContext.DEFAULT_NAMESPACE_REMAP,
"http://org.jboss.ws/provider");
+ jaxbConfig.put(JAXBRIContext.ANNOTATION_READER, reader);
+
+ JAXBContext jaxbContext = JAXBContext.newInstance(new Class[] {UserType.class},
jaxbConfig);
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+
+ JAXBElement jbe = unmarshaller.unmarshal(
+ new StreamSource(
+ new ByteArrayInputStream(reqString.getBytes())
+
+ ), UserType.class
+ );
+
+ UserType ut = (UserType)jbe.getValue();
+ assertEquals("Kermit", ut.getString());
+ assertEquals("The Frog", ut.getQname().getLocalPart());
+
+ }
+}
Property changes on:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/AnnotationReaderTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/JAXBIntroTestCase.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/JAXBIntroTestCase.java
(rev 0)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/JAXBIntroTestCase.java 2007-09-19
19:19:52 UTC (rev 4594)
@@ -0,0 +1,93 @@
+/*
+ * 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.ws.jaxws.jaxbintros;
+
+import junit.framework.Test;
+import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+import org.w3c.dom.Element;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPConnection;
+import javax.xml.soap.SOAPConnectionFactory;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.dom.DOMSource;
+import java.io.ByteArrayInputStream;
+import java.net.URL;
+
+/**
+ * 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 the server side the default JAXBContextFactory takes it into consideration.
+ * The client side is still missing this feature.
+ *
+ * @author heiko.braun(a)jboss.com
+ */
+public class JAXBIntroTestCase extends JBossWSTest
+{
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(JAXBIntroTestCase.class,
"jaxws-jaxbintros.war");
+ }
+
+ public void testWSDLAccess() throws Exception
+ {
+ URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-jaxbintros/ProviderEndpoint?wsdl");
+ Element wsdl = DOMUtils.parse(wsdlURL.openStream());
+ assertNotNull(wsdl);
+ }
+
+ public void testProviderMessage() throws Exception
+ {
+ String reqString =
+ "<env:Envelope
xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
+ " <env:Header/>" +
+ " <env:Body>" +
+ " <ns1:user xmlns:ns1='http://org.jboss.ws/provider'
string='Kermit'>" +
+ " <qname>The Frog</qname>" +
+ " </ns1:user>" +
+ " </env:Body>" +
+ "</env:Envelope>";
+
+ MessageFactory msgFactory = MessageFactory.newInstance();
+ SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
+ SOAPMessage reqMsg = msgFactory.createMessage(null, new
ByteArrayInputStream(reqString.getBytes()));
+
+ URL epURL = new URL("http://" + getServerHost() +
":8080/jaxws-jaxbintros/ProviderEndpoint");
+ SOAPMessage resMsg = con.call(reqMsg, epURL);
+ SOAPEnvelope resEnv = resMsg.getSOAPPart().getEnvelope();
+
+ Element child = (Element)resEnv.getBody().getChildElements().next();
+ JAXBContext jc = JAXBContext.newInstance(new Class[]{AnnotatedUserType.class});
+ AnnotatedUserType user = (AnnotatedUserType)jc.createUnmarshaller().unmarshal(new
DOMSource(child));
+
+ assertEquals("Kermit", user.getString());
+ assertEquals(new QName("The Frog"), user.getQname());
+ }
+}
Property changes on:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/JAXBIntroTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/ProviderBeanJAXB.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/ProviderBeanJAXB.java
(rev 0)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/ProviderBeanJAXB.java 2007-09-19
19:19:52 UTC (rev 4594)
@@ -0,0 +1,80 @@
+/*
+ * 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.ws.jaxws.jaxbintros;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxws.JAXBContextFactory;
+import org.jboss.wsf.common.DOMWriter;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.util.JAXBSource;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.WebServiceProvider;
+
+/**
+ * Test the JAXBBindingCustomization that rely on JAXBIntrodcutions
+ *
+ * @author heiko.braun(a)jboss.com
+ */
+@WebServiceProvider(serviceName = "ProviderService", portName =
"ProviderPort", targetNamespace = "http://org.jboss.ws/provider",
wsdlLocation = "WEB-INF/wsdl/Provider.wsdl")
+@ServiceMode(value = Service.Mode.PAYLOAD)
+public class ProviderBeanJAXB implements Provider<Source>
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(ProviderBeanJAXB.class);
+
+ public Source invoke(Source request)
+ {
+ try
+ {
+ DOMSource dsource = (DOMSource)request;
+ String payload = DOMWriter.printNode(dsource.getNode(), true);
+
+ System.out.println("Payload: \n" + payload);
+
+ // defaults to CustomizableJAXBContextFactory, which takes BindingCustomizations
into consideration
+ JAXBContext jc = JAXBContextFactory.newInstance().createContext(new Class[] {
UserType.class });
+ Unmarshaller unmarshaller = jc.createUnmarshaller();
+ JAXBElement jbe = unmarshaller.unmarshal(request, UserType.class);
+ UserType user = (UserType)jbe.getValue();
+
+ log.info("[string=" + user.getString() + ",qname=" +
user.getQname() + "]");
+
+ return new JAXBSource(jc, user);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception e)
+ {
+ throw new WebServiceException(e);
+ }
+ }
+}
Property changes on:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/ProviderBeanJAXB.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/UserType.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/UserType.java
(rev 0)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/UserType.java 2007-09-19
19:19:52 UTC (rev 4594)
@@ -0,0 +1,104 @@
+/*
+ * 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.ws.jaxws.jaxbintros;
+
+import javax.xml.namespace.QName;
+
+/**
+ * <p>Java class for UserType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within
this class.
+ *
+ * <pre>
+ * <complexType name="UserType">
+ * <complexContent>
+ * <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="string"
type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="qname"
type="{http://www.w3.org/2001/XMLSchema}QName"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+public class UserType
+{
+ protected String string;
+
+ protected QName qname;
+
+ /**
+ * Gets the value of the string property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getString()
+ {
+ return string;
+ }
+
+ /**
+ * Sets the value of the string property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setString(String value)
+ {
+ this.string = value;
+ }
+
+ /**
+ * Gets the value of the qname property.
+ *
+ * @return
+ * possible object is
+ * {@link javax.xml.namespace.QName }
+ *
+ */
+ public QName getQname()
+ {
+ return qname;
+ }
+
+ /**
+ * Sets the value of the qname property.
+ *
+ * @param value
+ * allowed object is
+ * {@link javax.xml.namespace.QName }
+ *
+ */
+ public void setQname(QName value)
+ {
+ this.qname = value;
+ }
+
+}
Property changes on:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/UserType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/trunk/src/test/resources/jaxws/jaxbintros/WEB-INF/Provider.wsdl
===================================================================
--- stack/native/trunk/src/test/resources/jaxws/jaxbintros/WEB-INF/Provider.wsdl
(rev 0)
+++
stack/native/trunk/src/test/resources/jaxws/jaxbintros/WEB-INF/Provider.wsdl 2007-09-19
19:19:52 UTC (rev 4594)
@@ -0,0 +1,43 @@
+<?xml version='1.0'?>
+<definitions name='ProviderService'
targetNamespace='http://org.jboss.ws/provider'
xmlns='http://schemas.xmlsoap.org/wsdl/'
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
xmlns:tns='http://org.jboss.ws/provider'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+ <types>
+ <xs:schema targetNamespace='http://org.jboss.ws/provider'
xmlns:tns='http://org.jboss.ws/provider' version='1.0'
xmlns:xs='http://www.w3.org/2001/XMLSchema'>
+ <xs:element name='user' type='tns:UserType'/>
+ <xs:complexType name='UserType'>
+ <xs:sequence>
+ <xs:element name='string' type='xs:string'/>
+ <xs:element name='qname' type='xs:QName'/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:schema>
+ </types>
+ <message name='echo'>
+ <part element='tns:user' name='user'/>
+ </message>
+ <message name='echoResponse'>
+ <part element='tns:user' name='user'/>
+ </message>
+ <portType name='Provider'>
+ <operation name='echo'>
+ <input message='tns:echo'/>
+ <output message='tns:echoResponse'/>
+ </operation>
+ </portType>
+ <binding name='ProviderBinding' type='tns:Provider'>
+ <soap:binding style='document'
transport='http://schemas.xmlsoap.org/soap/http'/>
+ <operation name='echo'>
+ <soap:operation soapAction=''/>
+ <input>
+ <soap:body use='literal'/>
+ </input>
+ <output>
+ <soap:body use='literal'/>
+ </output>
+ </operation>
+ </binding>
+ <service name='ProviderService'>
+ <port binding='tns:ProviderBinding' name='ProviderPort'>
+ <soap:address location='REPLACE_WITH_ACTUAL_URL'/>
+ </port>
+ </service>
+</definitions>
Property changes on:
stack/native/trunk/src/test/resources/jaxws/jaxbintros/WEB-INF/Provider.wsdl
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/trunk/src/test/resources/jaxws/jaxbintros/WEB-INF/jaxb-intros.xml
===================================================================
--- stack/native/trunk/src/test/resources/jaxws/jaxbintros/WEB-INF/jaxb-intros.xml
(rev 0)
+++
stack/native/trunk/src/test/resources/jaxws/jaxbintros/WEB-INF/jaxb-intros.xml 2007-09-19
19:19:52 UTC (rev 4594)
@@ -0,0 +1,33 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jaxb-intros
xmlns="http://www.jboss.org/xsd/jaxb/intros"
default-namespace="http://org.jboss.ws/provider">
+
+ <!--
+ The XSD for the schema can be found at:
+
http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/extras/jaxbintr...
+ Register it against the
http://www.jboss.org/xsd/jaxb/intros namespace in your IDE and
away you go :-)
+ -->
+
+ <!--
+ Note: how the "name" attributes on class, field and method configs can be
regular expressions.
+ -->
+
+ <!--
+@XmlRootElement(namespace = "http://org.jboss.ws/provider", name =
"user")
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "UserType", propOrder = { "string", "qname"
})
+public class UserType {}
+ -->
+
+ <!--
+ The type namespaces on the customerOrder are different from the rest of the message...
+ -->
+ <Class name="org.jboss.test.ws.jaxws.jaxbintros.UserType">
+ <XmlAccessorType value="FIELD"/>
+ <XmlRootElement name="user"
namespace="http://org.jboss.ws/provider"/>
+
+ <Field name="string">
+ <XmlAttribute />
+ </Field>
+ </Class>
+
+</jaxb-intros>
Property changes on:
stack/native/trunk/src/test/resources/jaxws/jaxbintros/WEB-INF/jaxb-intros.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/trunk/src/test/resources/jaxws/jaxbintros/WEB-INF/web.xml
===================================================================
--- stack/native/trunk/src/test/resources/jaxws/jaxbintros/WEB-INF/web.xml
(rev 0)
+++ stack/native/trunk/src/test/resources/jaxws/jaxbintros/WEB-INF/web.xml 2007-09-19
19:19:52 UTC (rev 4594)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+
+ <servlet>
+ <servlet-name>ProviderEndpoint</servlet-name>
+
<servlet-class>org.jboss.test.ws.jaxws.jaxbintros.ProviderBeanJAXB</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>ProviderEndpoint</servlet-name>
+ <url-pattern>/ProviderEndpoint</url-pattern>
+ </servlet-mapping>
+
+</web-app>
+
Property changes on:
stack/native/trunk/src/test/resources/jaxws/jaxbintros/WEB-INF/web.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/trunk/src/test/resources/jaxws/jaxbintros/WEB-INF/wsdl/Provider.wsdl
===================================================================
--- stack/native/trunk/src/test/resources/jaxws/jaxbintros/WEB-INF/wsdl/Provider.wsdl
(rev 0)
+++
stack/native/trunk/src/test/resources/jaxws/jaxbintros/WEB-INF/wsdl/Provider.wsdl 2007-09-19
19:19:52 UTC (rev 4594)
@@ -0,0 +1,43 @@
+<?xml version='1.0'?>
+<definitions name='ProviderService'
targetNamespace='http://org.jboss.ws/provider'
xmlns='http://schemas.xmlsoap.org/wsdl/'
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
xmlns:tns='http://org.jboss.ws/provider'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+ <types>
+ <xs:schema targetNamespace='http://org.jboss.ws/provider'
xmlns:tns='http://org.jboss.ws/provider' version='1.0'
xmlns:xs='http://www.w3.org/2001/XMLSchema'>
+ <xs:element name='user' type='tns:UserType'/>
+ <xs:complexType name='UserType'>
+ <xs:sequence>
+ <xs:element name='string' type='xs:string'/>
+ <xs:element name='qname' type='xs:QName'/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:schema>
+ </types>
+ <message name='echo'>
+ <part element='tns:user' name='user'/>
+ </message>
+ <message name='echoResponse'>
+ <part element='tns:user' name='user'/>
+ </message>
+ <portType name='Provider'>
+ <operation name='echo'>
+ <input message='tns:echo'/>
+ <output message='tns:echoResponse'/>
+ </operation>
+ </portType>
+ <binding name='ProviderBinding' type='tns:Provider'>
+ <soap:binding style='document'
transport='http://schemas.xmlsoap.org/soap/http'/>
+ <operation name='echo'>
+ <soap:operation soapAction=''/>
+ <input>
+ <soap:body use='literal'/>
+ </input>
+ <output>
+ <soap:body use='literal'/>
+ </output>
+ </operation>
+ </binding>
+ <service name='ProviderService'>
+ <port binding='tns:ProviderBinding' name='ProviderPort'>
+ <soap:address location='REPLACE_WITH_ACTUAL_URL'/>
+ </port>
+ </service>
+</definitions>
Property changes on:
stack/native/trunk/src/test/resources/jaxws/jaxbintros/WEB-INF/wsdl/Provider.wsdl
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: stack/native/trunk/version.properties
===================================================================
--- stack/native/trunk/version.properties 2007-09-19 19:08:10 UTC (rev 4593)
+++ stack/native/trunk/version.properties 2007-09-19 19:19:52 UTC (rev 4594)
@@ -5,8 +5,8 @@
specification.vendor=JBoss (
http://www.jboss.org)
specification.version=jbossws-2.0
-version.id=2.1.0.DEV
-repository.id=snapshot
+version.id=2.0.1.GA_SP1
+repository.id=2.0.1.GA_SP1
implementation.title=JBoss Web Services - Native
implementation.url=http://www.jboss.org/products/jbossws
@@ -66,6 +66,7 @@
jboss-security=4.0.5.GA
jboss-vfs=2.0.0.Beta2
jbossas-core-libs=4.2.0.GA
+jaxbintros=1.0.0.beta1
junit=3.8.1
oswego-concurrent=1.3.4
qdox=1.4