Package org.sonatype.nexus.client.core.subsystem.repository

Examples of org.sonatype.nexus.client.core.subsystem.repository.Repository


  @Test
  public void shouldGenerateVersionedRepoForVersion()
      throws Exception
  {
    final Repository repository = givenRepositoryWithOneRpm();

    final String content = repodata().getMetadata(repository.id(), "1.0", PRIMARY_XML, String.class);
    assertThat(content, containsString("test-artifact"));
  }
View Full Code Here


  @Test
  public void shouldGenerateVersionedRepoForAlias()
      throws Exception
  {
    final Repository repository = givenRepositoryWithOneRpm();

    yum().createOrUpdateAlias(repository.id(), "alias", "1.0");
    final String content = repodata().getMetadata(repository.id(), "alias", PRIMARY_XML, String.class);
    assertThat(content, containsString("test-artifact"));
  }
View Full Code Here

  @Test
  public void shouldGenerateIndexHtml()
      throws Exception
  {
    final Repository repository = givenRepositoryWithOneRpm();

    final String content = repodata().getIndex(repository.id(), "1.0");
    assertThat(content, containsString("<a href=\"repodata/\">repodata/</a>"));
  }
View Full Code Here

  @Test
  public void shouldGenerateIndexHtmlForRepodata()
      throws Exception
  {
    final Repository repository = givenRepositoryWithOneRpm();

    final String content = repodata().getIndex(repository.id(), "1.0", "repodata");
    assertThat(content, containsString("<a href=\"repomd.xml\">repomd.xml</a>"));
  }
View Full Code Here

  }

  private Repository givenRepositoryWithOneRpm()
      throws Exception
  {
    final Repository repository = createYumEnabledRepository(repositoryIdForTest());

    content().upload(
        repositoryLocation(repository.id(), "group/artifact/1.0/artifact-1.0.rpm"),
        testData.resolveFile("/rpms/test-artifact-1.2.3-1.noarch.rpm")
    );

    waitForNexusToSettleDown();
View Full Code Here

  @Test
  public void shouldNotHaveReadAccessToAliasesForAnonymous()
      throws Exception
  {
    final Repository repository = createYumEnabledRepository(repositoryIdForTest());

    final String alias = uniqueName();
    yum().createOrUpdateAlias(repository.id(), alias, VERSION);

    thrown.expect(NexusClientResponseException.class);
    thrown.expectMessage("401");
    createNexusClientForAnonymous(nexus()).getSubsystem(Yum.class).getAlias(repository.id(), alias);
  }
View Full Code Here

  @Test
  public void shouldNotCreateAliasForAnonymous()
      throws Exception
  {
    final Repository repository = createYumEnabledRepository(repositoryIdForTest());

    thrown.expect(NexusClientResponseException.class);
    thrown.expectMessage("401");
    createNexusClientForAnonymous(nexus()).getSubsystem(Yum.class)
        .createOrUpdateAlias(repository.id(), uniqueName(), VERSION);
  }
View Full Code Here

  @Test
  public void shouldNotHaveUpdateAccessToAliasesForAnonymous()
      throws Exception
  {
    final Repository repository = createYumEnabledRepository(repositoryIdForTest());

    final String alias = uniqueName();
    yum().createOrUpdateAlias(repository.id(), alias, VERSION);
    thrown.expect(NexusClientResponseException.class);
    thrown.expectMessage("401");
    createNexusClientForAnonymous(nexus()).getSubsystem(Yum.class)
        .createOrUpdateAlias(repository.id(), alias, "3.2.1");
  }
View Full Code Here

  @Test
  public void shouldAllowAccessForYumAdmin()
      throws Exception
  {
    final Repository repository = createYumEnabledRepository(repositoryIdForTest());

    final User user = givenYumAdminUser();
    final Yum yum = createNexusClient(nexus(), user.id(), PASSWORD).getSubsystem(Yum.class);
    final String alias = uniqueName();
    yum.createOrUpdateAlias(repository.id(), alias, VERSION);
    assertThat(yum.getAlias(repository.id(), alias), is(VERSION));
    yum.createOrUpdateAlias(repository.id(), alias, ANOTHER_VERSION);
    assertThat(yum.getAlias(repository.id(), alias), is(ANOTHER_VERSION));
  }
View Full Code Here

  }

  @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();
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.client.core.subsystem.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.