use of org.easymock.IMocksControl in project cxf by apache.
the class BareInInterceptorTest method setUp.
@Before
public void setUp() throws Exception {
bus = BusFactory.newInstance().createBus();
BindingFactoryManager bfm = bus.getExtension(BindingFactoryManager.class);
IMocksControl control = createNiceControl();
BindingFactory bf = control.createMock(BindingFactory.class);
Binding binding = control.createMock(Binding.class);
expect(bf.createBinding(null)).andStubReturn(binding);
expect(binding.getInFaultInterceptors()).andStubReturn(new ArrayList<Interceptor<? extends Message>>());
expect(binding.getOutFaultInterceptors()).andStubReturn(new ArrayList<Interceptor<? extends Message>>());
bfm.registerBindingFactory("http://schemas.xmlsoap.org/wsdl/soap/", bf);
}
use of org.easymock.IMocksControl in project cxf by apache.
the class CorbaMessageTest method setUp.
@Before
public void setUp() throws Exception {
java.util.Properties props = System.getProperties();
props.put("yoko.orb.id", "CXF-CORBA-Server-Binding");
orb = ORB.init(new String[0], props);
IMocksControl control = EasyMock.createNiceControl();
message = control.createMock(Message.class);
}
use of org.easymock.IMocksControl in project cxf by apache.
the class SOAPHandlerInterceptorTest method testGetUnderstoodHeadersReturnsNull.
@Test
public void testGetUnderstoodHeadersReturnsNull() {
@SuppressWarnings("rawtypes") List<Handler> list = new ArrayList<>();
list.add(new SOAPHandler<SOAPMessageContext>() {
public boolean handleMessage(SOAPMessageContext smc) {
return true;
}
public boolean handleFault(SOAPMessageContext smc) {
return true;
}
public Set<QName> getHeaders() {
return null;
}
public void close(MessageContext messageContext) {
}
});
HandlerChainInvoker invoker = new HandlerChainInvoker(list);
IMocksControl control = createNiceControl();
Binding binding = control.createMock(Binding.class);
expect(binding.getHandlerChain()).andReturn(list).anyTimes();
SoapMessage message = control.createMock(SoapMessage.class);
Exchange exchange = control.createMock(Exchange.class);
expect(message.getExchange()).andReturn(exchange).anyTimes();
expect(message.keySet()).andReturn(new HashSet<>());
expect(exchange.get(HandlerChainInvoker.class)).andReturn(invoker);
control.replay();
SOAPHandlerInterceptor li = new SOAPHandlerInterceptor(binding);
Set<QName> understood = li.getUnderstoodHeaders();
assertNotNull(understood);
assertTrue(understood.isEmpty());
}
use of org.easymock.IMocksControl in project cxf by apache.
the class PolicyRegistryImplTest method testAll.
@Test
public void testAll() {
PolicyRegistryImpl reg = new PolicyRegistryImpl();
IMocksControl control = EasyMock.createNiceControl();
Policy policy = control.createMock(Policy.class);
String key = "key";
assertNull(reg.lookup(key));
reg.register(key, policy);
assertSame(policy, reg.lookup(key));
reg.remove(key);
assertNull(reg.lookup(key));
}
use of org.easymock.IMocksControl in project cxf by apache.
the class Wsdl11AttachmentPolicyProviderTest method oneTimeSetUp.
@BeforeClass
public static void oneTimeSetUp() throws Exception {
IMocksControl control = EasyMock.createNiceControl();
Bus bus = control.createMock(Bus.class);
WSDLManager manager = new WSDLManagerImpl();
WSDLServiceBuilder builder = new WSDLServiceBuilder(bus);
DestinationFactoryManager dfm = control.createMock(DestinationFactoryManager.class);
EasyMock.expect(bus.getExtension(DestinationFactoryManager.class)).andReturn(dfm).anyTimes();
EasyMock.expect(dfm.getDestinationFactory(EasyMock.isA(String.class))).andReturn(null).anyTimes();
BindingFactoryManager bfm = control.createMock(BindingFactoryManager.class);
EasyMock.expect(bus.getExtension(BindingFactoryManager.class)).andReturn(bfm).anyTimes();
EasyMock.expect(bfm.getBindingFactory(EasyMock.isA(String.class))).andReturn(null).anyTimes();
control.replay();
int n = 19;
services = new ServiceInfo[n];
endpoints = new EndpointInfo[n];
for (int i = 0; i < n; i++) {
String resourceName = "/attachment/wsdl11/test" + i + ".wsdl";
URL url = Wsdl11AttachmentPolicyProviderTest.class.getResource(resourceName);
try {
services[i] = builder.buildServices(manager.getDefinition(url.toString())).get(0);
} catch (WSDLException ex) {
ex.printStackTrace();
fail("Failed to build service from resource " + resourceName);
}
assertNotNull(services[i]);
endpoints[i] = services[i].getEndpoints().iterator().next();
assertNotNull(endpoints[i]);
}
control.verify();
}
Aggregations