Author: dandiep
Date: Mon Jul 30 10:27:45 2007
New Revision: 561054
URL: http://svn.apache.org/viewvc?view=rev&rev=561054
Log:
Update AegisClientServer test to use simplified syntax and test JAX-WS. Fix
code-first client demo.
Modified:
incubator/cxf/trunk/distribution/src/main/release/samples/hello_world_code_first/src/demo/hw/client/Client.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java
incubator/cxf/trunk/systests/src/test/resources/webapp/WEB-INF/beans.xml
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/authservice/AuthService.java
Modified:
incubator/cxf/trunk/distribution/src/main/release/samples/hello_world_code_first/src/demo/hw/client/Client.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/hello_world_code_first/src/demo/hw/client/Client.java?view=diff&rev=561054&r1=561053&r2=561054
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/hello_world_code_first/src/demo/hw/client/Client.java
(original)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/hello_world_code_first/src/demo/hw/client/Client.java
Mon Jul 30 10:27:45 2007
@@ -19,10 +19,9 @@
package demo.hw.client;
-import java.net.URL;
-
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
+import javax.xml.ws.soap.SOAPBinding;
import demo.hw.server.HelloWorld;
@@ -38,17 +37,15 @@
}
public static void main(String args[]) throws Exception {
- Service service = Service.create(new
URL("http://localhost:9000/helloWorld?wsdl"),
- SERVICE_NAME);
-// // Endpoint Address
-// String endpointAddress =
-// "http://localhost:9000/helloWorld";
-//
-// // Add a port to the Service
-// service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING,
endpointAddress);
-//
+ Service service = Service.create(SERVICE_NAME);
+ // Endpoint Address
+ String endpointAddress = "http://localhost:9000/helloWorld";
+
+ // Add a port to the Service
+ service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING,
endpointAddress);
+
HelloWorld hw = service.getPort(HelloWorld.class);
- System.out.println(hw.sayHi("Dan"));
+ System.out.println(hw.sayHi("World"));
}
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java?view=diff&rev=561054&r1=561053&r2=561054
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java
Mon Jul 30 10:27:45 2007
@@ -23,18 +23,13 @@
import java.util.List;
import java.util.logging.Logger;
-
-import org.apache.cxf.Bus;
import org.apache.cxf.aegis.databinding.AegisDatabinding;
import org.apache.cxf.authservice.AuthService;
import org.apache.cxf.authservice.Authenticate;
-import org.apache.cxf.bus.spring.SpringBusFactory;
import org.apache.cxf.frontend.ClientProxyFactoryBean;
-import org.apache.cxf.interceptor.LoggingInInterceptor;
-import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
public class AegisClientServerTest extends AbstractBusClientServerTestBase {
@@ -46,16 +41,34 @@
}
@Test
- @Ignore
public void testAegisClient() throws Exception {
- Bus bus = new SpringBusFactory().createBus();
- bus.getInInterceptors().add(new LoggingInInterceptor());
- bus.getOutInterceptors().add(new LoggingOutInterceptor());
AegisDatabinding aegisBinding = new AegisDatabinding();
ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
- proxyFactory.getServiceFactory().setDataBinding(aegisBinding);
+ proxyFactory.setDataBinding(aegisBinding);
proxyFactory.setServiceClass(AuthService.class);
proxyFactory.setAddress("http://localhost:9002/service");
+ AuthService service = (AuthService) proxyFactory.create();
+ assertTrue(service.authenticate("Joe", "Joe", "123"));
+ assertFalse(service.authenticate("Joe1", "Joe", "fang"));
+ List<String> list = service.getRoles("Joe");
+ assertEquals(1, list.size());
+ assertEquals("Joe", list.get(0));
+ assertEquals("get Joe", service.getAuthentication("Joe"));
+ Authenticate au = new Authenticate();
+ au.setSid("ffang");
+ au.setUid("ffang");
+ assertTrue(service.authenticate(au));
+ au.setUid("ffang1");
+ assertFalse(service.authenticate(au));
+ }
+
+ @Test
+ public void testJaxWsAegisClient() throws Exception {
+ AegisDatabinding aegisBinding = new AegisDatabinding();
+ JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
+ proxyFactory.setDataBinding(aegisBinding);
+ proxyFactory.setServiceClass(AuthService.class);
+ proxyFactory.setAddress("http://localhost:9002/jaxwsAndAegis");
AuthService service = (AuthService) proxyFactory.create();
assertTrue(service.authenticate("Joe", "Joe", "123"));
assertFalse(service.authenticate("Joe1", "Joe", "fang"));
Modified:
incubator/cxf/trunk/systests/src/test/resources/webapp/WEB-INF/beans.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/resources/webapp/WEB-INF/beans.xml?view=diff&rev=561054&r1=561053&r2=561054
==============================================================================
--- incubator/cxf/trunk/systests/src/test/resources/webapp/WEB-INF/beans.xml
(original)
+++ incubator/cxf/trunk/systests/src/test/resources/webapp/WEB-INF/beans.xml
Mon Jul 30 10:27:45 2007
@@ -1,55 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
-->
<!-- START SNIPPET: beans -->
<!--beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:simple="http://cxf.apache.org/simple"
- xsi:schemaLocation="
-http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
-http://cxf.apache.org/simple http://cxf.apache.org/schemas/simple.xsd"-->
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:simple="http://cxf.apache.org/simple"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://cxf.apache.org/simple http://cxf.apache.org/schemas/simple.xsd"-->
<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:simple="http://cxf.apache.org/simple"
- xsi:schemaLocation="
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:simple="http://cxf.apache.org/simple"
+ xmlns:jaxws="http://cxf.apache.org/jaxws"
+ xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/simple
-http://cxf.apache.org/schemas/simple.xsd">
+http://cxf.apache.org/schemas/simple.xsd
+http://cxf.apache.org/jaxws
+http://cxf.apache.org/schemas/jaxws.xsd">
- <import resource="classpath:META-INF/cxf/cxf.xml" />
- <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
- <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
- <bean id="aegisDatabinding"
- class="org.apache.cxf.aegis.databinding.AegisDatabinding"/>
- <bean id="serviceFactory"
-
class="org.apache.cxf.service.factory.ReflectionServiceFactoryBean">
- <property name="dataBinding" ref="aegisDatabinding"/>
- </bean>
- <simple:server address="/service"
serviceClass="org.apache.cxf.authservice.AuthService">
- <simple:serviceFactory>
- <ref bean="serviceFactory"/>
- </simple:serviceFactory>
- <simple:serviceBean>
- <bean class="org.apache.cxf.authservice.AuthServiceImpl"/>
- </simple:serviceBean>
- </simple:server>
-
+ <import resource="classpath:META-INF/cxf/cxf.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
+
+ <simple:server address="/service"
+ serviceClass="org.apache.cxf.authservice.AuthService">
+ <simple:dataBinding>
+ <bean class="org.apache.cxf.aegis.databinding.AegisDatabinding" />
+ </simple:dataBinding>
+ <simple:serviceBean>
+ <bean class="org.apache.cxf.authservice.AuthServiceImpl" />
+ </simple:serviceBean>
+ </simple:server>
+
+ <jaxws:server address="/jaxwsAndAegis"
+ serviceClass="org.apache.cxf.authservice.AuthService">
+ <jaxws:dataBinding>
+ <bean class="org.apache.cxf.aegis.databinding.AegisDatabinding" />
+ </jaxws:dataBinding>
+ <jaxws:serviceBean>
+ <bean class="org.apache.cxf.authservice.AuthServiceImpl" />
+ </jaxws:serviceBean>
+ </jaxws:server>
+
</beans>
<!-- END SNIPPET: beans -->
Modified:
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/authservice/AuthService.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/authservice/AuthService.java?view=diff&rev=561054&r1=561053&r2=561054
==============================================================================
---
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/authservice/AuthService.java
(original)
+++
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/authservice/AuthService.java
Mon Jul 30 10:27:45 2007
@@ -20,6 +20,7 @@
package org.apache.cxf.authservice;
+import javax.jws.WebMethod;
import javax.jws.WebService;
/**
@@ -44,6 +45,7 @@
);
//test bean mode
+ @WebMethod(operationName = "authenticate2")
boolean authenticate(Authenticate auth);
String getAuthentication(String sid);