Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Arthorne2012-02-08 22:58:14 +0000
committerJohn Arthorne2012-02-08 22:58:14 +0000
commit5d2d6401627c5851207411a25c44dd56c17958da (patch)
treedce06065454e5351f7a565b7cd7da5b915f309fd
parent01a38934f837fbe013193d4324a8def5d2f0d292 (diff)
downloadrt.equinox.p2-5d2d6401627c5851207411a25c44dd56c17958da.tar.gz
rt.equinox.p2-5d2d6401627c5851207411a25c44dd56c17958da.tar.xz
rt.equinox.p2-5d2d6401627c5851207411a25c44dd56c17958da.zip
Test case for Bug 369834 - Failure reading zipped repository is
causing PDE/Build test failure
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/JarURLMetadataRepositoryTest.java45
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/bug369834/f-TestBuild-group.group.group.zipbin0 -> 2351 bytes
2 files changed, 36 insertions, 9 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/JarURLMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/JarURLMetadataRepositoryTest.java
index 7a67d14ed..74dd506d3 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/JarURLMetadataRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/JarURLMetadataRepositoryTest.java
@@ -12,10 +12,15 @@
package org.eclipse.equinox.p2.tests.metadata.repository;
import java.io.File;
+import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.p2.core.ProvisioningAgent;
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
+import org.eclipse.equinox.internal.p2.repository.ProgressStatistics;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.metadata.*;
import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription;
@@ -25,6 +30,7 @@ import org.eclipse.equinox.p2.repository.IRepositoryManager;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
+import org.eclipse.equinox.p2.tests.TestData;
public class JarURLMetadataRepositoryTest extends AbstractProvisioningTest {
@@ -42,6 +48,34 @@ public class JarURLMetadataRepositoryTest extends AbstractProvisioningTest {
protected void setUp() throws Exception {
manager = getMetadataRepositoryManager();
+ }
+
+ protected void tearDown() throws Exception {
+ manager = null;
+ if (testRepoJar != null)
+ FileUtils.deleteAll(testRepoJar.getParentFile());
+ }
+
+ /**
+ * Tests loading a repository in a zip file.
+ * This test case comes from bug 369834.
+ */
+ public void _testZipFileRepository() throws IOException, ProvisionException, OperationCanceledException {
+ //ensure a random agent doesn't cause it to fail
+ IProvisioningAgent other = new ProvisioningAgent();
+ other.stop();
+ ProgressStatistics.setProvisioningAgent(other);
+ File zip = TestData.getFile("bug369834", "f-TestBuild-group.group.group.zip");
+ URI location = URIUtil.toJarURI(zip.toURI(), new Path(""));
+ IMetadataRepository repo = manager.loadRepository(location, null);
+ assertTrue(!repo.query(QueryUtil.createIUAnyQuery(), null).isEmpty());
+ }
+
+ /**
+ * Tests loading a repository in a jar file.
+ */
+ public void testJarURLRepository() throws ProvisionException {
+ //create a repository
String tempDir = System.getProperty("java.io.tmpdir");
File testRepo = new File(tempDir, "testRepo");
FileUtils.deleteAll(testRepo);
@@ -49,7 +83,7 @@ public class JarURLMetadataRepositoryTest extends AbstractProvisioningTest {
Map properties = new HashMap();
properties.put(IRepository.PROP_COMPRESSED, "true");
IMetadataRepository repo = manager.createRepository(testRepo.toURI(), "TestRepo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties);
-
+ //populate with some basic metadata
InstallableUnitDescription descriptor = new MetadataFactory.InstallableUnitDescription();
descriptor.setId("testIuId");
descriptor.setVersion(Version.create("3.2.1"));
@@ -59,14 +93,7 @@ public class JarURLMetadataRepositoryTest extends AbstractProvisioningTest {
testRepoJar = new File(testRepo, "content.jar");
assertTrue(testRepoJar.exists());
testRepoJar.deleteOnExit();
- }
-
- protected void tearDown() throws Exception {
- manager = null;
- FileUtils.deleteAll(testRepoJar.getParentFile());
- }
- public void testJarURLRepository() throws ProvisionException {
URI jarRepoLocation = null;
try {
jarRepoLocation = new URI("jar:" + testRepoJar.toURI() + "!/");
@@ -74,7 +101,7 @@ public class JarURLMetadataRepositoryTest extends AbstractProvisioningTest {
fail(e.getMessage());
}
- IMetadataRepository repo = manager.loadRepository(jarRepoLocation, null);
+ repo = manager.loadRepository(jarRepoLocation, null);
assertTrue(!repo.query(QueryUtil.createIUAnyQuery(), null).isEmpty());
URI[] local = manager.getKnownRepositories(IRepositoryManager.REPOSITORIES_LOCAL);
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/bug369834/f-TestBuild-group.group.group.zip b/bundles/org.eclipse.equinox.p2.tests/testData/bug369834/f-TestBuild-group.group.group.zip
new file mode 100644
index 000000000..9fccbb3c0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/bug369834/f-TestBuild-group.group.group.zip
Binary files differ

Back to the top