endpoints = client.submit(query);
+ if (endpoints == null || endpoints.isEmpty()) throw new Exception("Cannot retrieve the GCoreEndpoint serviceName: "+serviceName +", serviceClass: " +serviceClass +", in scope: "+scope);
+
+ String urlFound = endpoints.get(0);
+ if(urlFound==null)
+ throw new Exception("Endpoint:"+resource+", is null for serviceName: "+serviceName +", serviceClass: " +serviceClass +", in scope: "+scope);
+
+ logger.info("found entyname "+urlFound+" for ckanResource: "+resource);
+
+ urlFound = urlFound.replaceFirst(":80", "").replace("http", "https");
+ return urlFound;
+
+ }catch(Exception e){
+ String error = "An error occurred during GCoreEndpoint discovery, serviceName: "+serviceName +", serviceClass: " +serviceClass +", in scope: "+scope +".";
+ logger.error(error, e);
+ throw new Exception(error);
+ }finally{
+ if(oldScope != null && !oldScope.equals(scope))
+ ScopeProvider.instance.set(oldScope);
+ }
+ }
+}
diff --git a/src/test/java/org/gcube/data_catalogue/grsf_publish_ws/JTests.java b/src/test/java/org/gcube/data_catalogue/grsf_publish_ws/JTests.java
index 05dc4be..39ac1d4 100644
--- a/src/test/java/org/gcube/data_catalogue/grsf_publish_ws/JTests.java
+++ b/src/test/java/org/gcube/data_catalogue/grsf_publish_ws/JTests.java
@@ -42,7 +42,6 @@ import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Status;
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Type_Fishery;
import org.gcube.datacatalogue.ckanutillibrary.DataCatalogue;
import org.gcube.datacatalogue.ckanutillibrary.DataCatalogueFactory;
-import org.junit.Test;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -506,4 +505,20 @@ public class JTests {
return result;
}
+ //@Test
+ public void GRSFServiceUrl() throws Exception{
+ String context = "/gcube/devNext/NextNext";
+ String url = GcoreEndpointGRSFService.getServiceUrl(context);
+ logger.debug("Url is " + url);
+
+ }
+
+ //@Test
+ public void removeHTML() throws Exception{
+
+ String toTest = "Based on the results of the MP operation for 2015–17 in its 2013 meeting and the outcome of the review of exceptional circumstances in its 2015 meeting, the ESC recommended that there is no need to revise the Extended Commission’s 2013 TAC decision regarding the TAC for 2016–17. The recommended annual TAC for the years 2016-2017 is 14,647.4t.
";
+ HelperMethods.removeHTML(toTest);
+
+ }
+
}