use of org.apache.cxf.Bus in project cxf by apache.
the class CustomOnBehalfOfTest method testUsernameOnBehalfOfSTS.
@org.junit.Test
public void testUsernameOnBehalfOfSTS() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = CustomOnBehalfOfTest.class.getResource("cxf-client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL wsdl = CustomOnBehalfOfTest.class.getResource("DoubleIt.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItTransportCustomBSTPort");
DoubleItPortType transportPort = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(transportPort, PORT);
// Transport port
((BindingProvider) transportPort).getRequestContext().put(SecurityConstants.USERNAME, "alice");
doubleIt(transportPort, 25);
((java.io.Closeable) transportPort).close();
bus.shutdown(true);
}
use of org.apache.cxf.Bus in project cxf by apache.
the class Server method run.
protected void run() {
URL busFile = Server.class.getResource("cxf-service.xml");
Bus busLocal = new SpringBusFactory().createBus(busFile);
BusFactory.setDefaultBus(busLocal);
setBus(busLocal);
try {
new Server();
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.apache.cxf.Bus in project cxf by apache.
the class STSServer method run.
protected void run() {
URL busFile = STSServer.class.getResource("cxf-sts.xml");
Bus busLocal = new SpringBusFactory().createBus(busFile);
BusFactory.setDefaultBus(busLocal);
setBus(busLocal);
try {
new STSServer();
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.apache.cxf.Bus in project cxf by apache.
the class DistributedCachingTest method testSAMLToken.
@org.junit.Test
public void testSAMLToken() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = DistributedCachingTest.class.getResource("cxf-client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL wsdl = DistributedCachingTest.class.getResource("DoubleIt.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItSAMLPort");
DoubleItPortType transportPort = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(transportPort, PORT);
// Transport port
doubleIt(transportPort, 25);
((java.io.Closeable) transportPort).close();
bus.shutdown(true);
}
use of org.apache.cxf.Bus in project cxf by apache.
the class DistributedCachingTest method testUsernameToken.
@org.junit.Test
public void testUsernameToken() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = DistributedCachingTest.class.getResource("cxf-client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL wsdl = DistributedCachingTest.class.getResource("DoubleIt.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItUsernameTokenPort");
DoubleItPortType transportPort = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(transportPort, PORT);
// Transport port
doubleIt(transportPort, 25);
((java.io.Closeable) transportPort).close();
bus.shutdown(true);
}
Aggregations