use of org.apache.cxf.calculator.CalculatorPortType in project cxf by apache.
the class SOAPBindingTest method testRoles.
@Test
public void testRoles() throws Exception {
URL wsdl1 = getClass().getResource("/wsdl/calculator.wsdl");
assertNotNull(wsdl1);
ServiceImpl service = new ServiceImpl(getBus(), wsdl1, SERVICE_1, ServiceImpl.class);
CalculatorPortType cal = service.getPort(PORT_1, CalculatorPortType.class);
BindingProvider bindingProvider = (BindingProvider) cal;
assertTrue(bindingProvider.getBinding() instanceof SOAPBinding);
SOAPBinding binding = (SOAPBinding) bindingProvider.getBinding();
assertNotNull(binding.getRoles());
assertEquals(2, binding.getRoles().size());
assertTrue(binding.getRoles().contains(Soap12.getInstance().getNextRole()));
assertTrue(binding.getRoles().contains(Soap12.getInstance().getUltimateReceiverRole()));
String myrole = "http://myrole";
Set<String> roles = new HashSet<>();
roles.add(myrole);
binding.setRoles(roles);
assertNotNull(binding.getRoles());
assertEquals(3, binding.getRoles().size());
assertTrue(binding.getRoles().contains(myrole));
assertTrue(binding.getRoles().contains(Soap12.getInstance().getNextRole()));
assertTrue(binding.getRoles().contains(Soap12.getInstance().getUltimateReceiverRole()));
roles.add(Soap12.getInstance().getNoneRole());
try {
binding.setRoles(roles);
fail("did not throw exception");
} catch (WebServiceException e) {
// that's expected with none role
}
}
use of org.apache.cxf.calculator.CalculatorPortType in project cxf by apache.
the class SOAPBindingTest method testSAAJ.
@Test
public void testSAAJ() throws Exception {
URL wsdl1 = getClass().getResource("/wsdl/calculator.wsdl");
assertNotNull(wsdl1);
ServiceImpl service = new ServiceImpl(getBus(), wsdl1, SERVICE_1, ServiceImpl.class);
CalculatorPortType cal = service.getPort(PORT_1, CalculatorPortType.class);
BindingProvider bindingProvider = (BindingProvider) cal;
assertTrue(bindingProvider.getBinding() instanceof SOAPBinding);
SOAPBinding binding = (SOAPBinding) bindingProvider.getBinding();
assertNotNull(binding.getMessageFactory());
assertNotNull(binding.getSOAPFactory());
}
use of org.apache.cxf.calculator.CalculatorPortType in project cxf by apache.
the class ServiceImplTest method testJAXBCachedOnRepeatGetPort.
@Test
public void testJAXBCachedOnRepeatGetPort() {
System.gc();
System.gc();
URL wsdl1 = getClass().getResource("/wsdl/calculator.wsdl");
assertNotNull(wsdl1);
ServiceImpl service = new ServiceImpl(getBus(), wsdl1, SERVICE_1, ServiceImpl.class);
CalculatorPortType cal1 = service.getPort(PORT_1, CalculatorPortType.class);
assertNotNull(cal1);
ClientProxy cp = (ClientProxy) Proxy.getInvocationHandler(cal1);
JAXBDataBinding db1 = (JAXBDataBinding) cp.getClient().getEndpoint().getService().getDataBinding();
assertNotNull(db1);
System.gc();
System.gc();
System.gc();
System.gc();
CalculatorPortType cal2 = service.getPort(PORT_1, CalculatorPortType.class);
assertNotNull(cal2);
cp = (ClientProxy) Proxy.getInvocationHandler(cal2);
JAXBDataBinding db2 = (JAXBDataBinding) cp.getClient().getEndpoint().getService().getDataBinding();
assertNotNull(db2);
assertEquals("got cached JAXBContext", db1.getContext(), db2.getContext());
}
use of org.apache.cxf.calculator.CalculatorPortType in project cxf by apache.
the class ServiceImplTest method testHandlerResolver.
@Test
public void testHandlerResolver() {
URL wsdl1 = getClass().getResource("/wsdl/calculator.wsdl");
assertNotNull(wsdl1);
ServiceImpl service = new ServiceImpl(getBus(), wsdl1, SERVICE_1, ServiceImpl.class);
TestHandlerResolver resolver = new TestHandlerResolver();
assertNull(resolver.getPortInfo());
service.setHandlerResolver(resolver);
CalculatorPortType cal = service.getPort(PORT_1, CalculatorPortType.class);
assertNotNull(cal);
PortInfo info = resolver.getPortInfo();
assertNotNull(info);
assertEquals(SERVICE_1, info.getServiceName());
assertEquals(PORT_1, info.getPortName());
assertEquals(SOAPBinding.SOAP12HTTP_BINDING, info.getBindingID());
}
use of org.apache.cxf.calculator.CalculatorPortType in project cxf by apache.
the class ServiceImplTest method testGetGoodPort.
@Test
public void testGetGoodPort() {
URL wsdl1 = getClass().getResource("/wsdl/calculator.wsdl");
assertNotNull(wsdl1);
ServiceImpl service = new ServiceImpl(getBus(), wsdl1, SERVICE_1, ServiceImpl.class);
CalculatorPortType cal = service.getPort(PORT_1, CalculatorPortType.class);
assertNotNull(cal);
}
Aggregations