Package org.sonatype.nexus.proxy.repository

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


      throws IOException
  {
    // the "default"
    boolean doTouch = LAST_REQUEST_ATTRIBUTE_ENABLED;

    final RepositoryKind repositoryKind = repository.getRepositoryKind();

    if (repositoryKind != null) {
      if (repositoryKind.isFacetAvailable(HostedRepository.class)) {
        // this is a hosted repository
        doTouch = LAST_REQUEST_ATTRIBUTE_ENABLED_FOR_HOSTED;
      }
      else if (repositoryKind.isFacetAvailable(ProxyRepository.class)) {
        // this is a proxy repository
        doTouch = LAST_REQUEST_ATTRIBUTE_ENABLED_FOR_PROXY;
      }
    }
View Full Code Here


    return link;
  }

  protected String extractRepositoryKind(Repository repository) {
    RepositoryKind kind = repository.getRepositoryKind();

    if (kind.isFacetAvailable(HostedRepository.class)) {
      return "hosted";
    }
    else if (kind.isFacetAvailable(ProxyRepository.class)) {
      return "proxy";
    }
    else if (kind.isFacetAvailable(GroupRepository.class)) {
      return "group";
    }
    else if (kind.isFacetAvailable(ShadowRepository.class)) {
      return "virtual";
    }
    else {
      // huh?
      return repository.getRepositoryKind().getMainFacet().getName();
View Full Code Here

    when(uid.getLock()).thenReturn(mock(RepositoryItemUidLock.class));
    when(repository.createUid(anyString())).thenReturn(uid);
    when(repository.getRepositoryContentClass()).thenReturn(new Maven2ContentClass());
    when(repository.isExposed()).thenReturn(true);

    final RepositoryKind repositoryKind = mock(RepositoryKind.class);
    when(repository.getRepositoryKind()).thenReturn(repositoryKind);
    Mockito.<Class<?>>when(repositoryKind.getMainFacet()).thenReturn(MavenHostedRepository.class);
    when(repositoryKind.isFacetAvailable(HostedRepository.class)).thenReturn(true);
    when(repositoryKind.isFacetAvailable(MavenRepository.class)).thenReturn(true);
    when(repositoryKind.isFacetAvailable(MavenHostedRepository.class)).thenReturn(true);
    return repository;
  }
View Full Code Here

      throws Exception
  {
    final RepositoryRegistry repositoryRegistry = mock(RepositoryRegistry.class);
    final TargetRegistry targetRegistry = mock(TargetRegistry.class);
    final Repository proxyRepository = mock(Repository.class);
    final RepositoryKind proxyRepositoryKind = mock(RepositoryKind.class);

    when(repositoryRegistry.getRepository(REPO_ID)).thenReturn(proxyRepository);
    when(proxyRepository.getRepositoryContentClass()).thenReturn(MAVEN_2_CONTENT_CLASS);
    when(proxyRepository.getLocalStatus()).thenReturn(LocalStatus.IN_SERVICE);
    when(proxyRepository.getRepositoryKind()).thenReturn(proxyRepositoryKind);
    when(proxyRepositoryKind.isFacetAvailable(ProxyRepository.class)).thenReturn(true);

    thrown.expect(IllegalArgumentException.class);
    new DefaultReleaseRemover(repositoryRegistry, targetRegistry, mock(Walker.class), MAVEN_2_CONTENT_CLASS)
        .removeReleases(new ReleaseRemovalRequest(REPO_ID, 1, null));
  }
View Full Code Here

      throws Exception
  {
    final RepositoryRegistry repositoryRegistry = mock(RepositoryRegistry.class);
    final TargetRegistry targetRegistry = mock(TargetRegistry.class);
    final Repository repository = mock(Repository.class);
    final RepositoryKind repositoryKind = mock(RepositoryKind.class);

    when(repositoryRegistry.getRepository(REPO_ID)).thenReturn(repository);
    when(repository.getRepositoryContentClass()).thenReturn(MAVEN_2_CONTENT_CLASS);
    when(repository.getLocalStatus()).thenReturn(LocalStatus.IN_SERVICE);
    when(repository.getRepositoryKind()).thenReturn(repositoryKind);
    when(repositoryKind.isFacetAvailable(GroupRepository.class)).thenReturn(true);

    thrown.expect(IllegalArgumentException.class);
    new DefaultReleaseRemover(repositoryRegistry, targetRegistry, mock(Walker.class), MAVEN_2_CONTENT_CLASS)
        .removeReleases(new ReleaseRemovalRequest(REPO_ID, 1, null));
  }
View Full Code Here

      throws Exception
  {
    final RepositoryRegistry repositoryRegistry = mock(RepositoryRegistry.class);
    final TargetRegistry targetRegistry = mock(TargetRegistry.class);
    final Repository repository = mock(Repository.class);
    final RepositoryKind repositoryKind = mock(RepositoryKind.class);
    final MavenRepository mavenRepository = mock(MavenRepository.class);

    when(repositoryRegistry.getRepository(REPO_ID)).thenReturn(repository);
    when(repository.getRepositoryContentClass()).thenReturn(MAVEN_2_CONTENT_CLASS);
    when(repository.getLocalStatus()).thenReturn(LocalStatus.IN_SERVICE);
    when(repository.getRepositoryKind()).thenReturn(repositoryKind);
    when(repositoryKind.isFacetAvailable(GroupRepository.class)).thenReturn(false);
    when(repository.adaptToFacet(MavenRepository.class)).thenReturn(mavenRepository);
    when(mavenRepository.getRepositoryPolicy()).thenReturn(RepositoryPolicy.SNAPSHOT);

    thrown.expect(IllegalArgumentException.class);
    new DefaultReleaseRemover(repositoryRegistry, targetRegistry, mock(Walker.class), MAVEN_2_CONTENT_CLASS)
View Full Code Here

      throws Exception
  {
    final RepositoryRegistry repositoryRegistry = mock(RepositoryRegistry.class);
    final TargetRegistry targetRegistry = mock(TargetRegistry.class);
    final Repository repository = mock(Repository.class);
    final RepositoryKind repositoryKind = mock(RepositoryKind.class);
    final MavenRepository mavenRepository = mock(MavenRepository.class);

    when(repositoryRegistry.getRepository(REPO_ID)).thenReturn(repository);
    when(repository.getRepositoryContentClass()).thenReturn(MAVEN_1_CONTENT_CLASS);
    when(repository.getLocalStatus()).thenReturn(LocalStatus.IN_SERVICE);
    when(repository.getRepositoryKind()).thenReturn(repositoryKind);
    when(repositoryKind.isFacetAvailable(GroupRepository.class)).thenReturn(false);
    when(repository.adaptToFacet(MavenRepository.class)).thenReturn(mavenRepository);
    when(mavenRepository.getRepositoryPolicy()).thenReturn(RepositoryPolicy.MIXED);

    thrown.expect(IllegalArgumentException.class);
    new DefaultReleaseRemover(repositoryRegistry, targetRegistry, mock(Walker.class), MAVEN_2_CONTENT_CLASS)
View Full Code Here

      throws Exception
  {
    final RepositoryRegistry repositoryRegistry = mock(RepositoryRegistry.class);
    final TargetRegistry targetRegistry = mock(TargetRegistry.class);
    final Repository repository = mock(Repository.class);
    final RepositoryKind repositoryKind = mock(RepositoryKind.class);
    final MavenRepository mavenRepository = mock(MavenRepository.class);

    when(repositoryRegistry.getRepository(REPO_ID)).thenReturn(repository);
    when(targetRegistry.getRepositoryTarget(TARGET_ID)).thenReturn(null);
    when(repositoryRegistry.getRepository(REPO_ID)).thenReturn(repository);
    when(repository.getRepositoryContentClass()).thenReturn(MAVEN_2_CONTENT_CLASS);
    when(repository.getLocalStatus()).thenReturn(LocalStatus.IN_SERVICE);
    when(repository.getRepositoryKind()).thenReturn(repositoryKind);
    when(repositoryKind.isFacetAvailable(ProxyRepository.class)).thenReturn(false);
    when(repository.adaptToFacet(MavenRepository.class)).thenReturn(mavenRepository);
    when(mavenRepository.getRepositoryPolicy()).thenReturn(RepositoryPolicy.RELEASE);

    when(mavenRepository.getLocalStatus()).thenReturn(LocalStatus.IN_SERVICE);
View Full Code Here

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

    thrown.expect(IllegalArgumentException.class);
    new DefaultSnapshotRemover(repositoryRegistry, mock(Walker.class), maven2ContentClass)
    {
      @Override
View Full Code Here

  {
    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);
    when(proxyRepository.getRepositoryKind()).thenReturn(proxyRepositoryKind);
    when(groupRepositoryKind.isFacetAvailable(GroupRepository.class)).thenReturn(true);
    when(proxyRepositoryKind.isFacetAvailable(ProxyRepository.class)).thenReturn(true);
    when(groupRepository.adaptToFacet(GroupRepository.class)).thenReturn(groupRepository);
    when(groupRepository.getMemberRepositories()).thenReturn(Arrays.asList(proxyRepository));

    final SnapshotRemovalResult result =
        new DefaultSnapshotRemover(repositoryRegistry, mock(Walker.class), maven2ContentClass)
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.proxy.repository.RepositoryKind

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.