use of org.apache.cxf.systest.mtom_feature.Hello in project cxf by apache.
the class MTOMBindingTypeTest method testEcho.
@Test
@org.junit.Ignore
public void testEcho() throws Exception {
byte[] bytes = ImageHelper.getImageBytes(getImage("/java.jpg"), "image/jpeg");
Holder<byte[]> image = new Holder<>(bytes);
Hello port = getPort();
SOAPBinding binding = (SOAPBinding) ((BindingProvider) port).getBinding();
binding.setMTOMEnabled(true);
port.echoData(image);
assertNotNull(image);
}
use of org.apache.cxf.systest.mtom_feature.Hello in project cxf by apache.
the class MTOMBindingTypeTest method getPort.
private Hello getPort() {
URL wsdl = getClass().getResource("/wsdl_systest/mtom.wsdl");
assertNotNull("WSDL is null", wsdl);
HelloService service = new HelloService(wsdl, serviceName);
assertNotNull("Service is null ", service);
Hello hello = service.getHelloPort();
try {
updateAddressPort(hello, PORT);
} catch (Exception ex) {
// ignore
}
return hello;
}
use of org.apache.cxf.systest.mtom_feature.Hello in project cxf by apache.
the class MTOMBindingTypeTest method testDetail.
@Test
public void testDetail() throws Exception {
ByteArrayOutputStream input = setupInLogging();
ByteArrayOutputStream output = setupOutLogging();
Holder<byte[]> photo = new Holder<>("CXF".getBytes());
Holder<Image> image = new Holder<>(getImage("/java.jpg"));
Hello port = getPort();
SOAPBinding binding = (SOAPBinding) ((BindingProvider) port).getBinding();
binding.setMTOMEnabled(true);
port.detail(photo, image);
String expected = "<xop:Include ";
assertTrue(output.toString().indexOf(expected) != -1);
assertTrue(input.toString().indexOf(expected) != -1);
assertEquals("CXF", new String(photo.value));
assertNotNull(image.value);
}
Aggregations