Examples of ProxyRepository


Examples of org.sonatype.nexus.proxy.repository.ProxyRepository

      throws Exception
  {
    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

Examples of org.sonatype.nexus.proxy.repository.ProxyRepository

            when(httpResponse.getEntity()).thenReturn(mock(HttpEntity.class));
            return httpResponse;
          }
        };

    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

Examples of org.sonatype.nexus.proxy.repository.ProxyRepository

          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);

      // a mock remote server that will simply "hang" to occupy the request socket
      final Server server =
          Server.withPort(0).serve("/").withBehaviours(Behaviours.pause(Time.days(1))).start();
      // the URL we will try to connect to
View Full Code Here

Examples of org.sonatype.nexus.proxy.repository.ProxyRepository

            when(httpResponse.getEntity()).thenReturn(mock(HttpEntity.class));
            return httpResponse;
          }
        };

    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

Examples of org.sonatype.nexus.proxy.repository.ProxyRepository

      // old way
      remotePath = storageItem.getRequestPath().substring(1);
    }

    try {
      ProxyRepository proxyRepository = getUnprotectedRepositoryRegistry().getRepositoryWithFacet(id,
          ProxyRepository.class);
      HttpClient client = httpClientProvider.create(
          new RemoteStorageContextCustomizer(proxyRepository.getRemoteStorageContext()));

      MavenRepositoryReader mr = new MavenRepositoryReader(client, queryStringBuilder);
      MavenRepositoryReaderResponse data = new MavenRepositoryReaderResponse();
      // FIXME: Sort this out, NEXUS-4058 was closed about a year go (orig: we really should not do the encoding here, but this is work around until NEXUS-4058 is fixed).
      String localUrl = createRemoteResourceReference(request, id, "").toString(false, false);
View Full Code Here

Examples of org.sonatype.nexus.proxy.repository.ProxyRepository

    final Repository repository = uid.getRepository();
    final ResourceStoreRequest request = new ResourceStoreRequest(uid.getPath());

    if (repository.getRepositoryKind().isFacetAvailable(ProxyRepository.class)) {
      final ProxyRepository proxyRepository = repository.adaptToFacet(ProxyRepository.class);
      final RemoteRepositoryStorage storage = proxyRepository.getRemoteStorage();
      if (storage != null) {
        return storage.getAbsoluteUrlFromBase(proxyRepository, request);
      }
      // locally hosted proxy repository, so drop through...
    }
View Full Code Here

Examples of org.sonatype.nexus.proxy.repository.ProxyRepository

  @Test
  public void verifyProcessAfterProxy()
      throws Exception
  {
    ProxyRepository repository = mock(ProxyRepository.class);
    mockRepository(repository, "repo5");
    when(repository.getRemoteUrl()).thenReturn("http://localhost:8082/nexus/content/repositories/thirdparty");

    MetadataProcessor.processProxiedMetadata(repository);

    ArgumentCaptor<ResourceStoreRequest> deleteRequests = ArgumentCaptor.forClass(ResourceStoreRequest.class);
    verify(repository).deleteItem(eq(false), deleteRequests.capture());
View Full Code Here

Examples of org.sonatype.nexus.proxy.repository.ProxyRepository

  private String getRemoteUrl() {
    return "http://" + nameOfConnector + "/";
  }

  private ProxyRepository getFakeProxyRepository(final String remoteUrl) {
    final ProxyRepository repository = Mockito.mock(ProxyRepository.class);
    Mockito.when(repository.getRemoteUrl()).thenReturn(remoteUrl);

    final DefaultRemoteStorageContext rsc = new DefaultRemoteStorageContext(null);
    rsc.setRemoteProxySettings(remoteProxySettings);
    rsc.setRemoteConnectionSettings(new DefaultRemoteConnectionSettings());
    Mockito.when(repository.getRemoteStorageContext()).thenReturn(rsc);

    return repository;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.