Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2009-02-18 23:13:49 +0000
committerAndrew Niefer2009-02-18 23:13:49 +0000
commitfb8c6a27e20f1b07e2a90243b75c24c6145c9078 (patch)
treee7cf46835053fb9210907b26fbc0c806fcfa5851 /bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/extensionlocation
parent6601987d56fce56a7d2adde59b25c04e02a561a1 (diff)
downloadrt.equinox.p2-fb8c6a27e20f1b07e2a90243b75c24c6145c9078.tar.gz
rt.equinox.p2-fb8c6a27e20f1b07e2a90243b75c24c6145c9078.tar.xz
rt.equinox.p2-fb8c6a27e20f1b07e2a90243b75c24c6145c9078.zip
bug 248951 - repository load hints
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/extensionlocation')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/extensionlocation/ExtensionLocationArtifactRepositoryFactoryTest.java44
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/extensionlocation/ExtensionLocationMetadataRepositoryFactoryTest.java44
2 files changed, 58 insertions, 30 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/extensionlocation/ExtensionLocationArtifactRepositoryFactoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/extensionlocation/ExtensionLocationArtifactRepositoryFactoryTest.java
index d70829f39..40537afcd 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/extensionlocation/ExtensionLocationArtifactRepositoryFactoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/extensionlocation/ExtensionLocationArtifactRepositoryFactoryTest.java
@@ -17,6 +17,7 @@ import org.eclipse.core.runtime.FileLocator;
import org.eclipse.equinox.internal.p2.extensionlocation.ExtensionLocationArtifactRepositoryFactory;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
+import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
import org.eclipse.equinox.p2.tests.TestActivator;
@@ -52,7 +53,7 @@ public class ExtensionLocationArtifactRepositoryFactoryTest extends AbstractProv
public void testNonFileURL() {
try {
URI nonFileURL = new URI("http://www.eclipse.org");
- factory.load(nonFileURL, getMonitor());
+ factory.load(nonFileURL, 0, getMonitor());
fail("0.1");
} catch (ProvisionException e) {
assertEquals("0.5", ProvisionException.REPOSITORY_NOT_FOUND, e.getStatus().getCode());
@@ -65,7 +66,7 @@ public class ExtensionLocationArtifactRepositoryFactoryTest extends AbstractProv
File directory = new File(tempDirectory, "nonexistent");
delete(directory);
try {
- factory.load(directory.toURI(), getMonitor());
+ factory.load(directory.toURI(), 0, getMonitor());
fail("0.1");
} catch (ProvisionException e) {
assertEquals("0.5", ProvisionException.REPOSITORY_NOT_FOUND, e.getStatus().getCode());
@@ -76,7 +77,7 @@ public class ExtensionLocationArtifactRepositoryFactoryTest extends AbstractProv
File file = new File(tempDirectory, "exists.file");
try {
file.createNewFile();
- factory.load(file.toURI(), getMonitor());
+ factory.load(file.toURI(), 0, getMonitor());
fail("0.1");
} catch (ProvisionException e) {
assertEquals("0.5", ProvisionException.REPOSITORY_NOT_FOUND, e.getStatus().getCode());
@@ -91,7 +92,7 @@ public class ExtensionLocationArtifactRepositoryFactoryTest extends AbstractProv
File directory = new File(tempDirectory, "exists");
directory.mkdirs();
try {
- factory.load(directory.toURI(), getMonitor());
+ factory.load(directory.toURI(), 0, getMonitor());
} catch (ProvisionException e) {
if (e.getStatus().getCode() == ProvisionException.REPOSITORY_NOT_FOUND)
return;
@@ -105,7 +106,7 @@ public class ExtensionLocationArtifactRepositoryFactoryTest extends AbstractProv
new File(directory, "plugins").mkdir();
new File(directory, "features").mkdir();
try {
- factory.load(directory.toURI(), getMonitor());
+ factory.load(directory.toURI(), 0, getMonitor());
} catch (ProvisionException e) {
fail("0.1", e);
}
@@ -116,7 +117,7 @@ public class ExtensionLocationArtifactRepositoryFactoryTest extends AbstractProv
directory.mkdirs();
new File(directory, "features").mkdir();
try {
- factory.load(directory.toURI(), getMonitor());
+ factory.load(directory.toURI(), 0, getMonitor());
} catch (ProvisionException e) {
fail("0.1", e);
}
@@ -127,7 +128,7 @@ public class ExtensionLocationArtifactRepositoryFactoryTest extends AbstractProv
directory.mkdirs();
new File(directory, "plugins").mkdir();
try {
- factory.load(directory.toURI(), getMonitor());
+ factory.load(directory.toURI(), 0, getMonitor());
} catch (ProvisionException e) {
fail("0.1", e);
}
@@ -141,7 +142,7 @@ public class ExtensionLocationArtifactRepositoryFactoryTest extends AbstractProv
new File(eclipseDirectory, "plugins").mkdir();
new File(eclipseDirectory, "features").mkdir();
try {
- factory.load(directory.toURI(), getMonitor());
+ factory.load(directory.toURI(), 0, getMonitor());
} catch (ProvisionException e) {
fail("0.1", e);
}
@@ -155,7 +156,7 @@ public class ExtensionLocationArtifactRepositoryFactoryTest extends AbstractProv
new File(eclipseDirectory, "plugins").mkdir();
new File(eclipseDirectory, "features").mkdir();
try {
- factory.load(directory.toURI(), getMonitor());
+ factory.load(directory.toURI(), 0, getMonitor());
} catch (ProvisionException e) {
if (e.getStatus().getCode() == ProvisionException.REPOSITORY_NOT_FOUND)
return;
@@ -169,7 +170,7 @@ public class ExtensionLocationArtifactRepositoryFactoryTest extends AbstractProv
copy("1.0", getTestData("1.1", "/testData/extensionlocation"), directory);
URI location = directory.toURI();
try {
- IArtifactRepository repo = factory.load(location, getMonitor());
+ IArtifactRepository repo = factory.load(location, 0, getMonitor());
if (repo.getArtifactKeys().length != 2)
fail("2.1");
} catch (ProvisionException ex) {
@@ -185,7 +186,7 @@ public class ExtensionLocationArtifactRepositoryFactoryTest extends AbstractProv
copy("1.0", getTestData("1.1", "/testData/extensionlocation/features"), features);
URI location = directory.toURI();
try {
- IArtifactRepository repo = factory.load(location, getMonitor());
+ IArtifactRepository repo = factory.load(location, 0, getMonitor());
if (repo.getArtifactKeys().length != 1)
fail("2.1");
} catch (ProvisionException ex) {
@@ -201,7 +202,7 @@ public class ExtensionLocationArtifactRepositoryFactoryTest extends AbstractProv
copy("1.0", getTestData("1.1", "/testData/extensionlocation/plugins"), plugins);
URI location = directory.toURI();
try {
- IArtifactRepository repo = factory.load(location, getMonitor());
+ IArtifactRepository repo = factory.load(location, 0, getMonitor());
if (repo.getArtifactKeys().length != 1)
fail("2.1");
} catch (ProvisionException ex) {
@@ -215,7 +216,7 @@ public class ExtensionLocationArtifactRepositoryFactoryTest extends AbstractProv
File eclipseDirectory = new File(directory, "eclipse");
copy("1.1", getTestData("1.1", "/testData/extensionlocation"), eclipseDirectory);
try {
- IArtifactRepository repo = factory.load(directory.toURI(), getMonitor());
+ IArtifactRepository repo = factory.load(directory.toURI(), 0, getMonitor());
if (repo.getArtifactKeys().length != 2)
fail("1.0");
} catch (ProvisionException e) {
@@ -223,10 +224,23 @@ public class ExtensionLocationArtifactRepositoryFactoryTest extends AbstractProv
}
}
+ public void testEclipseBaseModifiableRepository() {
+ File directory = new File(tempDirectory, "exists");
+ directory.mkdirs();
+ File eclipseDirectory = new File(directory, "eclipse");
+ copy("1.1", getTestData("1.1", "/testData/extensionlocation"), eclipseDirectory);
+ try {
+ IArtifactRepository repo = factory.load(directory.toURI(), IRepositoryManager.REPOSITORY_HINT_MODIFIABLE, getMonitor());
+ assertNull("1.0", repo);
+ } catch (ProvisionException e) {
+ fail("0.5", e);
+ }
+ }
+
public void testUpdateSiteXMLURL() {
File site = getTestData("0.1", "/testData/updatesite/site");
try {
- factory.load(site.toURI(), getMonitor());
+ factory.load(site.toURI(), 0, getMonitor());
} catch (ProvisionException e) {
if (e.getStatus().getCode() == ProvisionException.REPOSITORY_NOT_FOUND)
return;
@@ -237,7 +251,7 @@ public class ExtensionLocationArtifactRepositoryFactoryTest extends AbstractProv
public void testXXXSiteXXXXMLURL() {
File site = getTestData("0.1", "/testData/updatesite/xxxsitexxx");
try {
- factory.load(site.toURI(), getMonitor());
+ factory.load(site.toURI(), 0, getMonitor());
} catch (ProvisionException e) {
if (e.getStatus().getCode() == ProvisionException.REPOSITORY_NOT_FOUND)
return;
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/extensionlocation/ExtensionLocationMetadataRepositoryFactoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/extensionlocation/ExtensionLocationMetadataRepositoryFactoryTest.java
index 4a9e3bd85..bf4a0230f 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/extensionlocation/ExtensionLocationMetadataRepositoryFactoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/extensionlocation/ExtensionLocationMetadataRepositoryFactoryTest.java
@@ -15,6 +15,7 @@ import java.io.IOException;
import java.net.*;
import org.eclipse.equinox.internal.p2.extensionlocation.ExtensionLocationMetadataRepositoryFactory;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
+import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepositoryManager;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
import org.eclipse.equinox.internal.provisional.p2.query.Collector;
@@ -46,7 +47,7 @@ public class ExtensionLocationMetadataRepositoryFactoryTest extends AbstractProv
public void testNonFileURL() {
try {
URI nonFileURL = new URI("http://www.eclipse.org");
- factory.load(nonFileURL, getMonitor());
+ factory.load(nonFileURL, 0, getMonitor());
fail("0.1");
} catch (ProvisionException e) {
assertEquals("0.2", ProvisionException.REPOSITORY_NOT_FOUND, e.getStatus().getCode());
@@ -59,7 +60,7 @@ public class ExtensionLocationMetadataRepositoryFactoryTest extends AbstractProv
File directory = new File(tempDirectory, "nonexistent");
delete(directory);
try {
- factory.load(directory.toURI(), getMonitor());
+ factory.load(directory.toURI(), 0, getMonitor());
fail("0.1");
} catch (ProvisionException e) {
assertEquals("0.2", ProvisionException.REPOSITORY_NOT_FOUND, e.getStatus().getCode());
@@ -70,7 +71,7 @@ public class ExtensionLocationMetadataRepositoryFactoryTest extends AbstractProv
File file = new File(tempDirectory, "exists.file");
try {
file.createNewFile();
- factory.load(file.toURI(), getMonitor());
+ factory.load(file.toURI(), 0, getMonitor());
fail("0.1");
} catch (ProvisionException e) {
assertEquals("0.2", ProvisionException.REPOSITORY_NOT_FOUND, e.getStatus().getCode());
@@ -85,7 +86,7 @@ public class ExtensionLocationMetadataRepositoryFactoryTest extends AbstractProv
File directory = new File(tempDirectory, "exists");
directory.mkdirs();
try {
- factory.load(directory.toURI(), getMonitor());
+ factory.load(directory.toURI(), 0, getMonitor());
fail("0.1");
} catch (ProvisionException e) {
assertEquals("0.2", ProvisionException.REPOSITORY_NOT_FOUND, e.getStatus().getCode());
@@ -98,7 +99,7 @@ public class ExtensionLocationMetadataRepositoryFactoryTest extends AbstractProv
new File(directory, "plugins").mkdir();
new File(directory, "features").mkdir();
try {
- factory.load(directory.toURI(), getMonitor());
+ factory.load(directory.toURI(), 0, getMonitor());
} catch (ProvisionException e) {
fail("0.1");
}
@@ -109,7 +110,7 @@ public class ExtensionLocationMetadataRepositoryFactoryTest extends AbstractProv
directory.mkdirs();
new File(directory, "features").mkdir();
try {
- factory.load(directory.toURI(), getMonitor());
+ factory.load(directory.toURI(), 0, getMonitor());
} catch (ProvisionException e) {
fail("0.1");
}
@@ -120,7 +121,7 @@ public class ExtensionLocationMetadataRepositoryFactoryTest extends AbstractProv
directory.mkdirs();
new File(directory, "plugins").mkdir();
try {
- factory.load(directory.toURI(), getMonitor());
+ factory.load(directory.toURI(), 0, getMonitor());
} catch (ProvisionException e) {
fail("0.1");
}
@@ -134,7 +135,7 @@ public class ExtensionLocationMetadataRepositoryFactoryTest extends AbstractProv
new File(eclipseDirectory, "plugins").mkdir();
new File(eclipseDirectory, "features").mkdir();
try {
- factory.load(directory.toURI(), getMonitor());
+ factory.load(directory.toURI(), 0, getMonitor());
} catch (ProvisionException e) {
fail("0.1");
}
@@ -148,7 +149,7 @@ public class ExtensionLocationMetadataRepositoryFactoryTest extends AbstractProv
new File(eclipseDirectory, "plugins").mkdir();
new File(eclipseDirectory, "features").mkdir();
try {
- factory.load(directory.toURI(), getMonitor());
+ factory.load(directory.toURI(), 0, getMonitor());
fail("0.1");
} catch (ProvisionException e) {
assertEquals("0.2", ProvisionException.REPOSITORY_NOT_FOUND, e.getStatus().getCode());
@@ -161,7 +162,7 @@ public class ExtensionLocationMetadataRepositoryFactoryTest extends AbstractProv
copy("1.0", getTestData("1.1", "/testData/extensionlocation"), directory);
URI location = directory.toURI();
try {
- IMetadataRepository repo = factory.load(location, getMonitor());
+ IMetadataRepository repo = factory.load(location, 0, getMonitor());
if (repo.query(InstallableUnitQuery.ANY, new Collector(), null).toCollection().size() != 3)
fail("2.99");
} catch (ProvisionException ex) {
@@ -177,7 +178,7 @@ public class ExtensionLocationMetadataRepositoryFactoryTest extends AbstractProv
copy("1.0", getTestData("1.1", "/testData/extensionlocation/features"), features);
URI location = directory.toURI();
try {
- IMetadataRepository repo = factory.load(location, getMonitor());
+ IMetadataRepository repo = factory.load(location, 0, getMonitor());
if (repo.query(InstallableUnitQuery.ANY, new Collector(), null).toCollection().size() != 2)
fail("3.0");
} catch (ProvisionException ex) {
@@ -193,7 +194,7 @@ public class ExtensionLocationMetadataRepositoryFactoryTest extends AbstractProv
copy("1.0", getTestData("1.1", "/testData/extensionlocation/plugins"), plugins);
URI location = directory.toURI();
try {
- IMetadataRepository repo = factory.load(location, getMonitor());
+ IMetadataRepository repo = factory.load(location, 0, getMonitor());
if (repo.query(InstallableUnitQuery.ANY, new Collector(), null).toCollection().size() != 1)
fail("3.0");
} catch (ProvisionException ex) {
@@ -207,7 +208,7 @@ public class ExtensionLocationMetadataRepositoryFactoryTest extends AbstractProv
File eclipseDirectory = new File(directory, "eclipse");
copy("1.0", getTestData("1.1", "/testData/extensionlocation"), eclipseDirectory);
try {
- IMetadataRepository repo = factory.load(directory.toURI(), getMonitor());
+ IMetadataRepository repo = factory.load(directory.toURI(), 0, getMonitor());
if (repo.query(InstallableUnitQuery.ANY, new Collector(), null).toCollection().size() != 3)
fail("3.0");
} catch (ProvisionException e) {
@@ -215,10 +216,23 @@ public class ExtensionLocationMetadataRepositoryFactoryTest extends AbstractProv
}
}
+ public void testEclipseBaseModifiableRepository() {
+ File directory = new File(tempDirectory, "exists");
+ directory.mkdirs();
+ File eclipseDirectory = new File(directory, "eclipse");
+ copy("1.0", getTestData("1.1", "/testData/extensionlocation"), eclipseDirectory);
+ try {
+ IMetadataRepository repo = factory.load(directory.toURI(), IRepositoryManager.REPOSITORY_HINT_MODIFIABLE, getMonitor());
+ assertNull("3.0", repo);
+ } catch (ProvisionException e) {
+ fail("2.0");
+ }
+ }
+
public void testUpdateSiteXMLURL() {
File site = getTestData("0.1", "/testData/updatesite/site");
try {
- factory.load(site.toURI(), getMonitor());
+ factory.load(site.toURI(), 0, getMonitor());
} catch (ProvisionException e) {
if (e.getStatus().getCode() == ProvisionException.REPOSITORY_NOT_FOUND)
return;
@@ -229,7 +243,7 @@ public class ExtensionLocationMetadataRepositoryFactoryTest extends AbstractProv
public void testXXXSiteXXXXMLURL() {
File site = getTestData("0.1", "/testData/updatesite/xxxsitexxx");
try {
- factory.load(site.toURI(), getMonitor());
+ factory.load(site.toURI(), 0, getMonitor());
} catch (ProvisionException e) {
if (e.getStatus().getCode() == ProvisionException.REPOSITORY_NOT_FOUND)
return;

Back to the top