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");
TokenTestUtils.updateSTSPort((BindingProvider) transportPort, STS_PORT);
doubleIt(transportPort, 25);
}
use of org.apache.cxf.bus.spring.SpringBusFactory in project testcases by coheigea.
the class AuthorizationTest method testUTSecureProxy.
@org.junit.Test
public void testUTSecureProxy() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = AuthorizationTest.class.getResource("cxf-client.xml");
Bus bus = bf.createBus(busFile.toString());
SpringBusFactory.setDefaultBus(bus);
SpringBusFactory.setThreadDefaultBus(bus);
URL wsdl = AuthorizationTest.class.getResource("../proxyservice/DoubleItProxy.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItPort");
DoubleItPortType transportPort = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(transportPort, PROXY_PORT);
((BindingProvider) transportPort).getRequestContext().put(SecurityConstants.USERNAME, "alice");
((BindingProvider) transportPort).getRequestContext().put(SecurityConstants.PASSWORD, "security");
doubleIt(transportPort, 25);
}
use of org.apache.cxf.bus.spring.SpringBusFactory in project testcases by coheigea.
the class AuthenticationTest method testUTSecureProxyWrongPassword.
@org.junit.Test
public void testUTSecureProxyWrongPassword() 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("../proxyservice/DoubleItProxy.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItPort");
DoubleItPortType transportPort = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(transportPort, PROXY_PORT);
((BindingProvider) transportPort).getRequestContext().put(SecurityConstants.USERNAME, "alice");
((BindingProvider) transportPort).getRequestContext().put(SecurityConstants.PASSWORD, "bad-security");
try {
doubleIt(transportPort, 25);
fail("Failure expected on a bad password");
} catch (Exception ex) {
// expected
}
}
use of org.apache.cxf.bus.spring.SpringBusFactory in project testcases by coheigea.
the class AuthenticationTest method testUTSecureProxy.
@org.junit.Test
public void testUTSecureProxy() 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("../proxyservice/DoubleItProxy.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItPort");
DoubleItPortType transportPort = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(transportPort, PROXY_PORT);
((BindingProvider) transportPort).getRequestContext().put(SecurityConstants.USERNAME, "alice");
((BindingProvider) transportPort).getRequestContext().put(SecurityConstants.PASSWORD, "security");
doubleIt(transportPort, 25);
}
use of org.apache.cxf.bus.spring.SpringBusFactory in project testcases by coheigea.
the class SymmetricPolicyTest method testSymmetricStreaming.
@org.junit.Test
public void testSymmetricStreaming() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = SymmetricPolicyTest.class.getResource("cxf-client.xml");
Bus bus = bf.createBus(busFile.toString());
SpringBusFactory.setDefaultBus(bus);
SpringBusFactory.setThreadDefaultBus(bus);
URL wsdl = SymmetricPolicyTest.class.getResource("DoubleIt.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItSymmetricStreamingPort");
DoubleItPortType transportPort = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(transportPort, PORT);
doubleIt(transportPort, 25);
}
Aggregations