Package org.sonatype.nexus.proxy.storage.remote

Examples of org.sonatype.nexus.proxy.storage.remote.DefaultRemoteStorageContext


    this.poolManager = checkNotNull(poolManager);

    // we have been not configured yet! So, we have no ID and stuff coming from config!
    // set here
    remoteStorageContext =
        new DefaultRemoteStorageContext(getApplicationConfiguration().getGlobalRemoteStorageContext());
  }
View Full Code Here


  private MavenProxyRepository mavenProxyRepository;

  @Before
  public void initMocks() {
    MockitoAnnotations.initMocks(this);
    when(mavenProxyRepository.getRemoteStorageContext()).thenReturn(new DefaultRemoteStorageContext(null));
  }
View Full Code Here

      globalLocalStorageContext = new DefaultLocalStorageContext(null);

      // create global remote ctx
      // this one has no parent
      globalRemoteStorageContext = new DefaultRemoteStorageContext(null);

      final GlobalRemoteConnectionSettings globalRemoteConnectionSettings = globalRemoteConnectionSettingsProvider
          .get();
      // TODO: hack
      ((DefaultGlobalRemoteConnectionSettings) globalRemoteConnectionSettings).configure(this);
View Full Code Here

  }

  private DefaultRemoteStorageContext getRemoteStorageContext(@Nullable String configuredString) {
    DefaultRemoteConnectionSettings settings = new DefaultRemoteConnectionSettings();
    settings.setQueryString(configuredString);
    DefaultRemoteStorageContext ctx = new DefaultRemoteStorageContext(null);
    ctx.setRemoteConnectionSettings(settings);
    return ctx;
  }
View Full Code Here

    final HttpClientRemoteStorage underTest =
        new HttpClientRemoteStorage(Providers.of(mock(SystemStatus.class)),
            mock(MimeSupport.class), mock(QueryStringBuilder.class), mock(HttpClientManager.class));
    final ProxyRepository proxyMock = mock(ProxyRepository.class);
    when(proxyMock.getId()).thenReturn("id");
    when(proxyMock.getRemoteStorageContext()).thenReturn(new DefaultRemoteStorageContext(null));

    thrown.expect(RemoteItemNotFoundException.class);
    thrown.expectMessage("not found in remote storage of repository");

    underTest.retrieveItem(proxyMock, new ResourceStoreRequest("bar/"), "http://foo.com");
View Full Code Here

    final HttpClientRemoteStorage underTest =
        new HttpClientRemoteStorage(Providers.of(mock(SystemStatus.class)),
            mock(MimeSupport.class), mock(QueryStringBuilder.class), mock(HttpClientManager.class));
    final ProxyRepository proxyMock = mock(ProxyRepository.class);
    when(proxyMock.getId()).thenReturn("id");
    when(proxyMock.getRemoteStorageContext()).thenReturn(new DefaultRemoteStorageContext(null));

    thrown.expect(RemoteItemNotFoundException.class);
    thrown.expectMessage("not found in remote storage of repository");

    underTest.retrieveItem(proxyMock, new ResourceStoreRequest("bar/?param=x/"),
View Full Code Here

    final HttpClientRemoteStorage underTest =
        new HttpClientRemoteStorage(Providers.of(mock(SystemStatus.class)),
            mock(MimeSupport.class), mock(QueryStringBuilder.class), mock(HttpClientManager.class));
    final ProxyRepository proxyMock = mock(ProxyRepository.class);
    when(proxyMock.getId()).thenReturn("id");
    when(proxyMock.getRemoteStorageContext()).thenReturn(new DefaultRemoteStorageContext(null));

    thrown.expect(RemoteItemNotFoundException.class);
    thrown.expectMessage("not found in remote storage of repository");

    underTest.retrieveItem(proxyMock, new ResourceStoreRequest("bar/?param=x"),
View Full Code Here

          }
        };

    final ProxyRepository proxyMock = mock(ProxyRepository.class);
    when(proxyMock.getId()).thenReturn("foo");
    when(proxyMock.getRemoteStorageContext()).thenReturn(new DefaultRemoteStorageContext(null));

    underTest.retrieveItem(proxyMock, new ResourceStoreRequest("bar?param=x"), "http://foo.com");
  }
View Full Code Here

  {
    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);
View Full Code Here

        };

    final ProxyRepository proxyMock = mock(ProxyRepository.class);
    when(proxyMock.getId()).thenReturn("foo");
    when(proxyMock.getRemoteUrl()).thenReturn("http://repo1.maven.org/maven2/");
    when(proxyMock.getRemoteStorageContext()).thenReturn(new DefaultRemoteStorageContext(null));
   
    assertThat(underTest.checkRemoteAvailability(0, proxyMock, new ResourceStoreRequest("/"), false), is(true));
    assertThat(underTest.checkRemoteAvailability(System.currentTimeMillis(), proxyMock, new ResourceStoreRequest("/"), false), is(false));
  }
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.proxy.storage.remote.DefaultRemoteStorageContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.