This commit is contained in:
Fabio Sinibaldi 2021-03-04 16:44:56 +01:00
parent 530833b268
commit 14f16e5791
8 changed files with 35 additions and 17 deletions

View File

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=false
version=1

View File

@ -1,38 +1,48 @@
package org.gcube.spatial.data.clients.geoserver;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
import java.util.UUID;
import org.gcube.sdi.test.GCubeSDITest;
import org.gcube.spatial.data.clients.model.ConnectionDescriptor;
import org.gcube.spatial.data.sdi.model.credentials.AccessType;
import org.gcube.spatial.data.sdi.model.credentials.Credentials;
import org.gcube.spatial.data.clients.SDIGenericClient;
import org.gcube.spatial.data.clients.model.engine.Engine;
import org.gcube.spatial.data.sdi.model.faults.RemoteException;
import org.junit.BeforeClass;
import org.junit.Test;
public class GSTests extends GCubeSDITest{
protected GSRESTClient getClient() throws RemoteException, Exception {
SDIGenericClient obj=manager().getClientByEngineId(Engine.GS_ENGINE);
assertTrue(obj.getClass().isAssignableFrom(GeoServerClient.class));
return (GSRESTClient) obj.getRESTClient();
}
@Test
public void gets() throws RemoteException, Exception {
assumeTrue(isTestInfrastructureEnabled());
GSRESTClient client=new GSRESTClientImpl(desc);
// System.out.println(client.getStyles());
GSRESTClient client=getClient();
for(String ws : client.getWorkspaceNames()){
try {
System.out.println(client.getWorkspace(ws));
System.out.println(client.getStylesNamesinWorkspace(ws));
System.out.println(client.getDataStoresInWorkspace(ws));
}catch(RemoteException e) {
System.err.println("Unable to check "+ws+" : "+e.getRemoteMessage());
for(String ws : client.getWorkspaceNames()){
try {
System.out.println(client.getWorkspace(ws));
System.out.println(client.getStylesNamesinWorkspace(ws));
System.out.println(client.getDataStoresInWorkspace(ws));
}catch(RemoteException e) {
System.err.println("Unable to check "+ws+" : "+e.getRemoteMessage());
}
}
}
}
@Test
public void CRUDS() throws RemoteException, Exception {
GSRESTClient client=new GSRESTClientImpl(desc);
assumeTrue(isTestInfrastructureEnabled());
GSRESTClient client=getClient();
String ws=UUID.randomUUID().toString().replace("-", "_");
client.createWorkspace(ws);
client.getWorkspace(ws);

View File

@ -2,6 +2,9 @@ package org.gcube.spatial.data.sdi;
import java.net.MalformedURLException;
import static org.gcube.spatial.data.sdi.plugins.SDIAbstractPlugin.management;
import org.gcube.spatial.data.clients.geoserver.GSRESTClient;
import org.gcube.spatial.data.clients.model.engine.Engine;
import org.gcube.spatial.data.sdi.interfaces.SDIManagement;

View File

@ -2,5 +2,5 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for org.gcube.spatial.data.sdi-test-commons
## [v0.0.1-SNAPSHOT] - 2021-2-11
## [v0.0.2-SNAPSHOT] - 2021-2-11
First release

View File

@ -7,7 +7,7 @@
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>sdi-test-commons</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>0.0.2-SNAPSHOT</version>
<name>SDI test commons</name>
@ -47,6 +47,7 @@
<version>4.12</version>
</dependency>
</dependencies>
<description>Java library used to implement SDI clients.</description>