use of org.apache.cxf.factory_pattern.IsEvenResponse in project cxf by apache.
the class MultiplexHttpAddressClientServerTest method testWithManualMultiplexEprCreation.
@Test
public void testWithManualMultiplexEprCreation() throws Exception {
Service numService = Service.create(NumberFactoryImpl.NUMBER_SERVICE_QNAME);
Number num = numService.getPort(Number.class);
InvocationHandler handler = Proxy.getInvocationHandler(num);
BindingProvider bp = (BindingProvider) handler;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, NUMBER_SERVANT_ADDRESS_ROOT + "103");
IsEvenResponse numResp = num.isEven();
assertFalse("103 is not even", numResp.isEven());
}
use of org.apache.cxf.factory_pattern.IsEvenResponse in project cxf by apache.
the class ManualHttpMulitplexClientServerTest method testWithManualMultiplexEprCreation.
@Test
public void testWithManualMultiplexEprCreation() throws Exception {
NumberFactoryService service = new NumberFactoryService();
NumberFactory nfact = service.getNumberFactoryPort();
updateAddressPort(nfact, PORT);
W3CEndpointReference w3cEpr = nfact.create("2");
assertNotNull("reference", w3cEpr);
// use the epr info only
// no wsdl so default generated soap/http binding will be used
// address url must come from the calling context
EndpointReferenceType epr = ProviderImpl.convertToInternal(w3cEpr);
QName serviceName = EndpointReferenceUtils.getServiceName(epr, bus);
Service numService = Service.create(serviceName);
String portString = EndpointReferenceUtils.getPortName(epr);
QName portName = new QName(serviceName.getNamespaceURI(), portString);
numService.addPort(portName, SoapBindingFactory.SOAP_11_BINDING, "http://foo");
Number num = numService.getPort(portName, Number.class);
setupContextWithEprAddress(epr, num);
IsEvenResponse numResp = num.isEven();
assertTrue("2 is even", numResp.isEven());
// try again with the address from another epr
w3cEpr = nfact.create("3");
epr = ProviderImpl.convertToInternal(w3cEpr);
setupContextWithEprAddress(epr, num);
numResp = num.isEven();
assertFalse("3 is not even", numResp.isEven());
// try again with the address from another epr
w3cEpr = nfact.create("6");
epr = ProviderImpl.convertToInternal(w3cEpr);
setupContextWithEprAddress(epr, num);
numResp = num.isEven();
assertTrue("6 is even", numResp.isEven());
}
use of org.apache.cxf.factory_pattern.IsEvenResponse in project cxf by apache.
the class NumberImpl method genResponse.
private IsEvenResponse genResponse(boolean v) {
IsEvenResponse resp = new ObjectFactory().createIsEvenResponse();
resp.setEven(v);
return resp;
}
Aggregations