tests
This commit is contained in:
parent
1cfa13d0f6
commit
df1cf900ee
|
@ -67,12 +67,6 @@
|
|||
|
||||
<!-- TEST -->
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.10</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>gcube-geoserver-client</artifactId>
|
||||
|
@ -80,8 +74,11 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Test log binding -->
|
||||
<dependency>
|
||||
<artifactId>sdi-test-commons</artifactId>
|
||||
<groupId>org.gcube.spatial.data</groupId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
package org.gcube.spatial.data.sdi;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
public class BasicScopedTests {
|
||||
|
||||
// static String sdiHostname="sdi-t.pre.d4science.org";
|
||||
// static String scope ="/pred4s/preprod/preVRE";
|
||||
//
|
||||
// String sdiHostname="sdi-d-d4s.d4science.org";
|
||||
static String scope = "/gcube/devsec/devVRE";
|
||||
|
||||
@BeforeClass
|
||||
public static void setScope(){
|
||||
TokenSetter.set(scope);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,22 +1,25 @@
|
|||
package org.gcube.spatial.data.sdi;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import org.gcube.sdi.test.GCubeSDITest;
|
||||
import org.gcube.spatial.data.sdi.interfaces.Metadata;
|
||||
import org.gcube.spatial.data.sdi.model.metadata.MetadataPublishOptions;
|
||||
import org.gcube.spatial.data.sdi.model.metadata.TemplateInvocationBuilder;
|
||||
import org.gcube.spatial.data.sdi.plugins.SDIAbstractPlugin;
|
||||
import org.junit.Test;
|
||||
|
||||
public class MetadataTests extends BasicScopedTests{
|
||||
public class MetadataTests implements GCubeSDITest{
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void getAvailableTemplatesTest() throws IllegalArgumentException, URISyntaxException{
|
||||
|
||||
assumeTrue(isTestInfrastructureEnabled());
|
||||
// Metadata meta=SDIAbstractPlugin.metadata().at(new URI("http://"+sdiHostname+"/sdi-service/gcube/service")).build();
|
||||
Metadata meta=SDIAbstractPlugin.metadata().build();
|
||||
System.out.println(meta.getAvailableTemplates());
|
||||
|
@ -25,6 +28,7 @@ public class MetadataTests extends BasicScopedTests{
|
|||
|
||||
@Test
|
||||
public void pushMetadata() throws IllegalArgumentException, URISyntaxException{
|
||||
assumeTrue(isTestInfrastructureEnabled());
|
||||
File toPubilsh=Paths.get("src/test/resources/toEnrichMeta.xml").toFile();
|
||||
|
||||
// Metadata meta=SDIAbstractPlugin.metadata().at(new URI("http://"+sdiHostname+"/sdi-service/gcube/service")).build();
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package org.gcube.spatial.data.sdi;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
import static org.gcube.spatial.data.sdi.plugins.SDIAbstractPlugin.management;
|
||||
|
||||
|
||||
import org.gcube.sdi.test.GCubeSDITest;
|
||||
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;
|
||||
|
@ -12,10 +12,11 @@ import org.gcube.spatial.data.sdi.model.faults.RemoteException;
|
|||
import org.gcube.spatial.data.sdi.plugins.SDIAbstractPlugin;
|
||||
import org.junit.Test;
|
||||
|
||||
public class SDITests extends BasicScopedTests{
|
||||
public class SDITests implements GCubeSDITest{
|
||||
|
||||
@Test
|
||||
public void getScopeConfiguration() throws RemoteException, IllegalArgumentException, MalformedURLException {
|
||||
assumeTrue(isTestInfrastructureEnabled());
|
||||
SDIManagement sdi=SDIAbstractPlugin.management().build();
|
||||
System.out.println(sdi.getConfiguration());
|
||||
}
|
||||
|
@ -23,6 +24,7 @@ public class SDITests extends BasicScopedTests{
|
|||
|
||||
@Test
|
||||
public void getScopeHealth() throws RemoteException {
|
||||
assumeTrue(isTestInfrastructureEnabled());
|
||||
SDIManagement sdi=SDIAbstractPlugin.management().build();
|
||||
System.out.println(sdi.getReport());
|
||||
}
|
||||
|
@ -30,6 +32,7 @@ public class SDITests extends BasicScopedTests{
|
|||
|
||||
@Test
|
||||
public void getGS() throws Exception {
|
||||
assumeTrue(isTestInfrastructureEnabled());
|
||||
System.out.println(
|
||||
SDIAbstractPlugin.management().build().getClientByEngineId(Engine.GS_ENGINE).getInfo());
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>sdi-service</artifactId>
|
||||
<version>1.5.0-SNPASHOT</version>
|
||||
<version>1.5.0-SNAPSHOT</version>
|
||||
<name>SDI Service</name>
|
||||
<description>REST Interface towards SDI facilities</description>
|
||||
<packaging>war</packaging>
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.gcube.spatial.data.sdi;
|
|||
import java.net.URL;
|
||||
import java.util.Properties;
|
||||
|
||||
import lombok.Synchronized;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
|
@ -78,19 +77,20 @@ public class LocalConfiguration {
|
|||
static LocalConfiguration instance=null;
|
||||
|
||||
|
||||
@Synchronized
|
||||
public static LocalConfiguration init(URL propertiesURL){
|
||||
if(instance==null)
|
||||
instance=new LocalConfiguration(propertiesURL);
|
||||
return instance;
|
||||
}
|
||||
// @Synchronized
|
||||
// public static LocalConfiguration init(URL propertiesURL){
|
||||
// if(instance==null)
|
||||
// instance=new LocalConfiguration(propertiesURL);
|
||||
// return instance;
|
||||
// }
|
||||
|
||||
private Properties props=new Properties();
|
||||
|
||||
private LocalConfiguration(URL propertiesURL) {
|
||||
private LocalConfiguration() {
|
||||
try{
|
||||
String propertiesURL="/config.properties";
|
||||
log.debug("Loading {} ",propertiesURL);
|
||||
props.load(propertiesURL.openStream());
|
||||
props.load(new URL(propertiesURL).openStream());
|
||||
}catch(Exception e){
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
@ -48,8 +48,8 @@ public class SDIService extends ResourceConfig{
|
|||
ContainerConfiguration configuration=context.container().configuration();
|
||||
try{
|
||||
URL resourceUrl = context.application().getResource("/WEB-INF/config.properties");
|
||||
LocalConfiguration.init(resourceUrl).
|
||||
setTemplateConfigurationObject(ContextProvider.get());
|
||||
// LocalConfiguration.init(resourceUrl).
|
||||
LocalConfiguration.setTemplateConfigurationObject(ContextProvider.get());
|
||||
|
||||
}catch(Throwable t){
|
||||
log.debug("Listing available paths");
|
||||
|
|
|
@ -11,7 +11,7 @@ public class ConfigurationTest {
|
|||
TokenSetter.set("/d4science.research-infrastructures.eu/gCubeApps/BiodiversityLab");
|
||||
|
||||
// TokenSetter.set("/gcube/devNext/NextNext");
|
||||
LocalConfiguration.init(Paths.get("src/main/webapp/WEB-INF/config.properties").toUri().toURL());
|
||||
// LocalConfiguration.init(Paths.get("src/main/webapp/WEB-INF/config.properties").toUri().toURL());
|
||||
|
||||
// SDIManagerImpl sdi=new SDIManagerImpl(new GeoNetworkManagerImpl(new RoleManagerImpl()),
|
||||
// new ThreddsManagerFactory().provide(), new GISManagerImpl());
|
||||
|
|
|
@ -21,10 +21,10 @@ import org.junit.Test;
|
|||
|
||||
public class MainTest extends JerseyTest implements GCubeSDITest{
|
||||
|
||||
@BeforeClass
|
||||
public static void init() throws MalformedURLException {
|
||||
LocalConfiguration.init(Paths.get("src/main/webapp/WEB-INF/config.properties").toUri().toURL());
|
||||
}
|
||||
// @BeforeClass
|
||||
// public static void init() throws MalformedURLException {
|
||||
// LocalConfiguration.init(Paths.get("src/main/webapp/WEB-INF/config.properties").toUri().toURL());
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
package org.gcube.spatial.data.sdi.test;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import javax.xml.transform.TransformerException;
|
||||
|
||||
import org.gcube.spatial.data.sdi.LocalConfiguration;
|
||||
import org.gcube.spatial.data.sdi.engine.TemplateManager;
|
||||
import org.gcube.sdi.test.GCubeSDITest;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.metadata.MetadataTemplateManagerImpl;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.metadata.TemplateApplicationReport;
|
||||
import org.gcube.spatial.data.sdi.model.metadata.TemplateInvocationBuilder;
|
||||
import org.junit.Test;
|
||||
|
||||
public class MetadataApplicationTest {
|
||||
public class MetadataApplicationTest implements GCubeSDITest{
|
||||
|
||||
@Test
|
||||
public void apply() throws IOException, TransformerException{
|
||||
assumeTrue(isTestInfrastructureEnabled());
|
||||
TokenSetter.set("/gcube/devNext/NextNext");
|
||||
MetadataTemplateManagerImpl manager=new MetadataTemplateManagerImpl();
|
||||
// LocalConfiguration.init(Paths.get("src/main/webapp/WEB-INF/config.properties").toUri().toURL())
|
||||
|
|
|
@ -21,7 +21,7 @@ public class RegisterServiceTest {
|
|||
public static void main(String[] args) throws MalformedURLException, ServiceRegistrationException {
|
||||
TokenSetter.set("/d4science.research-infrastructures.eu/gCubeApps/AlienAndInvasiveSpecies");
|
||||
|
||||
LocalConfiguration.init(Paths.get("src/main/webapp/WEB-INF/config.properties").toUri().toURL());
|
||||
// LocalConfiguration.init(Paths.get("src/main/webapp/WEB-INF/config.properties").toUri().toURL());
|
||||
|
||||
// SDIManagerImpl sdi=new SDIManagerImpl(new GeoNetworkManagerImpl(new RoleManagerImpl()), new ThreddsManagerFactory().provide(), new GISManagerImpl());
|
||||
//
|
||||
|
|
|
@ -14,7 +14,7 @@ public class TestCreateCatalog {
|
|||
TokenSetter.set("/gcube/devNext");
|
||||
|
||||
|
||||
LocalConfiguration.init(Paths.get("src/main/webapp/WEB-INF/config.properties").toUri().toURL());
|
||||
// LocalConfiguration.init(Paths.get("src/main/webapp/WEB-INF/config.properties").toUri().toURL());
|
||||
|
||||
// ThreddsManager mng=new ThreddsManagerFactory().provide();
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ public class TestIS {
|
|||
|
||||
public static void main(String[] args) throws MalformedURLException {
|
||||
TokenSetter.set("/gcube/devNext/NextNext");
|
||||
LocalConfiguration.init(Paths.get("src/main/webapp/WEB-INF/config.properties").toUri().toURL());
|
||||
// LocalConfiguration.init(Paths.get("src/main/webapp/WEB-INF/config.properties").toUri().toURL());
|
||||
ServiceEndpoint e=ISUtils.querySEById("8e1962e9-05a7-40d4-a56f-574431f4c907");
|
||||
|
||||
e.profile().description(e.profile().description()+"_modified");
|
||||
|
|
Loading…
Reference in New Issue