diff options
author | John Arthorne | 2008-04-25 17:24:37 +0000 |
---|---|---|
committer | John Arthorne | 2008-04-25 17:24:37 +0000 |
commit | ffc81b85438738c9809aa50a0cf92197351a2827 (patch) | |
tree | f5391116d38d6219714ed4c485f2042a1d2211f1 | |
parent | 59aaed3a7a509425762925236afa367f7212b31a (diff) | |
download | rt.equinox.p2-ffc81b85438738c9809aa50a0cf92197351a2827.tar.gz rt.equinox.p2-ffc81b85438738c9809aa50a0cf92197351a2827.tar.xz rt.equinox.p2-ffc81b85438738c9809aa50a0cf92197351a2827.zip |
Don't run test if remote location is not reachable
-rw-r--r-- | bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java index 801fd40d9..53f71545b 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java @@ -11,6 +11,7 @@ package org.eclipse.equinox.p2.tests.metadata.repository; import java.io.File; +import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.*; @@ -144,8 +145,10 @@ public class MetadataRepositoryManagerTest extends AbstractProvisioningTest { * Tests that local caching of remote metadata repositories works, and that the * cache is updated when it becomes stale. */ - public void testMetadataCachingRemoteRepo() throws MalformedURLException, ProvisionException { + public void _testMetadataCachingRemoteRepo() throws MalformedURLException, ProvisionException { URL repoLocation = new URL("http://download.eclipse.org/eclipse/updates/3.4milestones/"); + if (!repoAvailable(repoLocation)) + return; AgentLocation agentLocation = (AgentLocation) ServiceHelper.getService(TestActivator.getContext(), AgentLocation.class.getName()); URL dataArea = agentLocation.getDataArea("org.eclipse.equinox.p2.metadata.repository/cache/"); File dataAreaFile = URLUtil.toFile(dataArea); @@ -177,6 +180,15 @@ public class MetadataRepositoryManagerTest extends AbstractProvisioningTest { cacheFile.delete(); } + private boolean repoAvailable(URL repoLocation) { + try { + repoLocation.openStream().close(); + } catch (IOException e) { + return false; + } + return true; + } + /** * Returns a non-existent file that can be used to write a temporary * file or directory. The location will be deleted in the test tearDown method. |