Package org.apache.maven.index

Examples of org.apache.maven.index.ArtifactInfo$ContextVersionComparator


        FlatSearchRequest request = new FlatSearchRequest( q, getIndexingContext() );
        FlatSearchResponse response = indexer.searchFlat( request );

        Set<ArtifactInfo> results = response.getResults();

        ArtifactInfo artifactInfo = results.iterator().next();
        assertEquals( "org.apache.archiva", artifactInfo.groupId );
        assertEquals( "archiva-index-methods-jar-test", artifactInfo.artifactId );
        assertEquals( "test-repo", artifactInfo.repository );

        assertEquals( 1, response.getTotalHits() );
View Full Code Here


        final Document d = r.document(i);
        final String uinfo = d.get(ArtifactInfo.UINFO);
        if (uinfo != null && !processedUinfos.contains(uinfo)) {
          // file is not present in storage but is on index, delete it from index
          final String[] ra = ArtifactInfo.FS_PATTERN.split(uinfo);
          final ArtifactInfo ai = new ArtifactInfo();
          ai.repository = context.getRepositoryId();
          ai.groupId = ra[0];
          ai.artifactId = ra[1];
          ai.version = ra[2];
          if (ra.length > 3) {
            ai.classifier = ArtifactInfo.renvl(ra[3]);
          }
          if (ra.length > 4) {
            ai.packaging = ArtifactInfo.renvl(ra[4]);
          }

          // minimal ArtifactContext for removal
          final ArtifactContext ac = new ArtifactContext(null, null, null, ai, ai.calculateGav());
          if (contextPath == null
              || context.getGavCalculator().gavToPath(ac.getGav()).startsWith(contextPath)) {
            if (IndexOp.DELETED == remove(ac)) {
              deleted++;
            }
View Full Code Here

          if (ac != null) {
            if (log.isDebugEnabled()) {
              log.debug("The ArtifactContext created from file is fine, continuing.");
            }

            ArtifactInfo ai = ac.getArtifactInfo();

            if (ai.sha1 == null) {
              // if repo has no sha1 checksum, odd nexus one
              ai.sha1 =
                  item.getRepositoryItemAttributes().get(DigestCalculatingInspector.DIGEST_SHA1_KEY);
View Full Code Here

    // emitted events about modifying them
    if (gav == null || gav.isSignature() || gav.isHash()) {
      return;
    }

    ArtifactInfo ai =
        new ArtifactInfo(context.getRepositoryId(), gav.getGroupId(), gav.getArtifactId(), gav.getBaseVersion(),
            gav.getClassifier());

    // store extension if classifier is not empty
    if (!Strings.isNullOrEmpty(ai.classifier)) {
      ai.packaging = gav.getExtension();
View Full Code Here

  }

  @Deprecated
  protected void postprocessResults(Collection<ArtifactInfo> res) {
    for (Iterator<ArtifactInfo> i = res.iterator(); i.hasNext(); ) {
      ArtifactInfo ai = i.next();

      if (indexArtifactFilter.filterArtifactInfo(ai)) {
        ai.context = formatContextId(ai);
      }
      else {
View Full Code Here

      response =
          lookup(IndexerManager.class).searchArtifactIterator("org.sonatype.nexus5525", "bundle", null,
              "bundle", null, snapshots.getId(), null, null, null, false, SearchType.EXACT, null);

      assertThat(response.getTotalHitsCount(), equalTo(1));
      final ArtifactInfo ai = response.getResults().next();

      assertThat(ai.packaging, equalTo("bundle"));
      assertThat(ai.fextension, equalTo("jar"));
    }
    finally {
View Full Code Here

            "maven-plugin", null, snapshots.getId(), null, null, null, false,
            SearchType.EXACT, null);

    assertEquals("There should be one hit!", 1, response.getTotalHits());

    ArtifactInfo ai = response.getResults().next();

    assertEquals("Coordinates should match too!",
        "org.apache.maven.plugins:maven-pmd-plugin:2.6-SNAPSHOT:null:maven-plugin", ai.toString());
  }
View Full Code Here

    try {
      if (iterator.getTotalHitsCount() == 0) {
        return null;
      }
      Assert.assertEquals(1, iterator.getTotalHitsCount());
      ArtifactInfo ai = iterator.iterator().next();
      Assert.assertEquals(version, ai.version);
      return ai;
    }
    finally {
      iterator.close();
View Full Code Here

    Collection<ArtifactInfo> ais = indexerManager.identifyArtifact(MAVEN.SHA1, sha1Hash);

    if (shouldBePresent) {
      assertTrue("Should find " + gid + ":" + aid + ":" + version, ais.size() > 0);

      ArtifactInfo ai = ais.iterator().next();

      assertEquals(gid, ai.groupId);
      assertEquals(aid, ai.artifactId);
      assertEquals(version, ai.version);
    }
View Full Code Here

      // repo has 3 artifacts indexed (plus 3 "internal" fields)
      assertThat("We have at least 3 Lucene documents in there for 3 artifacts!", context.getSize() >= 6);
      // repo has only 1 archetype
      assertThat("Catalog not exact!", catalog.getArchetypes(), hasSize(1));
      // add one archetype
      ArtifactInfo artifactInfo =
          new ArtifactInfo(context.getRepositoryId(), "org.sonatype.nexus.plugins", "nexus-archetype-plugin", "1.0",
              null);
      artifactInfo.packaging = "maven-archetype";
      ArtifactContext ac = new ArtifactContext(null, null, null, artifactInfo, artifactInfo.calculateGav());
      nexusIndexer.addArtifactToIndex(ac, context);
      // get catalog again
      catalog = macPlugin.listArcherypesAsCatalog(request, context);
      // repo has 4 artifacts indexed (plus 3 "internal" fields)
      assertThat("We have at least 4 Lucene documents in there for 3 artifacts!", context.getSize() >= 7);
View Full Code Here

TOP

Related Classes of org.apache.maven.index.ArtifactInfo$ContextVersionComparator

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.