46 lines
1.2 KiB
Java
46 lines
1.2 KiB
Java
package org.gcube.application;
|
|
|
|
import java.io.IOException;
|
|
import java.nio.file.Files;
|
|
import java.nio.file.Paths;
|
|
|
|
import org.gcube.application.geoportalcommon.geoportalconfig.DocumentConfig;
|
|
import org.gcube.common.scope.api.ScopeProvider;
|
|
import org.junit.Test;
|
|
|
|
public class LoadDocumentConfiguration {
|
|
|
|
private static String TOKEN = "";
|
|
private static String CONTEXT = "/gcube/devsec/devVRE";
|
|
private static String USERNAME = "francesco.mangiacrapa";
|
|
|
|
// @Before
|
|
public void init() {
|
|
ScopeProvider.instance.set(CONTEXT);
|
|
}
|
|
|
|
@Test
|
|
public void loadDocumentConfiguration() throws Exception {
|
|
System.out.println("loadDocumentConfiguration called");
|
|
String filePath = "/home/francescomangiacrapa/git/geoportal-data-common/src/test/resources/geoportal-config.json";
|
|
String theFile = readFile(filePath);
|
|
System.out.println("the file is: "+theFile);
|
|
DocumentConfig dc = org.gcube.application.geoportal.client.utils.Serialization.read(theFile,
|
|
DocumentConfig.class);
|
|
System.out.println(dc);
|
|
}
|
|
|
|
private static String readFile(String filePath) {
|
|
String content = "";
|
|
|
|
try {
|
|
content = new String(Files.readAllBytes(Paths.get(filePath)));
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
}
|
|
|
|
return content;
|
|
}
|
|
|
|
}
|