@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); }
public Bus createBus(URL[] urls, boolean includeDefaults) { try { return finishCreatingBus(createAppContext(urls, includeDefaults)); } catch (BeansException ex) { LogUtils.log(LOG, Level.WARNING, "APP_CONTEXT_CREATION_FAILED_MSG", ex, (Object[])null); throw new RuntimeException(ex); } }
protected void run() { Bus busLocal = new SpringBusFactory().createBus(configFileName); BusFactory.setDefaultBus(busLocal); setBus(busLocal); }
@Before public void setUp() throws Exception { SpringBusFactory bf = new SpringBusFactory(); bus = bf.createBus(CONFIG); BusFactory.setDefaultBus(bus); manager = bus.getExtension(ServerLifeCycleManager.class); recursiveCount = 0; recursiveEndpoints = new Endpoint[RECURSIVE_LIMIT]; startNotificationMap = new HashMap<>(); stopNotificationMap = new HashMap<>(); }
@Test public void testHttpsWrappedContinuations() throws Exception { SpringBusFactory bf = new SpringBusFactory(); Bus bus = bf.createBus(CLIENT_HTTPS_CONFIG_FILE); BusFactory.setDefaultBus(bus); QName serviceName = new QName("http://cxf.apache.org/systest/jaxws", "HelloContinuationService"); URL wsdlURL = new URL("https://localhost:" + HTTPS_PORT + "/securecontinuation?wsdl"); HelloContinuationService service = new HelloContinuationService(wsdlURL, serviceName); assertNotNull(service); final HelloContinuation helloPort = service.getHelloContinuationPort(); doTest(helloPort); bus.shutdown(true); }
@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 testClientServerComplexPolicyAuthorized() throws IOException { String configName = "org/apache/cxf/systest/ws/wssec10/client.xml"; Bus bus = new SpringBusFactory().createBus(configName); IPingService port = getComplexPolicyPort(bus); final String output = port.echo(INPUT); assertEquals(INPUT, output); ((java.io.Closeable)port).close(); bus.shutdown(true); }
public void setUpBus(String port) throws Exception { SpringBusFactory bf = new SpringBusFactory(); bus = bf.createBus("org/apache/cxf/systest/ws/policy/rmwsdl.xml"); BusFactory.setDefaultBus(bus); outRecorder = new OutMessageRecorder(); bus.getOutInterceptors().add(outRecorder); inRecorder = new InMessageRecorder(); bus.getInInterceptors().add(inRecorder); } }
private void makeTwoWayCallOnNewBus(URL wsdlUrl, String address) { SpringBusFactory bf = new SpringBusFactory(); Bus bus = bf.createBus(); BusFactory.setDefaultBus(bus); Endpoint ep = createService(address); doWork(wsdlUrl, address); // this should revert the JVM to its original state pending gc ep.stop(); bus.shutdown(true); }
public Bus createBus(String[] cfgFiles, boolean includeDefaults) { try { String userCfgFile = SystemPropertyAction.getPropertyOrNull(Configurer.USER_CFG_FILE_PROPERTY_NAME); String sysCfgFileUrl = SystemPropertyAction.getPropertyOrNull(Configurer.USER_CFG_FILE_PROPERTY_URL); final Resource r = BusApplicationContext.findResource(Configurer.DEFAULT_USER_CFG_FILE); boolean exists = true; if (r != null) { exists = AccessController .doPrivileged(new PrivilegedAction<Boolean>() { public Boolean run() { return r.exists(); } }); } if (context == null && userCfgFile == null && cfgFiles == null && sysCfgFileUrl == null && (r == null || !exists) && includeDefaults) { return new org.apache.cxf.bus.CXFBusFactory().createBus(); } return finishCreatingBus(createApplicationContext(cfgFiles, includeDefaults)); } catch (BeansException ex) { LogUtils.log(LOG, Level.WARNING, "APP_CONTEXT_CREATION_FAILED_MSG", ex, (Object[])null); throw new RuntimeException(ex); } }
@Test public void testHttpWrappedContinuations() throws Exception { SpringBusFactory bf = new SpringBusFactory(); Bus bus = bf.createBus(CLIENT_CONFIG_FILE); BusFactory.setDefaultBus(bus); QName serviceName = new QName("http://cxf.apache.org/systest/jaxws", "HelloContinuationService"); URL wsdlURL = new URL("http://localhost:" + PORT + "/hellocontinuation?wsdl"); HelloContinuationService service = new HelloContinuationService(wsdlURL, serviceName); assertNotNull(service); final HelloContinuation helloPort = service.getHelloContinuationPort(); doTest(helloPort); bus.shutdown(true); }
@Test public void testClientServerUTOnlyAuthorized() throws IOException { String configName = "org/apache/cxf/systest/ws/wssec10/client.xml"; Bus bus = new SpringBusFactory().createBus(configName); IPingService port = getUTOnlyPort(bus, false); final String output = port.echo(INPUT); assertEquals(INPUT, output); ((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); }
protected void run() { String configurationFile = "undertowBasicAuthServer.xml"; URL configure = UndertowBasicAuthServer.class.getResource(configurationFile); Bus bus = new SpringBusFactory().createBus(configure, true); bus.getInInterceptors().add(new LoggingInInterceptor()); bus.getOutInterceptors().add(new LoggingOutInterceptor()); BusFactory.setDefaultBus(bus); setBus(bus); GreeterImpl implementor = new GreeterImpl(); ep = Endpoint.publish(ADDRESS, implementor); }
public Bus createBus(String[] cfgFiles, boolean includeDefaults) { try { String userCfgFile = SystemPropertyAction.getPropertyOrNull(Configurer.USER_CFG_FILE_PROPERTY_NAME); String sysCfgFileUrl = SystemPropertyAction.getPropertyOrNull(Configurer.USER_CFG_FILE_PROPERTY_URL); final Resource r = BusApplicationContext.findResource(Configurer.DEFAULT_USER_CFG_FILE); boolean exists = true; if (r != null) { exists = AccessController .doPrivileged(new PrivilegedAction<Boolean>() { public Boolean run() { return r.exists(); } }); } if (context == null && userCfgFile == null && cfgFiles == null && sysCfgFileUrl == null && (r == null || !exists) && includeDefaults) { return new org.apache.cxf.bus.CXFBusFactory().createBus(); } return finishCreatingBus(createApplicationContext(cfgFiles, includeDefaults)); } catch (BeansException ex) { LogUtils.log(LOG, Level.WARNING, "APP_CONTEXT_CREATION_FAILED_MSG", ex, (Object[])null); throw new RuntimeException(ex); } }
@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 testHttpsWrappedContinuations() throws Exception { SpringBusFactory bf = new SpringBusFactory(); Bus bus = bf.createBus(CLIENT_HTTPS_CONFIG_FILE); BusFactory.setDefaultBus(bus); QName serviceName = new QName("http://cxf.apache.org/systest/jaxws", "HelloContinuationService"); URL wsdlURL = new URL("https://localhost:" + HTTPS_PORT + "/securecontinuation?wsdl"); HelloContinuationService service = new HelloContinuationService(wsdlURL, serviceName); assertNotNull(service); final HelloContinuation helloPort = service.getHelloContinuationPort(); doTest(helloPort); bus.shutdown(true); }
protected void run() { URL busFile = StaxServer.class.getResource("stax-server.xml"); Bus busLocal = new SpringBusFactory().createBus(busFile); BusFactory.setDefaultBus(busLocal); setBus(busLocal); } }
protected void run() { String configurationFile = "jettyDigestServer.xml"; URL configure = JettyBasicAuthServer.class.getResource(configurationFile); Bus bus = new SpringBusFactory().createBus(configure, true); bus.getInInterceptors().add(new LoggingInInterceptor()); bus.getOutInterceptors().add(new LoggingOutInterceptor()); BusFactory.setDefaultBus(bus); setBus(bus); GreeterImpl implementor = new GreeterImpl(); ep = Endpoint.publish(ADDRESS, implementor); }
public Bus createBus(URL[] urls, boolean includeDefaults) { try { return finishCreatingBus(createAppContext(urls, includeDefaults)); } catch (BeansException ex) { LogUtils.log(LOG, Level.WARNING, "APP_CONTEXT_CREATION_FAILED_MSG", ex, (Object[])null); throw new RuntimeException(ex); } }