Infrastructure check for tests in sdi-service
This commit is contained in:
parent
981afa4e8e
commit
64544bfafa
|
@ -42,11 +42,11 @@ public class GSRESTClientImpl extends AbstractGenericRESTClient implements GSRES
|
|||
|
||||
setBasePath(API_BASE_PATH);
|
||||
|
||||
log.info("Connecting to GS @ "+conn.getEndpoint());
|
||||
|
||||
Credentials cr=conn.getCredentials().get(0);
|
||||
log.debug("Using "+cr);
|
||||
register(HttpAuthenticationFeature.universal(cr.getUsername(), cr.getPassword()));
|
||||
// log.info("Connecting to GS @ "+conn.getEndpoint());
|
||||
//
|
||||
// Credentials cr=conn.getCredentials().get(0);
|
||||
// log.debug("Using "+cr);
|
||||
// register(HttpAuthenticationFeature.universal(cr.getUsername(), cr.getPassword()));
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -4,11 +4,11 @@ import org.junit.BeforeClass;
|
|||
|
||||
public class BasicScopedTests {
|
||||
|
||||
static String sdiHostname="sdi-t.pre.d4science.org";
|
||||
static String scope ="/pred4s/preprod/preVRE";
|
||||
// static String sdiHostname="sdi-t.pre.d4science.org";
|
||||
// static String scope ="/pred4s/preprod/preVRE";
|
||||
//
|
||||
// String sdiHostname="sdi-d-d4s.d4science.org";
|
||||
// String scope = "/gcube/devsec/devVRE";
|
||||
static String scope = "/gcube/devsec/devVRE";
|
||||
|
||||
@BeforeClass
|
||||
public static void setScope(){
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
<name>SDI Service</name>
|
||||
<description>REST Interface towards SDI facilities</description>
|
||||
<packaging>war</packaging>
|
||||
<properties>
|
||||
<jersey.version>2.25.1</jersey.version>
|
||||
</properties>
|
||||
<scm>
|
||||
<connection>scm:git:${gitBaseUrl}/gcube-sdi-suite</connection>
|
||||
<developerConnection>scm:git:${gitBaseUrl}/gcube-sdi-suite</developerConnection>
|
||||
|
@ -27,13 +24,6 @@
|
|||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey </groupId>
|
||||
<artifactId>jersey-bom</artifactId>
|
||||
<version>${jersey.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<dependencies>
|
||||
|
@ -161,6 +151,11 @@
|
|||
<artifactId>logback-classic</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.spatial.data</groupId>
|
||||
<artifactId>sdi-test-commons</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
|
||||
<artifactId>jersey-test-framework-provider-simple</artifactId>
|
||||
|
|
|
@ -64,7 +64,7 @@ public class SDIService extends ResourceConfig{
|
|||
packages("org.gcube.spatial.data");
|
||||
|
||||
|
||||
log.warn("Initializing App : Binders");
|
||||
log.info("Initializing App : Binders");
|
||||
|
||||
AbstractBinder binder = new AbstractBinder() {
|
||||
@Override
|
||||
|
@ -90,48 +90,8 @@ public class SDIService extends ResourceConfig{
|
|||
registerClasses(Thredds.class);
|
||||
registerClasses(Metadata.class);
|
||||
|
||||
log.warn("Initialization complete");
|
||||
// register(MoxyXmlFeature.class);
|
||||
|
||||
|
||||
log.info("Initialization complete");
|
||||
|
||||
// String hostName=configuration.hostname();
|
||||
// Integer port=configuration.port();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//SWAGGER
|
||||
// BeanConfig beanConfig = new BeanConfig();
|
||||
// beanConfig.setVersion("1.0.0");
|
||||
// beanConfig.setSchemes(new String[]{"http","https"});
|
||||
// beanConfig.setHost(hostName+":"+port);
|
||||
// beanConfig.setBasePath("/gcube/service/");
|
||||
// beanConfig.setResourcePackage(GeoNetwork.class.getPackage().getName());
|
||||
// beanConfig.setTitle("SDI Service");
|
||||
// beanConfig.setDescription("REST Interface towards SDI facilities");
|
||||
// beanConfig.setPrettyPrint(true);
|
||||
// beanConfig.setScan(true);
|
||||
//
|
||||
// System.out.println("********************** SDI INIT *****************************");
|
||||
|
||||
|
||||
|
||||
//
|
||||
// log.debug("Initializing persistence manager.. {} :",persistence);
|
||||
//
|
||||
// try {
|
||||
// persistence.init();
|
||||
// } catch (Throwable t) {
|
||||
// throw new RuntimeException("Unabel to init persistence. ",t);
|
||||
// }
|
||||
// log.debug("Initializing template manager.. {} : ",templateManager);
|
||||
//
|
||||
// ApplicationContext ctx = ContextProvider.get();
|
||||
// templateManager.init(ctx);
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
package org.gcube.spatial.data.sdi.test;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import org.gcube.spatial.data.sdi.LocalConfiguration;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.GISManagerImpl;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.GeoNetworkManagerImpl;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.RoleManagerImpl;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.SDIManagerImpl;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.ThreddsManagerImpl;
|
||||
import org.gcube.spatial.data.sdi.test.factories.ThreddsManagerFactory;
|
||||
|
||||
public class ConfigurationTest {
|
||||
|
||||
|
@ -20,10 +13,11 @@ public class ConfigurationTest {
|
|||
// TokenSetter.set("/gcube/devNext/NextNext");
|
||||
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());
|
||||
|
||||
System.out.println(sdi.getContextConfiguration());
|
||||
System.out.println(sdi.getContextConfiguration().getGeonetworkConfiguration().get(0).getAccessibleCredentials());
|
||||
// SDIManagerImpl sdi=new SDIManagerImpl(new GeoNetworkManagerImpl(new RoleManagerImpl()),
|
||||
// new ThreddsManagerFactory().provide(), new GISManagerImpl());
|
||||
//
|
||||
// System.out.println(sdi.getContextConfiguration());
|
||||
// System.out.println(sdi.getContextConfiguration().getGeonetworkConfiguration().get(0).getAccessibleCredentials());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.gcube.spatial.data.sdi.test;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
|
@ -8,32 +10,16 @@ import javax.ws.rs.core.Application;
|
|||
import javax.ws.rs.core.GenericType;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.gcube.sdi.test.GCubeSDITest;
|
||||
import org.gcube.spatial.data.sdi.LocalConfiguration;
|
||||
import org.gcube.spatial.data.sdi.SDIService;
|
||||
import org.gcube.spatial.data.sdi.engine.GISManager;
|
||||
import org.gcube.spatial.data.sdi.engine.GeoNetworkManager;
|
||||
import org.gcube.spatial.data.sdi.engine.RoleManager;
|
||||
import org.gcube.spatial.data.sdi.engine.SDIManager;
|
||||
import org.gcube.spatial.data.sdi.engine.TemplateManager;
|
||||
import org.gcube.spatial.data.sdi.engine.TemporaryPersistence;
|
||||
import org.gcube.spatial.data.sdi.engine.ThreddsManager;
|
||||
import org.gcube.spatial.data.sdi.model.ServiceConstants;
|
||||
import org.gcube.spatial.data.sdi.model.metadata.TemplateDescriptor;
|
||||
import org.gcube.spatial.data.sdi.test.factories.GISManagerFactory;
|
||||
import org.gcube.spatial.data.sdi.test.factories.GeoNetworkManagerFactory;
|
||||
import org.gcube.spatial.data.sdi.test.factories.MetadataTemplateManagerFactory;
|
||||
import org.gcube.spatial.data.sdi.test.factories.RoleManagerFactory;
|
||||
import org.gcube.spatial.data.sdi.test.factories.SDIManagerFactory;
|
||||
import org.gcube.spatial.data.sdi.test.factories.TemporaryPersistenceFactory;
|
||||
import org.gcube.spatial.data.sdi.test.factories.ThreddsManagerFactory;
|
||||
import org.glassfish.hk2.utilities.binding.AbstractBinder;
|
||||
import org.glassfish.jersey.media.multipart.MultiPartFeature;
|
||||
import org.glassfish.jersey.server.ResourceConfig;
|
||||
import org.glassfish.jersey.test.JerseyTest;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
public class MainTest extends JerseyTest{
|
||||
public class MainTest extends JerseyTest implements GCubeSDITest{
|
||||
|
||||
@BeforeClass
|
||||
public static void init() throws MalformedURLException {
|
||||
|
@ -41,80 +27,30 @@ public class MainTest extends JerseyTest{
|
|||
}
|
||||
|
||||
|
||||
public static class MyBinder extends AbstractBinder{
|
||||
|
||||
public MyBinder() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
bindFactory(TemporaryPersistenceFactory.class).to(TemporaryPersistence.class);
|
||||
bindFactory(RoleManagerFactory.class).to(RoleManager.class);
|
||||
bindFactory(SDIManagerFactory.class).to(SDIManager.class);
|
||||
bindFactory(ThreddsManagerFactory.class).to(ThreddsManager.class);
|
||||
bindFactory(GeoNetworkManagerFactory.class).to(GeoNetworkManager.class);
|
||||
bindFactory(GISManagerFactory.class).to(GISManager.class);
|
||||
bindFactory(MetadataTemplateManagerFactory.class).to(TemplateManager.class);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Application configure() {
|
||||
System.out.println("Configuration for "+ServiceConstants.APPLICATION);
|
||||
|
||||
ResourceConfig config= new ResourceConfig(SDIService.class);
|
||||
config.register(new MyBinder());
|
||||
// config.register(io.swagger.jaxrs.listing.ApiListingResource.class);
|
||||
// config.register(io.swagger.jaxrs.listing.SwaggerSerializers.class);
|
||||
//
|
||||
// //SWAGGER
|
||||
// BeanConfig beanConfig = new BeanConfig();
|
||||
// beanConfig.setVersion("1.0.0");
|
||||
// beanConfig.setSchemes(new String[]{"http","https"});
|
||||
// beanConfig.setHost("localhost:9998");
|
||||
// beanConfig.setBasePath("gcube/service");
|
||||
// String packageName=GeoNetwork.class.getPackage().getName();
|
||||
// System.out.println("PACKAGE : "+packageName);
|
||||
// beanConfig.setResourcePackage(packageName);
|
||||
// beanConfig.setScan(true);
|
||||
// System.out.println(beanConfig.getSwagger());
|
||||
//
|
||||
//
|
||||
|
||||
//Multipart
|
||||
// config.packages("org.glassfish.jersey.media.multipart");
|
||||
config.packages("org.gcube.spatial.data");
|
||||
config.register(MultiPartFeature.class);
|
||||
return config;
|
||||
return new SDIService();
|
||||
}
|
||||
|
||||
|
||||
// @Test
|
||||
// public void getConfiguration(){
|
||||
// System.out.println(target(Constants.GEONETWORK_INTERFACE).
|
||||
// path(Constants.GEONETWORK_CONFIGURATION_PATH).
|
||||
// request(MediaType.APPLICATION_JSON_TYPE).get(String.class));
|
||||
// System.out.println(target(Constants.GEONETWORK_INTERFACE).
|
||||
// path(Constants.GEONETWORK_CONFIGURATION_PATH).
|
||||
// getUri());
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void getConfiguration(){
|
||||
assumeTrue(isTestInfrastructureEnabled());
|
||||
System.out.println(target(ServiceConstants.INTERFACE).request(MediaType.APPLICATION_JSON_TYPE).get(String.class));
|
||||
}
|
||||
//
|
||||
@Test
|
||||
public void getGeoServer(){
|
||||
assumeTrue(isTestInfrastructureEnabled());
|
||||
System.out.println(target(ServiceConstants.GeoServer.INTERFACE).path("configuration/geoserver1.dev.d4science.org").request(MediaType.APPLICATION_JSON_TYPE).get(String.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetTemplateList(){
|
||||
assumeTrue(isTestInfrastructureEnabled());
|
||||
List<TemplateDescriptor> result=target(ServiceConstants.Metadata.INTERFACE).
|
||||
path(ServiceConstants.Metadata.LIST_METHOD).
|
||||
request(MediaType.APPLICATION_JSON_TYPE).get().
|
||||
|
@ -124,6 +60,7 @@ public class MainTest extends JerseyTest{
|
|||
|
||||
@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));
|
||||
}
|
||||
|
|
|
@ -10,13 +10,10 @@ import org.gcube.spatial.data.sdi.engine.impl.GISManagerImpl;
|
|||
import org.gcube.spatial.data.sdi.engine.impl.GeoNetworkManagerImpl;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.RoleManagerImpl;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.SDIManagerImpl;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.ThreddsManagerImpl;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.factories.ThreddsManagerFactory;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.faults.ServiceRegistrationException;
|
||||
import org.gcube.spatial.data.sdi.model.ParameterType;
|
||||
import org.gcube.spatial.data.sdi.model.services.GeoNetworkServiceDefinition;
|
||||
import org.gcube.spatial.data.sdi.test.factories.ThreddsManagerFactory;
|
||||
|
||||
import ch.qos.logback.core.util.SystemInfo;
|
||||
|
||||
public class RegisterServiceTest {
|
||||
|
||||
|
@ -26,10 +23,10 @@ public class RegisterServiceTest {
|
|||
|
||||
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());
|
||||
|
||||
|
||||
System.out.println(sdi.registerService(getGNDefinition()));
|
||||
// SDIManagerImpl sdi=new SDIManagerImpl(new GeoNetworkManagerImpl(new RoleManagerImpl()), new ThreddsManagerFactory().provide(), new GISManagerImpl());
|
||||
//
|
||||
//
|
||||
// System.out.println(sdi.registerService(getGNDefinition()));
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -4,9 +4,6 @@ import java.net.MalformedURLException;
|
|||
import java.nio.file.Paths;
|
||||
|
||||
import org.gcube.spatial.data.sdi.LocalConfiguration;
|
||||
import org.gcube.spatial.data.sdi.engine.ThreddsManager;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.ThreddsManagerImpl;
|
||||
import org.gcube.spatial.data.sdi.test.factories.ThreddsManagerFactory;
|
||||
|
||||
public class TestCreateCatalog {
|
||||
|
||||
|
@ -19,7 +16,7 @@ public class TestCreateCatalog {
|
|||
|
||||
LocalConfiguration.init(Paths.get("src/main/webapp/WEB-INF/config.properties").toUri().toURL());
|
||||
|
||||
ThreddsManager mng=new ThreddsManagerFactory().provide();
|
||||
// ThreddsManager mng=new ThreddsManagerFactory().provide();
|
||||
|
||||
/*
|
||||
* "PUT /sdi-service/gcube/service/Thredds?
|
||||
|
@ -73,12 +70,12 @@ public class TestCreateCatalog {
|
|||
|
||||
|
||||
|
||||
try {
|
||||
|
||||
mng.createCatalogFromTemplate(authority,path,datasetScanId,datasetScanName,folder,catalogReference);
|
||||
}catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// try {
|
||||
//
|
||||
// mng.createCatalogFromTemplate(authority,path,datasetScanId,datasetScanName,folder,catalogReference);
|
||||
// }catch(Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
package org.gcube.spatial.data.sdi.test.factories;
|
||||
|
||||
import org.gcube.spatial.data.sdi.engine.GISManager;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.GISManagerImpl;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.cluster.AbstractCluster;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.cluster.GeoServerCluster;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.cluster.GeoServerController;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.faults.ConfigurationNotFoundException;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.is.ISModule;
|
||||
import org.gcube.spatial.data.sdi.model.service.GeoServerDescriptor;
|
||||
import org.gcube.spatial.data.sdi.test.TestCommon;
|
||||
import org.gcube.spatial.data.sdi.test.TokenSetter;
|
||||
import org.glassfish.hk2.api.Factory;
|
||||
|
||||
public class GISManagerFactory implements Factory<GISManager>{
|
||||
|
||||
private GISManager manager;
|
||||
|
||||
public GISManagerFactory() {
|
||||
manager=new GISManagerImpl(){
|
||||
|
||||
@Override
|
||||
protected ISModule getRetriever() {
|
||||
TokenSetter.set(TestCommon.TEST_SCOPE);
|
||||
return super.getRetriever();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractCluster<GeoServerDescriptor, GeoServerController> getCluster() {
|
||||
TokenSetter.set(TestCommon.TEST_SCOPE);
|
||||
return super.getCluster();
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void dispose(GISManager arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public GISManager provide() {
|
||||
return manager;
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
package org.gcube.spatial.data.sdi.test.factories;
|
||||
|
||||
import org.gcube.spatial.data.sdi.engine.GeoNetworkManager;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.GeoNetworkManagerImpl;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.cluster.AbstractCluster;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.cluster.GeoNetworkController;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.is.ISModule;
|
||||
import org.gcube.spatial.data.sdi.model.service.GeoNetworkDescriptor;
|
||||
import org.gcube.spatial.data.sdi.test.TestCommon;
|
||||
import org.gcube.spatial.data.sdi.test.TokenSetter;
|
||||
import org.glassfish.hk2.api.Factory;
|
||||
|
||||
public class GeoNetworkManagerFactory implements Factory<GeoNetworkManager>{
|
||||
|
||||
private GeoNetworkManager manager;
|
||||
|
||||
public GeoNetworkManagerFactory() {
|
||||
manager=new GeoNetworkManagerImpl(new RoleManagerFactory().provide()){
|
||||
@Override
|
||||
protected ISModule getRetriever() {
|
||||
TokenSetter.set(TestCommon.TEST_SCOPE);
|
||||
return super.getRetriever();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractCluster<GeoNetworkDescriptor, GeoNetworkController> getCluster() {
|
||||
TokenSetter.set(TestCommon.TEST_SCOPE);
|
||||
return super.getCluster();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose(GeoNetworkManager arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeoNetworkManager provide() {
|
||||
return manager;
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
package org.gcube.spatial.data.sdi.test.factories;
|
||||
|
||||
import org.gcube.spatial.data.sdi.engine.RoleManager;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.RoleManagerImpl;
|
||||
import org.glassfish.hk2.api.Factory;
|
||||
|
||||
public class RoleManagerFactory implements Factory<RoleManager>{
|
||||
|
||||
@Override
|
||||
public RoleManager provide() {
|
||||
return new RoleManagerImpl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose(RoleManager arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
package org.gcube.spatial.data.sdi.test.factories;
|
||||
|
||||
import org.gcube.spatial.data.sdi.engine.SDIManager;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.SDIManagerImpl;
|
||||
import org.gcube.spatial.data.sdi.model.ScopeConfiguration;
|
||||
import org.gcube.spatial.data.sdi.model.health.HealthReport;
|
||||
import org.gcube.spatial.data.sdi.test.TestCommon;
|
||||
import org.gcube.spatial.data.sdi.test.TokenSetter;
|
||||
import org.glassfish.hk2.api.Factory;
|
||||
|
||||
public class SDIManagerFactory implements Factory<SDIManager>{
|
||||
|
||||
SDIManager manager=null;
|
||||
|
||||
|
||||
public SDIManagerFactory() {
|
||||
manager=new SDIManagerImpl(new GeoNetworkManagerFactory().provide(),new ThreddsManagerFactory().provide(),new GISManagerFactory().provide()){
|
||||
@Override
|
||||
public ScopeConfiguration getContextConfiguration() {
|
||||
TokenSetter.set(TestCommon.TEST_SCOPE);
|
||||
return super.getContextConfiguration();
|
||||
}
|
||||
@Override
|
||||
public HealthReport getHealthReport() {
|
||||
TokenSetter.set(TestCommon.TEST_SCOPE);
|
||||
return super.getHealthReport();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose(SDIManager arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public SDIManager provide() {
|
||||
return manager;
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
package org.gcube.spatial.data.sdi.test.factories;
|
||||
|
||||
import org.gcube.spatial.data.sdi.engine.TemporaryPersistence;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.TemporaryPersistenceImpl;
|
||||
import org.glassfish.hk2.api.Factory;
|
||||
|
||||
public class TemporaryPersistenceFactory implements Factory<TemporaryPersistence>{
|
||||
|
||||
|
||||
@Override
|
||||
public void dispose(TemporaryPersistence arg0) {
|
||||
arg0.shutdown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemporaryPersistence provide() {
|
||||
TemporaryPersistenceImpl temp=new TemporaryPersistenceImpl();
|
||||
|
||||
temp.init();
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package org.gcube.spatial.data.sdi.test.factories;
|
||||
|
||||
import org.gcube.spatial.data.sdi.engine.ThreddsManager;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.ThreddsManagerImpl;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.cluster.AbstractCluster;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.cluster.ThreddsController;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.faults.ConfigurationNotFoundException;
|
||||
import org.gcube.spatial.data.sdi.engine.impl.is.ISModule;
|
||||
import org.gcube.spatial.data.sdi.model.health.ServiceHealthReport;
|
||||
import org.gcube.spatial.data.sdi.model.service.ThreddsDescriptor;
|
||||
import org.gcube.spatial.data.sdi.test.TestCommon;
|
||||
import org.gcube.spatial.data.sdi.test.TokenSetter;
|
||||
import org.glassfish.hk2.api.Factory;
|
||||
|
||||
public class ThreddsManagerFactory implements Factory<ThreddsManager>{
|
||||
|
||||
private ThreddsManager manager;
|
||||
|
||||
|
||||
public ThreddsManagerFactory() {
|
||||
manager=new ThreddsManagerImpl(new MetadataTemplateManagerFactory().provide()){
|
||||
@Override
|
||||
protected AbstractCluster<ThreddsDescriptor, ThreddsController> getCluster() {
|
||||
TokenSetter.set(TestCommon.TEST_SCOPE);
|
||||
return super.getCluster();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ISModule getRetriever() {
|
||||
TokenSetter.set(TestCommon.TEST_SCOPE);
|
||||
return super.getRetriever();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ThreddsManager provide() {
|
||||
return manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose(ThreddsManager arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
|
@ -7,29 +7,32 @@ import org.gcube.spatial.data.sdi.model.faults.RemoteException;
|
|||
import org.junit.BeforeClass;
|
||||
|
||||
|
||||
public class GCubeSDITest {
|
||||
private static String testContext=null;
|
||||
|
||||
static {
|
||||
testContext=System.getProperty("testContext");
|
||||
public interface GCubeSDITest {
|
||||
|
||||
public default String getContext() {
|
||||
String testContext=System.getProperty("testContext");
|
||||
System.out.println("TEST CONTEXT = "+testContext);
|
||||
return testContext;
|
||||
}
|
||||
|
||||
protected static boolean isTestInfrastructureEnabled() {
|
||||
return testContext!=null;
|
||||
|
||||
|
||||
public default boolean isTestInfrastructureEnabled() {
|
||||
return getContext()!=null;
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void setTestContext() {
|
||||
if(isTestInfrastructureEnabled()) TokenSetter.set(testContext);
|
||||
public default void setTestContext() {
|
||||
if(isTestInfrastructureEnabled())
|
||||
TokenSetter.set(getContext());
|
||||
}
|
||||
|
||||
|
||||
protected static ScopeConfiguration scopeConfiguration() throws RemoteException {
|
||||
public default ScopeConfiguration scopeConfiguration() throws RemoteException {
|
||||
return SimpleSDIManagerClient.contextService().build().getConfiguration();
|
||||
}
|
||||
|
||||
protected static SDIManagement manager() throws RemoteException {
|
||||
public default SDIManagement manager() throws RemoteException {
|
||||
return SimpleSDIManagerClient.contextService().build();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue