This commit is contained in:
Fabio Sinibaldi 2016-05-09 16:27:28 +00:00
parent b14e714d99
commit 7f6aaabe61
4 changed files with 73 additions and 11 deletions

View File

@ -8,7 +8,7 @@
</parent> </parent>
<groupId>org.gcube.spatial.data</groupId> <groupId>org.gcube.spatial.data</groupId>
<artifactId>geonetwork</artifactId> <artifactId>geonetwork</artifactId>
<version>2.1.1-SNAPSHOT</version> <version>3.0.0-SNAPSHOT</version>
<name>geonetwork</name> <name>geonetwork</name>
<properties> <properties>
@ -84,6 +84,12 @@
<artifactId>common-gcore-resources</artifactId> <artifactId>common-gcore-resources</artifactId>
<version>[1.1.0-SNAPSHOT,2.0.0-SNAPSHOT)</version> <version>[1.1.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
</dependency> </dependency>
<!-- lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>0.11.6</version>
</dependency>
</dependencies> </dependencies>
<repositories> <repositories>
<repository> <repository>

View File

@ -0,0 +1,51 @@
package org.gcube.spatial.data.geonetwork.test;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.spatial.data.geonetwork.GeoNetwork;
import org.gcube.spatial.data.geonetwork.GeoNetworkAdministration;
import org.gcube.spatial.data.geonetwork.LoginLevel;
public class AdministrationTests {
private static final String defaultScope="/gcube/devsec";
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
ScopeProvider.instance.set(defaultScope);
System.out.println("Checking scope : "+defaultScope);
GeoNetworkAdministration reader=GeoNetwork.get();
reader.login(LoginLevel.DEFAULT);
System.out.println(reader.getGroups());
// String path="/tmp/groups3727046726110219425.txt";
// System.out.println("Reading from path "+path);
// String content=readFile(path,Charset.defaultCharset());
// System.out.println("Content is ");
// System.out.println(content);
// System.out.println("************************************");
// System.out.println(GroupsUtils.parseGroupPage(content));
}
static String readFile(String path, Charset encoding)
throws IOException
{
byte[] encoded = Files.readAllBytes(Paths.get(path));
return new String(encoded, encoding);
}
}

View File

@ -19,21 +19,26 @@ import org.opengis.metadata.Metadata;
public class LoginTest { public class LoginTest {
// private static final String defaultScope="/gcube/devsec"; private static final String defaultScope="/gcube/devsec";
private static final String defaultScope="/d4science.research-infrastructures.eu/gCubeApps"; // private static final String defaultScope="/d4science.research-infrastructures.eu/gCubeApps";
/** /**
* @param args * @param args
* @throws Exception * @throws Exception
*/ */
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
ScopeProvider.instance.set(defaultScope); // ScopeProvider.instance.set(defaultScope);
System.out.println("Checking scope : "+defaultScope); // System.out.println("Checking scope : "+defaultScope);
GeoNetworkReader reader=GeoNetwork.get();
reader.login(LoginLevel.DEFAULT);
System.out.println(reader.getById(94669)); ConfigurationManager.setConfiguration(MyConfiguration.class);
GeoNetworkReader reader=GeoNetwork.get();
reader.login(LoginLevel.DEFAULT);
final GNSearchRequest req=new GNSearchRequest();
req.addParam(GNSearchRequest.Param.any,"");
System.out.println(reader.query(req));
// ConfigurationManager.setConfiguration(MyConfiguration.class);
// String metaFile="meta.xml"; // String metaFile="meta.xml";
// long id=publishMeta(LoginLevel.PRIVATE, metaFile); // long id=publishMeta(LoginLevel.PRIVATE, metaFile);

View File

@ -17,7 +17,7 @@ public class MyConfiguration implements Configuration {
@Override @Override
public String getGeoNetworkEndpoint() { public String getGeoNetworkEndpoint() {
return "http://geoserver-dev3.d4science-ii.research-infrastructures.eu:8080/geonetwork"; return "http://localhost:8080/geonetwork";
} }
@Override @Override