Search in sources :

Example 6 with ArtifactDescriptor

use of org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor in project tycho by eclipse.

the class LocalArtifactRepositoryTest method getMavenLocation.

@Test
public void getMavenLocation() {
    LocalArtifactRepository repo = new LocalArtifactRepository(localRepoIndices);
    ArtifactDescriptor desc = newBundleArtifactDescriptor(true);
    Assert.assertEquals(new File(baseDir, "group/org.eclipse.tycho.test.maven/1.0.0/org.eclipse.tycho.test.maven-1.0.0.jar"), repo.internalGetArtifactStorageLocation(desc));
}
Also used : ArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor) IArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor) File(java.io.File) Test(org.junit.Test)

Example 7 with ArtifactDescriptor

use of org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor in project tycho by eclipse.

the class LocalArtifactRepositoryTest method addP2Artifact.

@Test
public void addP2Artifact() throws Exception {
    LocalArtifactRepository repo = new LocalArtifactRepository(localRepoIndices);
    ArtifactDescriptor desc = newBundleArtifactDescriptor(false);
    writeDummyArtifact(repo, desc);
    Assert.assertTrue(new File(baseDir, "p2/osgi/bundle/org.eclipse.tycho.test.p2/1.0.0/org.eclipse.tycho.test.p2-1.0.0.jar").exists());
    Assert.assertTrue(repo.contains(desc.getArtifactKey()));
    Assert.assertTrue(repo.contains(desc));
}
Also used : ArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor) IArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor) File(java.io.File) Test(org.junit.Test)

Example 8 with ArtifactDescriptor

use of org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor in project tycho by eclipse.

the class LocalArtifactRepositoryTest method reload.

@Test
public void reload() throws Exception {
    LocalArtifactRepository repo = new LocalArtifactRepository(localRepoIndices);
    ArtifactDescriptor mavenArtifact = newBundleArtifactDescriptor(true);
    ArtifactDescriptor p2Artifact = newBundleArtifactDescriptor(false);
    writeDummyArtifact(repo, mavenArtifact);
    writeDummyArtifact(repo, p2Artifact);
    repo.save();
    repo = new LocalArtifactRepository(localRepoIndices);
    Assert.assertTrue(repo.contains(mavenArtifact.getArtifactKey()));
    Assert.assertTrue(repo.contains(p2Artifact.getArtifactKey()));
}
Also used : ArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor) IArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor) Test(org.junit.Test)

Example 9 with ArtifactDescriptor

use of org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor in project tycho by eclipse.

the class LocalArtifactRepositoryTest method addMavenArtifact.

@Test
public void addMavenArtifact() throws Exception {
    LocalArtifactRepository repo = new LocalArtifactRepository(localRepoIndices);
    ArtifactDescriptor desc = newBundleArtifactDescriptor(true);
    writeDummyArtifact(repo, desc);
    Assert.assertTrue(new File(baseDir, "group/org.eclipse.tycho.test.maven/1.0.0/org.eclipse.tycho.test.maven-1.0.0.jar").exists());
    Assert.assertTrue(repo.contains(desc.getArtifactKey()));
    Assert.assertTrue(repo.contains(desc));
}
Also used : ArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor) IArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor) File(java.io.File) Test(org.junit.Test)

Example 10 with ArtifactDescriptor

use of org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor in project tycho by eclipse.

the class LocalArtifactRepositoryTest method testOutdatedIndex.

@Test
public void testOutdatedIndex() {
    // create Repo with single artifact
    LocalArtifactRepository repo = new LocalArtifactRepository(localRepoIndices);
    ArtifactDescriptor desc = newBundleArtifactDescriptor(false);
    repo.addDescriptor(desc);
    repo.save();
    // check: the artifact is in the index
    TychoRepositoryIndex artifactIndex = createArtifactsIndex(baseDir);
    Assert.assertFalse(artifactIndex.getProjectGAVs().isEmpty());
    // delete artifact content from file system
    deleteDir(new File(baseDir, "p2"));
    // create a new repo and check that the reference was gracefully removed from the index
    repo = new LocalArtifactRepository(localRepoIndices);
    repo.save();
    artifactIndex = createArtifactsIndex(baseDir);
    Assert.assertTrue(artifactIndex.getProjectGAVs().isEmpty());
}
Also used : ArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor) IArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor) TychoRepositoryIndex(org.eclipse.tycho.p2.repository.TychoRepositoryIndex) File(java.io.File) Test(org.junit.Test)

Aggregations

IArtifactDescriptor (org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor)29 ArtifactDescriptor (org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor)25 Test (org.junit.Test)22 File (java.io.File)8 MavenRepositoryCoordinates (org.eclipse.tycho.p2.repository.MavenRepositoryCoordinates)8 FeatureRootAdviceTest (org.eclipse.tycho.p2.impl.publisher.rootfiles.FeatureRootAdviceTest)4 ArtifactKey (org.eclipse.equinox.internal.p2.metadata.ArtifactKey)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 IArtifactKey (org.eclipse.equinox.p2.metadata.IArtifactKey)2 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)2 ProcessingStepDescriptor (org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor)2 IP2Artifact (org.eclipse.tycho.p2.metadata.IP2Artifact)2 BufferedOutputStream (java.io.BufferedOutputStream)1 FileInputStream (java.io.FileInputStream)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 IStatus (org.eclipse.core.runtime.IStatus)1