use of org.easymock.IMocksControl in project cxf by apache.
the class JAASLoginInterceptorTest method createTestCert.
private X509Certificate createTestCert(String subjectDn) {
IMocksControl c = EasyMock.createControl();
X509Certificate cert = c.createMock(X509Certificate.class);
Principal principal = c.createMock(Principal.class);
EasyMock.expect(principal.getName()).andReturn(subjectDn);
EasyMock.expect(cert.getSubjectDN()).andReturn(principal);
c.replay();
return cert;
}
use of org.easymock.IMocksControl in project cxf by apache.
the class CachedStreamTestBase method testUseBusProps.
@Test
public void testUseBusProps() throws Exception {
Bus oldbus = BusFactory.getThreadDefaultBus(false);
try {
Object cache = createCache(64);
File tmpfile = getTmpFile("Hello World!", cache);
assertNull("expects no tmp file", tmpfile);
close(cache);
IMocksControl control = EasyMock.createControl();
Bus b = control.createMock(Bus.class);
EasyMock.expect(b.getProperty("bus.io.CachedOutputStream.Threshold")).andReturn("4");
EasyMock.expect(b.getProperty("bus.io.CachedOutputStream.MaxSize")).andReturn(null);
EasyMock.expect(b.getProperty("bus.io.CachedOutputStream.CipherTransformation")).andReturn(null);
BusFactory.setThreadDefaultBus(b);
control.replay();
cache = createCache();
tmpfile = getTmpFile("Hello World!", cache);
assertNotNull("expects a tmp file", tmpfile);
assertTrue("expects a tmp file", tmpfile.exists());
close(cache);
assertFalse("expects no tmp file", tmpfile.exists());
control.verify();
} finally {
BusFactory.setThreadDefaultBus(oldbus);
}
}
use of org.easymock.IMocksControl in project cxf by apache.
the class TestBase method getMockedServiceModel.
protected ServiceInfo getMockedServiceModel(String wsdlUrl) throws Exception {
WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
wsdlReader.setFeature("javax.wsdl.verbose", false);
Definition def = wsdlReader.readWSDL(wsdlUrl);
IMocksControl control = EasyMock.createNiceControl();
Bus bus = control.createMock(Bus.class);
BindingFactoryManager bindingFactoryManager = control.createMock(BindingFactoryManager.class);
DestinationFactoryManager dfm = control.createMock(DestinationFactoryManager.class);
WSDLServiceBuilder wsdlServiceBuilder = new WSDLServiceBuilder(bus);
Service service = null;
for (Iterator<?> it = def.getServices().values().iterator(); it.hasNext(); ) {
Object obj = it.next();
if (obj instanceof Service) {
service = (Service) obj;
break;
}
}
EasyMock.expect(bus.getExtension(BindingFactoryManager.class)).andReturn(bindingFactoryManager);
EasyMock.expect(bus.getExtension(DestinationFactoryManager.class)).andStubReturn(dfm);
control.replay();
ServiceInfo serviceInfo = wsdlServiceBuilder.buildServices(def, service).get(0);
serviceInfo.setProperty(WSDLServiceBuilder.WSDL_DEFINITION, null);
serviceInfo.setProperty(WSDLServiceBuilder.WSDL_SERVICE, null);
return serviceInfo;
}
use of org.easymock.IMocksControl in project cxf by apache.
the class BareOutInterceptorTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
interceptor = new BareOutInterceptor();
baos = new ByteArrayOutputStream();
writer = getXMLStreamWriter(baos);
message.setContent(XMLStreamWriter.class, writer);
message.getExchange().put(BindingOperationInfo.class, operation);
IMocksControl control = EasyMock.createNiceControl();
InterceptorChain ic = control.createMock(InterceptorChain.class);
message.setInterceptorChain(ic);
control.replay();
}
use of org.easymock.IMocksControl in project cxf by apache.
the class DocLiteralInInterceptorTest 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);
}
Aggregations