use of java.net.URL in project camel by apache.
the class CxfMtomRouterCxfMessageModeTest method getPort.
@Override
protected Hello getPort() {
URL wsdl = getClass().getResource("/mtom.wsdl");
assertNotNull("WSDL is null", wsdl);
HelloService service = new HelloService(wsdl, HelloService.SERVICE);
assertNotNull("Service is null ", service);
Hello port = service.getHelloPort();
((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + port1 + "/CxfMtomRouterCxfMessageModeTest/jaxws-mtom/hello");
return port;
}
use of java.net.URL in project camel by apache.
the class CxfRsConsumerTest method testGetWrongCustomer.
@Test
public void testGetWrongCustomer() throws Exception {
URL url = new URL("http://localhost:" + CXT + "/rest/customerservice/customers/456");
try {
url.openStream();
fail("Expect to get exception here");
} catch (FileNotFoundException exception) {
// do nothing here
}
url = new URL("http://localhost:" + CXT + "/rest/customerservice/customers/234");
try {
url.openStream();
fail("Expect to get exception here");
} catch (FileNotFoundException exception) {
// do nothing here
}
url = new URL("http://localhost:" + CXT + "/rest/customerservice/customers/256");
try {
url.openStream();
fail("Expect to get exception here");
} catch (IOException exception) {
// expect the Internal error exception
}
}
use of java.net.URL in project camel by apache.
the class WSRMTest method testWSAddressing.
@Test
public void testWSAddressing() throws Exception {
JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
clientBean.setAddress(getClientAddress());
clientBean.setServiceClass(HelloWorld.class);
clientBean.setWsdlURL(WSRMTest.class.getResource("/HelloWorld.wsdl").toString());
SpringBusFactory bf = new SpringBusFactory();
URL cxfConfig = null;
if (getCxfClientConfig() != null) {
cxfConfig = ClassLoaderUtils.getResource(getCxfClientConfig(), this.getClass());
}
proxyFactory.setBus(bf.createBus(cxfConfig));
proxyFactory.getOutInterceptors().add(new MessageLossSimulator());
HelloWorld client = (HelloWorld) proxyFactory.create();
String result = client.sayHi("world!");
assertEquals("Get a wrong response", "Hello world!", result);
}
use of java.net.URL in project camel by apache.
the class WSSecurityRouteTest method testSignature.
@Test
public void testSignature() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = WSSecurityRouteTest.class.getResource("../client/wssec.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
GreeterService gs = new GreeterService();
Greeter greeter = gs.getGreeterSignaturePort();
((BindingProvider) greeter).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + CXFTestSupport.getPort2() + "/WSSecurityRouteTest/GreeterSignaturePort");
assertEquals("Get a wrong response", "Hello Security", greeter.greetMe("Security"));
}
use of java.net.URL in project camel by apache.
the class WSSecurityRouteTest method testEncryption.
@Test
public void testEncryption() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = WSSecurityRouteTest.class.getResource("../client/wssec.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
GreeterService gs = new GreeterService();
Greeter greeter = gs.getGreeterEncryptionPort();
((BindingProvider) greeter).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + CXFTestSupport.getPort2() + "/WSSecurityRouteTest/GreeterEncryptionPort");
assertEquals("Get a wrong response", "Hello Security", greeter.greetMe("Security"));
}
Aggregations