use of org.apache.cxf.bus.spring.SpringBusFactory in project tesb-rt-se by Talend.
the class DoubleItSTSClient method main.
public static void main(String[] args) throws Exception {
SpringBusFactory bf = new SpringBusFactory();
Bus bus = bf.createBus("META-INF/spring/client-sts-beans.xml");
SpringBusFactory.setDefaultBus(bus);
SpringBusFactory.setThreadDefaultBus(bus);
URL wsdl = DoubleItSTSClient.class.getResource("DoubleIt.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSAML2Port");
DoubleItPortType symmetricSaml2Port = service.getPort(portQName, DoubleItPortType.class);
int x = symmetricSaml2Port.execute(10);
System.out.println(x);
}
use of org.apache.cxf.bus.spring.SpringBusFactory in project fabric8 by fabric8io.
the class JsonSchemaJMXTest method testJMXGetJsonSchema.
@Test
public void testJMXGetJsonSchema() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
Bus bus = bf.createBus("/io/fabric8/cxf/endpoint/jaxws/jmx-enable.xml");
BusFactory.setDefaultBus(bus);
String json = "";
try {
connectToMBserver();
// test getJSONSchema
json = invokeEndpoint("getJSONSchema", null);
parseJson(json);
// test getJSONSchemaForClass
json = invokeEndpoint("getJSONSchemaForClass", "SayHi");
parseJson(json);
// test getJSONSchemaForOperation
json = invokeEndpoint("getJSONSchemaForOperation", "greetMe");
parseJson(json);
} catch (Throwable e) {
e.printStackTrace();
fail("invalid json for " + json);
} finally {
// ep.stop();
}
}
use of org.apache.cxf.bus.spring.SpringBusFactory in project testcases by coheigea.
the class XACML2AuthorizationTest method testUnauthorizedRequest.
@org.junit.Test
public void testUnauthorizedRequest() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = XACML2AuthorizationTest.class.getResource("cxf-client.xml");
Bus bus = bf.createBus(busFile.toString());
SpringBusFactory.setDefaultBus(bus);
SpringBusFactory.setThreadDefaultBus(bus);
URL wsdl = XACML2AuthorizationTest.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", "bob");
TokenTestUtils.updateSTSPort((BindingProvider) transportPort, STS_PORT);
try {
doubleIt(transportPort, 25);
fail("Failure expected on bob");
} catch (Exception ex) {
// expected
}
}
use of org.apache.cxf.bus.spring.SpringBusFactory in project testcases by coheigea.
the class XACML3AuthorizationTest method testAuthorizedRequest.
@org.junit.Test
public void testAuthorizedRequest() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = XACML3AuthorizationTest.class.getResource("cxf-client.xml");
Bus bus = bf.createBus(busFile.toString());
SpringBusFactory.setDefaultBus(bus);
SpringBusFactory.setThreadDefaultBus(bus);
URL wsdl = XACML3AuthorizationTest.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 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();
}
}
Aggregations