diff options
author | nash <nash@13f79535-47bb-0310-9956-ffa450edef68> | 2010-10-10 09:19:14 +0000 |
---|---|---|
committer | nash <nash@13f79535-47bb-0310-9956-ffa450edef68> | 2010-10-10 09:19:14 +0000 |
commit | f5a7db2033d9a59804fad5151034010f7815b8de (patch) | |
tree | 8591555215e1fb1447403447ee7da472ab0b5062 /sca-java-1.x/branches/sca-java-1.6.1/modules/binding-atom-abdera | |
parent | 9ec370cfd3e69162851a38c9abd248a02e8378eb (diff) |
TUSCANY-3707: If no internet connection, avoid running tests that need the internet
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1006260 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/branches/sca-java-1.6.1/modules/binding-atom-abdera')
-rw-r--r-- | sca-java-1.x/branches/sca-java-1.6.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/AggregatorTestCase.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-1.6.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/AggregatorTestCase.java b/sca-java-1.x/branches/sca-java-1.6.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/AggregatorTestCase.java index 9cd94b2bd7..f2ee21e29d 100644 --- a/sca-java-1.x/branches/sca-java-1.6.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/AggregatorTestCase.java +++ b/sca-java-1.x/branches/sca-java-1.6.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/AggregatorTestCase.java @@ -56,6 +56,11 @@ public class AggregatorTestCase { @Test public void testAggregator() throws Exception { + // this test needs an internet connection + if (!internetConnected()) { + return; + } + Entry<String, Item>[] entries = aggregatorService.getAll(); Assert.assertNotNull(entries); @@ -65,4 +70,20 @@ public class AggregatorTestCase { System.out.println(">>> Entry[" + pos + "] - " + entries[pos].getData().getTitle()); } } + + private static boolean internetConnected() { + try { + // see whether an internet connection is available + Socket testInternet = new Socket("tuscany.apache.org", 80); + testInternet.close(); + + // internet connection available + return true; + + } catch (Exception e) { + // no internet connection + System.out.println("Unable to run test because no internet connection available"); + return false; + } + } } |