JBossWS SVN: r14055 - hudson/branches.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-04-11 18:32:53 -0400 (Mon, 11 Apr 2011)
New Revision: 14055
Removed:
hudson/branches/jbossws-cxf-4.0.0.Alpha3/
Log:
Removing useless branch (no need to keep working hudson branch for alpha release)
13 years
JBossWS SVN: r14054 - stack/native/branches.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-04-11 18:22:59 -0400 (Mon, 11 Apr 2011)
New Revision: 14054
Added:
stack/native/branches/asoldano/
Log:
Branching for working on classloading changes related to avoidind exposing ws implementation classes to user classpath on AS7
13 years
JBossWS SVN: r14053 - in stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251: src/main/java/org/jboss/ws/core/client and 5 other directories.
by jbossws-commits@lists.jboss.org
Author: bmaxwell
Date: 2011-04-11 17:26:40 -0400 (Mon, 11 Apr 2011)
New Revision: 14053
Added:
stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/
stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/Endpoint.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/EndpointImpl.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/JBPAPP5486TestCase.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/resources/jaxws/jbpapp5486/
stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/resources/jaxws/jbpapp5486/WEB-INF/
stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/resources/jaxws/jbpapp5486/WEB-INF/jboss-web.xml
stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/resources/jaxws/jbpapp5486/WEB-INF/web.xml
Removed:
stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/Endpoint.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/EndpointImpl.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/JBPAPP5486TestCase.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/resources/jaxws/jbpapp5486/WEB-INF/
stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/resources/jaxws/jbpapp5486/WEB-INF/jboss-web.xml
stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/resources/jaxws/jbpapp5486/WEB-INF/web.xml
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/ant-import-tests/build-jars-jaxws.xml
stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/main/java/org/jboss/ws/core/client/RemotingConnectionImpl.java
Log:
[JBPAPP-6251] backported changes and test case for one off
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/ant-import-tests/build-jars-jaxws.xml
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/ant-import-tests/build-jars-jaxws.xml 2011-04-11 18:24:23 UTC (rev 14052)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/ant-import-tests/build-jars-jaxws.xml 2011-04-11 21:26:40 UTC (rev 14053)
@@ -130,7 +130,18 @@
<include name="**/*.wsdl"/>
</webinf>
</war>
-
+
+ <!-- jaxws-jbpapp5486 -->
+ <war warfile="${tests.output.dir}/libs/jaxws-jbpapp5486.war" webxml="${tests.output.dir}/resources/jaxws/jbpapp5486/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/classes">
+ <include name="org/jboss/test/ws/jaxws/jbpapp5486/*.class" />
+ <exclude name="org/jboss/test/ws/jaxws/jbpapp5486/*TestCase.class" />
+ </classes>
+ <webinf dir="${tests.output.dir}/resources/jaxws/jbpapp5486/WEB-INF">
+ <include name="jboss-web.xml" />
+ </webinf>
+ </war>
+
<!-- jaxws-jbws771 -->
<jar destfile="${tests.output.dir}/libs/jaxws-jbws771.jar">
<fileset dir="${tests.output.dir}/classes">
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/main/java/org/jboss/ws/core/client/RemotingConnectionImpl.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/main/java/org/jboss/ws/core/client/RemotingConnectionImpl.java 2011-04-11 18:24:23 UTC (rev 14052)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/main/java/org/jboss/ws/core/client/RemotingConnectionImpl.java 2011-04-11 21:26:40 UTC (rev 14053)
@@ -153,7 +153,7 @@
if (callProps.containsKey(StubExt.PROPERTY_CLIENT_TIMEOUT))
{
timeout = callProps.get(StubExt.PROPERTY_CLIENT_TIMEOUT);
- targetAddress = addURLParameter(targetAddress, "timeout", timeout.toString());
+ clientConfig.put("timeout", timeout.toString());
}
}
Deleted: stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/Endpoint.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/Endpoint.java 2010-12-13 13:06:35 UTC (rev 13470)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/Endpoint.java 2011-04-11 21:26:40 UTC (rev 14053)
@@ -1,40 +0,0 @@
-/*
- * 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.jbpapp5486;
-
-import javax.jws.WebService;
-
-/**
- * Test Endpoint.
- *
- * @author darran.lofthouse(a)jboss.com
- * @since 13th December 2010
- */
-@WebService(name = "Endpoint", targetNamespace = "http://ws.jboss.org/jbpap5486")
-public interface Endpoint
-{
-
- public String verifyNoTimeoutParameter(final String message);
-
- public String doSleep(final String message, final long timeout);
-
-}
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/Endpoint.java (from rev 13470, stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/Endpoint.java)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/Endpoint.java (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/Endpoint.java 2011-04-11 21:26:40 UTC (rev 14053)
@@ -0,0 +1,40 @@
+/*
+ * 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.jbpapp5486;
+
+import javax.jws.WebService;
+
+/**
+ * Test Endpoint.
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since 13th December 2010
+ */
+@WebService(name = "Endpoint", targetNamespace = "http://ws.jboss.org/jbpap5486")
+public interface Endpoint
+{
+
+ public String verifyNoTimeoutParameter(final String message);
+
+ public String doSleep(final String message, final long timeout);
+
+}
Deleted: stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/EndpointImpl.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/EndpointImpl.java 2010-12-13 13:06:35 UTC (rev 13470)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/EndpointImpl.java 2011-04-11 21:26:40 UTC (rev 14053)
@@ -1,81 +0,0 @@
-/*
- * 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.jbpapp5486;
-
-import java.util.Map;
-
-import javax.annotation.Resource;
-import javax.jws.WebService;
-import javax.servlet.http.HttpServletRequest;
-import javax.xml.ws.WebServiceContext;
-import javax.xml.ws.handler.MessageContext;
-
-/**
- * Test Endpoint implementation.
- *
- * @author darran.lofthouse(a)jboss.com
- * @since 13th December 2010
- */
-@WebService(name = "Endpoint", targetNamespace = "http://ws.jboss.org/jbpapp5486", endpointInterface = "org.jboss.test.ws.jaxws.jbpapp5486.Endpoint")
-public class EndpointImpl implements Endpoint
-{
-
- @Resource
- private WebServiceContext context;
-
- public String verifyNoTimeoutParameter(final String message)
- {
- if (getTimeout() != null)
- {
- throw new IllegalStateException("timeout parameter recieved.");
- }
-
- return message;
- }
-
- public String doSleep(final String message, final long timeout)
- {
- try
- {
- Thread.sleep(timeout);
- }
- catch (InterruptedException e)
- {
- throw new RuntimeException("We were interrupted!!", e);
- }
-
- return message;
- }
-
- private String getTimeout()
- {
- HttpServletRequest request = (HttpServletRequest)context.getMessageContext().get(MessageContext.SERVLET_REQUEST);
- String timeout = request.getParameter("timeout");
-
- return timeout;
- }
-
-
-
-
-
-}
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/EndpointImpl.java (from rev 13470, stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/EndpointImpl.java)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/EndpointImpl.java (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/EndpointImpl.java 2011-04-11 21:26:40 UTC (rev 14053)
@@ -0,0 +1,81 @@
+/*
+ * 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.jbpapp5486;
+
+import java.util.Map;
+
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+
+/**
+ * Test Endpoint implementation.
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since 13th December 2010
+ */
+@WebService(name = "Endpoint", targetNamespace = "http://ws.jboss.org/jbpapp5486", endpointInterface = "org.jboss.test.ws.jaxws.jbpapp5486.Endpoint")
+public class EndpointImpl implements Endpoint
+{
+
+ @Resource
+ private WebServiceContext context;
+
+ public String verifyNoTimeoutParameter(final String message)
+ {
+ if (getTimeout() != null)
+ {
+ throw new IllegalStateException("timeout parameter recieved.");
+ }
+
+ return message;
+ }
+
+ public String doSleep(final String message, final long timeout)
+ {
+ try
+ {
+ Thread.sleep(timeout);
+ }
+ catch (InterruptedException e)
+ {
+ throw new RuntimeException("We were interrupted!!", e);
+ }
+
+ return message;
+ }
+
+ private String getTimeout()
+ {
+ HttpServletRequest request = (HttpServletRequest)context.getMessageContext().get(MessageContext.SERVLET_REQUEST);
+ String timeout = request.getParameter("timeout");
+
+ return timeout;
+ }
+
+
+
+
+
+}
Deleted: stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/JBPAPP5486TestCase.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/JBPAPP5486TestCase.java 2010-12-13 13:06:35 UTC (rev 13470)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/JBPAPP5486TestCase.java 2011-04-11 21:26:40 UTC (rev 14053)
@@ -1,106 +0,0 @@
-/*
- * 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.jbpapp5486;
-
-import java.io.File;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.Service;
-import javax.xml.ws.WebServiceException;
-
-import junit.framework.Test;
-
-import org.jboss.ws.core.StubExt;
-import org.jboss.ws.core.WSTimeoutException;
-import org.jboss.wsf.test.JBossWSTest;
-import org.jboss.wsf.test.JBossWSTestSetup;
-
-/**
- * [JBPAPP-5486] Timeout value gets inserted into URLs
- *
- * @author darran.lofthouse(a)jboss.com
- * @since 13th December 2010
- * @see https://jira.jboss.org/browse/JBPAPP-5486
- */
-public class JBPAPP5486TestCase extends JBossWSTest
-{
-
- public static Test suite() throws Exception
- {
- return new JBossWSTestSetup(JBPAPP5486TestCase.class, "jaxws-jbpapp5486.war");
- }
-
- public void testNoTimeout() throws Exception
- {
- Service service = getService();
- Endpoint port = service.getPort(Endpoint.class);
-
- String message = "Hello 1";
- String response = port.verifyNoTimeoutParameter(message);
- assertEquals("Response Message", message, response);
- }
-
- public void testTimeout() throws Exception
- {
- Service service = getService();
- Endpoint port = service.getPort(Endpoint.class);
-
- ((BindingProvider)port).getRequestContext().put(StubExt.PROPERTY_CLIENT_TIMEOUT, "10000");
-
- String message = "Hello 2";
- String response = port.verifyNoTimeoutParameter(message);
- assertEquals("Response Message", message, response);
- }
-
- public void testTimeoutWorks() throws Exception
- {
- Service service = getService();
- Endpoint port = service.getPort(Endpoint.class);
-
- ((BindingProvider)port).getRequestContext().put(StubExt.PROPERTY_CLIENT_TIMEOUT, "500");
-
- String message = "Hello 3";
- try
- {
- port.doSleep(message, 1000);
- fail("Expected WS exception not thrown.");
- }
- catch (WebServiceException ignored)
- {
- assertEquals("Expected Cause", WSTimeoutException.class.getName(), ignored.getCause().getClass().getName());
- }
-
- }
-
- Service getService() throws Exception
- {
- URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-jbpapp5486?wsdl");
- QName serviceName = new QName("http://ws.jboss.org/jbpapp5486", "EndpointImplService");
-
- Service service = Service.create(wsdlURL, serviceName);
-
- return service;
- }
-
-}
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/JBPAPP5486TestCase.java (from rev 13470, stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/JBPAPP5486TestCase.java)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/JBPAPP5486TestCase.java (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/java/org/jboss/test/ws/jaxws/jbpapp5486/JBPAPP5486TestCase.java 2011-04-11 21:26:40 UTC (rev 14053)
@@ -0,0 +1,106 @@
+/*
+ * 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.jbpapp5486;
+
+import java.io.File;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceException;
+
+import junit.framework.Test;
+
+import org.jboss.ws.core.StubExt;
+import org.jboss.ws.core.WSTimeoutException;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+/**
+ * [JBPAPP-5486] Timeout value gets inserted into URLs
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since 13th December 2010
+ * @see https://jira.jboss.org/browse/JBPAPP-5486
+ */
+public class JBPAPP5486TestCase extends JBossWSTest
+{
+
+ public static Test suite() throws Exception
+ {
+ return new JBossWSTestSetup(JBPAPP5486TestCase.class, "jaxws-jbpapp5486.war");
+ }
+
+ public void testNoTimeout() throws Exception
+ {
+ Service service = getService();
+ Endpoint port = service.getPort(Endpoint.class);
+
+ String message = "Hello 1";
+ String response = port.verifyNoTimeoutParameter(message);
+ assertEquals("Response Message", message, response);
+ }
+
+ public void testTimeout() throws Exception
+ {
+ Service service = getService();
+ Endpoint port = service.getPort(Endpoint.class);
+
+ ((BindingProvider)port).getRequestContext().put(StubExt.PROPERTY_CLIENT_TIMEOUT, "10000");
+
+ String message = "Hello 2";
+ String response = port.verifyNoTimeoutParameter(message);
+ assertEquals("Response Message", message, response);
+ }
+
+ public void testTimeoutWorks() throws Exception
+ {
+ Service service = getService();
+ Endpoint port = service.getPort(Endpoint.class);
+
+ ((BindingProvider)port).getRequestContext().put(StubExt.PROPERTY_CLIENT_TIMEOUT, "500");
+
+ String message = "Hello 3";
+ try
+ {
+ port.doSleep(message, 1000);
+ fail("Expected WS exception not thrown.");
+ }
+ catch (WebServiceException ignored)
+ {
+ assertEquals("Expected Cause", WSTimeoutException.class.getName(), ignored.getCause().getClass().getName());
+ }
+
+ }
+
+ Service getService() throws Exception
+ {
+ URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-jbpapp5486?wsdl");
+ QName serviceName = new QName("http://ws.jboss.org/jbpapp5486", "EndpointImplService");
+
+ Service service = Service.create(wsdlURL, serviceName);
+
+ return service;
+ }
+
+}
Deleted: stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/resources/jaxws/jbpapp5486/WEB-INF/jboss-web.xml
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbpapp5486/WEB-INF/jboss-web.xml 2010-12-13 13:06:35 UTC (rev 13470)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/resources/jaxws/jbpapp5486/WEB-INF/jboss-web.xml 2011-04-11 21:26:40 UTC (rev 14053)
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.4//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_4_0.dtd">
-
-<jboss-web>
- <context-root>/jaxws-jbpapp5486</context-root>
-</jboss-web>
\ No newline at end of file
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/resources/jaxws/jbpapp5486/WEB-INF/jboss-web.xml (from rev 13470, stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbpapp5486/WEB-INF/jboss-web.xml)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/resources/jaxws/jbpapp5486/WEB-INF/jboss-web.xml (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/resources/jaxws/jbpapp5486/WEB-INF/jboss-web.xml 2011-04-11 21:26:40 UTC (rev 14053)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.4//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_4_0.dtd">
+
+<jboss-web>
+ <context-root>/jaxws-jbpapp5486</context-root>
+</jboss-web>
\ No newline at end of file
Deleted: stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/resources/jaxws/jbpapp5486/WEB-INF/web.xml
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbpapp5486/WEB-INF/web.xml 2010-12-13 13:06:35 UTC (rev 13470)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/resources/jaxws/jbpapp5486/WEB-INF/web.xml 2011-04-11 21:26:40 UTC (rev 14053)
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<web-app version="2.4" 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">
-
- <servlet>
- <servlet-name>TestEndpoint</servlet-name>
- <servlet-class>org.jboss.test.ws.jaxws.jbpapp5486.EndpointImpl</servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>TestEndpoint</servlet-name>
- <url-pattern>/*</url-pattern>
- </servlet-mapping>
-
-</web-app>
\ No newline at end of file
Copied: stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/resources/jaxws/jbpapp5486/WEB-INF/web.xml (from rev 13470, stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/jaxws/jbpapp5486/WEB-INF/web.xml)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/resources/jaxws/jbpapp5486/WEB-INF/web.xml (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/src/test/resources/jaxws/jbpapp5486/WEB-INF/web.xml 2011-04-11 21:26:40 UTC (rev 14053)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.4" 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">
+
+ <servlet>
+ <servlet-name>TestEndpoint</servlet-name>
+ <servlet-class>org.jboss.test.ws.jaxws.jbpapp5486.EndpointImpl</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>TestEndpoint</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
\ No newline at end of file
13 years
JBossWS SVN: r14052 - stack/native/branches.
by jbossws-commits@lists.jboss.org
Author: bmaxwell
Date: 2011-04-11 14:24:23 -0400 (Mon, 11 Apr 2011)
New Revision: 14052
Added:
stack/native/branches/jbossws-native-2.0.1.SP2_CP09_JBPAPP-6251/
Log:
[JBPAPP-6251] branch for one off patch
13 years
JBossWS SVN: r14050 - stack/cxf/branches/asoldano/modules/testsuite/cxf-spring-tests/scripts.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-04-11 07:11:38 -0400 (Mon, 11 Apr 2011)
New Revision: 14050
Modified:
stack/cxf/branches/asoldano/modules/testsuite/cxf-spring-tests/scripts/cxf-jars-jaxws.xml
stack/cxf/branches/asoldano/modules/testsuite/cxf-spring-tests/scripts/cxf-samples-jaxws.xml
Log:
Adding manifest module dependencies to fix testcase failures in cxf spring testsuite
Modified: stack/cxf/branches/asoldano/modules/testsuite/cxf-spring-tests/scripts/cxf-jars-jaxws.xml
===================================================================
--- stack/cxf/branches/asoldano/modules/testsuite/cxf-spring-tests/scripts/cxf-jars-jaxws.xml 2011-04-11 10:40:05 UTC (rev 14049)
+++ stack/cxf/branches/asoldano/modules/testsuite/cxf-spring-tests/scripts/cxf-jars-jaxws.xml 2011-04-11 11:11:38 UTC (rev 14050)
@@ -34,6 +34,9 @@
<webinf dir="${tests.output.dir}/test-resources/jaxws/cxf/aegis/jaxws/WEB-INF/">
<include name="jbossws-cxf.xml"/>
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.apache.cxf"/>
+ </manifest>
</war>
<war
@@ -44,6 +47,9 @@
<include name="org/jboss/test/ws/jaxws/cxf/aegis/AegisAnnotationGroupQueryImpl.class"/>
<include name="org/jboss/test/ws/jaxws/cxf/aegis/Member.class"/>
</classes>
+ <manifest>
+ <attribute name="Dependencies" value="org.apache.cxf"/>
+ </manifest>
</war>
<!-- jaxws-cxf-configuration -->
@@ -58,6 +64,9 @@
<webinf dir="${tests.output.dir}/test-resources/jaxws/cxf/configuration/WEB-INF">
<include name="jbossws-cxf.xml"/>
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.apache.cxf"/>
+ </manifest>
</war>
<!-- jaxws-cxf-descriptor -->
@@ -72,6 +81,9 @@
<webinf dir="${tests.output.dir}/test-resources/jaxws/cxf/descriptor/WEB-INF">
<include name="jbossws-cxf.xml"/>
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.apache.cxf"/>
+ </manifest>
</war>
<!-- jaxws-cxf-interop-wstrust10-client -->
Modified: stack/cxf/branches/asoldano/modules/testsuite/cxf-spring-tests/scripts/cxf-samples-jaxws.xml
===================================================================
--- stack/cxf/branches/asoldano/modules/testsuite/cxf-spring-tests/scripts/cxf-samples-jaxws.xml 2011-04-11 10:40:05 UTC (rev 14049)
+++ stack/cxf/branches/asoldano/modules/testsuite/cxf-spring-tests/scripts/cxf-samples-jaxws.xml 2011-04-11 11:11:38 UTC (rev 14050)
@@ -108,6 +108,9 @@
<include name="bob.jks" />
<include name="bob.properties" />
</zipfileset>
+ <manifest>
+ <attribute name="Dependencies" value="org.apache.ws.security"/>
+ </manifest>
</war>
<!-- jaxws-samples-wsse-sign-client -->
@@ -135,6 +138,9 @@
<include name="bob.jks" />
<include name="bob.properties" />
</zipfileset>
+ <manifest>
+ <attribute name="Dependencies" value="org.apache.ws.security"/>
+ </manifest>
</war>
<!-- jaxws-samples-wsse-sign-encrypt-client -->
@@ -158,6 +164,9 @@
<include name="jbossws-cxf.xml"/>
<include name="wsdl/*"/>
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.apache.ws.security"/>
+ </manifest>
</war>
<!-- jaxws-samples-wsse-username-authorize -->
@@ -260,6 +269,9 @@
<include name="bob.jks" />
<include name="bob.properties" />
</zipfileset>
+ <manifest>
+ <attribute name="Dependencies" value="org.apache.ws.security"/>
+ </manifest>
</war>
<!-- jaxws-samples-wssePolicy-sign-client -->
@@ -287,6 +299,9 @@
<include name="bob.jks" />
<include name="bob.properties" />
</zipfileset>
+ <manifest>
+ <attribute name="Dependencies" value="org.apache.ws.security"/>
+ </manifest>
</war>
<!-- jaxws-samples-wssePolicy-sign-encrypt-client -->
@@ -310,6 +325,9 @@
<include name="jbossws-cxf.xml"/>
<include name="wsdl/*"/>
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.apache.ws.security"/>
+ </manifest>
</war>
<!-- Please add alphabetically -->
13 years
JBossWS SVN: r14049 - in stack/cxf/branches/asoldano/modules: testsuite/cxf-tests/scripts and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-04-11 06:40:05 -0400 (Mon, 11 Apr 2011)
New Revision: 14049
Modified:
stack/cxf/branches/asoldano/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
stack/cxf/branches/asoldano/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
Log:
Fixing remaining non-spring testsuite failures
Modified: stack/cxf/branches/asoldano/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
===================================================================
--- stack/cxf/branches/asoldano/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java 2011-04-09 03:25:54 UTC (rev 14048)
+++ stack/cxf/branches/asoldano/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java 2011-04-11 10:40:05 UTC (rev 14049)
@@ -71,7 +71,10 @@
String jbosswsCxfXml = contextParams == null ? null : contextParams.get(BusHolder.PARAM_CXF_BEANS_URL);
BusHolder holder = null;
- //set the runtime classloader (pointing to the deployment unit) to allow CXF accessing to the classes
+ //set the runtime classloader (pointing to the deployment unit) to allow CXF accessing to the classes;
+ //use origClassLoader (which on AS7 is set to ASIL aggregation module's classloader by TCCLDeploymentProcessClassLoader) as
+ //parent to make sure user provided libs in the deployment do no mess up the WS endpoint's deploy if they duplicates
+ //libraries already available on the application server modules.
SecurityActions.setContextClassLoader(new DelegateClassLoader(dep.getRuntimeClassLoader(), origClassLoader));
if (jbosswsCxfXml != null) // Spring available
{
Modified: stack/cxf/branches/asoldano/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
===================================================================
--- stack/cxf/branches/asoldano/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2011-04-09 03:25:54 UTC (rev 14048)
+++ stack/cxf/branches/asoldano/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2011-04-11 10:40:05 UTC (rev 14049)
@@ -84,6 +84,9 @@
<classes dir="${tests.output.dir}/test-classes">
<include name="org/jboss/test/ws/jaxws/cxf/gzip/HelloWorld*.class"/>
</classes>
+ <manifest>
+ <attribute name="Dependencies" value="org.apache.cxf"/>
+ </manifest>
</war>
<war warfile="${tests.output.dir}/test-libs/jaxws-cxf-gzip-client.war"
manifest="${tests.output.dir}/test-resources/jaxws/cxf/gzip/META-INF/MANIFEST.MF"
13 years
JBossWS SVN: r14048 - in stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests: src/test/java/org/jboss/test/ws/jaxws and 5 other directories.
by jbossws-commits@lists.jboss.org
Author: bmaxwell
Date: 2011-04-08 23:25:54 -0400 (Fri, 08 Apr 2011)
New Revision: 14048
Added:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2901/
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2901/Endpoint.java
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2901/EndpointImpl.java
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2901/JBWS2901TestCase.java
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2901/
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2901/WEB-INF/
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2901/WEB-INF/web.xml
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2901/WEB-INF/wsdl/
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2901/WEB-INF/wsdl/service.wsdl
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2901/attack-message-1.xml
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2901/message.xml
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2901/passwd
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml
Log:
[JBPAPP-6242][JBPAPP-6243] adding test case for JBWS-2901
Modified: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml 2011-04-09 02:44:41 UTC (rev 14047)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml 2011-04-09 03:25:54 UTC (rev 14048)
@@ -630,6 +630,20 @@
<include name="jboss-web.xml"/>
</webinf>
</war>
+
+ <!-- jaxws-jbws2901 -->
+ <war destfile="${tests.output.dir}/test-libs/jaxws-jbws2901.war" webxml="${tests.output.dir}/test-resources/jaxws/jbws2901/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/test-classes">
+ <include name="org/jboss/test/ws/jaxws/jbws2901/Endpoint.class"/>
+ <include name="org/jboss/test/ws/jaxws/jbws2901/EndpointImpl.class"/>
+ </classes>
+ <webinf dir="${tests.output.dir}/test-resources/jaxws/jbws2901/WEB-INF">
+ <include name="wsdl/service.wsdl"/>
+ </webinf>
+ <fileset dir="${tests.output.dir}/test-resources/jaxws/jbws2901">
+ <include name="passwd" />
+ </fileset>
+ </war>
<!-- jaxws-jbws2927 -->
<war warfile="${tests.output.dir}/test-libs/jaxws-jbws2927.war" webxml="${tests.output.dir}/test-resources/jaxws/jbws2927/WEB-INF/web.xml">
Added: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2901/Endpoint.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2901/Endpoint.java (rev 0)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2901/Endpoint.java 2011-04-09 03:25:54 UTC (rev 14048)
@@ -0,0 +1,34 @@
+/*
+ * 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.jbws2901;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+@WebService (name="Endpoint")
+@SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
+public interface Endpoint
+{
+ @WebMethod(operationName = "echoString", action = "urn:EchoString")
+ String echo(String input);
+}
Added: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2901/EndpointImpl.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2901/EndpointImpl.java (rev 0)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2901/EndpointImpl.java 2011-04-09 03:25:54 UTC (rev 14048)
@@ -0,0 +1,39 @@
+/*
+ * 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.jbws2901;
+
+import javax.jws.WebService;
+
+@WebService
+(
+ portName = "EndpointPort",
+ serviceName = "EndpointService",
+ wsdlLocation = "WEB-INF/wsdl/service.wsdl",
+ endpointInterface = "org.jboss.test.ws.jaxws.jbws2901.Endpoint"
+)
+public class EndpointImpl
+{
+ public String echo(String msg)
+ {
+ return msg;
+ }
+}
Added: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2901/JBWS2901TestCase.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2901/JBWS2901TestCase.java (rev 0)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2901/JBWS2901TestCase.java 2011-04-09 03:25:54 UTC (rev 14048)
@@ -0,0 +1,98 @@
+/**
+ *
+ */
+package org.jboss.test.ws.jaxws.jbws2901;
+
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import junit.framework.Test;
+
+import org.jboss.wsf.common.IOUtils;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+import org.jboss.test.ws.jaxws.jbws2901.Endpoint;
+/**
+ * [JBWS-2901] Disable XML external entity resolver
+ *
+ * @author <a href="mailto:bmaxwell@redhat.com">Brad Maxwell</a>
+ *
+ */
+public class JBWS2901TestCase extends JBossWSTest
+{
+ private String endpointURL = "http://" + getServerHost() + ":8080/jaxws-jbws2901/TestService";
+ private String targetNS = "http://jbws2901.jaxws.ws.test.jboss.org/";
+ private String passwdContents = "root:x:0:0:root:/root:/bin/bash";
+
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(JBWS2901TestCase.class, "jaxws-jbws2901.war");
+ }
+
+ public void testLegalAccess() throws Exception
+ {
+ URL wsdlURL = new URL(endpointURL + "?wsdl");
+ QName serviceName = new QName(targetNS, "EndpointService");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ Endpoint port = (Endpoint)service.getPort(Endpoint.class);
+
+ Object retObj = port.echo("Hello");
+ assertEquals("Hello", retObj);
+ }
+
+ public void testSOAPMessage() throws Exception
+ {
+ String response = getResponse("jaxws/jbws2901/message.xml");
+ assertTrue(response.contains("HTTP/1.1 200 OK"));
+ assertTrue(response.contains("<return>Hello</return>"));
+ }
+
+ public void testSOAPMessageAttack1() throws Exception
+ {
+ String response = getResponse("jaxws/jbws2901/attack-message-1.xml");
+ assertFalse(response.contains(passwdContents));
+ }
+
+ private String getResponse(String requestFile) throws Exception
+ {
+ final String CRNL = "\r\n";
+ String content = getContent(new FileInputStream(getResourceFile(requestFile)));
+ Socket socket = new Socket();
+ socket.connect(new InetSocketAddress(getServerHost(), 8080));
+ OutputStream out = socket.getOutputStream();
+
+ // send an HTTP request to the endpoint
+ out.write(("POST /jaxws-jbws2901/TestService HTTP/1.0" + CRNL).getBytes());
+ out.write(("Host: " + getServerHost() + ":8080" + CRNL).getBytes());
+ out.write(("Content-Type: text/xml" + CRNL).getBytes());
+ out.write(("Content-Length: " + content.length() + CRNL).getBytes());
+ out.write((CRNL).getBytes());
+ out.write((content).getBytes());
+
+ // read the response
+ String response = getContent(socket.getInputStream());
+ socket.close();
+ System.out.println("---");
+ System.out.println(response);
+ System.out.println("---");
+ return response;
+ }
+
+ private static String getContent(InputStream is) throws IOException
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ IOUtils.copyStream(baos, is);
+ return new String(baos.toByteArray());
+ }
+}
Added: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2901/WEB-INF/web.xml
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2901/WEB-INF/web.xml (rev 0)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2901/WEB-INF/web.xml 2011-04-09 03:25:54 UTC (rev 14048)
@@ -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>TestService</servlet-name>
+ <servlet-class>org.jboss.test.ws.jaxws.jbws2901.EndpointImpl</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>TestService</servlet-name>
+ <url-pattern>/TestService</url-pattern>
+ </servlet-mapping>
+
+</web-app>
+
Added: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2901/WEB-INF/wsdl/service.wsdl
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2901/WEB-INF/wsdl/service.wsdl (rev 0)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2901/WEB-INF/wsdl/service.wsdl 2011-04-09 03:25:54 UTC (rev 14048)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions name='EndpointService' targetNamespace='http://jbws2901.jaxws.ws.test.jboss.org/' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://jbws2901.jaxws.ws.test.jboss.org/' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+ <types>
+ <xs:schema targetNamespace='http://jbws2901.jaxws.ws.test.jboss.org/' version='1.0' xmlns:tns='http://jbws2901.jaxws.ws.test.jboss.org/' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
+ <xs:element name='echoString' type='tns:echoString'/>
+ <xs:element name='echoStringResponse' type='tns:echoStringResponse'/>
+ <xs:complexType name='echoString'>
+ <xs:sequence>
+ <xs:element minOccurs='0' name='arg0' type='xs:string'/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name='echoStringResponse'>
+ <xs:sequence>
+ <xs:element minOccurs='0' name='return' type='xs:string'/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:schema>
+ </types>
+ <message name='Endpoint_echoString'>
+ <part element='tns:echoString' name='echoString'/>
+ </message>
+ <message name='Endpoint_echoStringResponse'>
+ <part element='tns:echoStringResponse' name='echoStringResponse'/>
+ </message>
+ <portType name='Endpoint'>
+ <operation name='echoString' parameterOrder='echoString'>
+ <input message='tns:Endpoint_echoString'/>
+ <output message='tns:Endpoint_echoStringResponse'/>
+ </operation>
+ </portType>
+ <binding name='EndpointBinding' type='tns:Endpoint'>
+ <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
+ <operation name='echoString'>
+ <soap:operation soapAction='urn:EchoString'/>
+ <input>
+ <soap:body use='literal'/>
+ </input>
+ <output>
+ <soap:body use='literal'/>
+ </output>
+ </operation>
+ </binding>
+ <service name='EndpointService'>
+ <port binding='tns:EndpointBinding' name='EndpointPort'>
+ <soap:address location='REPLACE_WITH_ACTUAL_URL'/>
+ </port>
+ </service>
+</definitions>
\ No newline at end of file
Added: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2901/attack-message-1.xml
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2901/attack-message-1.xml (rev 0)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2901/attack-message-1.xml 2011-04-09 03:25:54 UTC (rev 14048)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<!DOCTYPE x[
+<!ENTITY showme SYSTEM "http://localhost:8080/jaxws-jbws2901/passwd">
+]
+>
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:jbw="http://jbws2901.jaxws.ws.test.jboss.org/">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <jbw:echoString>
+ <!--Optional:-->
+ <arg0>&showme;</arg0>
+ </jbw:echoString>
+ </soapenv:Body>
+</soapenv:Envelope>
Added: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2901/message.xml
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2901/message.xml (rev 0)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2901/message.xml 2011-04-09 03:25:54 UTC (rev 14048)
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:jbw="http://jbws2901.jaxws.ws.test.jboss.org/">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <jbw:echoString>
+ <!--Optional:-->
+ <arg0>Hello</arg0>
+ </jbw:echoString>
+ </soapenv:Body>
+</soapenv:Envelope>
Added: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2901/passwd
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2901/passwd (rev 0)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbws2901/passwd 2011-04-09 03:25:54 UTC (rev 14048)
@@ -0,0 +1 @@
+root:x:0:0:root:/root:/bin/bash
13 years, 1 month
JBossWS SVN: r14047 - stack/native/branches/jbossws-native-3.1.2.SP7_JBPAPP-6163/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1988.
by jbossws-commits@lists.jboss.org
Author: bmaxwell
Date: 2011-04-08 22:44:41 -0400 (Fri, 08 Apr 2011)
New Revision: 14047
Modified:
stack/native/branches/jbossws-native-3.1.2.SP7_JBPAPP-6163/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1988/DigestTestCase.java
Log:
[JBPAPP-6163] updated test case from JBWS3014
Modified: stack/native/branches/jbossws-native-3.1.2.SP7_JBPAPP-6163/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1988/DigestTestCase.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2.SP7_JBPAPP-6163/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1988/DigestTestCase.java 2011-04-08 15:52:55 UTC (rev 14046)
+++ stack/native/branches/jbossws-native-3.1.2.SP7_JBPAPP-6163/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1988/DigestTestCase.java 2011-04-09 02:44:41 UTC (rev 14047)
@@ -37,14 +37,14 @@
String password = "taadtaadpstcsm";
String nonce = "d36e316282959a9ed4c89851497a717f";
String created = "2003-12-15T14:43:07Z";
- String expectedDigest = "quR/EWLAV4xLf9Zqyw4pDmfV9OY=";
+ String expectedDigest = "0WSAldY9ogqqVyQo7ubbZxxFU/s=";
String digest = SendUsernameOperation.createPasswordDigest(nonce, created, password);
assertEquals(expectedDigest, digest);
password = "therealfrog";
nonce = "gHGIdDEWjX1Ay/LiVd3qJ1ua8VbjXis8CJwNDQh1ySA=";
created = "2008-03-12T17:12:31.310Z";
- expectedDigest = "IEeuDaP/NTozwiyJHzTgBoCCDjg=";
+ expectedDigest = "gx8TcJ9VG2hOFC6ZFmNi/JI2rh4=";
digest = SendUsernameOperation.createPasswordDigest(nonce, created, password);
assertEquals(expectedDigest, digest);
}
@@ -53,7 +53,7 @@
{
String password = "therealfrog";
String nonce = "gHGIdDEWjX1Ay/LiVd3qJ1ua8VbjXis8CJwNDQh1ySA=";
- String expectedDigest = "sdA2umjMZQEY2ejbt5L6WbJOrB0=";
+ String expectedDigest = "MBqDfskkdh3eEtRlLdkWa79+w58=";
String digest = SendUsernameOperation.createPasswordDigest(nonce, null, password);
assertEquals(expectedDigest, digest);
}
13 years, 1 month
JBossWS SVN: r14046 - stack/cxf/branches/asoldano/modules/resources/src/main/resources/modules/org/jboss/ws/api/main.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-04-08 11:52:55 -0400 (Fri, 08 Apr 2011)
New Revision: 14046
Modified:
stack/cxf/branches/asoldano/modules/resources/src/main/resources/modules/org/jboss/ws/api/main/module.xml
Log:
Adding dependencies on jbossws-api (jboss-modules and saaj stuff)
Modified: stack/cxf/branches/asoldano/modules/resources/src/main/resources/modules/org/jboss/ws/api/main/module.xml
===================================================================
--- stack/cxf/branches/asoldano/modules/resources/src/main/resources/modules/org/jboss/ws/api/main/module.xml 2011-04-08 15:52:49 UTC (rev 14045)
+++ stack/cxf/branches/asoldano/modules/resources/src/main/resources/modules/org/jboss/ws/api/main/module.xml 2011-04-08 15:52:55 UTC (rev 14046)
@@ -30,6 +30,9 @@
<dependencies>
<module name="javax.api"/>
+ <module name="com.sun.xml.messaging.saaj" services="export" export="true"/>
+ <module name="javax.xml.ws.api"/>
<module name="org.jboss.logging"/>
+ <module name="org.jboss.modules"/>
</dependencies>
</module>
13 years, 1 month
JBossWS SVN: r14045 - in shared-testsuite/branches/asoldano/src/test: java/org/jboss/test and 13 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-04-08 11:52:49 -0400 (Fri, 08 Apr 2011)
New Revision: 14045
Added:
shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/helper/
shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/helper/DOMWriter.java
Modified:
shared-testsuite/branches/asoldano/src/test/ant-import/build-jars-jaxws.xml
shared-testsuite/branches/asoldano/src/test/ant-import/build-samples-jaxws.xml
shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxrpc/samples/message/MessageTestCase.java
shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxrpc/samples/message/MessageTestServiceBean.java
shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointServlet.java
shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/jbws1807/ProviderImpl.java
shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/jbws1815/JBWS1815TestCase.java
shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/jbws2960/JBWS2960TestCase.java
shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/namespace/CustomHandler.java
shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/addressing/AddressingPort.java
shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/addressing/ServerHandler.java
shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointEJB.java
shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointJSE.java
shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/httpbinding/LogicalSourceHandler.java
shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java
shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/logicalhandler/LogicalSourceHandler.java
shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/provider/LogicalSourceHandler.java
shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/provider/ProviderBeanPayload.java
shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java
Log:
Updating testcases for supporting new client classpath without ws impl classes
Modified: shared-testsuite/branches/asoldano/src/test/ant-import/build-jars-jaxws.xml
===================================================================
--- shared-testsuite/branches/asoldano/src/test/ant-import/build-jars-jaxws.xml 2011-04-08 15:50:13 UTC (rev 14044)
+++ shared-testsuite/branches/asoldano/src/test/ant-import/build-jars-jaxws.xml 2011-04-08 15:52:49 UTC (rev 14045)
@@ -378,6 +378,7 @@
<war warfile="${tests.output.dir}/test-libs/jaxws-jbws1807.war" webxml="${tests.output.dir}/test-resources/jaxws/jbws1807/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/test-classes">
<include name="org/jboss/test/ws/jaxws/jbws1807/ProviderImpl.class" />
+ <include name="org/jboss/test/helper/DOMWriter.class" />
</classes>
<webinf dir="${tests.output.dir}/test-resources/jaxws/jbws1807/WEB-INF">
<include name="wsdl/**" />
@@ -1083,6 +1084,7 @@
<include name="org/jboss/test/ws/jaxws/namespace/EndpointBean.class" />
<include name="org/jboss/test/ws/jaxws/namespace/EndpointInterface.class" />
<include name="org/jboss/test/ws/jaxws/namespace/*.xml" />
+ <include name="org/jboss/test/helper/DOMWriter.class" />
</classes>
<webinf dir="${tests.output.dir}/test-resources/jaxws/namespace/WEB-INF">
<include name="jboss-web.xml" />
Modified: shared-testsuite/branches/asoldano/src/test/ant-import/build-samples-jaxws.xml
===================================================================
--- shared-testsuite/branches/asoldano/src/test/ant-import/build-samples-jaxws.xml 2011-04-08 15:50:13 UTC (rev 14044)
+++ shared-testsuite/branches/asoldano/src/test/ant-import/build-samples-jaxws.xml 2011-04-08 15:52:49 UTC (rev 14045)
@@ -175,6 +175,9 @@
<include name="org/jboss/test/ws/jaxws/samples/logicalhandler/ObjectFactory.class"/>
<include name="org/jboss/test/ws/jaxws/samples/logicalhandler/jaxws-server-jaxb-handlers.xml"/>
</classes>
+ <manifest>
+ <attribute name="Dependencies" value="com.sun.xml.bind export services"/>
+ </manifest>
</war>
<!-- jaxws-samples-oneway -->
Added: shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/helper/DOMWriter.java
===================================================================
--- shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/helper/DOMWriter.java (rev 0)
+++ shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/helper/DOMWriter.java 2011-04-08 15:52:49 UTC (rev 14045)
@@ -0,0 +1,671 @@
+/*
+ * ====================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache(a)apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+package org.jboss.test.helper;
+
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Traverse a DOM tree in order to print a document that is parsed.
+ *
+ * @author Andy Clark, IBM
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:mvecera@redhat.com">Martin Vecera</a>
+ * @author <a href="mailto:alessio.soldano@jboss.com">Alessio Soldano</a>
+ */
+@SuppressWarnings("unchecked")
+public class DOMWriter
+{
+ private static final Pattern PATTERN = Pattern.compile("[&<>'\"\r\n]");
+ // Print writer
+ private PrintWriter out;
+ // True, if canonical output
+ private boolean canonical;
+ // True, if pretty printing should be used
+ private boolean prettyprint;
+ // True, if the XML declaration should be written
+ private boolean writeXMLDeclaration;
+ // True, if whitespace should be ignored
+ private boolean ignoreWhitespace;
+ // Explicit character set encoding
+ private String charsetName;
+ // indent for the pretty printer
+ private int prettyIndent;
+ // True, if the XML declaration has been written
+ private boolean wroteXMLDeclaration;
+ // The node that started the write
+ private Node rootNode;
+ // True if we want namespace completion
+ private boolean completeNamespaces = true;
+ // The current default namespace
+ private String currentDefaultNamespace;
+
+ public DOMWriter(Writer w)
+ {
+ this.out = new PrintWriter(w);
+ }
+
+ public DOMWriter(Writer w, String charsetName)
+ {
+ this.out = new PrintWriter(w);
+ this.charsetName = charsetName;
+ this.writeXMLDeclaration = true;
+ }
+
+ public DOMWriter(OutputStream stream)
+ {
+ try
+ {
+ this.out = new PrintWriter(new OutputStreamWriter(stream, "UTF-8"));
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ // ignore, UTF-8 should be available
+ }
+ }
+
+ public DOMWriter(OutputStream stream, String charsetName)
+ {
+ try
+ {
+ this.out = new PrintWriter(new OutputStreamWriter(stream, charsetName));
+ this.charsetName = charsetName;
+ this.writeXMLDeclaration = true;
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ throw new IllegalArgumentException("Unsupported encoding: " + charsetName);
+ }
+ }
+
+ /**
+ * Print a node with explicit prettyprinting.
+ * The defaults for all other DOMWriter properties apply.
+ *
+ */
+ public static String printNode(Node node, boolean prettyprint)
+ {
+ StringWriter strw = new StringWriter();
+ new DOMWriter(strw).setPrettyprint(prettyprint).print(node);
+ return strw.toString();
+ }
+
+ public boolean isCanonical()
+ {
+ return canonical;
+ }
+
+ /**
+ * Set wheter entities should appear in their canonical form.
+ * The default is false.
+ */
+ public DOMWriter setCanonical(boolean canonical)
+ {
+ this.canonical = canonical;
+ return this;
+ }
+
+ public boolean isIgnoreWhitespace()
+ {
+ return ignoreWhitespace;
+ }
+
+ /**
+ * Set whether whitespace should be ignored.
+ * The default is false.
+ */
+ public DOMWriter setIgnoreWhitespace(boolean ignoreWhitespace)
+ {
+ this.ignoreWhitespace = ignoreWhitespace;
+ return this;
+ }
+
+ /**
+ * Set wheter subelements should have their namespaces completed.
+ * Setting this to false may lead to invalid XML fragments.
+ * The default is true.
+ */
+ public DOMWriter setCompleteNamespaces(boolean complete)
+ {
+ this.completeNamespaces = complete;
+ return this;
+ }
+
+ public boolean isPrettyprint()
+ {
+ return prettyprint;
+ }
+
+ /**
+ * Set wheter element should be indented.
+ * The default is false.
+ */
+ public DOMWriter setPrettyprint(boolean prettyprint)
+ {
+ this.prettyprint = prettyprint;
+ return this;
+ }
+
+ public boolean isWriteXMLDeclaration()
+ {
+ return writeXMLDeclaration;
+ }
+
+ /**
+ * Set wheter the XML declaration should be written.
+ * The default is false.
+ */
+ public DOMWriter setWriteXMLDeclaration(boolean flag)
+ {
+ this.writeXMLDeclaration = flag;
+ return this;
+ }
+
+ public void print(Node node)
+ {
+ if (prettyprint && ignoreWhitespace)
+ throw new IllegalStateException("Cannot pretty print and ignore whitespace");
+
+ rootNode = node;
+ printInternal(node, false);
+ }
+
+ private void printInternal(Node node, boolean indentEndMarker)
+ {
+ // is there anything to do?
+ if (node == null)
+ {
+ return;
+ }
+
+ // JBAS-2117 - Don't skip the DOCUMENT_NODE
+ // if (node instanceof Document) node = ((Document)node).getDocumentElement();
+
+ if (wroteXMLDeclaration == false && writeXMLDeclaration == true && canonical == false)
+ {
+ out.print("<?xml version='1.0'");
+ if (charsetName != null)
+ out.print(" encoding='" + charsetName + "'");
+
+ out.print("?>");
+ if (prettyprint)
+ out.println();
+
+ wroteXMLDeclaration = true;
+ }
+
+ int type = node.getNodeType();
+ boolean hasChildNodes = node.getChildNodes().getLength() > 0;
+
+ String nodeName = node.getNodeName();
+ switch (type)
+ {
+ // print document
+ case Node.DOCUMENT_NODE:
+ {
+ NodeList children = node.getChildNodes();
+ int len = children.getLength();
+ for (int iChild = 0; iChild < len; iChild++)
+ {
+ printInternal(children.item(iChild), false);
+ }
+ out.flush();
+ break;
+ }
+
+ // print element with attributes
+ case Node.ELEMENT_NODE:
+ {
+ Element element = (Element)node;
+ if (prettyprint)
+ {
+ for (int i = 0; i < prettyIndent; i++)
+ {
+ out.print(' ');
+ }
+ prettyIndent++;
+ }
+
+ out.print('<');
+ out.print(nodeName);
+
+ Map nsMap = new HashMap();
+ String elPrefix = node.getPrefix();
+ String elNamespaceURI = node.getNamespaceURI();
+ if (elPrefix != null)
+ {
+ String nsURI = getNamespaceURI(elPrefix, element, rootNode);
+ nsMap.put(elPrefix, nsURI);
+ }
+
+ Attr attrs[] = sortAttributes(node.getAttributes());
+ for (int i = 0; i < attrs.length; i++)
+ {
+ Attr attr = attrs[i];
+ String atPrefix = attr.getPrefix();
+ String atName = attr.getNodeName();
+ String atValue = normalize(attr.getNodeValue(), canonical);
+
+ if (atName.equals("xmlns"))
+ currentDefaultNamespace = atValue;
+
+ if (atPrefix != null && !atPrefix.equals("xmlns") && !atPrefix.equals("xml"))
+ {
+ String nsURI = getNamespaceURI(atPrefix, element, rootNode);
+ nsMap.put(atPrefix, nsURI);
+ // xsi:type='ns1:SubType', xsi:type='xsd:string'
+ if (atName.equals(atPrefix + ":type") && atValue.indexOf(":") > 0)
+ {
+ // xsi defined on the envelope
+ if (nsURI == null)
+ nsURI = getNamespaceURI(atPrefix, element, null);
+
+ if ("http://www.w3.org/2001/XMLSchema-instance".equals(nsURI))
+ {
+ String typePrefix = atValue.substring(0, atValue.indexOf(":"));
+ String typeURI = getNamespaceURI(typePrefix, element, rootNode);
+ nsMap.put(typePrefix, typeURI);
+ }
+ }
+ }
+
+ out.print(" " + atName + "='" + atValue + "'");
+ }
+
+ // Add namespace declaration for prefixes
+ // that are defined further up the tree
+ if (completeNamespaces)
+ {
+ Iterator itPrefix = nsMap.keySet().iterator();
+ while (itPrefix.hasNext())
+ {
+ String prefix = (String)itPrefix.next();
+ String nsURI = (String)nsMap.get(prefix);
+ if (nsURI == null)
+ {
+ nsURI = getNamespaceURI(prefix, element, null);
+ out.print(" xmlns:" + prefix + "='" + nsURI + "'");
+ }
+ }
+ }
+
+ // The SAX ContentHandler will by default not add the namespace declaration
+ // <Hello xmlns='http://somens'>World</Hello>
+ if (elPrefix == null && elNamespaceURI != null)
+ {
+ String defaultNamespace = element.getAttribute("xmlns");
+ if (defaultNamespace.length() == 0 && !elNamespaceURI.equals(currentDefaultNamespace))
+ {
+ out.print(" xmlns='" + elNamespaceURI + "'");
+ currentDefaultNamespace = elNamespaceURI;
+ }
+ }
+
+ if (hasChildNodes)
+ {
+ out.print('>');
+ }
+
+ // Find out if the end marker is indented
+ indentEndMarker = isEndMarkerIndented(node);
+
+ if (indentEndMarker)
+ {
+ out.print('\n');
+ }
+
+ NodeList childNodes = node.getChildNodes();
+ int len = childNodes.getLength();
+ for (int i = 0; i < len; i++)
+ {
+ Node childNode = childNodes.item(i);
+ printInternal(childNode, false);
+ }
+ break;
+ }
+
+ // handle entity reference nodes
+ case Node.ENTITY_REFERENCE_NODE:
+ {
+ if (canonical)
+ {
+ NodeList children = node.getChildNodes();
+ if (children != null)
+ {
+ int len = children.getLength();
+ for (int i = 0; i < len; i++)
+ {
+ printInternal(children.item(i), false);
+ }
+ }
+ }
+ else
+ {
+ out.print('&');
+ out.print(nodeName);
+ out.print(';');
+ }
+ break;
+ }
+
+ // print cdata sections
+ case Node.CDATA_SECTION_NODE:
+ {
+ if (canonical)
+ {
+ out.print(normalize(node.getNodeValue(), canonical));
+ }
+ else
+ {
+ out.print("<![CDATA[");
+ out.print(node.getNodeValue());
+ out.print("]]>");
+ }
+ break;
+ }
+
+ // print text
+ case Node.TEXT_NODE:
+ {
+ String text = normalize(node.getNodeValue(), canonical);
+ if (text.trim().length() > 0)
+ {
+ out.print(text);
+ }
+ else if (prettyprint == false && ignoreWhitespace == false)
+ {
+ out.print(text);
+ }
+ break;
+ }
+
+ // print processing instruction
+ case Node.PROCESSING_INSTRUCTION_NODE:
+ {
+ out.print("<?");
+ out.print(nodeName);
+ String data = node.getNodeValue();
+ if (data != null && data.length() > 0)
+ {
+ out.print(' ');
+ out.print(data);
+ }
+ out.print("?>");
+ break;
+ }
+
+ // print comment
+ case Node.COMMENT_NODE:
+ {
+ for (int i = 0; i < prettyIndent; i++)
+ {
+ out.print(' ');
+ }
+
+ out.print("<!--");
+ String data = node.getNodeValue();
+ if (data != null)
+ {
+ out.print(data);
+ }
+ out.print("-->");
+
+ if (prettyprint)
+ {
+ out.print('\n');
+ }
+
+ break;
+ }
+ }
+
+ if (type == Node.ELEMENT_NODE)
+ {
+ if (prettyprint)
+ prettyIndent--;
+
+ if (hasChildNodes == false)
+ {
+ out.print("/>");
+ }
+ else
+ {
+ if (indentEndMarker)
+ {
+ for (int i = 0; i < prettyIndent; i++)
+ {
+ out.print(' ');
+ }
+ }
+
+ out.print("</");
+ out.print(nodeName);
+ out.print('>');
+ }
+
+ if (prettyIndent > 0)
+ {
+ out.print('\n');
+ }
+ }
+ out.flush();
+ }
+
+ private String getNamespaceURI(String prefix, Element element, Node stopNode)
+ {
+ Node parent = element.getParentNode();
+ String nsURI = element.getAttribute("xmlns:" + prefix);
+ if (nsURI.length() == 0 && element != stopNode && parent instanceof Element)
+ return getNamespaceURI(prefix, (Element)parent, stopNode);
+
+ return (nsURI.length() > 0 ? nsURI : null);
+ }
+
+ private boolean isEndMarkerIndented(Node node)
+ {
+ if (prettyprint)
+ {
+ NodeList childNodes = node.getChildNodes();
+ int len = childNodes.getLength();
+ for (int i = 0; i < len; i++)
+ {
+ Node children = childNodes.item(i);
+ if (children.getNodeType() == Node.ELEMENT_NODE)
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /** Returns a sorted list of attributes. */
+ private Attr[] sortAttributes(NamedNodeMap attrs)
+ {
+
+ int len = (attrs != null) ? attrs.getLength() : 0;
+ Attr array[] = new Attr[len];
+ for (int i = 0; i < len; i++)
+ {
+ array[i] = (Attr)attrs.item(i);
+ }
+ for (int i = 0; i < len - 1; i++)
+ {
+ String name = array[i].getNodeName();
+ int index = i;
+ for (int j = i + 1; j < len; j++)
+ {
+ String curName = array[j].getNodeName();
+ if (curName.compareTo(name) < 0)
+ {
+ name = curName;
+ index = j;
+ }
+ }
+ if (index != i)
+ {
+ Attr temp = array[i];
+ array[i] = array[index];
+ array[index] = temp;
+ }
+ }
+ return (array);
+ }
+
+ /** Normalizes the given string. */
+ public static String normalize(String strValue, boolean canonical)
+ {
+ Matcher m = PATTERN.matcher(strValue);
+ if (m.find())
+ {
+ int pos = m.start(); // we can use previous match to skip some part at the string beginning
+ int len = strValue.length(); // just a single call to length()
+ char[] input = new char[len]; // this is to ommit calls to String.charAt()
+ strValue.getChars(0, len, input, 0);
+ StringBuilder sb = new StringBuilder(len * 3); // faster than StringBuffer, not thread safe
+
+ int copyStart = 0;
+
+ for (int i = pos; i < len; i++)
+ {
+ char ch = input[i];
+ switch (ch)
+ {
+ case '<' :
+ if (copyStart < i)
+ {
+ sb.append(input, copyStart, i - copyStart);
+ }
+ copyStart = i + 1;
+ sb.append("<");
+ break;
+ case '>' :
+ if (copyStart < i)
+ {
+ sb.append(input, copyStart, i - copyStart);
+ }
+ copyStart = i + 1;
+ sb.append(">");
+ break;
+ case '"' :
+ if (copyStart < i)
+ {
+ sb.append(input, copyStart, i - copyStart);
+ }
+ copyStart = i + 1;
+ sb.append(""");
+ break;
+ case '\'' :
+ if (copyStart < i)
+ {
+ sb.append(input, copyStart, i - copyStart);
+ }
+ copyStart = i + 1;
+ sb.append("'");
+ break;
+ case '&' :
+ if (copyStart < i)
+ {
+ sb.append(input, copyStart, i - copyStart);
+ }
+ copyStart = i + 1;
+ sb.append("&");
+ break;
+ case '\r' :
+ case '\n' :
+ if (canonical)
+ {
+ if (copyStart < i)
+ {
+ sb.append(input, copyStart, i - copyStart);
+ }
+ copyStart = i + 1;
+ sb.append("&#");
+ sb.append(Integer.toString(ch));
+ sb.append(';');
+ break;
+ }
+
+ }
+ }
+ if (copyStart < len)
+ {
+ sb.append(input, copyStart, len - copyStart);
+ }
+
+ return sb.toString();
+ }
+ else
+ {
+ return strValue;
+ }
+ }
+}
Modified: shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxrpc/samples/message/MessageTestCase.java
===================================================================
--- shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxrpc/samples/message/MessageTestCase.java 2011-04-08 15:50:13 UTC (rev 14044)
+++ shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxrpc/samples/message/MessageTestCase.java 2011-04-08 15:52:49 UTC (rev 14045)
@@ -48,7 +48,7 @@
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestSetup;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified: shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxrpc/samples/message/MessageTestServiceBean.java
===================================================================
--- shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxrpc/samples/message/MessageTestServiceBean.java 2011-04-08 15:50:13 UTC (rev 14044)
+++ shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxrpc/samples/message/MessageTestServiceBean.java 2011-04-08 15:52:49 UTC (rev 14045)
@@ -35,7 +35,7 @@
import javax.xml.transform.dom.DOMSource;
import org.jboss.logging.Logger;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import org.jboss.wsf.common.DOMWriter;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified: shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointServlet.java
===================================================================
--- shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointServlet.java 2011-04-08 15:50:13 UTC (rev 14044)
+++ shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointServlet.java 2011-04-08 15:52:49 UTC (rev 14045)
@@ -30,7 +30,10 @@
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.ws.Endpoint;
import javax.xml.ws.EndpointReference;
import javax.xml.ws.Service;
@@ -38,7 +41,7 @@
import javax.xml.ws.wsaddressing.W3CEndpointReference;
import org.jboss.logging.Logger;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -51,7 +54,6 @@
@SuppressWarnings("serial")
public class EndpointServlet extends HttpServlet
{
-
private Endpoint endpoint1;
private Endpoint endpoint2;
private static final String TEST_ELEMENT = "<fabrikam:CustomerKey xmlns:fabrikam='http://example.com/fabrikam'>123456789</fabrikam:CustomerKey>";
@@ -92,8 +94,9 @@
String retStr = port.echo(param);
//Test epr
- assertEndpointReference(endpoint1.getEndpointReference(DOMUtils.parse(TEST_ELEMENT)), TEST_ELEMENT);
- assertEndpointReference(endpoint1.getEndpointReference(W3CEndpointReference.class, (Element[])null), null);
+ DocumentBuilder builder = getDocumentBuilder();
+ assertEndpointReference(endpoint1.getEndpointReference(DOMUtils.parse(TEST_ELEMENT, builder)), TEST_ELEMENT, builder);
+ assertEndpointReference(endpoint1.getEndpointReference(W3CEndpointReference.class, (Element[])null), null, builder);
// Return the result
PrintWriter pw = new PrintWriter(res.getWriter());
@@ -101,11 +104,11 @@
pw.close();
}
- private void assertEndpointReference(EndpointReference epr, String refPar) throws IOException
+ private void assertEndpointReference(EndpointReference epr, String refPar, DocumentBuilder builder) throws IOException
{
Logger.getLogger(this.getClass()).info("epr: "+epr);
assert(W3CEndpointReference.class.getName().equals(epr.getClass().getName()));
- Element endpointReference = DOMUtils.parse(epr.toString());
+ Element endpointReference = DOMUtils.parse(epr.toString(), builder);
assert("EndpointReference".equals(endpointReference.getNodeName()));
assert("http://www.w3.org/2005/08/addressing".equals(endpointReference.getAttribute("xmlns")));
NodeList addresses = endpointReference.getElementsByTagName("Address");
@@ -116,4 +119,23 @@
assert(epr.toString().contains(refPar));
}
}
+
+ private DocumentBuilder getDocumentBuilder()
+ {
+ DocumentBuilderFactory factory = null;
+ try
+ {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ factory.setExpandEntityReferences(false);
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ return builder;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create document builder", e);
+ }
+ }
}
Modified: shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/jbws1807/ProviderImpl.java
===================================================================
--- shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/jbws1807/ProviderImpl.java 2011-04-08 15:50:13 UTC (rev 14044)
+++ shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/jbws1807/ProviderImpl.java 2011-04-08 15:52:49 UTC (rev 14045)
@@ -24,6 +24,9 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.ws.BindingType;
@@ -34,8 +37,8 @@
import javax.xml.ws.http.HTTPBinding;
import org.jboss.logging.Logger;
-import org.jboss.wsf.common.DOMUtils;
-import org.jboss.wsf.common.DOMWriter;
+import org.jboss.test.helper.DOMWriter;
+import org.jboss.wsf.util.DOMUtils;
@WebServiceProvider(wsdlLocation = "WEB-INF/wsdl/provider.wsdl", portName = "ProviderPort", serviceName = "ProviderService", targetNamespace = "http://ws.com/")
@ServiceMode(value = Service.Mode.PAYLOAD)
@@ -49,7 +52,7 @@
{
try
{
- String input = DOMWriter.printNode(DOMUtils.sourceToElement(source), false);
+ String input = DOMWriter.printNode(DOMUtils.sourceToElement(source, getDocumentBuilder()), false);
log.info("invoke: " + input);
String reply = "<reply>" + input + "</reply>";
@@ -60,4 +63,23 @@
throw new RuntimeException(ex);
}
}
+
+ private DocumentBuilder getDocumentBuilder()
+ {
+ DocumentBuilderFactory factory = null;
+ try
+ {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ factory.setExpandEntityReferences(false);
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ return builder;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create document builder", e);
+ }
+ }
}
Modified: shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/jbws1815/JBWS1815TestCase.java
===================================================================
--- shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/jbws1815/JBWS1815TestCase.java 2011-04-08 15:50:13 UTC (rev 14044)
+++ shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/jbws1815/JBWS1815TestCase.java 2011-04-08 15:52:49 UTC (rev 14045)
@@ -25,6 +25,10 @@
import java.io.IOException;
import java.net.URL;
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
import javax.xml.soap.Detail;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPConnection;
@@ -36,7 +40,7 @@
import junit.framework.Test;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestSetup;
import org.w3c.dom.Element;
@@ -69,7 +73,7 @@
public void testWSDLAccess() throws Exception
{
URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
- Element wsdl = DOMUtils.parse(wsdlURL.openStream());
+ Element wsdl = DOMUtils.parse(wsdlURL.openStream(), getDocumentBuilder());
assertNotNull(wsdl);
}
@@ -98,5 +102,24 @@
SOAPMessage reqMsg = msgFactory.createMessage(null, new ByteArrayInputStream(msgString.getBytes()));
return reqMsg;
}
+
+ private DocumentBuilder getDocumentBuilder()
+ {
+ DocumentBuilderFactory factory = null;
+ try
+ {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ factory.setExpandEntityReferences(false);
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ return builder;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create document builder", e);
+ }
+ }
}
Modified: shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/jbws2960/JBWS2960TestCase.java
===================================================================
--- shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/jbws2960/JBWS2960TestCase.java 2011-04-08 15:50:13 UTC (rev 14044)
+++ shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/jbws2960/JBWS2960TestCase.java 2011-04-08 15:52:49 UTC (rev 14045)
@@ -35,7 +35,7 @@
import junit.framework.Assert;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
import org.w3c.dom.Element;
Modified: shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/namespace/CustomHandler.java
===================================================================
--- shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/namespace/CustomHandler.java 2011-04-08 15:50:13 UTC (rev 14044)
+++ shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/namespace/CustomHandler.java 2011-04-08 15:52:49 UTC (rev 14045)
@@ -31,7 +31,7 @@
import javax.xml.ws.handler.soap.SOAPMessageContext;
import org.jboss.logging.Logger;
-import org.jboss.wsf.common.DOMWriter;
+import org.jboss.test.helper.DOMWriter;
/**
* A simple SOAPHandler checking the exchanged message uses the SEI namespace.
Modified: shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/addressing/AddressingPort.java
===================================================================
--- shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/addressing/AddressingPort.java 2011-04-08 15:50:13 UTC (rev 14044)
+++ shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/addressing/AddressingPort.java 2011-04-08 15:52:49 UTC (rev 14045)
@@ -25,12 +25,15 @@
import java.rmi.RemoteException;
import java.util.Map;
+import javax.xml.XMLConstants;
import javax.xml.bind.JAXBElement;
import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.ws.BindingProvider;
import org.jboss.logging.Logger;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import org.jboss.wsf.common.addressing.MAP;
import org.jboss.wsf.common.addressing.MAPBuilder;
import org.jboss.wsf.common.addressing.MAPBuilderFactory;
@@ -109,7 +112,7 @@
}
try
{
- replyTo.addReferenceParameter(DOMUtils.parse(getClientIdElement(clientID)));
+ replyTo.addReferenceParameter(DOMUtils.parse(getClientIdElement(clientID), getDocumentBuilder()));
}
catch (IOException e)
{
@@ -162,4 +165,23 @@
buffer.append(">" + clientid + "</" + qualname + ">");
return buffer.toString();
}
+
+ private static DocumentBuilder getDocumentBuilder()
+ {
+ DocumentBuilderFactory factory = null;
+ try
+ {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ factory.setExpandEntityReferences(false);
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ return builder;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create document builder", e);
+ }
+ }
}
Modified: shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/addressing/ServerHandler.java
===================================================================
--- shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/addressing/ServerHandler.java 2011-04-08 15:50:13 UTC (rev 14044)
+++ shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/addressing/ServerHandler.java 2011-04-08 15:52:49 UTC (rev 14045)
@@ -26,13 +26,14 @@
import javax.xml.ws.handler.MessageContext.Scope;
import org.jboss.logging.Logger;
-import org.jboss.wsf.common.DOMUtils;
import org.jboss.wsf.common.addressing.MAP;
import org.jboss.wsf.common.addressing.MAPBuilder;
import org.jboss.wsf.common.addressing.MAPBuilderFactory;
import org.jboss.wsf.common.addressing.MAPEndpoint;
import org.jboss.wsf.common.handler.GenericSOAPHandler;
import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
/**
* A server side handler for the ws-addressing
@@ -65,10 +66,10 @@
if (obj instanceof Element)
{
Element el = (Element)obj;
- QName qname = DOMUtils.getElementQName(el);
+ QName qname = getElementQName(el);
if (qname.equals(IDQN))
{
- clientid = DOMUtils.getTextContent(el);
+ clientid = getTextContent(el);
}
}
else
@@ -101,4 +102,95 @@
return true;
}
+
+ // ---------------- DOM Util methods -------------------
+
+ /** Get the qname of the given node.
+ */
+ protected static QName getElementQName(Element el)
+ {
+ String qualifiedName = el.getNodeName();
+ return resolveQName(el, qualifiedName);
+ }
+
+ /** Transform the given qualified name into a QName
+ */
+ protected static QName resolveQName(Element el, String qualifiedName)
+ {
+ QName qname;
+ String prefix = "";
+ String namespaceURI = "";
+ String localPart = qualifiedName;
+
+ int colIndex = qualifiedName.indexOf(":");
+ if (colIndex > 0)
+ {
+ prefix = qualifiedName.substring(0, colIndex);
+ localPart = qualifiedName.substring(colIndex + 1);
+
+ if ("xmlns".equals(prefix))
+ {
+ namespaceURI = "URI:XML_PREDEFINED_NAMESPACE";
+ }
+ else
+ {
+ Element nsElement = el;
+ while (namespaceURI.equals("") && nsElement != null)
+ {
+ namespaceURI = nsElement.getAttribute("xmlns:" + prefix);
+ if (namespaceURI.equals(""))
+ nsElement = getParentElement(nsElement);
+ }
+ }
+
+ if (namespaceURI.equals("") && el.getNamespaceURI() != null)
+ {
+ namespaceURI = el.getNamespaceURI();
+ }
+
+ if (namespaceURI.equals(""))
+ throw new IllegalArgumentException("Cannot find namespace uri for: " + qualifiedName);
+ }
+ else
+ {
+ Element nsElement = el;
+ while (namespaceURI.equals("") && nsElement != null)
+ {
+ namespaceURI = nsElement.getAttribute("xmlns");
+ if (namespaceURI.equals(""))
+ nsElement = getParentElement(nsElement);
+ }
+ }
+
+ qname = new QName(namespaceURI, localPart, prefix);
+ return qname;
+ }
+
+ /** Gets parent element or null if there is none
+ */
+ protected static Element getParentElement(Node node)
+ {
+ Node parent = node.getParentNode();
+ return (parent instanceof Element ? (Element)parent : null);
+ }
+
+ /** Get the concatenated text content, or null.
+ */
+ protected static String getTextContent(Node node)
+ {
+ boolean hasTextContent = false;
+ StringBuilder buffer = new StringBuilder();
+ NodeList nlist = node.getChildNodes();
+ int len = nlist.getLength();
+ for (int i = 0; i < len; i++)
+ {
+ Node child = nlist.item(i);
+ if (child.getNodeType() == Node.TEXT_NODE)
+ {
+ buffer.append(child.getNodeValue());
+ hasTextContent = true;
+ }
+ }
+ return (hasTextContent ? buffer.toString() : null);
+ }
}
Modified: shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointEJB.java
===================================================================
--- shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointEJB.java 2011-04-08 15:50:13 UTC (rev 14044)
+++ shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointEJB.java 2011-04-08 15:52:49 UTC (rev 14045)
@@ -33,12 +33,15 @@
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
+import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.handler.MessageContext;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import org.jboss.wsf.common.DOMWriter;
import org.jboss.wsf.spi.annotation.AuthMethod;
import org.jboss.wsf.spi.annotation.TransportGuarantee;
@@ -107,11 +110,11 @@
Element root = null;
if (wsdl instanceof InputSource)
{
- root = DOMUtils.parse((InputSource)wsdl);
+ root = DOMUtils.parse((InputSource)wsdl, getDocumentBuilder());
}
else if (wsdl instanceof URI)
{
- root = DOMUtils.parse(((URI)wsdl).toURL().openStream());
+ root = DOMUtils.parse(((URI)wsdl).toURL().openStream(), getDocumentBuilder());
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
new DOMWriter(out).setPrettyprint(true).print(root);
@@ -140,4 +143,23 @@
{
return wsCtx.isUserInRole(role);
}
+
+ private DocumentBuilder getDocumentBuilder()
+ {
+ DocumentBuilderFactory factory = null;
+ try
+ {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ factory.setExpandEntityReferences(false);
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ return builder;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create document builder", e);
+ }
+ }
}
Modified: shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointJSE.java
===================================================================
--- shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointJSE.java 2011-04-08 15:50:13 UTC (rev 14044)
+++ shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointJSE.java 2011-04-08 15:52:49 UTC (rev 14045)
@@ -31,12 +31,15 @@
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
+import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.handler.MessageContext;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import org.jboss.wsf.common.DOMWriter;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;
@@ -84,11 +87,11 @@
Element root = null;
if (wsdl instanceof InputSource)
{
- root = DOMUtils.parse((InputSource)wsdl);
+ root = DOMUtils.parse((InputSource)wsdl, getDocumentBuilder());
}
else if (wsdl instanceof URI)
{
- root = DOMUtils.parse(((URI)wsdl).toURL().openStream());
+ root = DOMUtils.parse(((URI)wsdl).toURL().openStream(), getDocumentBuilder());
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
new DOMWriter(out).setPrettyprint(true).print(root);
@@ -118,4 +121,23 @@
{
return wsCtx.isUserInRole(role);
}
+
+ private DocumentBuilder getDocumentBuilder()
+ {
+ DocumentBuilderFactory factory = null;
+ try
+ {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ factory.setExpandEntityReferences(false);
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ return builder;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create document builder", e);
+ }
+ }
}
Modified: shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/httpbinding/LogicalSourceHandler.java
===================================================================
--- shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/httpbinding/LogicalSourceHandler.java 2011-04-08 15:50:13 UTC (rev 14044)
+++ shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/httpbinding/LogicalSourceHandler.java 2011-04-08 15:52:49 UTC (rev 14045)
@@ -24,6 +24,9 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
@@ -34,7 +37,7 @@
import org.jboss.logging.Logger;
import org.jboss.wsf.common.handler.GenericLogicalHandler;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import org.w3c.dom.Element;
/**
@@ -72,7 +75,7 @@
tf.newTransformer().transform(source, new StreamResult(baos));
// Parse the payload and extract the value
- Element root = DOMUtils.parse(new ByteArrayInputStream(baos.toByteArray()));
+ Element root = DOMUtils.parse(new ByteArrayInputStream(baos.toByteArray()), getDocumentBuilder());
String oldValue = DOMUtils.getTextContent(root);
String newValue = oldValue + ":" + direction + "LogicalHandler";
@@ -96,4 +99,23 @@
throw new WebServiceException(ex);
}
}
+
+ private DocumentBuilder getDocumentBuilder()
+ {
+ DocumentBuilderFactory factory = null;
+ try
+ {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ factory.setExpandEntityReferences(false);
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ return builder;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create document builder", e);
+ }
+ }
}
Modified: shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java
===================================================================
--- shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java 2011-04-08 15:50:13 UTC (rev 14044)
+++ shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java 2011-04-08 15:52:49 UTC (rev 14045)
@@ -21,10 +21,13 @@
*/
package org.jboss.test.ws.jaxws.samples.httpbinding;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import org.w3c.dom.Element;
import javax.jws.HandlerChain;
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
@@ -81,7 +84,7 @@
private void verifyRequest(String xml) throws IOException
{
- Element was = DOMUtils.parse(xml);
+ Element was = DOMUtils.parse(xml, getDocumentBuilder());
if(!"somePayload".equals(was.getLocalName())
|| !"http://org.jboss.ws/httpbinding".equals(was.getNamespaceURI())
@@ -90,5 +93,24 @@
throw new WebServiceException("Unexpected payload: " + xml);
}
}
+
+ private DocumentBuilder getDocumentBuilder()
+ {
+ DocumentBuilderFactory factory = null;
+ try
+ {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ factory.setExpandEntityReferences(false);
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ return builder;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create document builder", e);
+ }
+ }
}
Modified: shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/logicalhandler/LogicalSourceHandler.java
===================================================================
--- shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/logicalhandler/LogicalSourceHandler.java 2011-04-08 15:50:13 UTC (rev 14044)
+++ shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/logicalhandler/LogicalSourceHandler.java 2011-04-08 15:52:49 UTC (rev 14045)
@@ -24,6 +24,9 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
@@ -34,7 +37,7 @@
import org.jboss.logging.Logger;
import org.jboss.wsf.common.handler.GenericLogicalHandler;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import org.w3c.dom.Element;
/**
@@ -72,7 +75,7 @@
tf.newTransformer().transform(source, new StreamResult(baos));
// Parse the payload and extract the value
- Element root = DOMUtils.parse(new ByteArrayInputStream(baos.toByteArray()));
+ Element root = DOMUtils.parse(new ByteArrayInputStream(baos.toByteArray()), getDocumentBuilder());
Element element = DOMUtils.getFirstChildElement(root);
String oldValue = DOMUtils.getTextContent(element);
@@ -97,4 +100,23 @@
throw new WebServiceException(ex);
}
}
+
+ private DocumentBuilder getDocumentBuilder()
+ {
+ DocumentBuilderFactory factory = null;
+ try
+ {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ factory.setExpandEntityReferences(false);
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ return builder;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create document builder", e);
+ }
+ }
}
Modified: shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/provider/LogicalSourceHandler.java
===================================================================
--- shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/provider/LogicalSourceHandler.java 2011-04-08 15:50:13 UTC (rev 14044)
+++ shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/provider/LogicalSourceHandler.java 2011-04-08 15:52:49 UTC (rev 14045)
@@ -24,6 +24,9 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
@@ -34,7 +37,7 @@
import org.jboss.logging.Logger;
import org.jboss.wsf.common.handler.GenericLogicalHandler;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import org.w3c.dom.Element;
/**
@@ -72,7 +75,7 @@
tf.newTransformer().transform(source, new StreamResult(baos));
// Parse the payload and extract the value
- Element root = DOMUtils.parse(new ByteArrayInputStream(baos.toByteArray()));
+ Element root = DOMUtils.parse(new ByteArrayInputStream(baos.toByteArray()), getDocumentBuilder());
String oldValue = DOMUtils.getTextContent(root);
String newValue = oldValue + ":" + direction + ":LogicalSourceHandler";
@@ -96,4 +99,23 @@
throw new WebServiceException(ex);
}
}
+
+ private DocumentBuilder getDocumentBuilder()
+ {
+ DocumentBuilderFactory factory = null;
+ try
+ {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ factory.setExpandEntityReferences(false);
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ return builder;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create document builder", e);
+ }
+ }
}
Modified: shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/provider/ProviderBeanPayload.java
===================================================================
--- shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/provider/ProviderBeanPayload.java 2011-04-08 15:50:13 UTC (rev 14044)
+++ shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/jaxws/samples/provider/ProviderBeanPayload.java 2011-04-08 15:52:49 UTC (rev 14045)
@@ -22,7 +22,7 @@
package org.jboss.test.ws.jaxws.samples.provider;
import org.w3c.dom.Element;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -30,6 +30,9 @@
import java.io.IOException;
import javax.jws.HandlerChain;
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
@@ -81,7 +84,7 @@
private void verifyRequest(String xml) throws IOException
{
- Element was = DOMUtils.parse(xml);
+ Element was = DOMUtils.parse(xml, getDocumentBuilder());
if(!"somePayload".equals(was.getLocalName())
|| !"http://org.jboss.ws/provider".equals(was.getNamespaceURI())
@@ -89,6 +92,25 @@
{
throw new WebServiceException("Unexpected payload: " + xml);
}
-}
+ }
+
+ private DocumentBuilder getDocumentBuilder()
+ {
+ DocumentBuilderFactory factory = null;
+ try
+ {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ factory.setExpandEntityReferences(false);
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ return builder;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create document builder", e);
+ }
+ }
}
Modified: shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java
===================================================================
--- shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java 2011-04-08 15:50:13 UTC (rev 14044)
+++ shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java 2011-04-08 15:52:49 UTC (rev 14045)
@@ -23,7 +23,9 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStream;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -35,8 +37,6 @@
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.handler.MessageContext;
-import org.jboss.wsf.common.IOUtils;
-
@WebService(portName = "SaajServicePort", serviceName = "SaajService", wsdlLocation = "WEB-INF/wsdl/SaajService.wsdl", targetNamespace = "http://www.jboss.org/jbossws/saaj", endpointInterface = "org.jboss.test.ws.saaj.jbws3084.ServiceIface")
public class ServiceImpl implements ServiceIface
{
@@ -93,7 +93,7 @@
{
InputStream is = entry.getValue().getInputStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- IOUtils.copyStream(baos, is);
+ copyStream(baos, is);
String name = Integer.toString(index++);
DataHandler handler = new DataHandler(new InputStreamDataSource(
new ByteArrayInputStream(baos.toByteArray()), "text/plain", name));
@@ -107,4 +107,25 @@
return "Hello World!";
}
+
+ public static void copyStream(OutputStream outs, InputStream ins) throws IOException
+ {
+ try
+ {
+ byte[] bytes = new byte[1024];
+ int r = ins.read(bytes);
+ while (r > 0)
+ {
+ outs.write(bytes, 0, r);
+ r = ins.read(bytes);
+ }
+ }
+ catch (IOException e)
+ {
+ throw e;
+ }
+ finally{
+ ins.close();
+ }
+ }
}
13 years, 1 month