Examples of NexusArtifact


Examples of org.sonatype.nexus.rest.model.NexusArtifact

      throws Exception
  {
    // wait to index up the changes
    getEventInspectorsUtil().waitForCalmPeriod();

    NexusArtifact result = getSearchMessageUtil().identify(sha1);
    Assert.assertNotNull("Pom with " + sha1 + " not found " + msg, result);
  }
View Full Code Here

Examples of org.sonatype.nexus.rest.model.NexusArtifact

  // 2. search using SHA1
  public void searchForSHA1()
      throws Exception
  {
    // know-artifact-1
    NexusArtifact result = getSearchMessageUtil().identify("4ce1d96bd11b8959b32a75c1fa5b738d7b87d408");
    Assert.assertNotNull(result);

    // know-artifact-2
    result = getSearchMessageUtil().identify("230377663ac3b19ad83c99b0afdb056dd580c5c8");
    Assert.assertNotNull(result);
View Full Code Here

Examples of org.sonatype.nexus.rest.model.NexusArtifact

    try {
      String responseText = RequestFacade.doGetForText("service/local/identify/sha1/" + sha1);
      XStreamRepresentation representation =
          new XStreamRepresentation(xstream, responseText, MediaType.APPLICATION_XML);

      return (NexusArtifact) representation.getPayload(new NexusArtifact());
    }
    catch (AssertionError e) {
      // unsuccesful GET
      return null;
    }
View Full Code Here

Examples of org.sonatype.nexus.rest.model.NexusArtifact

    response.setCount(10);
    response.setFrom(50);
    response.setTotalCount(8);
    response.setTooManyResults(true);

    NexusArtifact artifact1 = new NexusArtifact();
    artifact1.setArtifactId("artifactId1");
    artifact1.setClassifier("classifier1");
    artifact1.setContextId("contextId1");
    artifact1.setGroupId("groupId1");
    artifact1.setPackaging("packaging1");
    artifact1.setRepoId("repoId1");
    artifact1.setResourceURI("resourceURI1");
    artifact1.setVersion("version1");
    artifact1.setArtifactLink("artifactLink");
    artifact1.setExtension("extension");
    artifact1.setPomLink("pomLink");
    response.addData(artifact1);

    NexusArtifact artifact2 = new NexusArtifact();
    artifact2.setArtifactId("artifactId1");
    artifact2.setClassifier("classifier1");
    artifact2.setContextId("contextId1");
    artifact2.setGroupId("groupId1");
    artifact2.setPackaging("packaging1");
    artifact2.setRepoId("repoId1");
    artifact2.setResourceURI("resourceURI1");
    artifact2.setVersion("version1");
    artifact2.setArtifactLink("artifactLink2");
    artifact2.setExtension("extension2");
    artifact2.setPomLink("pomLink2");
    response.addData(artifact2);

    this.marshalUnmarchalThenCompare(response);
    this.validateXmlHasNoPackageNames(response);
  }
View Full Code Here

Examples of org.sonatype.nexus.rest.model.NexusArtifact

  {
    String alg = request.getAttributes().get(ALGORITHM_KEY).toString();

    String checksum = request.getAttributes().get(HASH_KEY).toString();

    NexusArtifact na = null;

    try {
      if ("sha1".equalsIgnoreCase(alg)) {
        Collection<NexusArtifact> nas =
            ai2NaColl(request, indexerManager.identifyArtifact(MAVEN.SHA1, checksum));
View Full Code Here

Examples of org.sonatype.nexus.rest.model.NexusArtifact

    }

    List<NexusArtifact> result = new ArrayList<NexusArtifact>();

    for (ArtifactInfo ai : aic) {
      NexusArtifact na = ai2Na(request, ai);

      if (na != null) {
        result.add(na);
      }
    }
View Full Code Here

Examples of org.sonatype.nexus.rest.model.NexusArtifact

  protected Collection<NexusArtifact> ai2NaColl(Request request, IteratorResultSet aic) {
    List<NexusArtifact> result = new ArrayList<NexusArtifact>();

    if (aic != null) {
      for (ArtifactInfo ai : aic) {
        NexusArtifact na = ai2Na(request, ai);

        if (na != null) {
          result.add(na);
        }
      }
View Full Code Here

Examples of org.sonatype.nexus.rest.model.NexusArtifact

  protected NexusArtifact ai2Na(Request request, ArtifactInfo ai) {
    if (ai == null) {
      return null;
    }

    NexusArtifact a = new NexusArtifact();

    a.setGroupId(ai.groupId);

    a.setArtifactId(ai.artifactId);

    a.setVersion(ai.version);

    a.setClassifier(ai.classifier);

    a.setPackaging(ai.packaging);

    a.setExtension(ai.fextension);

    a.setRepoId(ai.repository);

    a.setContextId(ai.context);

    a.setHighlightedFragment(getMatchHighlightHtmlSnippet(ai));

    if (ai.repository != null) {
      a.setPomLink(createPomLink(request, ai));

      a.setArtifactLink(createArtifactLink(request, ai));

      try {
        Repository repository = getUnprotectedRepositoryRegistry().getRepository(ai.repository);

        if (MavenRepository.class.isAssignableFrom(repository.getClass())) {
          MavenRepository mavenRepository = (MavenRepository) repository;

          Gav gav =
              new Gav(ai.groupId, ai.artifactId, ai.version, ai.classifier,
                  mavenRepository.getArtifactPackagingMapper().getExtensionForPackaging(ai.packaging),
                  null, null, null, false, null, false, null);

          ResourceStoreRequest req =
              new ResourceStoreRequest(mavenRepository.getGavCalculator().gavToPath(gav));

          a.setResourceURI(createRepositoryReference(request, ai.repository, req.getRequestPath()).toString());
        }
      }
      catch (NoSuchRepositoryException e) {
        getLogger().warn("No such repository: '" + ai.repository + "'.", e);
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.