You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by wi...@apache.org on 2017/06/07 09:59:59 UTC

[1/3] marmotta git commit: MARMOTTA-666: extended prefix provider interface to allow pinging

Repository: marmotta
Updated Branches:
  refs/heads/develop 3f7588a49 -> 56981f5db


MARMOTTA-666: extended prefix provider interface to allow pinging


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/7f691913
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/7f691913
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/7f691913

Branch: refs/heads/develop
Commit: 7f691913264d03b5540314d643748baa5f7e0408
Parents: 3f7588a
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed Jun 7 11:28:46 2017 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed Jun 7 11:28:46 2017 +0200

----------------------------------------------------------------------
 .../core/api/prefix/PrefixProvider.java         |  7 +++++++
 .../platform/core/services/prefix/PrefixCC.java | 21 +++++++++++++++++++-
 2 files changed, 27 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/7f691913/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/prefix/PrefixProvider.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/prefix/PrefixProvider.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/prefix/PrefixProvider.java
index d0bd578..338ede0 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/prefix/PrefixProvider.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/api/prefix/PrefixProvider.java
@@ -26,6 +26,13 @@ package org.apache.marmotta.platform.core.api.prefix;
 public interface PrefixProvider {
 
     /**
+     * Ccheck the connectivity with the prefix provider
+     *
+     * @return connectivity state
+     */
+    boolean ping();
+
+    /**
      * Get namespace identified by this prefix
      * 
      * @param prefix prefix

http://git-wip-us.apache.org/repos/asf/marmotta/blob/7f691913/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/prefix/PrefixCC.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/prefix/PrefixCC.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/prefix/PrefixCC.java
index 523c3bb..8dd0ae8 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/prefix/PrefixCC.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/prefix/PrefixCC.java
@@ -17,6 +17,7 @@
  */
 package org.apache.marmotta.platform.core.services.prefix;
 
+import com.sun.org.apache.xpath.internal.operations.Bool;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.io.LineIterator;
 import org.apache.http.HttpEntity;
@@ -54,7 +55,25 @@ public class PrefixCC implements PrefixProvider {
     private Logger log;
 
     @Inject
-    private HttpClientService   httpClientService;
+    private HttpClientService httpClientService;
+
+    @Override
+    public boolean ping() {
+        HttpGet head = new HttpGet(URI);
+        HttpRequestUtil.setUserAgentString(head, USER_AGENT);
+        try {
+            return httpClientService.execute(head, new ResponseHandler<Boolean>() {
+
+                @Override
+                public Boolean handleResponse(HttpResponse response) {
+                    return (200 == response.getStatusLine().getStatusCode());
+                }
+            });
+        } catch (IOException e) {
+            log.error("Error pinging {}: {}", URI, e.getMessage());
+            return false;
+        }
+    }
 
     @Override
     public String getNamespace(final String prefix) {


[2/3] marmotta git commit: MARMOTTA-666: adapted PrefixCC test for only run when there is Internet access

Posted by wi...@apache.org.
MARMOTTA-666: adapted PrefixCC test for only run when there is Internet access


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/4e124fd6
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/4e124fd6
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/4e124fd6

Branch: refs/heads/develop
Commit: 4e124fd6d97239bb182f4ebfab3a22e6dbb16f7d
Parents: 7f69191
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed Jun 7 11:33:25 2017 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed Jun 7 11:33:25 2017 +0200

----------------------------------------------------------------------
 .../platform/core/test/prefix/PrefixCCTest.java         | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/4e124fd6/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/prefix/PrefixCCTest.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/prefix/PrefixCCTest.java b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/prefix/PrefixCCTest.java
index a8b852b..22ebba8 100644
--- a/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/prefix/PrefixCCTest.java
+++ b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/prefix/PrefixCCTest.java
@@ -21,10 +21,7 @@ import java.util.Random;
 
 import org.apache.marmotta.platform.core.services.prefix.PrefixCC;
 import org.apache.marmotta.platform.core.test.base.EmbeddedMarmotta;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.*;
 
 /**
  * Test the functionality of our prefix.cc implementation
@@ -46,7 +43,7 @@ public class PrefixCCTest {
         prefixcc = marmotta.getService(PrefixCC.class);
         random = new Random();
     }
-    
+
     @AfterClass
     public static void tearDown() {
         marmotta.shutdown();
@@ -55,6 +52,11 @@ public class PrefixCCTest {
         random = null;
     }
 
+    @Before
+    public void checks() {
+        Assume.assumeTrue(prefixcc.ping());
+    }
+
     @Test
     public void testGetNamespace() {
     	Assert.assertEquals(NAMESPACE, prefixcc.getNamespace(PREFIX));


[3/3] marmotta git commit: MARMOTTA-666: merged pr on github, closes #29

Posted by wi...@apache.org.
MARMOTTA-666: merged pr on github, closes #29

Signed-off-by: Sergio Fernández <wi...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/56981f5d
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/56981f5d
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/56981f5d

Branch: refs/heads/develop
Commit: 56981f5db0b2123fcf3a1d33c456db6e616e37ab
Parents: 3f7588a 4e124fd
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed Jun 7 11:59:40 2017 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed Jun 7 11:59:40 2017 +0200

----------------------------------------------------------------------
 .../core/api/prefix/PrefixProvider.java         |  7 +++++++
 .../platform/core/services/prefix/PrefixCC.java | 21 +++++++++++++++++++-
 .../platform/core/test/prefix/PrefixCCTest.java | 12 ++++++-----
 3 files changed, 34 insertions(+), 6 deletions(-)
----------------------------------------------------------------------