Author: richard.opalka(a)jboss.com
Date: 2010-03-17 06:28:48 -0400 (Wed, 17 Mar 2010)
New Revision: 11796
Added:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/dar/XMLGregorianCalendarHelper.java
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/news/XMLGregorianCalendarHelper.java
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/scripts/build-samples-jaxws.xml
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/dar/ClientHelper.java
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/dar/ReplyConverter.java
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/news/Agency.java
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/news/Printer.java
Log:
[JBPAPP-3930] removing dependency on Sun proprietary classes
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/scripts/build-samples-jaxws.xml
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/scripts/build-samples-jaxws.xml 2010-03-16
20:29:41 UTC (rev 11795)
+++
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/scripts/build-samples-jaxws.xml 2010-03-17
10:28:48 UTC (rev 11796)
@@ -36,6 +36,7 @@
<fileset dir="${tests.output.dir}/test-classes">
<include
name="org/jboss/test/ws/jaxws/samples/dar/generated/*.class"/>
<include
name="org/jboss/test/ws/jaxws/samples/dar/ClientHelper.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/dar/XMLGregorianCalendarHelper.class"/>
<include
name="org/jboss/test/ws/jaxws/samples/dar/Client.class"/>
</fileset>
</jar>
@@ -49,6 +50,7 @@
<include
name="org/jboss/test/ws/jaxws/samples/dar/DarRequest.class"/>
<include
name="org/jboss/test/ws/jaxws/samples/dar/DarResponse.class"/>
<include
name="org/jboss/test/ws/jaxws/samples/dar/ReplyConverter.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/dar/XMLGregorianCalendarHelper.class"/>
<include
name="org/jboss/test/ws/jaxws/samples/dar/Route.class"/>
<include
name="org/jboss/test/ws/jaxws/samples/dar/ServiceRequest.class"/>
<include name="org/jboss/test/ws/jaxws/samples/dar/Stop.class"/>
@@ -62,6 +64,7 @@
<fileset dir="${tests.output.dir}/test-classes">
<include
name="org/jboss/test/ws/jaxws/samples/dar/generated/*.class"/>
<include
name="org/jboss/test/ws/jaxws/samples/dar/ClientHelper.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/dar/XMLGregorianCalendarHelper.class"/>
<include
name="org/jboss/test/ws/jaxws/samples/dar/AddressingClient.class"/>
</fileset>
</jar>
@@ -92,6 +95,7 @@
<classes dir="${tests.output.dir}/test-classes">
<include
name="org/jboss/test/ws/jaxws/samples/dar/generated/*.class"/>
<include
name="org/jboss/test/ws/jaxws/samples/dar/ClientHelper.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/dar/XMLGregorianCalendarHelper.class"/>
<include
name="org/jboss/test/ws/jaxws/samples/dar/JMSClient.class"/>
</classes>
<webinf
dir="${tests.output.dir}/test-resources/jaxws/samples/dar/WEB-INF-jms">
@@ -161,12 +165,14 @@
<fileset dir="${tests.output.dir}/test-classes">
<include
name="org/jboss/test/ws/jaxws/samples/news/generated/agency/*.class"/>
<include
name="org/jboss/test/ws/jaxws/samples/news/Agency.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/news/XMLGregorianCalendarHelper.class"/>
</fileset>
</jar>
<jar
jarfile="${tests.output.dir}/test-libs/jaxws-samples-news-step1-printer.jar">
<fileset dir="${tests.output.dir}/test-classes">
<include
name="org/jboss/test/ws/jaxws/samples/news/generated/printer/**/*.class"/>
<include
name="org/jboss/test/ws/jaxws/samples/news/Printer.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/news/XMLGregorianCalendarHelper.class"/>
</fileset>
</jar>
<jar
jarfile="${tests.output.dir}/test-libs/jaxws-samples-news-step2-newspaper.jar">
@@ -194,6 +200,7 @@
<fileset dir="${tests.output.dir}/test-classes">
<include
name="org/jboss/test/ws/jaxws/samples/news/generated/agency/*.class"/>
<include
name="org/jboss/test/ws/jaxws/samples/news/Agency.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/news/XMLGregorianCalendarHelper.class"/>
<include
name="org/jboss/test/ws/jaxws/samples/news/SecureAgency.class"/>
</fileset>
<metainf
dir="${tests.output.dir}/test-resources/jaxws/samples/news/META-INF">
@@ -206,6 +213,7 @@
<fileset dir="${tests.output.dir}/test-classes">
<include
name="org/jboss/test/ws/jaxws/samples/news/generated/printer/**/*.class"/>
<include
name="org/jboss/test/ws/jaxws/samples/news/Printer.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/news/XMLGregorianCalendarHelper.class"/>
<include
name="org/jboss/test/ws/jaxws/samples/news/SecurePrinter.class"/>
</fileset>
</jar>
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/dar/ClientHelper.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/dar/ClientHelper.java 2010-03-16
20:29:41 UTC (rev 11795)
+++
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/dar/ClientHelper.java 2010-03-17
10:28:48 UTC (rev 11796)
@@ -34,8 +34,6 @@
import org.jboss.test.ws.jaxws.samples.dar.generated.ServiceRequest;
import org.jboss.test.ws.jaxws.samples.dar.generated.Stop;
-import com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl;
-
public class ClientHelper
{
public static void setUsernamePassword(BindingProvider bp, String username, String
password)
@@ -53,10 +51,10 @@
ServiceRequest serviceRequest = new ServiceRequest();
Stop up = new Stop();
up.setNode(new Double(Math.random()*1000).intValue());
- up.setTime(new XMLGregorianCalendarImpl(new GregorianCalendar()));
+ up.setTime(XMLGregorianCalendarHelper.convert(new GregorianCalendar()));
Stop down = new Stop();
down.setNode(new Double(Math.random()*1000).intValue());
- down.setTime(new XMLGregorianCalendarImpl(new GregorianCalendar()));
+ down.setTime(XMLGregorianCalendarHelper.convert(new GregorianCalendar()));
serviceRequest.setFrom(up);
serviceRequest.setTo(down);
serviceRequest.setPeople(new Double(Math.random()*3).intValue()+1);
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/dar/ReplyConverter.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/dar/ReplyConverter.java 2010-03-16
20:29:41 UTC (rev 11795)
+++
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/dar/ReplyConverter.java 2010-03-17
10:28:48 UTC (rev 11796)
@@ -23,7 +23,8 @@
import java.util.GregorianCalendar;
-import com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl;
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
public class ReplyConverter
{
@@ -76,7 +77,7 @@
s.setNode(stop.getNode());
GregorianCalendar cal = new GregorianCalendar();
cal.setTime(stop.getTime());
- s.setTime(new XMLGregorianCalendarImpl(cal));
+ s.setTime(XMLGregorianCalendarHelper.convert(cal));
return s;
}
}
Copied:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/dar/XMLGregorianCalendarHelper.java
(from rev 11540,
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/dar/XMLGregorianCalendarHelper.java)
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/dar/XMLGregorianCalendarHelper.java
(rev 0)
+++
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/dar/XMLGregorianCalendarHelper.java 2010-03-17
10:28:48 UTC (rev 11796)
@@ -0,0 +1,52 @@
+/*
+ * 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.test.ws.jaxws.samples.dar;
+
+import java.util.GregorianCalendar;
+
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+/**
+ * Helper class translating GregorianCalendar instances to XMLGregorianCalendar
instances.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public final class XMLGregorianCalendarHelper
+{
+ private XMLGregorianCalendarHelper()
+ {
+ // forbidden inheritance
+ }
+
+ public static XMLGregorianCalendar convert(final GregorianCalendar cal)
+ {
+ try
+ {
+ return DatatypeFactory.newInstance().newXMLGregorianCalendar(cal);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+}
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/news/Agency.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/news/Agency.java 2010-03-16
20:29:41 UTC (rev 11795)
+++
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/news/Agency.java 2010-03-17
10:28:48 UTC (rev 11796)
@@ -26,12 +26,11 @@
import javax.xml.namespace.QName;
+import org.jboss.test.ws.jaxws.samples.dar.XMLGregorianCalendarHelper;
import org.jboss.test.ws.jaxws.samples.news.generated.agency.PressRelease;
import org.jboss.test.ws.jaxws.samples.news.generated.agency.PressReleaseEndpoint;
import org.jboss.test.ws.jaxws.samples.news.generated.agency.PressReleaseService;
-import com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl;
-
/**
* The press agency client
*
@@ -55,7 +54,7 @@
pressRelease.setAgencyId("agency01");
pressRelease.setTitle(title);
pressRelease.setBody(body);
- pressRelease.setDate(new XMLGregorianCalendarImpl(new GregorianCalendar()));
+ pressRelease.setDate(XMLGregorianCalendarHelper.convert(new GregorianCalendar()));
endpoint.submitPressRelease(pressRelease);
}
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/news/Printer.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/news/Printer.java 2010-03-16
20:29:41 UTC (rev 11795)
+++
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/news/Printer.java 2010-03-17
10:28:48 UTC (rev 11796)
@@ -32,6 +32,7 @@
import javax.xml.ws.BindingProvider;
import javax.xml.ws.soap.SOAPBinding;
+import org.jboss.test.ws.jaxws.samples.dar.XMLGregorianCalendarHelper;
import org.jboss.test.ws.jaxws.samples.news.generated.printer.mtom.EditionMTOM;
import org.jboss.test.ws.jaxws.samples.news.generated.printer.mtom.NewspaperMTOMService;
import
org.jboss.test.ws.jaxws.samples.news.generated.printer.mtom.NewspaperMTOMEndpoint;
@@ -39,8 +40,6 @@
import org.jboss.test.ws.jaxws.samples.news.generated.printer.swa.NewspaperSWAService;
import org.jboss.test.ws.jaxws.samples.news.generated.printer.swa.NewspaperSWAEndpoint;
-import com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl;
-
/**
* The printer client
*
@@ -70,8 +69,8 @@
public void run() throws IOException
{
- XMLGregorianCalendar from = new XMLGregorianCalendarImpl(new
GregorianCalendar(2008,1,10));
- XMLGregorianCalendar to = new XMLGregorianCalendarImpl(new
GregorianCalendar(2008,1,14));
+ XMLGregorianCalendar from = XMLGregorianCalendarHelper.convert(new
GregorianCalendar(2008,1,10));
+ XMLGregorianCalendar to = XMLGregorianCalendarHelper.convert(new
GregorianCalendar(2008,1,14));
if (mtom)
{
((SOAPBinding)(((BindingProvider)mtomEndpoint).getBinding())).setMTOMEnabled(true);
Copied:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/news/XMLGregorianCalendarHelper.java
(from rev 11540,
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/news/XMLGregorianCalendarHelper.java)
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/news/XMLGregorianCalendarHelper.java
(rev 0)
+++
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/news/XMLGregorianCalendarHelper.java 2010-03-17
10:28:48 UTC (rev 11796)
@@ -0,0 +1,52 @@
+/*
+ * 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.test.ws.jaxws.samples.news;
+
+import java.util.GregorianCalendar;
+
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+/**
+ * Helper class translating GregorianCalendar instances to XMLGregorianCalendar
instances.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public final class XMLGregorianCalendarHelper
+{
+ private XMLGregorianCalendarHelper()
+ {
+ // forbidden inheritance
+ }
+
+ public static XMLGregorianCalendar convert(final GregorianCalendar cal)
+ {
+ try
+ {
+ return DatatypeFactory.newInstance().newXMLGregorianCalendar(cal);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+}