Author: bimargulies Date: Sat Oct 23 21:36:34 2010 New Revision: 1026682 URL: http://svn.apache.org/viewvc?rev=1026682&view=rev Log: Make some unit tests use the new API.
Modified: cxf/trunk/distribution/src/main/release/samples/aegis/src/demo/hw/client/Client.java cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/client/Client.java cxf/trunk/distribution/src/main/release/samples/java_first_jms/src/main/java/demo/client/ClientJMS.java cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/client/Client.java cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/Client.java cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/ClientServiceConfigTest.java cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionTest.java cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/ExceptionInheritanceTest.java cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/intf/InterfaceInheritanceTest.java cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/DOMMappingTest.java cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/proxy/ProxyTest.java cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayTest.java cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTestsWithService.java cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/map/StudentTest.java cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsClientTest.java Modified: cxf/trunk/distribution/src/main/release/samples/aegis/src/demo/hw/client/Client.java URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/aegis/src/demo/hw/client/Client.java?rev=1026682&r1=1026681&r2=1026682&view=diff ============================================================================== --- cxf/trunk/distribution/src/main/release/samples/aegis/src/demo/hw/client/Client.java (original) +++ cxf/trunk/distribution/src/main/release/samples/aegis/src/demo/hw/client/Client.java Sat Oct 23 21:36:34 2010 @@ -36,14 +36,13 @@ public final class Client { public static void main(String args[]) throws Exception { ClientProxyFactoryBean factory = new ClientProxyFactoryBean(); - factory.setServiceClass(HelloWorld.class); if (args != null && args.length > 0 && !"".equals(args[0])) { factory.setAddress(args[0]); } else { factory.setAddress("http://localhost:9000/Hello"); } factory.getServiceFactory().setDataBinding(new AegisDatabinding()); - HelloWorld client = (HelloWorld)factory.create(); + HelloWorld client = factory.create(HelloWorld.class); System.out.println("Invoke sayHi()...."); System.out.println(client.sayHi(System.getProperty("user.name"))); Document doc = client.getADocument(); Modified: cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/client/Client.java URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/client/Client.java?rev=1026682&r1=1026681&r2=1026682&view=diff ============================================================================== --- cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/client/Client.java (original) +++ cxf/trunk/distribution/src/main/release/samples/java_first_jaxws_factory_bean/src/demo/hw/client/Client.java Sat Oct 23 21:36:34 2010 @@ -35,9 +35,8 @@ public final class Client { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.getInInterceptors().add(new LoggingInInterceptor()); factory.getOutInterceptors().add(new LoggingOutInterceptor()); - factory.setServiceClass(HelloWorld.class); factory.setAddress("http://localhost:9000/helloWorld"); - HelloWorld client = (HelloWorld) factory.create(); + HelloWorld client = factory.create(HelloWorld.class); System.out.println(client.sayHi("World")); } Modified: cxf/trunk/distribution/src/main/release/samples/java_first_jms/src/main/java/demo/client/ClientJMS.java URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/java_first_jms/src/main/java/demo/client/ClientJMS.java?rev=1026682&r1=1026681&r2=1026682&view=diff ============================================================================== --- cxf/trunk/distribution/src/main/release/samples/java_first_jms/src/main/java/demo/client/ClientJMS.java (original) +++ cxf/trunk/distribution/src/main/release/samples/java_first_jms/src/main/java/demo/client/ClientJMS.java Sat Oct 23 21:36:34 2010 @@ -71,10 +71,9 @@ public final class ClientJMS { private static HelloWorld createClientCxf() { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); - factory.setServiceClass(HelloWorld.class); factory.setTransportId(JMSSpecConstants.SOAP_JMS_SPECIFICATION_TRANSPORTID); factory.setAddress(JMS_ENDPOINT_URI); - HelloWorld client = (HelloWorld)factory.create(); + HelloWorld client = factory.create(HelloWorld.class); return client; } } Modified: cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/client/Client.java URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/client/Client.java?rev=1026682&r1=1026681&r2=1026682&view=diff ============================================================================== --- cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/client/Client.java (original) +++ cxf/trunk/distribution/src/main/release/samples/java_first_pojo/src/demo/hw/client/Client.java Sat Oct 23 21:36:34 2010 @@ -29,14 +29,12 @@ public final class Client { public static void main(String args[]) throws Exception { ClientProxyFactoryBean factory = new ClientProxyFactoryBean(); - factory.setServiceClass(HelloWorld.class); if (args != null && args.length > 0 && !"".equals(args[0])) { factory.setAddress(args[0]); } else { factory.setAddress("http://localhost:9000/Hello"); } - //factory.getServiceFactory().setDataBinding(new AegisDatabinding()); - HelloWorld client = (HelloWorld)factory.create(); + HelloWorld client = factory.create(HelloWorld.class); System.out.println("Invoke sayHi()...."); System.out.println(client.sayHi(System.getProperty("user.name"))); System.exit(0); Modified: cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/Client.java URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/Client.java?rev=1026682&r1=1026681&r2=1026682&view=diff ============================================================================== --- cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/Client.java (original) +++ cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/Client.java Sat Oct 23 21:36:34 2010 @@ -31,7 +31,6 @@ public final class Client { public static void main(String args[]) throws Exception { ClientProxyFactoryBean factory = new ClientProxyFactoryBean(); - factory.setServiceClass(HelloWorld.class); String serviceURL; if (args != null && args.length > 0 && !"".equals(args[0])) { serviceURL = args[0]; @@ -42,7 +41,7 @@ public final class Client { factory.setAddress(serviceURL); factory.setWsdlURL(serviceURL + "?wsdl"); factory.getServiceFactory().setDataBinding(new AegisDatabinding()); - HelloWorld client = (HelloWorld)factory.create(); + HelloWorld client = factory.create(HelloWorld.class); System.out.println("Invoke sayHi()...."); System.out.println(client.sayHi(System.getProperty("user.name"))); System.exit(0); Modified: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/ClientServiceConfigTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/ClientServiceConfigTest.java?rev=1026682&r1=1026681&r2=1026682&view=diff ============================================================================== --- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/ClientServiceConfigTest.java (original) +++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/ClientServiceConfigTest.java Sat Oct 23 21:36:34 2010 @@ -50,25 +50,24 @@ public class ClientServiceConfigTest ext svrFac.setServiceClass(Echo.class); svrFac.setBus(getBus()); svrFac.create(); - + Endpoint endpoint = Endpoint.create(new EchoImpl()); EndpointImpl impl = (EndpointImpl) endpoint; impl.setDataBinding(new AegisDatabinding()); endpoint.publish("local://JaxWsEcho"); } - + @Test public void talkToJaxWsHolder() throws Exception { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); - factory.setServiceClass(Echo.class); factory.setDataBinding(new AegisDatabinding()); factory.setAddress("local://JaxWsEcho"); - Echo client = (Echo) factory.create(); + Echo client = (Echo) factory.create(Echo.class); Holder<String> sholder = new Holder<String>(); client.echo("Channa Doll", sholder); assertEquals("Channa Doll", sholder.value); } - + @Test public void ordinaryParamNameTest() throws Exception { ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean(); @@ -77,12 +76,11 @@ public class ClientServiceConfigTest ext proxyFac.setDataBinding(new AegisDatabinding()); proxyFac.setAddress("local://Echo"); - proxyFac.setServiceClass(Echo.class); proxyFac.setBus(getBus()); - Echo echo = (Echo)proxyFac.create(); + Echo echo = proxyFac.create(Echo.class); String boing = echo.simpleEcho("reflection"); assertEquals("reflection", boing); } - + } Modified: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionTest.java?rev=1026682&r1=1026681&r2=1026682&view=diff ============================================================================== --- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionTest.java (original) +++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionTest.java Sat Oct 23 21:36:34 2010 @@ -45,12 +45,11 @@ public class ExceptionTest extends Abstr public void testHeaders() throws Exception { ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean(); proxyFac.setAddress("local://ExceptionService"); - proxyFac.setServiceClass(ExceptionService.class); proxyFac.setBus(getBus()); setupAegis(proxyFac.getClientFactoryBean()); - - ExceptionService client = (ExceptionService)proxyFac.create(); - + + ExceptionService client = proxyFac.create(ExceptionService.class); + try { client.sayHiWithException(); fail("Must throw exception!"); @@ -65,7 +64,7 @@ public class ExceptionTest extends Abstr + "[...@element='tns:String']", wsdl); } - + @Test(expected = HelloException.class) @Ignore("Not working yet due to namespace things") public void testJaxwsServerSimpleClient() throws Exception { @@ -76,18 +75,17 @@ public class ExceptionTest extends Abstr Server server = sfbean.create(); Service service = server.getEndpoint().getService(); service.setInvoker(new BeanInvoker(new ExceptionServiceImpl())); - + ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean(); proxyFac.setAddress("local://ExceptionServiceJaxWs1"); - proxyFac.setServiceClass(ExceptionService.class); proxyFac.setBus(getBus()); setupAegis(proxyFac.getClientFactoryBean()); - - ExceptionService clientInterface = (ExceptionService)proxyFac.create(); - + + ExceptionService clientInterface = proxyFac.create(ExceptionService.class); + clientInterface.sayHiWithException(); } - + @Test(expected = HelloException.class) public void testJaxwsNoXfireCompat() throws Exception { JaxWsServerFactoryBean sfbean = new JaxWsServerFactoryBean(); @@ -98,17 +96,17 @@ public class ExceptionTest extends Abstr Server server = sfbean.create(); Service service = server.getEndpoint().getService(); service.setInvoker(new BeanInvoker(new ExceptionServiceImpl())); - + JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); proxyFac.setAddress("local://ExceptionServiceJaxWs"); proxyFac.setServiceClass(ExceptionService.class); proxyFac.setBus(getBus()); proxyFac.getClientFactoryBean().getServiceFactory().setDataBinding(new AegisDatabinding()); ExceptionService clientInterface = (ExceptionService)proxyFac.create(); - + clientInterface.sayHiWithException(); } - + @Test(expected = HelloException.class) public void testJaxws() throws Exception { JaxWsServerFactoryBean sfbean = new JaxWsServerFactoryBean(); @@ -118,17 +116,16 @@ public class ExceptionTest extends Abstr Server server = sfbean.create(); Service service = server.getEndpoint().getService(); service.setInvoker(new BeanInvoker(new ExceptionServiceImpl())); - + JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); proxyFac.setAddress("local://ExceptionService4"); - proxyFac.setServiceClass(ExceptionService.class); proxyFac.setBus(getBus()); setupAegis(proxyFac.getClientFactoryBean()); - ExceptionService clientInterface = (ExceptionService)proxyFac.create(); - + ExceptionService clientInterface = proxyFac.create(ExceptionService.class); + clientInterface.sayHiWithException(); } - + public static class ExceptionServiceImpl implements ExceptionService { public String sayHiWithException() throws HelloException { @@ -136,6 +133,6 @@ public class ExceptionTest extends Abstr ex.setFaultInfo("test"); throw ex; } - + } } Modified: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/ExceptionInheritanceTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/ExceptionInheritanceTest.java?rev=1026682&r1=1026681&r2=1026682&view=diff ============================================================================== --- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/ExceptionInheritanceTest.java (original) +++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/ExceptionInheritanceTest.java Sat Oct 23 21:36:34 2010 @@ -41,10 +41,10 @@ import org.junit.Test; public class ExceptionInheritanceTest extends AbstractAegisTest { private WS1 client; private Map<String, Object> props; - + public void setUp() throws Exception { super.setUp(); - + AegisContext globalContext = new AegisContext(); globalContext.setWriteXsiTypes(true); @@ -57,12 +57,11 @@ public class ExceptionInheritanceTest ex ClientProxyFactoryBean pf = new ClientProxyFactoryBean(); setupAegis(pf.getClientFactoryBean(), binding); - pf.setServiceClass(WS1.class); pf.getServiceFactory().setProperties(props); pf.setAddress("local://WS1"); pf.setProperties(props); - - client = (WS1) pf.create(); + + client = pf.create(WS1.class); Server server = createService(WS1.class, new WS1Impl(), "WS1", binding); new LoggingFeature().initialize(server, null); @@ -70,20 +69,20 @@ public class ExceptionInheritanceTest ex } @Override - protected ServerFactoryBean createServiceFactory(Class serviceClass, - Object serviceBean, - String address, + protected ServerFactoryBean createServiceFactory(Class serviceClass, + Object serviceBean, + String address, QName name, AegisDatabinding b) { - ServerFactoryBean sf = super.createServiceFactory(serviceClass, - serviceBean, - address, + ServerFactoryBean sf = super.createServiceFactory(serviceClass, + serviceBean, + address, name, b); sf.getServiceFactory().setProperties(props); return sf; } - + @Test public void testClient() throws Exception { Modified: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/intf/InterfaceInheritanceTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/intf/InterfaceInheritanceTest.java?rev=1026682&r1=1026681&r2=1026682&view=diff ============================================================================== --- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/intf/InterfaceInheritanceTest.java (original) +++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/intf/InterfaceInheritanceTest.java Sat Oct 23 21:36:34 2010 @@ -32,7 +32,7 @@ import org.junit.Test; * This test ensures that we're handling inheritance of interfaces correctly. * Since we can't do multiple parent inheritance in XML schema, which interfaces * require, we just don't allow interface inheritance period. - * + * * @author Dan Diephouse */ public class InterfaceInheritanceTest extends AbstractAegisTest { @@ -49,11 +49,10 @@ public class InterfaceInheritanceTest ex public void testClient() throws Exception { ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean(); proxyFac.setAddress("local://IInterfaceService"); - proxyFac.setServiceClass(IInterfaceService.class); proxyFac.setBus(getBus()); setupAegis(proxyFac.getClientFactoryBean()); - IInterfaceService client = (IInterfaceService)proxyFac.create(); + IInterfaceService client = proxyFac.create(IInterfaceService.class); IChild child = client.getChild(); assertNotNull(child); Modified: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/DOMMappingTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/DOMMappingTest.java?rev=1026682&r1=1026681&r2=1026682&view=diff ============================================================================== --- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/DOMMappingTest.java (original) +++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/DOMMappingTest.java Sat Oct 23 21:36:34 2010 @@ -47,7 +47,7 @@ public class DOMMappingTest extends Abst private IDocumentService docClient; - @Before + @Before public void setUp() throws Exception { super.setUp(); createService(DocumentService.class, "DocService"); @@ -59,29 +59,28 @@ public class DOMMappingTest extends Abst proxyFac.setDataBinding(new AegisDatabinding()); proxyFac.setAddress("local://DocService"); - proxyFac.setServiceClass(IDocumentService.class); proxyFac.setBus(getBus()); - Object proxyObj = proxyFac.create(); + Object proxyObj = proxyFac.create(IDocumentService.class); docClient = (IDocumentService)proxyObj; Client client = ClientProxy.getClient(proxyObj); ClientImpl clientImpl = (ClientImpl)client; clientImpl.setSynchronousTimeout(1000000000); } - + @Test public void testSimpleString() throws Exception { String s = docClient.simpleStringReturn(); assertEquals("simple", s); } - + @Test public void testDocService() throws Exception { Document doc = docClient.returnDocument(); Element rootElement = doc.getDocumentElement(); assertEquals("carrot", rootElement.getNodeName()); } - + @Test public void testBeanCases() throws Exception { BeanWithDOM bwd = docClient.getBeanWithDOM(); Modified: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/proxy/ProxyTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/proxy/ProxyTest.java?rev=1026682&r1=1026681&r2=1026682&view=diff ============================================================================== --- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/proxy/ProxyTest.java (original) +++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/proxy/ProxyTest.java Sat Oct 23 21:36:34 2010 @@ -40,25 +40,24 @@ public class ProxyTest extends AbstractA public void testProxy() throws Exception { ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean(); proxyFac.setAddress("local://HelloProxyService"); - proxyFac.setServiceClass(HelloProxyService.class); proxyFac.setBus(getBus()); AegisContext aegisContext = new AegisContext(); aegisContext.getBeanImplementationMap().put(Hello.class, MyHello.class.getName()); AegisDatabinding binding = new AegisDatabinding(); binding.setAegisContext(aegisContext); - + setupAegis(proxyFac.getClientFactoryBean(), binding); - HelloProxyService client = (HelloProxyService)proxyFac.create(); - + HelloProxyService client = proxyFac.create(HelloProxyService.class); + Hello h = client.sayHiWithProxy(); assertTrue(h instanceof MyHello); } - + public static class HelloProxyServiceImpl implements HelloProxyService { public Hello sayHiWithProxy() { return new MyHello(); } - + } } Modified: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayTest.java?rev=1026682&r1=1026681&r2=1026682&view=diff ============================================================================== --- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayTest.java (original) +++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayTest.java Sat Oct 23 21:36:34 2010 @@ -86,11 +86,9 @@ public class FlatArrayTest extends Abstr ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean(); proxyFac.setDataBinding(new AegisDatabinding()); proxyFac.setAddress("local://FlatArray"); - proxyFac.setServiceClass(FlatArrayServiceInterface.class); proxyFac.setBus(getBus()); - Object proxyObj = proxyFac.create(); - FlatArrayServiceInterface client = (FlatArrayServiceInterface)proxyObj; + FlatArrayServiceInterface client = proxyFac.create(FlatArrayServiceInterface.class); client.submitStringArray(STRING_ARRAY); assertArrayEquals(STRING_ARRAY, service.stringArrayValue); } @@ -100,11 +98,9 @@ public class FlatArrayTest extends Abstr ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean(); proxyFac.setDataBinding(new AegisDatabinding()); proxyFac.setAddress("local://FlatArray"); - proxyFac.setServiceClass(FlatArrayServiceInterface.class); proxyFac.setBus(getBus()); - Object proxyObj = proxyFac.create(); - FlatArrayServiceInterface client = (FlatArrayServiceInterface)proxyObj; + FlatArrayServiceInterface client = proxyFac.create(FlatArrayServiceInterface.class); BeanWithFlatArray bwfa = new BeanWithFlatArray(); bwfa.setValues(INT_ARRAY); client.takeBeanWithFlatArray(bwfa); @@ -115,11 +111,9 @@ public class FlatArrayTest extends Abstr ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean(); proxyFac.setDataBinding(new AegisDatabinding()); proxyFac.setAddress("local://FlatArray"); - proxyFac.setServiceClass(FlatArrayServiceInterface.class); proxyFac.setBus(getBus()); - Object proxyObj = proxyFac.create(); - FlatArrayServiceInterface client = (FlatArrayServiceInterface)proxyObj; + FlatArrayServiceInterface client = proxyFac.create(FlatArrayServiceInterface.class); BeanWithFlatCollection bwfc = new BeanWithFlatCollection(); bwfc.getValues().add(1); bwfc.getValues().add(2); Modified: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTestsWithService.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTestsWithService.java?rev=1026682&r1=1026681&r2=1026682&view=diff ============================================================================== --- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTestsWithService.java (original) +++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTestsWithService.java Sat Oct 23 21:36:34 2010 @@ -37,10 +37,10 @@ import org.junit.Before; import org.junit.Test; /** - * + * */ public class CollectionTestsWithService extends AbstractAegisTest { - + private CollectionServiceInterface csi; private CollectionService impl; @@ -48,18 +48,17 @@ public class CollectionTestsWithService public void before() { impl = new CollectionService(); createService(CollectionServiceInterface.class, impl, null); - + ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean(); - proxyFac.getServiceFactory().getServiceConfigurations().add(0, + proxyFac.getServiceFactory().getServiceConfigurations().add(0, new XFireCompatibilityServiceConfiguration()); - proxyFac.setServiceClass(CollectionServiceInterface.class); proxyFac.setDataBinding(new AegisDatabinding()); proxyFac.setAddress("local://CollectionServiceInterface"); proxyFac.setBus(getBus()); - csi = (CollectionServiceInterface)proxyFac.create(); + csi = proxyFac.create(CollectionServiceInterface.class); } - + /** * CXF-2017 * @throws Exception @@ -75,15 +74,15 @@ public class CollectionTestsWithService innerMap.put("firstBean", bean); complexMap.put("firstKey", innerMap); csi.mapOfMapWithStringAndPojo(complexMap); - + Map<String, Map<String, BeanWithGregorianDate>> gotMap = impl.getLastComplexMap(); assertTrue(gotMap.containsKey("firstKey")); Map<String, BeanWithGregorianDate> v = gotMap.get("firstKey"); BeanWithGregorianDate b = v.get("firstBean"); assertNotNull(b); - + } - + @Test public void testListTypes() throws Exception { SortedSet<String> strings = new TreeSet<String>(); @@ -91,16 +90,16 @@ public class CollectionTestsWithService strings.add("Baker"); String first = csi.takeSortedStrings(strings); assertEquals("Able", first); - + //CHECKSTYLE:OFF HashSet<String> hashedSet = new HashSet<String>(); hashedSet.addAll(strings); String countString = csi.takeUnsortedSet(hashedSet); assertEquals("2", countString); //CHECKSTYLE:ON - + } - + @Test public void returnValueIsCollectionOfArrays() { Collection<double[]> doubleDouble = csi.returnCollectionOfPrimitiveArrays(); @@ -123,7 +122,7 @@ public class CollectionTestsWithService assertEquals(3.14, data[1][1], .0001); assertEquals(2.0, data[1][2], .0001); } - + @Test public void returnValueIsCollectionOfArraysOfAny() { Collection<Document[]> r = csi.returnCollectionOfDOMFragments(); Modified: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/map/StudentTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/map/StudentTest.java?rev=1026682&r1=1026681&r2=1026682&view=diff ============================================================================== --- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/map/StudentTest.java (original) +++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/map/StudentTest.java Sat Oct 23 21:36:34 2010 @@ -34,7 +34,7 @@ import org.apache.cxf.jaxws.JaxWsServerF import org.junit.Test; public class StudentTest extends AbstractAegisTest { - + @Test public void testWSDL() throws Exception { JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean(); @@ -44,11 +44,11 @@ public class StudentTest extends Abstrac setupAegis(sf); Server server = sf.create(); Document wsdl = getWSDLDocument(server); - + assertValid("//*...@name='string2stringMap']", wsdl); } - - @Test + + @Test public void testReturnMap() throws Exception { JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean(); @@ -58,25 +58,24 @@ public class StudentTest extends Abstrac setupAegis(sf); Server server = sf.create(); server.start(); - + JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); proxyFac.setAddress("local://StudentService"); - proxyFac.setServiceClass(StudentService.class); proxyFac.setBus(getBus()); setupAegis(proxyFac.getClientFactoryBean()); - StudentService clientInterface = (StudentService)proxyFac.create(); + StudentService clientInterface = proxyFac.create(StudentService.class); Map<Long, Student> fullMap = clientInterface.getStudentsMap(); assertNotNull(fullMap); Student one = fullMap.get(Long.valueOf(1)); assertNotNull(one); assertEquals("Student1", one.getName()); - + Map<String, ?> wildMap = clientInterface.getWildcardMap(); assertEquals("valuestring", wildMap.get("keystring")); } - @Test + @Test public void testMapMap() throws Exception { ServerFactoryBean sf = new ServerFactoryBean(); @@ -85,13 +84,10 @@ public class StudentTest extends Abstrac sf.setAddress("local://StudentServiceDocLiteral"); setupAegis(sf); Server server = sf.create(); - server.getEndpoint().getInInterceptors().add(new LoggingInInterceptor()); - server.getEndpoint().getOutInterceptors().add(new LoggingOutInterceptor()); server.start(); - + ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean(); proxyFac.setAddress("local://StudentServiceDocLiteral"); - proxyFac.setServiceClass(StudentServiceDocLiteral.class); proxyFac.setBus(getBus()); setupAegis(proxyFac.getClientFactoryBean()); //CHECKSTYLE:OFF @@ -99,13 +95,13 @@ public class StudentTest extends Abstrac mss.put("Alice", new Student()); HashMap<String, HashMap<String, Student>> mmss = new HashMap<String, HashMap<String, Student>>(); mmss.put("Bob", mss); - - StudentServiceDocLiteral clientInterface = (StudentServiceDocLiteral)proxyFac.create(); + + StudentServiceDocLiteral clientInterface = proxyFac.create(StudentServiceDocLiteral.class); clientInterface.takeMapMap(mmss); //CHECKSTYLE:ON } - - @Test + + @Test public void testReturnMapDocLiteral() throws Exception { JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean(); @@ -117,22 +113,21 @@ public class StudentTest extends Abstrac server.getEndpoint().getInInterceptors().add(new LoggingInInterceptor()); server.getEndpoint().getOutInterceptors().add(new LoggingOutInterceptor()); server.start(); - + JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); proxyFac.setAddress("local://StudentServiceDocLiteral"); - proxyFac.setServiceClass(StudentServiceDocLiteral.class); proxyFac.setBus(getBus()); setupAegis(proxyFac.getClientFactoryBean()); - + proxyFac.getInInterceptors().add(new LoggingInInterceptor()); proxyFac.getOutInterceptors().add(new LoggingOutInterceptor()); - StudentServiceDocLiteral clientInterface = (StudentServiceDocLiteral)proxyFac.create(); + StudentServiceDocLiteral clientInterface = proxyFac.create(StudentServiceDocLiteral.class); Map<Long, Student> fullMap = clientInterface.getStudentsMap(); assertNotNull(fullMap); Student one = fullMap.get(Long.valueOf(1)); assertNotNull(one); assertEquals("Student1", one.getName()); - + } } Modified: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsClientTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsClientTest.java?rev=1026682&r1=1026681&r2=1026682&view=diff ============================================================================== --- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsClientTest.java (original) +++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxWsClientTest.java Sat Oct 23 21:36:34 2010 @@ -54,12 +54,12 @@ import org.junit.Test; public class JaxWsClientTest extends AbstractJaxWsTest { private final QName serviceName = new QName("http://apache.org/hello_world_soap_http", - "SOAPService"); + "SOAPService"); private final QName portName = new QName("http://apache.org/hello_world_soap_http", "SoapPort"); private final String address = "http://localhost:9000/SoapContext/SoapPort"; private Destination d; - + @Before public void setUp() throws Exception { super.setUpBus(); @@ -75,7 +75,7 @@ public class JaxWsClientTest extends Abs javax.xml.ws.Service s = javax.xml.ws.Service .create(new QName("http://apache.org/hello_world_soap_http", "SoapPort")); assertNotNull(s); - + try { s = javax.xml.ws.Service.create(new URL("file:/does/not/exist.wsdl"), new QName("http://apache.org/hello_world_soap_http", "SoapPort")); @@ -84,7 +84,7 @@ public class JaxWsClientTest extends Abs // ignore, this is expected } } - + @Test public void testRequestContext() throws Exception { URL url = getClass().getResource("/wsdl/hello_world.wsdl"); @@ -93,12 +93,12 @@ public class JaxWsClientTest extends Abs Greeter greeter = s.getPort(portName, Greeter.class); InvocationHandler handler = Proxy.getInvocationHandler(greeter); BindingProvider bp = null; - + if (handler instanceof BindingProvider) { bp = (BindingProvider)handler; //System.out.println(bp.toString()); Map<String, Object> requestContext = bp.getRequestContext(); - String reqAddr = + String reqAddr = (String)requestContext.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY); assertEquals("the address get from requestContext is not equal", address, reqAddr); @@ -114,17 +114,17 @@ public class JaxWsClientTest extends Abs .create(url, serviceName); Greeter greeter = s.getPort(portName, Greeter.class); final InvocationHandler handler = Proxy.getInvocationHandler(greeter); - + Map<String, Object> requestContext = ((BindingProvider)handler).getRequestContext(); requestContext.put(JaxWsClientProxy.THREAD_LOCAL_REQUEST_CONTEXT, Boolean.TRUE); - + //re-get the context so it's not a thread safe variant requestContext = ((BindingProvider)handler).getRequestContext(); - + final String key = "Hi"; - + requestContext.put(key, "ho"); - + final Object[] result = new Object[2]; Thread t = new Thread() { public void run() { @@ -136,11 +136,11 @@ public class JaxWsClientTest extends Abs }; t.start(); t.join(); - + assertEquals("thread sees the put", "ho", result[0]); assertNull("thread did not remove the put", result[1]); - - assertEquals("main thread does not see removal", + + assertEquals("main thread does not see removal", "ho", requestContext.get(key)); } @@ -171,7 +171,7 @@ public class JaxWsClientTest extends Abs MessagePartInfo part = bop.getOutput().getMessageParts().get(0); assertEquals(0, part.getIndex()); - + d.setMessageObserver(new MessageReplayObserver("sayHiResponse.xml")); Object ret[] = client.invoke(bop, new Object[] {"hi"}, null); assertNotNull(ret); @@ -196,13 +196,13 @@ public class JaxWsClientTest extends Abs fail("Should have returned a fault!"); } catch (Fault fault) { assertEquals(true, fault.getMessage().indexOf("Foo") >= 0); - } - + } + } - + public static class NestedFaultThrower extends AbstractPhaseInterceptor<Message> { - + public NestedFaultThrower() { super(Phase.PRE_LOGICAL); addBefore(FaultThrower.class.getName()); @@ -219,13 +219,13 @@ public class JaxWsClientTest extends Abs @Test public void testClientProxyFactory() { - JaxWsProxyFactoryBean cf = new JaxWsProxyFactoryBean(); + JaxWsProxyFactoryBean cf = new JaxWsProxyFactoryBean(); cf.setAddress("http://localhost:9000/test"); - cf.setServiceClass(Greeter.class); - Greeter greeter = (Greeter) cf.create(); + Greeter greeter = cf.create(Greeter.class); + /* .n.b. don't call call create with an argument and change the SEI. */ Greeter greeter2 = (Greeter) cf.create(); Greeter greeter3 = (Greeter) cf.create(); - + Client c = ClientProxy.getClient(greeter); Client c2 = ClientProxy.getClient(greeter2); Client c3 = ClientProxy.getClient(greeter3); @@ -235,19 +235,19 @@ public class JaxWsClientTest extends Abs assertNotSame(c.getEndpoint(), c2.getEndpoint()); assertNotSame(c.getEndpoint(), c3.getEndpoint()); assertNotSame(c3.getEndpoint(), c2.getEndpoint()); - - ((BindingProvider)greeter).getRequestContext().put("test", "manny"); - ((BindingProvider)greeter2).getRequestContext().put("test", "moe"); + + ((BindingProvider)greeter).getRequestContext().put("test", "manny"); + ((BindingProvider)greeter2).getRequestContext().put("test", "moe"); ((BindingProvider)greeter3).getRequestContext().put("test", "jack"); - + assertEquals("manny", ((BindingProvider)greeter).getRequestContext().get("test")); assertEquals("moe", ((BindingProvider)greeter2).getRequestContext().get("test")); assertEquals("jack", ((BindingProvider)greeter3).getRequestContext().get("test")); } - - + + public static class FaultThrower extends AbstractPhaseInterceptor<Message> { - + public FaultThrower() { super(Phase.PRE_LOGICAL); }