Package org.sonatype.nexus.proxy.repository

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


  public TreeNode listNodes(final TreeNodeFactory factory, final String path, final Map<Field, String> hints,
                            final ArtifactInfoFilter artifactInfoFilter, final String repositoryId)
      throws NoSuchRepositoryException, IOException
  {
    final Repository repository = repositoryRegistry.getRepository(repositoryId);

    if (!INDEXABLE(repository) || !INSERVICE(repository)) {
      return null;
    }
View Full Code Here


   */
  @Test
  public void noOperatorReturnedWhenTrustStoreIsEnabledButNoRepositoryInHttpContext()
      throws Exception
  {
    final Repository repository = mock(Repository.class);
    when(repository.getId()).thenReturn("foo");

    final TrustStore trustStore = mock(TrustStore.class);
    when(trustStore.getSSLContextFor(repositoryTrustStoreKey("foo"))).thenReturn(SSLContext.getDefault());

    final HttpContext httpContext = mock(HttpContext.class);
View Full Code Here

  private LockedIndexingContexts lockSearchTargetIndexingContexts(String repositoryId)
      throws NoSuchRepositoryException
  {
    List<Repository> repositories = new ArrayList<Repository>();
    if (repositoryId != null) {
      final Repository repository = repositoryRegistry.getRepository(repositoryId);
      if (INCLUDEINSEARCH(repository)) {
        if (ISGROUP(repository)) {
          Map<String, Repository> members = new HashMap<String, Repository>();
          addGroupMembers(members, (GroupRepository) repository);
          repositories.addAll(members.values());
        }
        else {
          repositories.add(repository);
        }
      }
    }
    else {
      for (Repository repository : repositoryRegistry.getRepositories()) {
        if (!ISGROUP(repository) && INCLUDEINSEARCH(repository) && repository.isSearchable()) {
          repositories.add(repository);
        }
      }
    }
View Full Code Here

   */
  @Test
  public void noOperatorReturnedWhenTrustStoreIsEnabledButHttpContextContainsAnotherTypeUnderKey()
      throws Exception
  {
    final Repository repository = mock(Repository.class);
    when(repository.getId()).thenReturn("foo");

    final TrustStore trustStore = mock(TrustStore.class);
    when(trustStore.getSSLContextFor(repositoryTrustStoreKey("foo"))).thenReturn(SSLContext.getDefault());

    final HttpContext httpContext = mock(HttpContext.class);
View Full Code Here

  private SearchNGResponse deployAndSearch(int artifactCount, final DeployType deployType)
      throws Exception
  {
    final String key = "nexus5412";
    final Repository releases = repositoryRegistry.getRepository("releases");
    final Repository snapshots = repositoryRegistry.getRepository("snapshots");
    for (int i = 1; i <= artifactCount; i++) {
      if (deployType == DeployType.RELEASE || deployType == DeployType.BOTH) {
        deployDummyArtifact(releases, key, Integer.toString(i));
      }
      if (deployType == DeployType.SNAPSHOT || deployType == DeployType.BOTH) {
View Full Code Here

      throws Exception
  {
    wairForAsyncEventsToCalmDown();
    waitForTasksToStop();

    final Repository releases = repositoryRegistry.getRepository("releases");

    final String key = "nexus5422";

    deployDummyArtifact(releases, key, "2");
    deployDummyArtifact(releases, key, "2.0");
View Full Code Here

      throws Exception
  {
    wairForAsyncEventsToCalmDown();
    waitForTasksToStop();

    final Repository releases = repositoryRegistry.getRepository("releases");

    final M2Repository releases2 = (M2Repository) this.lookup(Repository.class, M2Repository.ID);
    final CRepository repoConfig = new DefaultCRepository();
    repoConfig.setId("releases2");
    repoConfig.setExposed(true);
    repoConfig.setProviderRole(Repository.class.getName());
    repoConfig.setProviderHint("maven2");
    releases2.configure(repoConfig);
    repositoryRegistry.addRepository(releases2);

    wairForAsyncEventsToCalmDown();
    waitForTasksToStop();

    final String key = "dummy";

    deployDummyArtifact(releases, key, "1");
    deployDummyArtifact(releases2, key, "1");
    deployDummyArtifact(releases, key, "2");
    deployDummyArtifact(releases2, key, "2");

    wairForAsyncEventsToCalmDown();
    waitForTasksToStop();

    SearchNGResponse result = search(key);

    Assert.assertEquals(2, result.getData().size());
    for (int i = 0; i < 2; i++) {
      NexusNGArtifact nexusNGArtifact = result.getData().get(0);
      Assert.assertEquals(2, nexusNGArtifact.getArtifactHits().size());
      Assert.assertEquals(releases.getId(), nexusNGArtifact.getArtifactHits().get(0).getRepositoryId());
      Assert.assertEquals(releases2.getId(), nexusNGArtifact.getArtifactHits().get(1).getRepositoryId());
    }
  }
View Full Code Here

    response.setData(responseData);

    List<NexusNGRepositoryDetail> repoDetails = new ArrayList<NexusNGRepositoryDetail>();

    for (String repositoryId : repositoryIds) {
      Repository repository;
      try {
        repository = getUnprotectedRepositoryRegistry().getRepository(repositoryId);
        addRepositoryDetails(repoDetails, request, repository);
      }
      catch (NoSuchRepositoryException e) {
View Full Code Here

      a.setPomLink(createPomLink(request, ai));

      a.setArtifactLink(createArtifactLink(request, ai));

      try {
        Repository repository = getUnprotectedRepositoryRegistry().getRepository(ai.repository);

        if (MavenRepository.class.isAssignableFrom(repository.getClass())) {
          MavenRepository mavenRepository = (MavenRepository) repository;

          Gav gav =
              new Gav(ai.groupId, ai.artifactId, ai.version, ai.classifier,
                  mavenRepository.getArtifactPackagingMapper().getExtensionForPackaging(ai.packaging),
View Full Code Here

    // add repo content
    fillInRepo();

    // our patients, group and one member
    final GroupRepository group = (GroupRepository) repositoryRegistry.getRepository("public");
    final Repository member = repositoryRegistry.getRepository("snapshots");

    // reindex
    indexerManager.reindexAllRepositories(null, true);

    // Note: public by default contains snapshots repository as member
    // Snapshots repository is the only one that contains GroupID "org.sonatype.plexus".
    // Meaning, the presence of this search (is in result set or not) is used
    // to validate the group member changes.

    // assure context does exists (if Igor comments out few lines or so, as MI will plainly swallow targeted search
    // against nonexistent context!)
    Assert.assertNotNull(((DefaultIndexerManager) indexerManager).getRepositoryIndexContext(group));
    Assert.assertNotNull(((DefaultIndexerManager) indexerManager).getRepositoryIndexContext(member));

    // do searches
    searchFor("org.sonatype.plexus", 1, member.getId()); // is in this repo
    searchFor("org.sonatype.plexus", 1, group.getId()); // snapshots is member of public

    // reconfigure group member: make it non-indexable
    member.setSearchable(false);
    member.setIndexable(false);
    nexusConfiguration().saveConfiguration();
    waitForTasksToStop();
    wairForAsyncEventsToCalmDown();

    // assure context does exists (if Igor comments out few lines or so, as MI will plainly swallow targeted search
    // against nonexistent context!)
    Assert.assertNotNull(((DefaultIndexerManager) indexerManager).getRepositoryIndexContext(group));
    Assert.assertNull(((DefaultIndexerManager) indexerManager).getRepositoryIndexContext(member));

    // do searches
    searchFor("org.sonatype.plexus", 0, member.getId()); // is in this repo
    searchFor("org.sonatype.plexus", 0, group.getId()); // snapshots is not member of public

    // reconfigure group: add apache-snapshots
    member.setSearchable(true);
    member.setIndexable(true);
    nexusConfiguration().saveConfiguration();
    waitForTasksToStop();
    wairForAsyncEventsToCalmDown();

    // assure context does exists (if Igor comments out few lines or so, as MI will plainly swallow targeted search
    // against nonexistent context!)
    Assert.assertNotNull(((DefaultIndexerManager) indexerManager).getRepositoryIndexContext(group));
    Assert.assertNotNull(((DefaultIndexerManager) indexerManager).getRepositoryIndexContext(member));

    // do searches
    searchFor("org.sonatype.plexus", 1, member.getId()); // is in this repo
    searchFor("org.sonatype.plexus", 1, group.getId()); // snapshots is not member of public
  }
View Full Code Here

TOP

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

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.