Package org.ebayopensource.nexus.plugins.artifactusage.store

Examples of org.ebayopensource.nexus.plugins.artifactusage.store.GAV


  }

  public void testGetGavFromSimplePom() throws Exception {
    StorageFileItem pomFileItem = getMockStorageFileItem("src/test/remote-repo/test/artifactusage/simple-artifact/1.0/simple-artifact-1.0.pom");

    GAV artifact = ((DefaultArtifactUsageCalculator) this
        .lookup(ArtifactUsageCalculator.class))
        .getArtifactForStorageItem(pomFileItem);
    assertNotNull(artifact);
    assertEquals("test.artifactusage", artifact.getGroupId());
    assertEquals("simple-artifact", artifact.getArtifactId());
    assertEquals("1.0", artifact.getVersion());
  }
View Full Code Here


  }

  public void testGetGavFromPomWithParent() throws Exception {
    StorageFileItem pomFileItem = getMockStorageFileItem("src/test/remote-repo/test/artifactusage/artifact-with-parent/1.0/artifact-with-parent-1.0.pom");

    GAV artifact = ((DefaultArtifactUsageCalculator) this
        .lookup(ArtifactUsageCalculator.class))
        .getArtifactForStorageItem(pomFileItem);
    assertNotNull(artifact);
    assertEquals("test.artifactusage", artifact.getGroupId());
    assertEquals("artifact-with-parent", artifact.getArtifactId());
    assertEquals("1.9.1", artifact.getVersion());

  }
View Full Code Here

  }

  public void testGetGavFromPomWithProperties() throws Exception {
    StorageFileItem pomFileItem = getMockStorageFileItem("src/test/remote-repo/test/artifactusage/artifact-with-properties/1.0/artifact-with-properties-1.0.pom");

    GAV artifact = ((DefaultArtifactUsageCalculator) this
        .lookup(ArtifactUsageCalculator.class))
        .getArtifactForStorageItem(pomFileItem);
    assertNotNull(artifact);
    assertEquals("test.artifactusage", artifact.getGroupId());
    assertEquals("artifact-with-properties", artifact.getArtifactId());
    assertEquals("${this-version}", artifact.getVersion());

  }
View Full Code Here

      type = "json";
    } else if (artifactGav.endsWith(".xml")) {
      artifactGav = artifactGav.substring(0, artifactGav.length() - 4);
    }

    GAV gav = new GAV(artifactGav);
    Collection<ArtifactUser> artifactUsers = artifactUsageStore
        .getArtifactUsers(gav);

    // if the client wanted JSON, setup the appropriate Representation
    if ("json".equals(type)) {
View Full Code Here

          .getRepositorySystem().readArtifactDescriptor(
              this.getRepositorySession(), descriptorRequest);
      for (org.sonatype.aether.graph.Dependency dependency : descriptorResult
          .getDependencies()) {
        getLogger().debug("{} depends on {}", artifact, dependency.getArtifact());
        artifactDependencies.add(new GAV(dependency.getArtifact()
            .getGroupId(),
            dependency.getArtifact().getArtifactId(), dependency
                .getArtifact().getVersion()));
      }
    } catch (ArtifactDescriptorException e) {
View Full Code Here

        .getRepositoryItemUid().getPath(), item.getModified())) {
      return;
    }

    // convert to a Maven project
    GAV artifact = getArtifactForStorageItem(item);
    if (artifact != null) {
      artifactUsageStore.addDependencies(artifact, dependencyResolver
          .resolveDependencies(artifact), item.getRepositoryItemUid()
          .getPath());
    }
View Full Code Here

      getLogger().debug(
          "Removing artifact usage data for "
              + item.getRepositoryItemUid().getPath());
    }

    GAV artifact = getArtifactForStorageItem(item);
    if (artifact != null) {
      artifactUsageStore.removeArtifact(artifact);
    }
  }
View Full Code Here

    try {
      PomArtifactManager mgr = new PomArtifactManager(
          this.nexusConfig.getTemporaryDirectory());
      mgr.storeTempPomFile(item.getInputStream());
      ArtifactCoordinate ac = mgr.getArtifactCoordinateFromTempPomFile();
      return new GAV(ac.getGroupId(), ac.getArtifactId(), ac.getVersion());
    } catch (Exception e) {
      getLogger().warn(
              "Error processing POM file for artifact usage data.", ExceptionUtils.getRootCause(e));
      return null;
    }
View Full Code Here

      getLogger().debug(
          "getting usage of "
              + request.getResourceRef().getLastSegment());
    }
    Collection<ArtifactUser> artifactList = artifactUsageStore
        .getArtifactUsers(new GAV(request.getResourceRef()
            .getLastSegment()));
    // limiting depth of the data to n levels so that we don't stall out
    String jsonText = "{" + ArtifactUsageSerializer.toJson(artifactList, 5)
        + "}";
View Full Code Here

      getLogger().debug(
          "getting usage of "
              + request.getResourceRef().getLastSegment());
    }
    Collection<ArtifactUser> artifactList = artifactUsageStore
        .getArtifactUsers(new GAV(request.getResourceRef()
            .getLastSegment()));

    Set<GAV> artifacts = new TreeSet<GAV>();
    collectArtifacts(artifacts, artifactList);
    String jsonText = "{" + ArtifactUsageSerializer.toJson(artifacts) + "}";
View Full Code Here

TOP

Related Classes of org.ebayopensource.nexus.plugins.artifactusage.store.GAV

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.