2017-05-09 15:41:59 +02:00
|
|
|
package org.gcube.informationsystem.exporter;
|
|
|
|
|
2017-09-05 16:14:57 +02:00
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map;
|
|
|
|
|
2017-05-09 15:41:59 +02:00
|
|
|
import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
|
|
|
|
import org.gcube.informationsystem.exporter.mapper.GenericResourceExporterTest;
|
|
|
|
import org.gcube.informationsystem.exporter.mapper.ServiceEndpointExporterTest;
|
|
|
|
import org.junit.Test;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
public class ISExporterPluginTest {
|
|
|
|
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(ISExporterPluginTest.class);
|
|
|
|
|
2019-11-15 12:06:01 +01:00
|
|
|
// @Test
|
2019-02-12 18:12:24 +01:00
|
|
|
public void testLaunch() throws ObjectNotFound, Exception {
|
2019-11-15 12:06:01 +01:00
|
|
|
String[] contexts = {
|
|
|
|
"/gcube", "/gcube/devNext", "/gcube/devNext/NextNext" //, "/gcube/devsec", "/gcube/devsec/devVRE"
|
2017-05-09 15:41:59 +02:00
|
|
|
};
|
2019-02-06 11:52:23 +01:00
|
|
|
|
2019-11-15 12:06:01 +01:00
|
|
|
for(String context : contexts) {
|
2017-05-09 15:41:59 +02:00
|
|
|
logger.info("\n\n\n-------------------------------------------------------------------------");
|
2019-11-15 12:06:01 +01:00
|
|
|
ContextTest.setContextByName(context);
|
|
|
|
|
2017-05-09 15:41:59 +02:00
|
|
|
ISExporterPlugin isExporterPlugin = new ISExporterPlugin(new ISExporterPluginDeclaration());
|
2019-02-12 18:12:24 +01:00
|
|
|
Map<String,Object> inputs = new HashMap<String,Object>();
|
2017-09-05 16:14:57 +02:00
|
|
|
inputs.put(ISExporterPlugin.FILTERED_REPORT, true);
|
2019-11-15 12:06:01 +01:00
|
|
|
inputs.put(ISExporterPlugin.STATISTICS, false);
|
2017-09-05 16:14:57 +02:00
|
|
|
isExporterPlugin.launch(inputs);
|
2017-05-09 15:41:59 +02:00
|
|
|
logger.info("\n\n\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-15 12:06:01 +01:00
|
|
|
@Test
|
2019-02-12 18:12:24 +01:00
|
|
|
public void export() throws ObjectNotFound, Exception {
|
2019-11-15 12:06:01 +01:00
|
|
|
String[] contexts = {
|
|
|
|
// "/gcube", "/gcube/devNext",
|
|
|
|
"/gcube/devNext/NextNext" //,
|
|
|
|
// "/gcube/devsec", "/gcube/devsec/devVRE"
|
2019-02-12 18:12:24 +01:00
|
|
|
};
|
|
|
|
|
2019-11-15 12:06:01 +01:00
|
|
|
for(String context : contexts) {
|
|
|
|
ContextTest.setContextByName(context);
|
2019-02-12 18:12:24 +01:00
|
|
|
|
|
|
|
GenericResourceExporterTest genericResourceExporterTest = new GenericResourceExporterTest();
|
|
|
|
genericResourceExporterTest.export();
|
|
|
|
|
|
|
|
ServiceEndpointExporterTest serviceEndpointExporterTest = new ServiceEndpointExporterTest();
|
|
|
|
serviceEndpointExporterTest.export();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-09 15:41:59 +02:00
|
|
|
//@Test
|
2019-02-12 18:12:24 +01:00
|
|
|
public void removeExported() throws ObjectNotFound, Exception {
|
2019-11-15 12:06:01 +01:00
|
|
|
String[] contexts = {
|
|
|
|
"/gcube", "/gcube/devNext", "/gcube/devNext/NextNext", "/gcube/devsec", "/gcube/devsec/devVRE"
|
2017-05-09 15:41:59 +02:00
|
|
|
};
|
|
|
|
|
2019-11-15 12:06:01 +01:00
|
|
|
for(String context : contexts) {
|
|
|
|
ContextTest.setContextByName(context);
|
2017-05-09 15:41:59 +02:00
|
|
|
|
|
|
|
GenericResourceExporterTest genericResourceExporterTest = new GenericResourceExporterTest();
|
2017-09-05 16:14:57 +02:00
|
|
|
genericResourceExporterTest.removeExported();
|
2017-05-09 15:41:59 +02:00
|
|
|
|
|
|
|
ServiceEndpointExporterTest serviceEndpointExporterTest = new ServiceEndpointExporterTest();
|
2017-09-05 16:14:57 +02:00
|
|
|
serviceEndpointExporterTest.removeExported();
|
2017-05-09 15:41:59 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|