Author: alessio.soldano(a)jboss.com
Date: 2008-02-26 06:43:42 -0500 (Tue, 26 Feb 2008)
New Revision: 5808
Added:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1991/
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1991/Hello.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1991/HelloJavaBean.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1991/UsernameAuthTestCase.java
stack/native/trunk/src/test/resources/jaxws/jbws1991/
stack/native/trunk/src/test/resources/jaxws/jbws1991/META-INF/
stack/native/trunk/src/test/resources/jaxws/jbws1991/META-INF/jboss-wsse-client.xml
stack/native/trunk/src/test/resources/jaxws/jbws1991/META-INF/jboss-wsse-server.xml
Modified:
stack/native/trunk/ant-import-tests/build-jars-jaxws.xml
Log:
[JBWS-1991] Test case
Modified: stack/native/trunk/ant-import-tests/build-jars-jaxws.xml
===================================================================
--- stack/native/trunk/ant-import-tests/build-jars-jaxws.xml 2008-02-26 10:47:26 UTC (rev
5807)
+++ stack/native/trunk/ant-import-tests/build-jars-jaxws.xml 2008-02-26 11:43:42 UTC (rev
5808)
@@ -643,6 +643,17 @@
<include name="wsdl/**"/>
</metainf>
</jar>
+
+ <!-- jaxws-jbws1991 -->
+ <jar destfile="${tests.output.dir}/libs/jaxws-jbws1991.jar">
+ <fileset dir="${tests.output.dir}/classes">
+ <include name="org/jboss/test/ws/jaxws/jbws1991/*.class"/>
+ <exclude
name="org/jboss/test/ws/jaxws/jbws1991/*TestCase.class"/>
+ </fileset>
+ <metainf
dir="${tests.output.dir}/resources/jaxws/jbws1991/META-INF">
+ <include name="jboss-wsse-server.xml"/>
+ </metainf>
+ </jar>
<!-- jaxws-jbws2000 -->
<jar destfile="${tests.output.dir}/libs/jaxws-jbws2000.jar">
Added: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1991/Hello.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1991/Hello.java
(rev 0)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1991/Hello.java 2008-02-26
11:43:42 UTC (rev 5808)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws1991;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+@WebService(name = "Hello", targetNamespace =
"http://org.jboss.ws/jbws1991")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+public interface Hello
+{
+ @WebMethod
+ public String echo(String par);
+}
Property changes on:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1991/Hello.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1991/HelloJavaBean.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1991/HelloJavaBean.java
(rev 0)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1991/HelloJavaBean.java 2008-02-26
11:43:42 UTC (rev 5808)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws1991;
+
+import javax.annotation.Resource;
+import javax.annotation.security.RolesAllowed;
+import javax.ejb.Stateless;
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.ws.WebServiceContext;
+
+import org.jboss.annotation.security.SecurityDomain;
+import org.jboss.logging.Logger;
+import org.jboss.ws.annotation.EndpointConfig;
+import org.jboss.wsf.spi.annotation.WebContext;
+
+
+@Stateless
+@WebService(name = "Hello", serviceName = "HelloService",
targetNamespace = "http://org.jboss.ws/jbws1991")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+@WebContext(contextRoot = "/jaxws-jbws1991", urlPattern = "/*")
+@EndpointConfig(configName = "Standard WSSecurity Endpoint")
+@SecurityDomain("JBossWS")
+@RolesAllowed({"friend"})
+public class HelloJavaBean
+{
+ private Logger log = Logger.getLogger(HelloJavaBean.class);
+ @Resource
+ private WebServiceContext ctx;
+
+ @WebMethod
+ public String echo(String par)
+ {
+ log.info("User principal: " + ctx.getUserPrincipal());
+ return par;
+ }
+}
Property changes on:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1991/HelloJavaBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1991/UsernameAuthTestCase.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1991/UsernameAuthTestCase.java
(rev 0)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1991/UsernameAuthTestCase.java 2008-02-26
11:43:42 UTC (rev 5808)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws1991;
+
+import java.io.File;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+
+import junit.framework.Test;
+
+import org.jboss.ws.core.StubExt;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+/**
+ *
http://jira.jboss.org/jira/browse/JBWS-1991
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 26-02-2008
+ */
+public class UsernameAuthTestCase extends JBossWSTest
+{
+ private String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() +
":8080/jaxws-jbws1991";
+
+ public static Test suite() throws Exception
+ {
+ return new JBossWSTestSetup(UsernameAuthTestCase.class,
"jaxws-jbws1991.jar");
+ }
+
+ public void testAuth() throws Exception
+ {
+ Hello port = getPort();
+ ((BindingProvider)port).getRequestContext().put(BindingProvider.USERNAME_PROPERTY,
"kermit");
+ ((BindingProvider)port).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,
"thefrog");
+ String msg = "Hi!";
+ try
+ {
+ String result = port.echo(msg);
+ assertEquals(msg, result);
+ }
+ catch (Exception e)
+ {
+ fail();
+ }
+ }
+
+ private Hello getPort() throws Exception
+ {
+ URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
+ QName serviceName = new QName("http://org.jboss.ws/jbws1991",
"HelloService");
+ Hello port = Service.create(wsdlURL, serviceName).getPort(Hello.class);
+ URL securityURL = new
File("resources/jaxws/jbws1991/META-INF/jboss-wsse-client.xml").toURL();
+ ((StubExt)port).setSecurityConfig(securityURL.toExternalForm());
+ ((StubExt)port).setConfigName("Standard WSSecurity Client");
+ ((BindingProvider)port).getRequestContext().put(StubExt.PROPERTY_AUTH_TYPE,
StubExt.PROPERTY_AUTH_TYPE_WSSE);
+ return port;
+ }
+}
\ No newline at end of file
Property changes on:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1991/UsernameAuthTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/trunk/src/test/resources/jaxws/jbws1991/META-INF/jboss-wsse-client.xml
===================================================================
--- stack/native/trunk/src/test/resources/jaxws/jbws1991/META-INF/jboss-wsse-client.xml
(rev 0)
+++
stack/native/trunk/src/test/resources/jaxws/jbws1991/META-INF/jboss-wsse-client.xml 2008-02-26
11:43:42 UTC (rev 5808)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jboss-ws-security
xmlns="http://www.jboss.com/ws-security/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://www.jboss.com/ws-security/config
http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">
+
+ <config>
+ <username/>
+ <timestamp ttl="300"/>
+ </config>
+</jboss-ws-security>
\ No newline at end of file
Property changes on:
stack/native/trunk/src/test/resources/jaxws/jbws1991/META-INF/jboss-wsse-client.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/trunk/src/test/resources/jaxws/jbws1991/META-INF/jboss-wsse-server.xml
===================================================================
--- stack/native/trunk/src/test/resources/jaxws/jbws1991/META-INF/jboss-wsse-server.xml
(rev 0)
+++
stack/native/trunk/src/test/resources/jaxws/jbws1991/META-INF/jboss-wsse-server.xml 2008-02-26
11:43:42 UTC (rev 5808)
@@ -0,0 +1,10 @@
+<jboss-ws-security
xmlns="http://www.jboss.com/ws-security/config"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://www.jboss.com/ws-security/config
+
http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">
+ <config>
+ <timestamp ttl="300"/>
+ <requires/>
+ </config>
+
+</jboss-ws-security>
Property changes on:
stack/native/trunk/src/test/resources/jaxws/jbws1991/META-INF/jboss-wsse-server.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF