{
setParameters();
HttpClientFactoryImpl httpClientFactory = null;
try {
// the foreplay: setting up
final RemoteStorageContext globalRemoteStorageContext = new DefaultRemoteStorageContext(null);
final DefaultRemoteConnectionSettings rcs = new DefaultRemoteConnectionSettings();
rcs.setConnectionTimeout(86400000);
globalRemoteStorageContext.setRemoteConnectionSettings(new DefaultRemoteConnectionSettings());
globalRemoteStorageContext.setRemoteProxySettings(mock(RemoteProxySettings.class));
// real provider and initializing it with NexusStarted event
httpClientFactory = new HttpClientFactoryImpl(
Providers.of(mock(SystemStatus.class)),
Providers.of(globalRemoteStorageContext),
mock(EventBus.class),
mock(PoolingClientConnectionManagerMBeanInstaller.class),
null
);
// the RRS instance we test
final HttpClientRemoteStorage underTest =
new HttpClientRemoteStorage(Providers.of(mock(SystemStatus.class)),
mock(MimeSupport.class), mock(QueryStringBuilder.class), new HttpClientManagerImpl(httpClientFactory));
// a mock proxy repository with some mocks to make RRS work
final RemoteStorageContext proxyContext = new DefaultRemoteStorageContext(globalRemoteStorageContext);
final ProxyRepository repository = mock(ProxyRepository.class);
when(repository.getId()).thenReturn("foo");
when(repository.getName()).thenReturn("foo");
when(repository.getRemoteStorageContext()).thenReturn(proxyContext);