use of org.apache.cxf.bus.spring.SpringBusFactory in project testcases by coheigea.
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.spring.SpringBusFactory in project testcases by coheigea.
the class FailoverAuthenticationTest method testAuthenticatedRequest.
@org.junit.Test
public void testAuthenticatedRequest() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = FailoverAuthenticationTest.class.getResource("cxf-client.xml");
Bus bus = bf.createBus(busFile.toString());
SpringBusFactory.setDefaultBus(bus);
SpringBusFactory.setThreadDefaultBus(bus);
URL wsdl = FailoverAuthenticationTest.class.getResource("DoubleIt.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItTransportPort");
DoubleItPortType transportPort = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(transportPort, PORT);
Client client = ClientProxy.getClient(transportPort);
client.getRequestContext().put("ws-security.username", "alice");
doubleIt(transportPort, 25);
System.out.println("Kill first Tomcat instance...sleeping for 10s...");
Thread.sleep(10L * 1000L);
doubleIt(transportPort, 30);
}
use of org.apache.cxf.bus.spring.SpringBusFactory in project testcases by coheigea.
the class SSOTest method testAuthenticatedRequest.
@org.junit.Test
public void testAuthenticatedRequest() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = SSOTest.class.getResource("cxf-client.xml");
Bus bus = bf.createBus(busFile.toString());
SpringBusFactory.setDefaultBus(bus);
SpringBusFactory.setThreadDefaultBus(bus);
URL wsdl = SSOTest.class.getResource("DoubleIt.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItTransportSSOPort");
DoubleItPortType transportPort = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(transportPort, PORT);
Client client = ClientProxy.getClient(transportPort);
client.getRequestContext().put("ws-security.username", "alice");
doubleIt(transportPort, 25);
// Remove the username to test that SSO is working...
client.getRequestContext().remove("ws-security.username");
for (int i = 1; i < 10; i++) {
doubleIt(transportPort, i * 5);
}
}
use of org.apache.cxf.bus.spring.SpringBusFactory in project testcases by coheigea.
the class AuthenticationTest method testAuthenticatedRequest.
@org.junit.Test
public void testAuthenticatedRequest() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = AuthenticationTest.class.getResource("cxf-client.xml");
Bus bus = bf.createBus(busFile.toString());
SpringBusFactory.setDefaultBus(bus);
SpringBusFactory.setThreadDefaultBus(bus);
URL wsdl = AuthenticationTest.class.getResource("DoubleIt.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItTransportPort");
DoubleItPortType transportPort = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(transportPort, PORT);
Client client = ClientProxy.getClient(transportPort);
client.getRequestContext().put("ws-security.username", "alice");
doubleIt(transportPort, 25);
}
use of org.apache.cxf.bus.spring.SpringBusFactory in project testcases by coheigea.
the class AuthenticationTest method testAuthenticatedRequestBasicAuthentication.
@org.junit.Test
public void testAuthenticatedRequestBasicAuthentication() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = AuthenticationTest.class.getResource("cxf-client.xml");
Bus bus = bf.createBus(busFile.toString());
SpringBusFactory.setDefaultBus(bus);
SpringBusFactory.setThreadDefaultBus(bus);
URL wsdl = AuthenticationTest.class.getResource("DoubleIt.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItTransportBasicAuthPort");
DoubleItPortType transportPort = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(transportPort, PORT);
doubleIt(transportPort, 25);
}
Aggregations