use of org.apache.hello_world.Greeter in project cxf by apache.
the class SSLv3Test method testClientSSL3Allowed.
@org.junit.Test
public void testClientSSL3Allowed() throws Exception {
// Doesn't work with IBM JDK
if ("IBM Corporation".equals(System.getProperty("java.vendor"))) {
return;
}
SpringBusFactory bf = new SpringBusFactory();
URL busFile = SSLv3Test.class.getResource("sslv3-client-allow.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL url = SOAPService.WSDL_LOCATION;
SOAPService service = new SOAPService(url, SOAPService.SERVICE);
assertNotNull("Service is null", service);
final Greeter port = service.getHttpsPort();
assertNotNull("Port is null", port);
updateAddressPort(port, PORT3);
assertEquals(port.greetMe("Kitty"), "Hello Kitty");
((java.io.Closeable) port).close();
bus.shutdown(true);
}
use of org.apache.hello_world.Greeter in project cxf by apache.
the class SSLv3Test method testAsyncClientSSL3NotAllowed.
@org.junit.Test
public void testAsyncClientSSL3NotAllowed() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = SSLv3Test.class.getResource("sslv3-client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL url = SOAPService.WSDL_LOCATION;
SOAPService service = new SOAPService(url, SOAPService.SERVICE);
assertNotNull("Service is null", service);
final Greeter port = service.getHttpsPort();
assertNotNull("Port is null", port);
// Enable Async
((BindingProvider) port).getRequestContext().put("use.async.http.conduit", true);
updateAddressPort(port, PORT3);
try {
port.greetMe("Kitty");
fail("Failure expected on the client not supporting SSLv3 by default");
} catch (Exception ex) {
// expected
}
((java.io.Closeable) port).close();
bus.shutdown(true);
}
use of org.apache.hello_world.Greeter in project cxf by apache.
the class HTTPConduitTest method testLogLevelIssueCXF3466.
@Test
public void testLogLevelIssueCXF3466() throws Exception {
startServer("Mortimer");
Greeter mortimer = getMortimerGreeter();
Logger rootLogger = LogManager.getLogManager().getLogger("");
Level oldLevel = rootLogger.getLevel();
rootLogger.setLevel(Level.FINE);
try {
// Will throw exception Stream is closed if bug is present
mortimer.sayHi();
} finally {
rootLogger.setLevel(oldLevel);
}
assertProxyRequestCount(1);
}
use of org.apache.hello_world.Greeter in project cxf by apache.
the class HTTPConduitTest method testHttp2HttpLoopRedirectFail.
/**
* This methods tests that a redirection loop will fail.
* Hurlon redirects to Abost, which redirects to Hurlon.
*
* Note: Unfortunately, the invocation may "fail" for any
* number of reasons.
*/
@Test
public void testHttp2HttpLoopRedirectFail() throws Exception {
startServer("Abost");
startServer("Hurlon");
URL config = getClass().getResource("Http2HttpLoopRedirectFail.cxf");
// We go through the back door, setting the default bus.
new DefaultBusFactory().createBus(config);
URL wsdl = getClass().getResource("greeting.wsdl");
assertNotNull("WSDL is null", wsdl);
SOAPService service = new SOAPService(wsdl, serviceName);
assertNotNull("Service is null", service);
Greeter hurlon = service.getPort(hurlonQ, Greeter.class);
assertNotNull("Port is null", hurlon);
updateAddressPort(hurlon, getPort("PORT3"));
configureProxy(ClientProxy.getClient(hurlon));
String answer = null;
try {
answer = hurlon.sayHi();
fail("Redirect didn't fail. Got answer: " + answer);
} catch (Exception e) {
// This exception will be one of not being able to
// read from the StreamReader
// e.printStackTrace();
}
assertProxyRequestCount(2);
}
use of org.apache.hello_world.Greeter in project cxf by apache.
the class DigestAuthTest method testDigestAuth.
@Test
public void testDigestAuth() throws Exception {
URL wsdl = getClass().getResource("../greeting.wsdl");
assertNotNull("WSDL is null", wsdl);
SOAPService service = new SOAPService(wsdl, serviceName);
assertNotNull("Service is null", service);
Greeter mortimer = service.getPort(mortimerQ, Greeter.class);
assertNotNull("Port is null", mortimer);
TestUtil.setAddress(mortimer, "http://localhost:" + PORT + "/digestauth/greeter");
Client client = ClientProxy.getClient(mortimer);
HTTPConduit http = (HTTPConduit) client.getConduit();
AuthorizationPolicy authPolicy = new AuthorizationPolicy();
authPolicy.setAuthorizationType("Digest");
authPolicy.setUserName("foo");
authPolicy.setPassword("bar");
http.setAuthorization(authPolicy);
String answer = mortimer.sayHi();
assertEquals("Unexpected answer: " + answer, "Hi", answer);
}
Aggregations