Author: ningjiang
Date: Sun Aug 26 22:44:00 2007
New Revision: 570004
URL: http://svn.apache.org/viewvc?rev=570004&view=rev
Log:
Added a work around test case for CXF-922
Added:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/resources/BethalClientBeans.xml
(with props)
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/HelloImpl.java
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java?rev=570004&r1=570003&r2=570004&view=diff
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java
Sun Aug 26 22:44:00 2007
@@ -38,6 +38,7 @@
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.BusApplicationContext;
import org.apache.cxf.bus.spring.SpringBusFactory;
import org.apache.cxf.configuration.jsse.TLSClientParameters;
import org.apache.cxf.configuration.security.AuthorizationPolicy;
@@ -406,8 +407,32 @@
Greeter bethal = service.getPort(bethalQ, Greeter.class);
assertNotNull("Port is null", bethal);
-
- // we just verified the configurations are loaded successfully
+ verifyBethalClient(bethal);
+ }
+
+ @Test
+ public void testGetClientFromSpringContext() throws Exception {
+ startServer("Bethal");
+ // The http conduit configuration file , it supports wildcard
+ URL config =
getClass().getResource("resources/BethalClientConfig.cxf");
+ // The client bean configuration file
+ URL beans = getClass().getResource("resources/BethalClientBeans.xml");
+ // We go through the back door, setting the default bus.
+ new DefaultBusFactory().createBus(config);
+ // Init the context which contains the client bean,
+ // and we use the already loaded bus to set the configuration
+ // The false parameter means we just use the default bus
+ // which just set by the DefaultBusFactory
+ BusApplicationContext context = new BusApplicationContext(beans,
false);
+ Greeter bethal = (Greeter)context.getBean("Bethal");
+ // verify the client side's setting
+ verifyBethalClient(bethal);
+ }
+
+
+
+ // we just verify the configurations are loaded successfully
+ private void verifyBethalClient(Greeter bethal) {
Client client = ClientProxy.getClient(bethal);
HTTPConduit http =
(HTTPConduit) client.getConduit();
@@ -427,14 +452,11 @@
"Betty", authPolicy.getUserName());
assertEquals("Set the wrong pass word form the configuration",
"password", authPolicy.getPassword());
-
-
-
-
String answer = bethal.sayHi();
assertTrue("Unexpected answer: " + answer,
"Bonjour from Bethal".equals(answer));
}
+
/**
* This methods tests a basic https connection to Bethal.
* It supplies an authorization policy with premetive user/pass
Added:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/resources/BethalClientBeans.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/resources/BethalClientBeans.xml?rev=570004&view=auto
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/resources/BethalClientBeans.xml
(added)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/resources/BethalClientBeans.xml
Sun Aug 26 22:44:00 2007
@@ -0,0 +1,44 @@
+<?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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sec="http://cxf.apache.org/configuration/security"
+ xmlns:http="http://cxf.apache.org/transports/http/configuration"
+ xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
+ xmlns:jaxws="http://cxf.apache.org/jaxws"
+ xsi:schemaLocation="
+ http://cxf.apache.org/configuration/security
+ http://cxf.apache.org/schemas/configuration/security.xsd
+ http://cxf.apache.org/transports/http/configuration
+ http://cxf.apache.org/schemas/configuration/http-conf.xsd
+ http://cxf.apache.org/transports/http-jetty/configuration
+ http://cxf.apache.org/schemas/configuration/http-jetty.xsd
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd">
+
+ <jaxws:client id="Bethal"
+ serviceClass="org.apache.hello_world.Greeter"
+ serviceName="s:SOAPService"
+ endpointName="s:Bethal"
+ xmlns:s="http://apache.org/hello_world"
+ address="https://localhost:9002/Bethal"/>
+
+</beans>
Propchange:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/resources/BethalClientBeans.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/resources/BethalClientBeans.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/resources/BethalClientBeans.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/HelloImpl.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/HelloImpl.java?rev=570004&r1=570003&r2=570004&view=diff
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/HelloImpl.java
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/HelloImpl.java
Sun Aug 26 22:44:00 2007
@@ -20,7 +20,7 @@
import javax.jws.WebService;
[EMAIL PROTECTED](name = "Hello", serviceName = "HelloService", portName =
"HelloPort",
[EMAIL PROTECTED](name = "Hello", serviceName = "HelloService", portName =
"HelloPort1",
targetNamespace = "http://cxf.apache.org/systest/jaxws/",
endpointInterface = "org.apache.cxf.systest.jaxws.Hello")
public class HelloImpl implements Hello {