Package org.sonatype.nexus.proxy.registry

Examples of org.sonatype.nexus.proxy.registry.RepositoryRegistry


  @Test
  public void shouldFailWhenProxyRepositories()
      throws Exception
  {
    final Maven2ContentClass maven2ContentClass = new Maven2ContentClass();
    final RepositoryRegistry repositoryRegistry = mock(RepositoryRegistry.class);
    final Repository proxyRepository = mock(Repository.class);
    final RepositoryKind proxyRepositoryKind = mock(RepositoryKind.class);

    when(repositoryRegistry.getRepository("foo-proxy")).thenReturn(proxyRepository);
    when(proxyRepository.getRepositoryContentClass()).thenReturn(maven2ContentClass);
    when(proxyRepository.getLocalStatus()).thenReturn(LocalStatus.IN_SERVICE);
    when(proxyRepository.getRepositoryKind()).thenReturn(proxyRepositoryKind);
    when(proxyRepositoryKind.isFacetAvailable(ProxyRepository.class)).thenReturn(true);
View Full Code Here


  @Test
  public void shouldSkipProxyRepositoriesWhenPartOfAGroup()
      throws Exception
  {
    final Maven2ContentClass maven2ContentClass = new Maven2ContentClass();
    final RepositoryRegistry repositoryRegistry = mock(RepositoryRegistry.class);
    final Repository proxyRepository = mock(Repository.class);
    final GroupRepository groupRepository = mock(GroupRepository.class);
    final RepositoryKind groupRepositoryKind = mock(RepositoryKind.class);
    final RepositoryKind proxyRepositoryKind = mock(RepositoryKind.class);

    when(repositoryRegistry.getRepository("foo-group")).thenReturn(groupRepository);
    when(groupRepository.getRepositoryContentClass()).thenReturn(maven2ContentClass);
    when(proxyRepository.getRepositoryContentClass()).thenReturn(maven2ContentClass);
    when(groupRepository.getLocalStatus()).thenReturn(LocalStatus.IN_SERVICE);
    when(proxyRepository.getLocalStatus()).thenReturn(LocalStatus.IN_SERVICE);
    when(groupRepository.getRepositoryKind()).thenReturn(groupRepositoryKind);
View Full Code Here

  @Test
  public void shouldSkipProxyRepositoriesWhenProcessingAllRepositories()
      throws Exception
  {
    final Maven2ContentClass maven2ContentClass = new Maven2ContentClass();
    final RepositoryRegistry repositoryRegistry = mock(RepositoryRegistry.class);
    final Repository proxyRepository = mock(Repository.class);
    final RepositoryKind proxyRepositoryKind = mock(RepositoryKind.class);

    when(repositoryRegistry.getRepositories()).thenReturn(Arrays.asList(proxyRepository));
    when(proxyRepository.getRepositoryContentClass()).thenReturn(maven2ContentClass);
    when(proxyRepository.getLocalStatus()).thenReturn(LocalStatus.IN_SERVICE);
    when(proxyRepository.getRepositoryKind()).thenReturn(proxyRepositoryKind);
    when(proxyRepositoryKind.isFacetAvailable(ProxyRepository.class)).thenReturn(true);
View Full Code Here

      throws Exception
  {
    final Repository repo = mock(Repository.class);
    when(repo.getId()).thenReturn(REPO);
    when(repo.getLocalUrl()).thenReturn(osIndependentUri(rpmsDir()));
    final RepositoryRegistry repoRegistry = mock(RepositoryRegistry.class);
    when(repoRegistry.getRepository(anyString())).thenReturn(repo);
    return repoRegistry;
  }
View Full Code Here

      throws Exception
  {
    String remoteUrl = "http://localhost:" + server.getConnectors()[0].getLocalPort() + "/auth-test/";

    String repoId = "testSiteWithAuth";
    RepositoryRegistry repoRegistry = this.lookup(RepositoryRegistry.class);

    TemplateProvider templateProvider =
        this.lookup(TemplateProvider.class, DefaultRepositoryTemplateProvider.PROVIDER_ID);
    Maven2ProxyRepositoryTemplate template =
        (Maven2ProxyRepositoryTemplate) templateProvider.getTemplateById("default_proxy_release");
    template.getCoreConfiguration().getConfiguration(true).setId(repoId);
    template.getCoreConfiguration().getConfiguration(true).setName(repoId + "-name");
    template.getCoreConfiguration().getConfiguration(true).setIndexable(false); // disable index
    template.getCoreConfiguration().getConfiguration(true).setSearchable(false); // disable index

    M2Repository m2Repo = (M2Repository) template.create();
    repoRegistry.addRepository(m2Repo);

    m2Repo.setRemoteUrl(remoteUrl);
    m2Repo.setRemoteAuthenticationSettings(new UsernamePasswordRemoteAuthenticationSettings("admin", "admin"));
    m2Repo.commitChanges();
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.proxy.registry.RepositoryRegistry

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.