use of org.example.contract.doubleit.DoubleItPortType in project cxf by apache.
the class ModifiedRequestTest method testModifiedSignature.
@org.junit.Test
public void testModifiedSignature() throws Exception {
if (!unrestrictedPoliciesInstalled) {
return;
}
SpringBusFactory bf = new SpringBusFactory();
URL busFile = ModifiedRequestTest.class.getResource("client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL wsdl = ModifiedRequestTest.class.getResource("DoubleItFault.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricPort");
DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(port, PORT);
Client cxfClient = ClientProxy.getClient(port);
ModifiedSignatureInterceptor modifyInterceptor = new ModifiedSignatureInterceptor();
cxfClient.getOutInterceptors().add(modifyInterceptor);
makeInvocation(port, false);
// Streaming invocation
port = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(port, STAX_PORT);
cxfClient = ClientProxy.getClient(port);
modifyInterceptor = new ModifiedSignatureInterceptor();
cxfClient.getOutInterceptors().add(modifyInterceptor);
makeInvocation(port, true);
((java.io.Closeable) port).close();
bus.shutdown(true);
}
use of org.example.contract.doubleit.DoubleItPortType in project cxf by apache.
the class GCMTest method testAESGCM192.
@org.junit.Test
public void testAESGCM192() throws Exception {
if (!unrestrictedPoliciesInstalled) {
return;
}
//
if ("IBM Corporation".equals(System.getProperty("java.vendor")) && System.getProperty("java.version") != null && System.getProperty("java.version").startsWith("1.7")) {
return;
}
SpringBusFactory bf = new SpringBusFactory();
URL busFile = GCMTest.class.getResource("client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL wsdl = GCMTest.class.getResource("DoubleItGCM.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItGCM192Port");
DoubleItPortType gcmPort = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(gcmPort, test.getPort());
if (test.isStreaming()) {
SecurityTestUtil.enableStreaming(gcmPort);
}
assertEquals(50, gcmPort.doubleIt(25));
((java.io.Closeable) gcmPort).close();
bus.shutdown(true);
}
use of org.example.contract.doubleit.DoubleItPortType in project cxf by apache.
the class GCMTest method testAESGCM256MGFSHA256.
@org.junit.Test
public void testAESGCM256MGFSHA256() throws Exception {
if (!unrestrictedPoliciesInstalled) {
return;
}
//
if ("IBM Corporation".equals(System.getProperty("java.vendor")) && System.getProperty("java.version") != null && System.getProperty("java.version").startsWith("1.7")) {
return;
}
SpringBusFactory bf = new SpringBusFactory();
URL busFile = GCMTest.class.getResource("mgf-client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL wsdl = GCMTest.class.getResource("DoubleItGCM.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItGCM256MGFSHA256Port");
DoubleItPortType gcmPort = service.getPort(portQName, DoubleItPortType.class);
String port = MGF_PORT;
if (STAX_PORT.equals(test.getPort())) {
port = MGF_STAX_PORT;
}
updateAddressPort(gcmPort, port);
if (test.isStreaming()) {
SecurityTestUtil.enableStreaming(gcmPort);
}
assertEquals(50, gcmPort.doubleIt(25));
((java.io.Closeable) gcmPort).close();
bus.shutdown(true);
}
use of org.example.contract.doubleit.DoubleItPortType in project cxf by apache.
the class GCMTest method testAESGCM128.
@org.junit.Test
public void testAESGCM128() throws Exception {
//
if ("IBM Corporation".equals(System.getProperty("java.vendor")) && System.getProperty("java.version") != null && System.getProperty("java.version").startsWith("1.7")) {
return;
}
SpringBusFactory bf = new SpringBusFactory();
URL busFile = GCMTest.class.getResource("client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL wsdl = GCMTest.class.getResource("DoubleItGCM.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItGCM128Port");
DoubleItPortType gcmPort = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(gcmPort, test.getPort());
if (test.isStreaming()) {
SecurityTestUtil.enableStreaming(gcmPort);
}
assertEquals(50, gcmPort.doubleIt(25));
((java.io.Closeable) gcmPort).close();
bus.shutdown(true);
}
use of org.example.contract.doubleit.DoubleItPortType in project cxf by apache.
the class HTTPGetTest method testSignedBodyTimestamp.
@org.junit.Test
public void testSignedBodyTimestamp() throws Exception {
if (!unrestrictedPoliciesInstalled) {
return;
}
SpringBusFactory bf = new SpringBusFactory();
URL busFile = HTTPGetTest.class.getResource("client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL wsdl = HTTPGetTest.class.getResource("DoubleItHTTPGet.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItSignBodyPort");
DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(port, PORT);
Map<String, Object> outProps = new HashMap<>();
outProps.put("action", "Timestamp Signature");
outProps.put("signaturePropFile", "alice.properties");
outProps.put("user", "alice");
outProps.put("passwordCallbackClass", "org.apache.cxf.systest.ws.common.KeystorePasswordCallback");
outProps.put("signatureParts", "{}{http://schemas.xmlsoap.org/soap/envelope/}Body;" + "{}{http://docs.oasis-open.org/wss/2004/01/oasis-" + "200401-wss-wssecurity-utility-1.0.xsd}Timestamp;");
bus.getOutInterceptors().add(new WSS4JOutInterceptor(outProps));
int result = port.doubleIt(25);
assertEquals(result, 50);
bus.shutdown(true);
}
Aggregations