Examples of MavenProxyRepository


Examples of org.sonatype.nexus.client.core.subsystem.repository.maven.MavenProxyRepository

   */
  @Test
  public void manageRepositoryTrustStoreKeys()
      throws Exception
  {
    final MavenProxyRepository proxyRepository =
        repositories().create(MavenProxyRepository.class, repositoryIdForTest())
            .asProxyOf("https://localhost:445")
            .doNotDownloadRemoteIndexes()
            .save();

    assertThat(truststore().isEnabledFor(repositoryTrustStoreKey(proxyRepository.id())), is(false));

    truststore().enableFor(repositoryTrustStoreKey(proxyRepository.id()));
    assertThat(truststore().isEnabledFor(repositoryTrustStoreKey(proxyRepository.id())), is(true));

    truststore().disableFor(repositoryTrustStoreKey(proxyRepository.id()));
    assertThat(truststore().isEnabledFor(repositoryTrustStoreKey(proxyRepository.id())), is(false));
  }
View Full Code Here

Examples of org.sonatype.nexus.client.core.subsystem.repository.maven.MavenProxyRepository

    httpServer = Server.withPort(0).withKeystore("keystore", "password").
        serve("/*").withBehaviours(
        Behaviours.get(testData().resolveFile("proxy-repo"))
    ).start();

    final MavenProxyRepository proxyRepository =
        repositories().create(MavenProxyRepository.class, repositoryIdForTest())
            .asProxyOf(httpServer.getUrl().toExternalForm())
            .doNotDownloadRemoteIndexes()
            .save();

    final Certificate certificate = certificates().get(proxyRepository.id());

    assertThat(certificate, is(notNullValue()));
    assertThat(certificate.pem(), is(notNullValue()));
    assertThat(certificate.fingerprint(), is("CB:11:54:75:02:87:33:42:54:33:7D:2E:10:48:D7:4E:AE:BB:5C:90"));
  }
View Full Code Here

Examples of org.sonatype.nexus.client.core.subsystem.repository.maven.MavenProxyRepository

   */
  @Test
  public void caSignedCertificate()
      throws Exception
  {
    final MavenProxyRepository proxyRepository =
        repositories().create(MavenProxyRepository.class, repositoryIdForTest())
            .asProxyOf("https://repository.sonatype.org/content/groups/sonatype-public-grid/")
            .doNotDownloadRemoteIndexes()
            .save();

    final Certificate certificate = certificates().get(proxyRepository.id());

    assertThat(certificate, is(notNullValue()));
    assertThat(certificate.pem(), is(notNullValue()));
    assertThat(certificate.fingerprint(), is("61:96:33:FA:AF:52:1C:EC:D5:97:CF:CC:C3:CE:15:20:F9:CC:22:6B"));
  }
View Full Code Here

Examples of org.sonatype.nexus.client.core.subsystem.repository.maven.MavenProxyRepository

  @Test
  public void downloadFromRemoteRequiringMutualTrust()
      throws Exception
  {
    final MavenProxyRepository repository = createMavenProxyRepository(httpsRemoteServer);
    downloadArtifact(repository.id());
  }
View Full Code Here

Examples of org.sonatype.nexus.client.core.subsystem.repository.maven.MavenProxyRepository

  @Test
  public void downloadFromRemoteRequiringMutualTrustUsingNexusTrustStore()
      throws Exception
  {
    final MavenProxyRepository repository = createMavenProxyRepository(httpsRemoteServer);
    truststore().enableFor(repositoryTrustStoreKey(repository.id()));
    downloadArtifact(repository.id());
  }
View Full Code Here

Examples of org.sonatype.nexus.client.core.subsystem.repository.maven.MavenProxyRepository

  @Ignore // NEXUS-6184
  @Test
  public void cleanUp() throws Exception {
    final Repository hosted = createYumEnabledRepository(repositoryIdForTest());
    final MavenProxyRepository proxy = createYumEnabledProxyRepository(repositoryIdForTest() + "-proxy", hosted.contentUri());

    // upload to hosted
    content().upload(
        repositoryLocation(hosted.id(), "test/test-artifact/0.0.1/test-artifact-0.0.1.rpm"),
        testData().resolveFile("/rpms/test-artifact-1.2.3-1.noarch.rpm")
    );
    client().getSubsystem(Routing.class).updatePrefixFile(proxy.id());
    waitForNexusToSettleDown();

    // verify proxy got it, and record the primary path
    {
      final String primaryXml = repodata().getMetadata(proxy.id(), PRIMARY_XML, String.class);
      assertThat(primaryXml, containsString("test-artifact"));
    }
    final String primaryXmlPath1 = repodata().getMetadataPath(proxy.id(), PRIMARY_XML);
    assertThat(content().exists(Location.repositoryLocation(proxy.id(), primaryXmlPath1)), is(true));

    // upload to hosted something else, the modifies repomd.xml and all the files around it
    content().upload(
        repositoryLocation(hosted.id(), "test/othertest-artifact/0.0.1/othertest-artifact-0.0.1.rpm"),
        testData().resolveFile("/rpms/test-artifact-1.2.3-1.noarch.rpm")
    );
    client().getSubsystem(Routing.class).updatePrefixFile(proxy.id());
    waitForNexusToSettleDown();

    // verify proxy got it, and old primary path is not existing anymore (as hash included in file name changed)
    {
      final String primaryXml = repodata().getMetadata(proxy.id(), PRIMARY_XML, String.class);
      assertThat(primaryXml, containsString("test-artifact"));
      assertThat(primaryXml, containsString("othertest-artifact"));
    }
    assertThat(content().exists(Location.repositoryLocation(proxy.id(), primaryXmlPath1)), is(false));
    final String primaryXmlPath2 = repodata().getMetadataPath(proxy.id(), PRIMARY_XML);
    assertThat(content().exists(Location.repositoryLocation(proxy.id(), primaryXmlPath2)), is(true));
  }
View Full Code Here

Examples of org.sonatype.nexus.client.core.subsystem.repository.maven.MavenProxyRepository

            Behaviours.get(remoteRepoRoot)
        )
        .start();

    // create the proxy
    final MavenProxyRepository proxyRepository = repositories()
        .create(MavenProxyRepository.class, repositoryIdForTest("someorgProxy1"))
        .asProxyOf(server.getUrl().toExternalForm())
        .doNotDownloadRemoteIndexes()
        .save();

    routingTest().waitForAllRoutingUpdateJobToStop();
    // waitForWLPublishingOutcomes( proxyRepository.id() );
    client().getSubsystem(Scheduler.class).waitForAllTasksToStop();

    // nuke the repo cache
    nukeProxyCaches(proxyRepository.id());

    try {
      // clear recorder
      recorder.clear();
      // remote repo lives without prefix file
      {
        // check that newly added proxy is not publishing prefix file
        assertThat(routing().getStatus(proxyRepository.id()).getPublishedStatus(),
            equalTo(Outcome.FAILED));

        // and because no WL, we can fetch whatever we want (com and org)
        // all these will go remotely
        fetchAndAssert(downloadsDir, proxyRepository.id(), COM_SOMEORG_ARTIFACT_10_POM, true);
        fetchAndAssert(downloadsDir, proxyRepository.id(), COM_SOMEORG_ARTIFACT_10_JAR, true);
        fetchAndAssert(downloadsDir, proxyRepository.id(), ORG_SOMEORG_ARTIFACT_10_POM, true);
        fetchAndAssert(downloadsDir, proxyRepository.id(), ORG_SOMEORG_ARTIFACT_10_JAR, true);
        fetchAndAssert(downloadsDir, proxyRepository.id(), FLUKE_ARTIFACT_POM, false);
        fetchAndAssert(downloadsDir, proxyRepository.id(), FLUKE_ARTIFACT_JAR, false);

        // note: sha1 is asked for existing files only
        // GET /hu/fluke/artifact/1.0/artifact-1.0.jar,
        // GET /hu/fluke/artifact/1.0/artifact-1.0.pom,
        // GET /org/someorg/artifact/1.0/artifact-1.0.jar.sha1,
        // GET /org/someorg/artifact/1.0/artifact-1.0.jar,
        // GET /org/someorg/artifact/1.0/artifact-1.0.pom.sha1,
        // GET /org/someorg/artifact/1.0/artifact-1.0.pom,
        // GET /com/someorg/artifact/1.0/artifact-1.0.jar.sha1,
        // GET /com/someorg/artifact/1.0/artifact-1.0.jar,
        // GET /com/someorg/artifact/1.0/artifact-1.0.pom.sha1,
        // GET /com/someorg/artifact/1.0/artifact-1.0.pom,
        final List<String> requests = recorder.getPathsForVerb("GET");
        assertThat(requests.size(), is(10));
        assertThat(
            requests,
            containsInAnyOrder(COM_SOMEORG_ARTIFACT_10_POM, COM_SOMEORG_ARTIFACT_10_POM + ".sha1",
                COM_SOMEORG_ARTIFACT_10_JAR, COM_SOMEORG_ARTIFACT_10_JAR + ".sha1",
                ORG_SOMEORG_ARTIFACT_10_POM, ORG_SOMEORG_ARTIFACT_10_POM + ".sha1",
                ORG_SOMEORG_ARTIFACT_10_JAR, ORG_SOMEORG_ARTIFACT_10_JAR + ".sha1", FLUKE_ARTIFACT_POM,
                FLUKE_ARTIFACT_JAR));
      }

      // nuke the repo cache
      nukeProxyCaches(proxyRepository.id());

      // now set the prefixes file that contains /org/someorg prefix only, and repeat
      prefixesFile.setContent(Files.toString(testData().resolveFile("someorg-prefixes.txt"),
          Charset.forName("UTF-8")));

      // update the WL of proxy repo to have new prefixes file picked up
      routing().updatePrefixFile(proxyRepository.id());

      // wait for update to finish since it's async op, client above returned immediately
      // but update happens in a separate thread. Still this should be quick operation as prefix file is used
      Status proxyStatus = routing().getStatus(proxyRepository.id());
      // sit and wait for remote discovery (or the timeout Junit @Rule will kill us)
      while (proxyStatus.getPublishedStatus() != Outcome.SUCCEEDED) {
        Thread.sleep(10000);
        proxyStatus = routing().getStatus(proxyRepository.id());
      }

      // nuke the repo cache
      nukeProxyCaches(proxyRepository.id());

      // clear recorder
      recorder.clear();
      // repeat the test with slightly different expectations
      {
        // check that newly added proxy is publishing prefix file
        assertThat(routing().getStatus(proxyRepository.id()).getPublishedStatus(),
            equalTo(Outcome.SUCCEEDED));

        // and because we have WL, we cant fetch whatever we want (com and org)
        // only WL-enlisted of these will go remotely
        fetchAndAssert(downloadsDir, proxyRepository.id(), COM_SOMEORG_ARTIFACT_10_POM, false);
        fetchAndAssert(downloadsDir, proxyRepository.id(), COM_SOMEORG_ARTIFACT_10_JAR, false);
        fetchAndAssert(downloadsDir, proxyRepository.id(), ORG_SOMEORG_ARTIFACT_10_POM, true);
        fetchAndAssert(downloadsDir, proxyRepository.id(), ORG_SOMEORG_ARTIFACT_10_JAR, true);
        fetchAndAssert(downloadsDir, proxyRepository.id(), FLUKE_ARTIFACT_POM, false);
        fetchAndAssert(downloadsDir, proxyRepository.id(), FLUKE_ARTIFACT_JAR, false);

        // GET /org/someorg/artifact/1.0/artifact-1.0.jar.sha1,
        // GET /org/someorg/artifact/1.0/artifact-1.0.jar,
        // GET /org/someorg/artifact/1.0/artifact-1.0.pom.sha1,
        // GET /org/someorg/artifact/1.0/artifact-1.0.pom,
View Full Code Here

Examples of org.sonatype.nexus.client.core.subsystem.repository.maven.MavenProxyRepository

            Behaviours.get(remoteRepoRoot)
        )
        .start();

    // create the proxy
    final MavenProxyRepository proxyRepository =
        repositories().create(MavenProxyRepository.class, repositoryIdForTest("someorgProxy1"))
            .asProxyOf(server.getUrl().toExternalForm())
            .doNotDownloadRemoteIndexes()
            .save();

    routingTest().waitForAllRoutingUpdateJobToStop();
    // waitForWLPublishingOutcomes( proxyRepository.id() );
    client().getSubsystem(Scheduler.class).waitForAllTasksToStop();

    // nuke the repo cache
    nukeProxyCaches(proxyRepository.id());

    try {
      // clear recorder
      recorder.clear();
      // repeat the test with slightly different expectations
      {
        // check that newly added proxy is publishing prefix file
        assertThat(routing().getStatus(proxyRepository.id()).getPublishedStatus(),
            equalTo(Outcome.SUCCEEDED));

        // and because we have WL, we cant fetch whatever we want (com and org)
        // only WL-enlisted of these will go remotely
        fetchAndAssert(downloadsDir, proxyRepository.id(), COM_SOMEORG_ARTIFACT_10_POM, false);
        fetchAndAssert(downloadsDir, proxyRepository.id(), COM_SOMEORG_ARTIFACT_10_JAR, false);
        fetchAndAssert(downloadsDir, proxyRepository.id(), ORG_SOMEORG_ARTIFACT_10_POM, true);
        fetchAndAssert(downloadsDir, proxyRepository.id(), ORG_SOMEORG_ARTIFACT_10_JAR, true);
        fetchAndAssert(downloadsDir, proxyRepository.id(), FLUKE_ARTIFACT_POM, false);
        fetchAndAssert(downloadsDir, proxyRepository.id(), FLUKE_ARTIFACT_JAR, false);

        // GET /org/someorg/artifact/1.0/artifact-1.0.jar.sha1,
        // GET /org/someorg/artifact/1.0/artifact-1.0.jar,
        // GET /org/someorg/artifact/1.0/artifact-1.0.pom.sha1,
        // GET /org/someorg/artifact/1.0/artifact-1.0.pom,
        final List<String> requests = recorder.getPathsForVerb("GET");
        assertThat(requests.size(), is(4));
        assertThat(
            requests,
            containsInAnyOrder(ORG_SOMEORG_ARTIFACT_10_POM, ORG_SOMEORG_ARTIFACT_10_POM + ".sha1",
                ORG_SOMEORG_ARTIFACT_10_JAR, ORG_SOMEORG_ARTIFACT_10_JAR + ".sha1"));
      }

      // now loose the prefixes file
      prefixesFile.setContent(null);

      // update the WL of proxy repo to have new prefixes file picked up
      routing().updatePrefixFile(proxyRepository.id());

      // wait for update to finish since it's async op, client above returned immediately
      // but update happens in a separate thread. Still this should be quick operation as prefix file is used
      Status proxyStatus = routing().getStatus(proxyRepository.id());
      // sit and wait for remote discovery (or the timeout Junit @Rule will kill us)
      while (proxyStatus.getPublishedStatus() != Outcome.FAILED) {
        Thread.sleep(10000);
        proxyStatus = routing().getStatus(proxyRepository.id());
      }

      // nuke the repo cache
      nukeProxyCaches(proxyRepository.id());

      // clear recorder
      recorder.clear();
      // remote repo lives without prefix file
      {
        // check that newly added proxy is not publishing prefix file
        assertThat(routing().getStatus(proxyRepository.id()).getPublishedStatus(),
            equalTo(Outcome.FAILED));

        // and because no WL, we can fetch whatever we want (com and org)
        // all these will go remotely
        fetchAndAssert(downloadsDir, proxyRepository.id(), COM_SOMEORG_ARTIFACT_10_POM, true);
        fetchAndAssert(downloadsDir, proxyRepository.id(), COM_SOMEORG_ARTIFACT_10_JAR, true);
        fetchAndAssert(downloadsDir, proxyRepository.id(), ORG_SOMEORG_ARTIFACT_10_POM, true);
        fetchAndAssert(downloadsDir, proxyRepository.id(), ORG_SOMEORG_ARTIFACT_10_JAR, true);
        fetchAndAssert(downloadsDir, proxyRepository.id(), FLUKE_ARTIFACT_POM, false);
        fetchAndAssert(downloadsDir, proxyRepository.id(), FLUKE_ARTIFACT_JAR, false);

        // note: sha1 is asked for existing files only
        // GET /hu/fluke/artifact/1.0/artifact-1.0.jar,
        // GET /hu/fluke/artifact/1.0/artifact-1.0.pom,
        // GET /org/someorg/artifact/1.0/artifact-1.0.jar.sha1,
View Full Code Here

Examples of org.sonatype.nexus.client.core.subsystem.repository.maven.MavenProxyRepository

    return repository;
  }

  protected MavenProxyRepository createYumEnabledProxyRepository(final String repositoryId, final String remoteUrl) {
    final MavenProxyRepository repository = repositories()
        .create(MavenProxyRepository.class, repositoryId)
        .doNotDownloadRemoteIndexes()
        .asProxyOf(remoteUrl)
        .withItemMaxAge(0)
        .save();
View Full Code Here

Examples of org.sonatype.nexus.client.core.subsystem.repository.maven.MavenProxyRepository

   */
  @Test
  public void repositoryNotBlocked() {
    final String rId = repositoryIdForTest();

    final MavenProxyRepository repository = repositories().create(MavenProxyRepository.class, rId)
        .asProxyOf(repositories().get("releases").contentUri())
        .save();

    Capability capability = capabilities().create("[repositoryIsNotBlocked]")
        .withProperty("repository", rId)
        .save();
    MatcherAssert.assertThat(capability.isActive(), is(true));

    logRemote("Block repository '{}'", rId);
    repository.block();
    capability.refresh();
    MatcherAssert.assertThat(capability.isActive(), is(false));

    logRemote("Unblock repository '{}'", rId);
    repository.unblock();
    capability.refresh();
    MatcherAssert.assertThat(capability.isActive(), is(true));
  }
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.