package org.springside.examples.miniservice.functional.ws;

import static org.junit.Assert.*;

import javax.xml.ws.BindingProvider;

import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.springside.examples.miniservice.Start;
import org.springside.examples.miniservice.functional.BaseFunctionalTestCase;
import org.springside.examples.miniservice.functional.category.Smoke;
import org.springside.examples.miniservice.webservice.ws.AccountWebService;
import org.springside.examples.miniservice.webservice.ws.result.UserListResult;

/**
 * UserService Web服务的功能测试, 测试主要的接口调用.
 * 
 * 以用JAXWS的API自行创建.
 * 
 * @author calvin
 */

public class AccountWebServiceWithDynamicCreateClientIT extends BaseFunctionalTestCase {

	/**
	 * 测试搜索用户
	 */
	@Test
	@Category(Smoke.class)
	public void searchUser() {
		String address = Start.TEST_BASE_URL + "/ws/accountservice";

		JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
		proxyFactory.setAddress(address);
		proxyFactory.setServiceClass(AccountWebService.class);
		AccountWebService accountWebServiceCreated = (AccountWebService) proxyFactory.create();

		//(可选)演示重新设定endpoint address.
		((BindingProvider) accountWebServiceCreated).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
				address);

		UserListResult result = accountWebServiceCreated.searchUser(null, null);

		assertTrue(result.getUserList().size() >= 4);
		assertEquals("Jack", result.getUserList().get(0).getName());
	}

}

@@ -152,35 +152,199 @@
 cxf.
-jaxws.JaxWsProxyFactoryBean
+frontend.ClientProxy;%0Aimport org.apache.cxf.jaxws.JaxWsProxyFactoryBean;%0Aimport org.apache.cxf.transport.http.HTTPConduit;%0Aimport org.apache.cxf.transports.http.configuration.HTTPClientPolicy
 ;%0Aim
@@ -862,17 +862,16 @@
 vin%0A */%0A
-%0A
 public c
@@ -957,82 +957,44 @@
 %7B%0A%0A%09
-/**%0A%09 * %E6%B5%8B%E8%AF%95%E6%90%9C%E7%B4%A2%E7%94%A8%E6%88%B7%0A%09 */%0A%09@Test%0A%09@Category(Smoke.class)%0A%09public void searchUser
+public AccountWebService creatClient
 () %7B
@@ -1471,16 +1471,433 @@
 ress);%0A%0A
+%09%09//(%E5%8F%AF%E9%80%89)%E6%BC%94%E7%A4%BA%E9%87%8D%E6%96%B0%E8%AE%BE%E5%AE%9ATimeout%E6%97%B6%E9%97%B4%0A%09%09HTTPClientPolicy policy = new HTTPClientPolicy();%0A%09%09policy.setReceiveTimeout(200000);%0A%09%09HTTPConduit conduit = (HTTPConduit) ClientProxy.getClient(accountWebServiceCreated).getConduit();%0A%09%09conduit.setClient(policy);%0A%0A%09%09return accountWebServiceCreated;%0A%09%7D%0A%0A%09/**%0A%09 * %E6%B5%8B%E8%AF%95%E6%90%9C%E7%B4%A2%E7%94%A8%E6%88%B7%0A%09 */%0A%09@Test%0A%09@Category(Smoke.class)%0A%09public void searchUser() %7B%0A%09%09AccountWebService accountWebService = creatClient();%0A%0A
 %09%09UserLi
@@ -1931,23 +1931,16 @@
 bService
-Created
 .searchU

set socket timeout in functional test case for the slow jenkins.