Examples of PrefixSource


Examples of org.sonatype.nexus.proxy.maven.routing.PrefixSource

    final Manager wm = lookup(Manager.class);
    waitForRoutingBackgroundUpdates();

    // after member change, group1 should have proxy1, proxy2 and proxy3 WL in group
    {
      final PrefixSource groupPrefixSource =
          wm.getPrefixSourceFor(getRepositoryRegistry().getRepositoryWithFacet(GROUP1_REPO_ID,
              MavenRepository.class));

      assertThat("Group1 should have WL", groupPrefixSource.supported());

      final List<String> groupEntries = groupPrefixSource.readEntries();
      assertThat(groupEntries, hasSize(4));
      assertThat(groupEntries, hasItem("/org/apache"));
      assertThat(groupEntries, hasItem("/org/sonatype"));
      assertThat(groupEntries, hasItem("/com/sonatype"));
      assertThat(groupEntries, hasItem("/eu/flatwhite"));
    }
    // after member change, group2 should have g1+p3 but is same as g1 (since p3 is member of g1 too) -- (WL is
    // kept unique)
    {
      final PrefixSource groupPrefixSource =
          wm.getPrefixSourceFor(getRepositoryRegistry().getRepositoryWithFacet(GROUP2_REPO_ID,
              MavenRepository.class));

      assertThat("Group2 should have WL", groupPrefixSource.supported());

      final List<String> groupEntries = groupPrefixSource.readEntries();
      assertThat(groupEntries, hasSize(4));
      assertThat(groupEntries, hasItem("/org/apache"));
      assertThat(groupEntries, hasItem("/org/sonatype"));
      assertThat(groupEntries, hasItem("/com/sonatype"));
      assertThat(groupEntries, hasItem("/eu/flatwhite"));
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.PrefixSource

    // all is settled now, proxy should have prefix file pulled from remote AND merged with cache content
    final MavenProxyRepository proxyRepository =
        getRepositoryRegistry().getRepositoryWithFacet(PROXY_REPO_ID, MavenProxyRepository.class);

    final Manager routingManager = lookup(Manager.class);
    final PrefixSource proxyPrefixSource = routingManager.getPrefixSourceFor(proxyRepository);

    assertThat("Prefix file for proxy repository should exists", proxyPrefixSource.exists());
    assertThat("Prefix file for proxy repository should be discovered", proxyPrefixSource.supported());
    assertThat("Prefix file should be instanceof FilePrefixSource", proxyPrefixSource instanceof FilePrefixSource);

    final List<String> entries = proxyPrefixSource.readEntries();
    // first 3 entries are from remote prefix file, see remotePrefixFile() method
    // last 4th entry was "sneaked" in to storage (simulating locally but not remotely available file)
    assertThat(entries,
        containsInAnyOrder("/org/apache/maven", "/org/sonatype", "/eu/flatwhite", "/com/sonatype"));
  }
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.PrefixSource

    waitForRoutingBackgroundUpdates();

    // after boot, we should have group WL exist (as all 2 member WLs should exist)
    // group1 WL should be union of the 2 proxy member WLs
    {
      final PrefixSource groupPrefixSource =
          wm.getPrefixSourceFor(getRepositoryRegistry().getRepositoryWithFacet(GROUP1_REPO_ID,
              MavenRepository.class));

      assertThat("Group1 should have WL", groupPrefixSource.supported());

      final List<String> groupEntries = groupPrefixSource.readEntries();
      assertThat(groupEntries, hasSize(3));
      assertThat(groupEntries, hasItem("/com/sonatype"));
      assertThat(groupEntries, hasItem("/org/sonatype"));
      assertThat(groupEntries, hasItem("/org/apache"));
    }
    // group2 WL should be same as group1 (is only member)
    {
      final PrefixSource groupPrefixSource =
          wm.getPrefixSourceFor(getRepositoryRegistry().getRepositoryWithFacet(GROUP2_REPO_ID,
              MavenRepository.class));

      assertThat("Group2 should have WL", groupPrefixSource.supported());

      final List<String> groupEntries = groupPrefixSource.readEntries();
      assertThat(groupEntries, hasSize(3));
      assertThat(groupEntries, hasItem("/com/sonatype"));
      assertThat(groupEntries, hasItem("/org/sonatype"));
      assertThat(groupEntries, hasItem("/org/apache"));
    }
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.PrefixSource

    final Manager wm = lookup(Manager.class);
    waitForRoutingBackgroundUpdates();

    // group1 WL should have only proxy1 WL
    {
      final PrefixSource groupPrefixSource =
          wm.getPrefixSourceFor(getRepositoryRegistry().getRepositoryWithFacet(GROUP1_REPO_ID,
              MavenRepository.class));

      assertThat("Group1 should have WL", groupPrefixSource.supported());

      final List<String> groupEntries = groupPrefixSource.readEntries();
      assertThat(groupEntries, hasSize(1));
      assertThat(groupEntries, hasItem("/org/apache"));
    }
    // group2 WL should be same as group1 (is only member)
    {
      final PrefixSource groupPrefixSource =
          wm.getPrefixSourceFor(getRepositoryRegistry().getRepositoryWithFacet(GROUP2_REPO_ID,
              MavenRepository.class));

      assertThat("Group2 should have WL", groupPrefixSource.supported());

      final List<String> groupEntries = groupPrefixSource.readEntries();
      assertThat(groupEntries, hasSize(1));
      assertThat(groupEntries, hasItem("/org/apache"));
    }
  }
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.PrefixSource

    waitForRoutingBackgroundUpdates();

    // after member addition, we should have all 3 WLs member in group
    // group1 WL should be union of the 3 proxy member WLs
    {
      final PrefixSource groupPrefixSource =
          wm.getPrefixSourceFor(getRepositoryRegistry().getRepositoryWithFacet(GROUP1_REPO_ID,
              MavenRepository.class));

      assertThat("Group1 should have WL", groupPrefixSource.supported());

      final List<String> groupEntries = groupPrefixSource.readEntries();
      assertThat(groupEntries, hasSize(4));
      assertThat(groupEntries, hasItem("/com/sonatype"));
      assertThat(groupEntries, hasItem("/org/sonatype"));
      assertThat(groupEntries, hasItem("/org/apache"));
      assertThat(groupEntries, hasItem("/eu/flatwhite"));
    }
    // group2 WL should be same as group1 (is only member)
    {
      final PrefixSource groupPrefixSource =
          wm.getPrefixSourceFor(getRepositoryRegistry().getRepositoryWithFacet(GROUP2_REPO_ID,
              MavenRepository.class));

      assertThat("Group2 should have WL", groupPrefixSource.supported());

      final List<String> groupEntries = groupPrefixSource.readEntries();
      assertThat(groupEntries, hasSize(4));
      assertThat(groupEntries, hasItem("/com/sonatype"));
      assertThat(groupEntries, hasItem("/org/sonatype"));
      assertThat(groupEntries, hasItem("/org/apache"));
      assertThat(groupEntries, hasItem("/eu/flatwhite"));
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.PrefixSource

    final Manager wm = lookup(Manager.class);
    waitForRoutingBackgroundUpdates();

    // after member addition and removal, group1 should have proxy1 and proxt3 WL in group
    {
      final PrefixSource groupPrefixSource =
          wm.getPrefixSourceFor(getRepositoryRegistry().getRepositoryWithFacet(GROUP1_REPO_ID,
              MavenRepository.class));

      assertThat("Group1 should have WL", groupPrefixSource.supported());

      final List<String> groupEntries = groupPrefixSource.readEntries();
      assertThat(groupEntries, hasSize(2));
      assertThat(groupEntries, hasItem("/org/apache"));
      assertThat(groupEntries, hasItem("/eu/flatwhite"));
    }
    // group2 WL should be same as group1 (is only member)
    {
      final PrefixSource groupPrefixSource =
          wm.getPrefixSourceFor(getRepositoryRegistry().getRepositoryWithFacet(GROUP2_REPO_ID,
              MavenRepository.class));

      assertThat("Group2 should have WL", groupPrefixSource.supported());

      final List<String> groupEntries = groupPrefixSource.readEntries();
      assertThat(groupEntries, hasSize(2));
      assertThat(groupEntries, hasItem("/org/apache"));
      assertThat(groupEntries, hasItem("/eu/flatwhite"));
    }
  }
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.PrefixSource

    doTestAllowed(filter, "/.meta/prefix.txt", true);
  }

  @Test
  public void withWl() {
    final PrefixSource entrySource = new ArrayListPrefixSource(Arrays.asList("/org/apache", "/org/sonatype"));
    Mockito.when(wlManager.getPrefixSourceFor(Mockito.any(MavenProxyRepository.class))).thenReturn(
        entrySource);

    // WL will be built, not every request should be allowed
    final ProxyRequestFilterImpl filter =
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.PrefixSource

      throws Exception
  {
    try {
      final Manager wm = lookup(Manager.class);
      {
        final PrefixSource proxy1EntrySource =
            wm.getPrefixSourceFor(getRepositoryRegistry().getRepositoryWithFacet(PROXY1_REPO_ID,
                MavenRepository.class));
        final PrefixSource proxy2EntrySource =
            wm.getPrefixSourceFor(getRepositoryRegistry().getRepositoryWithFacet(PROXY2_REPO_ID,
                MavenRepository.class));
        final PrefixSource groupEntrySource =
            wm.getPrefixSourceFor(getRepositoryRegistry().getRepositoryWithFacet(GROUP_REPO_ID,
                MavenRepository.class));

        assertThat("Proxy1 should not have ES", !proxy1EntrySource.supported()); // we served noscrape file
        assertThat("Proxy2 should not have ES", !proxy2EntrySource.supported()); // we served noscrape file
        assertThat("Group cannot have ES", !groupEntrySource.supported()); // as proxy member are disabled
      }
    }
    finally {
      server1.stop();
      server2.stop();
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.PrefixSource

      final Manager wm = lookup(Manager.class);
      wm.updatePrefixFile(getRepositoryRegistry().getRepositoryWithFacet(PROXY1_REPO_ID, MavenRepository.class));
      waitForRoutingBackgroundUpdates();
      {
        final PrefixSource proxy1EntrySource =
            wm.getPrefixSourceFor(getRepositoryRegistry().getRepositoryWithFacet(PROXY1_REPO_ID,
                MavenRepository.class));
        final PrefixSource proxy2EntrySource =
            wm.getPrefixSourceFor(getRepositoryRegistry().getRepositoryWithFacet(PROXY2_REPO_ID,
                MavenRepository.class));
        final PrefixSource groupEntrySource =
            wm.getPrefixSourceFor(getRepositoryRegistry().getRepositoryWithFacet(GROUP_REPO_ID,
                MavenRepository.class));

        assertThat("Proxy1 should have ES", proxy1EntrySource.supported()); // we serve prefix file
        assertThat("Proxy2 should not have ES", !proxy2EntrySource.supported()); // we serve noscrape file
        assertThat("Group cannot have ES", !groupEntrySource.supported()); // we serve noscrape file
      }
    }
    finally {
      server1.stop();
      server2.stop();
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.PrefixSource

      final Manager wm = lookup(Manager.class);
      wm.updatePrefixFile(getRepositoryRegistry().getRepositoryWithFacet(PROXY1_REPO_ID, MavenRepository.class));
      wm.updatePrefixFile(getRepositoryRegistry().getRepositoryWithFacet(PROXY2_REPO_ID, MavenRepository.class));
      waitForRoutingBackgroundUpdates();
      {
        final PrefixSource proxy1EntrySource =
            wm.getPrefixSourceFor(getRepositoryRegistry().getRepositoryWithFacet(PROXY1_REPO_ID,
                MavenRepository.class));
        final PrefixSource proxy2EntrySource =
            wm.getPrefixSourceFor(getRepositoryRegistry().getRepositoryWithFacet(PROXY2_REPO_ID,
                MavenRepository.class));
        final PrefixSource groupEntrySource =
            wm.getPrefixSourceFor(getRepositoryRegistry().getRepositoryWithFacet(GROUP_REPO_ID,
                MavenRepository.class));

        assertThat("Proxy1 should have ES", proxy1EntrySource.supported()); // we served prefix file
        assertThat("Proxy2 should have ES", proxy2EntrySource.supported()); // we served prefix file
        assertThat("Group should have ES", groupEntrySource.supported()); // both proxies have it

        // GROUP wl must have 4 entries: 1 from hosted (/com/sonatype) + 3 from proxied prefix file
        final List<String> groupEntries = groupEntrySource.readEntries();
        assertThat(groupEntries.size(), equalTo(4));
        assertThat(groupEntries, hasItem("/com/sonatype"));
        assertThat(groupEntries, hasItem("/org/sonatype"));
        assertThat(groupEntries, hasItem("/org/apache/maven"));
        assertThat(groupEntries, hasItem("/eu/flatwhite"));
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.