use of org.sonatype.nexus.index.context.IndexingContext in project intellij-community by JetBrains.
the class NexusIndexerTest method _testAddingTwoContextsWithSameId.
public void _testAddingTwoContextsWithSameId() throws Exception {
IndexingContext i1 = addContext("id", new File(myIndexDir, "one"), null, null);
IndexingContext i2 = addContext("id", new File(myIndexDir, "two"), null, null);
myIndexer.removeIndexingContext(i1, false);
myIndexer.removeIndexingContext(i2, false);
addContext("id", new File(myIndexDir, "one"), null, null);
addContext("id", new File(myIndexDir, "two"), null, null);
}
use of org.sonatype.nexus.index.context.IndexingContext in project intellij-community by JetBrains.
the class Maven3ServerIndexerImpl method addArtifact.
@Override
public MavenId addArtifact(int indexId, File artifactFile) throws RemoteException, MavenServerIndexerException {
try {
IndexingContext index = getIndex(indexId);
ArtifactContext artifactContext = myArtifactContextProducer.getArtifactContext(index, artifactFile);
if (artifactContext == null)
return null;
addArtifact(myIndexer, index, artifactContext);
org.sonatype.nexus.index.ArtifactInfo a = artifactContext.getArtifactInfo();
return new MavenId(a.groupId, a.artifactId, a.version);
} catch (Exception e) {
throw new MavenServerIndexerException(wrapException(e));
}
}
use of org.sonatype.nexus.index.context.IndexingContext in project intellij-community by JetBrains.
the class NexusIndexerTest method _testIteratingAddedArtifacts.
public void _testIteratingAddedArtifacts() throws Exception {
if (ignore())
return;
IndexingContext c = addContext("virtual", myIndexDir, null, null);
addArtifact(c, "group1", "id1", "version1", "x:/path1");
addArtifact(c, "group2", "id2", "version2", "x:/path2");
addArtifact(c, "group3", "id3", "version3", "x:/path3");
IndexReader r = c.getIndexReader();
assertEquals(5, r.numDocs());
List<String> result = new ArrayList<String>();
for (int i = 0; i < r.numDocs(); i++) {
// third document becomes deleted somehow...
Document d = r.document(i);
String uinfo = d.get(ArtifactInfo.UINFO);
result.add(uinfo);
}
System.out.println(result);
}
use of org.sonatype.nexus.index.context.IndexingContext in project intellij-community by JetBrains.
the class NexusIndexerTest method _testDownloading.
public void _testDownloading() throws Exception {
String id = "remote";
String url = "file:///" + myRepositoryHelper.getTestDataPath("remote");
IndexingContext c = addContext(id, myIndexDir, null, url);
IndexUpdateRequest request = new IndexUpdateRequest(c);
request.setResourceFetcher(new Maven2ServerIndexFetcher(id, url, myEmbedder.getComponent(WagonManager.class), new NullTransferListener()));
myUpdater.fetchAndUpdateIndex(request);
assertSearchWorks();
}
use of org.sonatype.nexus.index.context.IndexingContext in project intellij-community by JetBrains.
the class Maven2ServerIndexerImpl method addArtifact.
public MavenId addArtifact(int indexId, File artifactFile) throws MavenServerIndexerException {
try {
IndexingContext index = getIndex(indexId);
ArtifactContext artifactContext = myArtifactContextProducer.getArtifactContext(index, artifactFile);
if (artifactContext == null)
return null;
addArtifact(myIndexer, index, artifactContext);
org.sonatype.nexus.index.ArtifactInfo a = artifactContext.getArtifactInfo();
return new MavenId(a.groupId, a.artifactId, a.version);
} catch (Exception e) {
throw new MavenServerIndexerException(wrapException(e));
}
}
Aggregations