@Override protected void run() { String configurationFile = "SessionServer.xml"; URL configure = SessionServer.class.getResource(configurationFile); bus = new SpringBusFactory().createBus(configure, true); BusFactory.setDefaultBus(bus); }
@Test public void testClientServer() throws Exception { Bus bus = new SpringBusFactory().createBus("org/apache/cxf/systest/ws/security/handler/client.xml"); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); Service service = Service.create(new URL("http://localhost:" + PORT + "/wsse/HelloWorldWS?wsdl"), new QName("http://cxf.apache.org/wsse/handler/helloworld", "HelloWorldImplService")); QName portName = new QName("http://cxf.apache.org/wsse/handler/helloworld", "HelloWorldPort"); HelloWorld port = service.getPort(portName, HelloWorld.class); updateAddressPort(port, PORT); assertEquals("Hello CXF", port.sayHello("CXF")); bus.shutdown(true); }
@Test public void testManagedBusWithTransientId() throws Exception { SpringBusFactory factory = new SpringBusFactory(); Bus bus = factory.createBus("org/apache/cxf/systest/management/managed-bus.xml", true); doManagedBusTest(bus, bus.getId(), "cxf_managed_bus_test", Integer.parseInt(JMX_PORT1)); }
private WebClient createWebClient(String address) { JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean(); bean.setAddress(address); SpringBusFactory bf = new SpringBusFactory(); URL busFile = JAXRSOAuth2Test.class.getResource("client.xml"); Bus springBus = bf.createBus(busFile.toString()); bean.setBus(springBus); WebClient wc = bean.createWebClient(); wc.type(MediaType.APPLICATION_FORM_URLENCODED).accept(MediaType.APPLICATION_JSON); return wc; }
@org.junit.Test public void testBasicAuth() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = BasicAuthTest.class.getResource("client.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = BasicAuthTest.class.getResource("DoubleItBasicAuth.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItBasicAuthPort"); DoubleItPortType utPort = service.getPort(portQName, DoubleItPortType.class); updateAddressPort(utPort, PORT); assertEquals(50, utPort.doubleIt(25)); ((java.io.Closeable)utPort).close(); bus.shutdown(true); }
@Test public void testManagedBusWithPersistentId() throws Exception { SpringBusFactory factory = new SpringBusFactory(); Bus bus = factory.createBus("org/apache/cxf/systest/management/persistent-id.xml", true); doManagedBusTest(bus, "cxf_managed_bus_test", bus.getId(), Integer.parseInt(JMX_PORT2)); }
private WebClient createOAuth2WebClient(String address) { JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean(); bean.setAddress(address); SpringBusFactory bf = new SpringBusFactory(); URL busFile = JAXRSOAuth2TlsTest.class.getResource("client.xml"); Bus springBus = bf.createBus(busFile.toString()); bean.setBus(springBus); WebClient wc = bean.createWebClient(); wc.type(MediaType.APPLICATION_FORM_URLENCODED).accept(MediaType.APPLICATION_JSON); return wc; } private WebClient createDynRegWebClient(String address) {
protected void run() { URL busFile = StaxServer.class.getResource("stax-server.xml"); Bus busLocal = new SpringBusFactory().createBus(busFile); BusFactory.setDefaultBus(busLocal); setBus(busLocal); } }
@org.junit.Test public void testSignedSAML() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = ActionTest.class.getResource("client.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = ActionTest.class.getResource("DoubleItAction.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItSignedSAMLPort"); DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class); updateAddressPort(port, PORT); assertEquals(50, port.doubleIt(25)); ((java.io.Closeable)port).close(); bus.shutdown(true); }
@Test public void testClientServer() throws Exception { System.getProperties().remove("com.sun.CORBA.POA.ORBServerId"); System.getProperties().remove("com.sun.CORBA.POA.ORBPersistentServerPort"); URL wsdlUrl = this.getClass().getResource("/wsdl_systest/hello_world_corba.wsdl"); new SpringBusFactory().createBus("org/apache/cxf/systest/corba/hello_world_client.xml"); GreeterCORBAService gcs = new GreeterCORBAService(wsdlUrl, SERVICE_NAME); Greeter port = gcs.getGreeterCORBAPort(); String output = port.greetMe("Betty"); assertTrue("Unexpected returned string: " + output, "Hello Betty".equals(output)); }
private WebClient createRsWebClient(String address, ClientAccessToken at, String clientContext) { JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean(); bean.setAddress(address); SpringBusFactory bf = new SpringBusFactory(); URL busFile = JAXRSOAuth2TlsTest.class.getResource(clientContext); Bus springBus = bf.createBus(busFile.toString()); bean.setBus(springBus); WebClient wc = bean.createWebClient(); wc.accept(MediaType.APPLICATION_XML); wc.authorization(at); return wc; }
protected void run() { Bus busLocal = new SpringBusFactory().createBus(configFileName); BusFactory.setDefaultBus(busLocal); setBus(busLocal); }
@org.junit.Test public void testTransformFeature() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = StaxTransformFeatureTest.class.getResource("client.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = StaxTransformFeatureTest.class.getResource("DoubleItTransform.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItPlaintextPort2"); DoubleItPortType2 port = service.getPort(portQName, DoubleItPortType2.class); updateAddressPort(port, PORT); assertEquals(50, port.doubleIt2(25)); ((java.io.Closeable)port).close(); bus.shutdown(true); }
@Test public void testLoadBusWithServletApplicationContext() throws BusException { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] {"/org/apache/cxf/systest/bus/servlet.xml"}); Bus bus = new SpringBusFactory(ctx).createBus(); checkBindingExtensions(bus); checkHTTPTransportFactories(bus); checkOtherCoreExtensions(bus); ctx.close(); } @Test
protected void run() { URL busFile = Server.class.getResource("server.xml"); Bus busLocal = new SpringBusFactory().createBus(busFile); BusFactory.setDefaultBus(busLocal); setBus(busLocal); } }
@org.junit.Test public void test3DESEncryptionGivenKey() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = ActionTest.class.getResource("client.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = ActionTest.class.getResource("DoubleItAction.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleIt3DESEncryptionPort"); DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class); updateAddressPort(port, PORT); assertEquals(50, port.doubleIt(25)); ((java.io.Closeable)port).close(); bus.shutdown(true); }
protected void run() { SpringBusFactory factory = new SpringBusFactory(); Bus bus = factory.createBus( "org/apache/cxf/systest/ws/security/server.xml" ); BusFactory.setDefaultBus(bus); setBus(bus); }
@org.junit.Test public void testKerberosViaCustomTokenAction() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = KerberosTokenTest.class.getResource("client.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = KerberosTokenTest.class.getResource("DoubleItKerberos.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItKerberosTransportActionPort"); DoubleItPortType kerberosPort = service.getPort(portQName, DoubleItPortType.class); TestUtil.updateAddressPort(kerberosPort, PORT2); Assert.assertEquals(50, kerberosPort.doubleIt(25)); ((java.io.Closeable)kerberosPort).close(); bus.shutdown(true); } }
protected void run() { SpringBusFactory factory = new SpringBusFactory(); Bus bus = factory.createBus( "org/apache/cxf/systest/ws/security/stax-server.xml" ); BusFactory.setDefaultBus(bus); setBus(bus); }
@org.junit.Test public void testSymmetricBytesInAttachment() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = MTOMSecurityTest.class.getResource("client.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = MTOMSecurityTest.class.getResource("DoubleItMtom.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItSymmetricPort"); DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class); updateAddressPort(port, PORT); int result = port.doubleIt(25); assertEquals(result, 50); ((java.io.Closeable)port).close(); bus.shutdown(true); }