Package org.sonatype.nexus.proxy.maven.gav

Examples of org.sonatype.nexus.proxy.maven.gav.M2GavCalculator


  private Collection<Gav> getGavs(String path, Collection<String> items) {
    if (!path.endsWith("/")) {
      path = path + "/";
    }
    M2GavCalculator calc = new M2GavCalculator();

    List<Gav> gavs = new ArrayList<Gav>();
    Collections.sort((ArrayList<String>) items);
    for (String item : items) {
      final Gav gav = calc.pathToGav(path + item);
      if (gav != null) {
        gavs.add(gav);
      }
    }
View Full Code Here


  private Collection<Gav> toGavs(List<String> items)
      throws Exception
  {
    String path = "org/sonatype/nexus/nexus-api/1.2.0-SNAPSHOT/";
    M2GavCalculator calc = new M2GavCalculator();

    List<Gav> gavs = new ArrayList<Gav>();
    for (String item : items) {
      gavs.add(calc.pathToGav(path + item));
    }

    return gavs;
  }
View Full Code Here

  @Override
  public void setUp() throws Exception {
    super.setUp();
    layoutConverter = new Nexus6185LayoutConverterShadowRepository();
    gavCalculator = new M2GavCalculator();
  }
View Full Code Here

      extends LayoutConverterShadowRepository
  {

    @Override
    public GavCalculator getM2GavCalculator() {
      return new M2GavCalculator();
    }
View Full Code Here

   *
   * @see <a href="https://issues.sonatype.org/browse/NEXUS-6731">NEXUS-6731</a>
   */
  @Test
  public void classifierNotPassedOnGeneratedPomAndClassifiedArtifactDeploy() throws Exception {
    final M2GavCalculator gavCalculator = new M2GavCalculator();
    final MetadataManager metadataManager = mock(MetadataManager.class);
    final MavenRepository mavenRepository = mock(MavenRepository.class);
    when(mavenRepository.getGavCalculator()).thenReturn(gavCalculator);
    when(mavenRepository.getMetadataManager()).thenReturn(metadataManager);
    when(mavenRepository.retrieveItem(any(Boolean.class), any(ResourceStoreRequest.class)))
        .thenThrow(ItemNotFoundException.class);
    final ArtifactStoreHelper artifactStoreHelper = new ArtifactStoreHelper(mavenRepository);

    final Gav gav = gavCalculator.pathToGav("/org/test/artifact/1.0/artifact-1.0-classifier.jar");
    assertThat(gav.getClassifier(), equalTo("classifier"));

    final ArtifactStoreRequest request = new ArtifactStoreRequest(mavenRepository, gav, false);
    artifactStoreHelper.storeArtifactWithGeneratedPom(
        request, "pom", new ByteArrayInputStream("Content".getBytes(Charsets.UTF_8)), null);
View Full Code Here

  public void setup() {
    this.locator = mock(MetadataLocator.class);
    this.updater = new DefaultMetadataUpdater(locator);

    this.repo = mock(MavenRepository.class);
    GavCalculator calculator = new M2GavCalculator();
    when(repo.getGavCalculator()).thenReturn(calculator);
  }
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.proxy.maven.gav.M2GavCalculator

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.