diff --git a/pom.xml b/pom.xml
index 1518bbf..c046bc8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -44,6 +44,9 @@
sdi-interface
sdi-test-commons
+
+
+
sdi-library
diff --git a/sdi-service/pom.xml b/sdi-service/pom.xml
index 34c73f9..a8c0dd5 100644
--- a/sdi-service/pom.xml
+++ b/sdi-service/pom.xml
@@ -20,7 +20,7 @@
org.gcube.distribution
gcube-smartgears-bom
- 2.0.0
+ 2.1.0
pom
import
diff --git a/sdi-service/src/main/java/org/gcube/spatial/data/sdi/engine/impl/is/GeoNetworkRetriever.java b/sdi-service/src/main/java/org/gcube/spatial/data/sdi/engine/impl/is/GeoNetworkRetriever.java
index ac83acc..613b168 100644
--- a/sdi-service/src/main/java/org/gcube/spatial/data/sdi/engine/impl/is/GeoNetworkRetriever.java
+++ b/sdi-service/src/main/java/org/gcube/spatial/data/sdi/engine/impl/is/GeoNetworkRetriever.java
@@ -24,47 +24,6 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
public class GeoNetworkRetriever extends AbstractISModule{
-// @Override
-// public GeoNetworkDescriptor getObject() throws ConfigurationNotFoundException {
-// //TODO skip library
-// //TODO use both GCoreEndpoints and ServiceEndpoint
-//
-//
-//// log.info("Gathering geonetwork information under scope {} ",ScopeUtils.getCurrentScope());
-//// LocalConfiguration config=LocalConfiguration.get();
-//// String category=config.getProperty(LocalConfiguration.GEONETWORK_SE_CATEGORY);
-//// String platformName=config.getProperty(LocalConfiguration.GEONETWORK_SE_PLATFORM);
-//// String priorityProperty=config.getProperty(LocalConfiguration.GEONETWORK_SE_PRIORITY);
-//// String endpointName=config.getProperty(LocalConfiguration.GEONETWORK_SE_ENDPOINT_NAME);
-//// ServiceEndpoint se=getTheRightServiceEndpoint(ISUtils.queryForServiceEndpoints(category, platformName), endpointName, priorityProperty);
-//// AccessPoint access=getTheRightAccessPoint(se, endpointName, priorityProperty);
-////
-//
-// try{
-// //INIT LIB
-// GISInterface gis=GISInterface.get();
-// GeoNetworkAdministration gnAdmin=(GeoNetworkAdministration) gis.getGeoNewtorkPublisher();
-// Configuration config=gnAdmin.getConfiguration();
-//
-// Version version=config.getGeoNetworkVersion().equals(ServerAccess.Version.TRE)?new Version(3,0,0):new Version(2,6,0);
-// String baseEndpoint=config.getGeoNetworkEndpoint();
-// ScopeConfiguration scopeConfig=config.getScopeConfiguration();
-// List accessibleCredentials=new ArrayList();
-// for(Account acc: scopeConfig.getAccounts().values()){
-// accessibleCredentials.add(fromGeoNetworkAccount(acc));
-// }
-//
-// Credentials adminCredentials=fromGeoNetworkAccount(config.getAdminAccount());
-// // GN Lib doesn't expose ADMIN account type
-// adminCredentials.setAccessType(AccessType.ADMIN);
-// accessibleCredentials.add(adminCredentials);
-// return new GeoNetworkDescriptor(version, baseEndpoint, accessibleCredentials, scopeConfig.getPrivateGroup()+"", scopeConfig.getPublicGroup()+"", "3");
-// }catch(Exception e){
-// log.warn("Unable to gather geonetwork information",e);
-// throw new ConfigurationNotFoundException("Unable to gather information on geonetwork. Please contact administrator.",e);
-// }
-// }
-
protected static final Credentials fromGeoNetworkAccount(Account toTranslate){
@@ -189,7 +148,7 @@ public class GeoNetworkRetriever extends AbstractISModule{
GeoNetworkServiceDefinition gnDefinition=(GeoNetworkServiceDefinition) definition;
AccessPoint point=new AccessPoint();
- point.address("http://"+definition.getHostname()+"/geonetwork");
+ point.address("https://"+definition.getHostname()+"/geonetwork");
point.credentials(ISUtils.encryptString(definition.getAdminPassword()), "admin");
point.description("Main Access point");
point.name(getServiceEndpointAccessPointName());
diff --git a/sdi-service/src/main/java/org/gcube/spatial/data/sdi/engine/impl/is/ThreddsRetriever.java b/sdi-service/src/main/java/org/gcube/spatial/data/sdi/engine/impl/is/ThreddsRetriever.java
index 4f5028d..dea5b5e 100644
--- a/sdi-service/src/main/java/org/gcube/spatial/data/sdi/engine/impl/is/ThreddsRetriever.java
+++ b/sdi-service/src/main/java/org/gcube/spatial/data/sdi/engine/impl/is/ThreddsRetriever.java
@@ -164,8 +164,7 @@ public class ThreddsRetriever extends AbstractISModule {
}
}catch(IOException e) {
String msg="Unable to check thredds instance hosted on "+hostname;
- log.warn(msg);
- log.debug("Exception was ",e);
+ log.warn(msg,e);
toReturn.add(new Status(msg,Level.WARNING));
// } catch (DataTransferException e) {
// String msg="DataTransfer not found in host "+hostname;
diff --git a/sdi-service/src/main/java/org/gcube/spatial/data/sdi/engine/impl/metadata/MetadataHandler.java b/sdi-service/src/main/java/org/gcube/spatial/data/sdi/engine/impl/metadata/MetadataHandler.java
index 0c6c060..4a16b13 100644
--- a/sdi-service/src/main/java/org/gcube/spatial/data/sdi/engine/impl/metadata/MetadataHandler.java
+++ b/sdi-service/src/main/java/org/gcube/spatial/data/sdi/engine/impl/metadata/MetadataHandler.java
@@ -50,6 +50,15 @@ public class MetadataHandler {
}
+ public String initUUID() throws SAXException, IOException {
+ return setUUID(UUID.randomUUID().toString());
+ }
+
+ public String setUUID(String uuid) throws SAXException, IOException {
+ MetadataUtils.addContent("gmd:MD_Metadata",document,String.format(CommonMetadataPieces.fileIdentifier, metaUUID),helper,MetadataUtils.Position.first_child);
+ return getUUID();
+ }
+
public String getUUID() throws SAXException, IOException{
//Set | get meta UUID
if(metaUUID==null){
@@ -57,14 +66,11 @@ public class MetadataHandler {
List metaUUIDList=helper.evaluate("//gmd:fileIdentifier/gco:CharacterString/text()");
- if(metaUUIDList.isEmpty()){
- metaUUID=UUID.randomUUID().toString();
- log.debug("Stting uuid {} ",metaUUID);
- MetadataUtils.addContent("gmd:MD_Metadata",document,String.format(CommonMetadataPieces.fileIdentifier, metaUUID),helper,MetadataUtils.Position.first_child);
- }else {
+ if(!metaUUIDList.isEmpty()) {
metaUUID=metaUUIDList.get(0);
- log.debug("Found meta UUID {} ",metaUUID);
+ log.debug("Found meta UUID {} ",metaUUID);
}
+
}
return metaUUID;
}
diff --git a/sdi-service/src/main/java/org/gcube/spatial/data/sdi/engine/impl/metadata/MetadataTemplateManagerImpl.java b/sdi-service/src/main/java/org/gcube/spatial/data/sdi/engine/impl/metadata/MetadataTemplateManagerImpl.java
index 988657d..8b2fed8 100644
--- a/sdi-service/src/main/java/org/gcube/spatial/data/sdi/engine/impl/metadata/MetadataTemplateManagerImpl.java
+++ b/sdi-service/src/main/java/org/gcube/spatial/data/sdi/engine/impl/metadata/MetadataTemplateManagerImpl.java
@@ -100,7 +100,7 @@ public class MetadataTemplateManagerImpl implements TemplateManager {
cfg.setLogTemplateExceptions(false);
- // availableTemplates.add(new TemplateDescriptor("THREDDS-ONLINE", "Thredds online resources", "Template for online resources exposed by thredds.", "http://sdi-d4s.d4science.org"));
+ //availableTemplates.add(new TemplateDescriptor("THREDDS-ONLINE", "Thredds online resources", "Template for online resources exposed by thredds.", "..."));
ThreddsOnlineTemplate tpl=new ThreddsOnlineTemplate();
diff --git a/sdi-service/src/main/java/org/gcube/spatial/data/sdi/engine/impl/metadata/templates/ThreddsOnlineTemplate.java b/sdi-service/src/main/java/org/gcube/spatial/data/sdi/engine/impl/metadata/templates/ThreddsOnlineTemplate.java
index 9e73c7f..abc58d8 100644
--- a/sdi-service/src/main/java/org/gcube/spatial/data/sdi/engine/impl/metadata/templates/ThreddsOnlineTemplate.java
+++ b/sdi-service/src/main/java/org/gcube/spatial/data/sdi/engine/impl/metadata/templates/ThreddsOnlineTemplate.java
@@ -32,7 +32,8 @@ public class ThreddsOnlineTemplate extends AbstractMetadataTemplate
- http://${hostname}/thredds/dodsC/${cataloguedPath}
+ https://${hostname}/thredds/dodsC/${cataloguedPath}
WWW:LINK-1.0-http--link
@@ -101,7 +101,7 @@
- http://${hostname}/thredds/ncss/${cataloguedPath}
+ https://${hostname}/thredds/ncss/${cataloguedPath}
WWW:LINK-1.0-http--link
@@ -118,7 +118,7 @@
- http://${hostname}/thredds/wcs/${cataloguedPath}?service=wcs&version=1.0.0&request=GetCoverage&coverage=${layername}&CRS=EPSG:4326&format=geotiff
+ https://${hostname}/thredds/wcs/${cataloguedPath}?service=wcs&version=1.0.0&request=GetCoverage&coverage=${layername}&CRS=EPSG:4326&format=geotiff
OGC:WCS-1.0.0-http-get-coverage
@@ -135,7 +135,7 @@
- http://${hostname}/thredds/wms/${cataloguedPath}
+ https://${hostname}/thredds/wms/${cataloguedPath}
OGC:WMS-1.3.0-http-get-map
@@ -152,7 +152,7 @@
- http://${hostname}/thredds/fileServer/${cataloguedPath}
+ https://${hostname}/thredds/fileServer/${cataloguedPath}
WWW:LINK-1.0-http--link
@@ -169,7 +169,7 @@
- http://${hostname}/thredds/ncml/${cataloguedPath}
+ https://${hostname}/thredds/ncml/${cataloguedPath}
WWW:LINK-1.0-http--link
@@ -187,7 +187,7 @@
- http://${hostname}/thredds/uddc/${cataloguedPath}
+ https://${hostname}/thredds/uddc/${cataloguedPath}
WWW:LINK-1.0-http--link
diff --git a/sdi-service/src/test/java/org/gcube/spatial/data/sdi/test/MainTest.java b/sdi-service/src/test/java/org/gcube/spatial/data/sdi/test/MainTest.java
index eece4ce..227b5cf 100644
--- a/sdi-service/src/test/java/org/gcube/spatial/data/sdi/test/MainTest.java
+++ b/sdi-service/src/test/java/org/gcube/spatial/data/sdi/test/MainTest.java
@@ -2,6 +2,7 @@ package org.gcube.spatial.data.sdi.test;
import static org.junit.Assume.assumeTrue;
+import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.file.Paths;
@@ -43,6 +44,18 @@ public class MainTest extends ServiceTest{
path("configuration/"+hostname).request(MediaType.APPLICATION_JSON_TYPE).get(String.class));
}
+
+
+ @Test
+ public void testHealthReport() {
+ assumeTrue(isTestInfrastructureEnabled());
+ System.out.println(target(ServiceConstants.INTERFACE).path("status").request(MediaType.APPLICATION_JSON_TYPE).get(String.class));
+ System.out.println(target(ServiceConstants.INTERFACE).path("status").request(MediaType.APPLICATION_XML_TYPE).get(String.class));
+ }
+
+
+ // *********** METADATA
+
@Test
public void testGetTemplateList(){
assumeTrue(isTestInfrastructureEnabled());
@@ -53,27 +66,6 @@ public class MainTest extends ServiceTest{
System.out.println(result);
}
- @Test
- public void testHealthReport() {
- assumeTrue(isTestInfrastructureEnabled());
- System.out.println(target(ServiceConstants.INTERFACE).path("status").request(MediaType.APPLICATION_JSON_TYPE).get(String.class));
- System.out.println(target(ServiceConstants.INTERFACE).path("status").request(MediaType.APPLICATION_XML_TYPE).get(String.class));
- }
- @Test
- public void publishMetadata() {
- assumeTrue(isTestInfrastructureEnabled());
-
- // push
-
-
- }
-
-// private void publishMetadataFile(File toPublish) {
-// TemplateInvocationBuilder builder=new TemplateInvocationBuilder();
-// builder.threddsOnlineResources("localhost", "someFileName.sc", "newCatalog");
-// TemplateApplicationReport report=manager.applyMetadataTemplates(Paths.get("src/test/resources/xml/toEnrichMetadata.xml").toFile(), builder.get());
-// System.out.println(report);
-// }
}
diff --git a/sdi-service/src/test/java/org/gcube/spatial/data/sdi/test/ServiceTest.java b/sdi-service/src/test/java/org/gcube/spatial/data/sdi/test/ServiceTest.java
index 3b5e4e9..c52c17b 100644
--- a/sdi-service/src/test/java/org/gcube/spatial/data/sdi/test/ServiceTest.java
+++ b/sdi-service/src/test/java/org/gcube/spatial/data/sdi/test/ServiceTest.java
@@ -3,20 +3,24 @@ package org.gcube.spatial.data.sdi.test;
import static org.junit.Assume.assumeTrue;
import javax.ws.rs.core.Application;
+import javax.ws.rs.core.Response;
import org.gcube.data.transfer.library.client.AuthorizationFilter;
import org.gcube.sdi.test.GCubeSDITest;
import org.gcube.spatial.data.sdi.SDIService;
import org.glassfish.jersey.client.ClientConfig;
+import org.glassfish.jersey.media.multipart.MultiPartFeature;
import org.glassfish.jersey.test.JerseyTest;
import org.junit.BeforeClass;
public class ServiceTest extends JerseyTest {
-// @BeforeClass
-// public static void init() throws MalformedURLException {
-// LocalConfiguration.init(Paths.get("src/main/webapp/WEB-INF/config.properties").toUri().toURL());
-// }
+ protected static void checkResponse(Response toCheck) throws Exception{
+ switch(toCheck.getStatusInfo().getFamily()){
+ case SUCCESSFUL : break;
+ default : throw new Exception("Unexpected Response code : "+toCheck.getStatus(),new Exception(toCheck.readEntity(String.class)));
+ }
+ }
@Override
@@ -30,6 +34,7 @@ public class ServiceTest extends JerseyTest {
// TODO Auto-generated method stub
super.configureClient(config);
+ config.register(MultiPartFeature.class);
config.register(AuthorizationFilter.class);
}
diff --git a/sdi-service/src/test/java/org/gcube/spatial/data/sdi/test/TestCreateCatalog.java b/sdi-service/src/test/java/org/gcube/spatial/data/sdi/test/TestCreateCatalog.java
index cdf4de4..976cdfc 100644
--- a/sdi-service/src/test/java/org/gcube/spatial/data/sdi/test/TestCreateCatalog.java
+++ b/sdi-service/src/test/java/org/gcube/spatial/data/sdi/test/TestCreateCatalog.java
@@ -18,12 +18,7 @@ public class TestCreateCatalog {
// ThreddsManager mng=new ThreddsManagerFactory().provide();
- /*
- * "PUT /sdi-service/gcube/service/Thredds?
- * name=Thredds+Root+Catalog&
- * path=public/netcdf/syncfolderfrancesco&
- * folder=public/netcdf/syncfolderfrancesco HTTP/1.1" 1057 Jersey/2.13 (HttpUrlConnection 1.8.0_131)
- */
+
String baseName="ThreddsRootCatalog";