2017-04-13 17:35:47 +02:00
|
|
|
package org.gcube.informationsystem.sweeper;
|
|
|
|
|
2017-04-14 11:51:20 +02:00
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map;
|
|
|
|
|
2017-04-13 17:35:47 +02:00
|
|
|
import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
|
|
|
|
import org.gcube.common.scope.api.ScopeProvider;
|
|
|
|
import org.junit.Test;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
public class ISSweeperPluginTest {
|
|
|
|
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(ISSweeperPluginTest.class);
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testLaunch() throws ObjectNotFound, Exception{
|
2020-04-03 17:44:08 +02:00
|
|
|
String[] contexts = {
|
|
|
|
ContextTest.VRE_ALTERNATIVE_CONTEXT,
|
|
|
|
ContextTest.VRE_DEFAULT_CONTEXT,
|
|
|
|
ContextTest.VO_ALTERNATIVE_CONTEXT,
|
|
|
|
ContextTest.VO_DEFAULT_CONTEXT,
|
|
|
|
ContextTest.ROOT_TEST_CONTEXT
|
2017-04-13 17:35:47 +02:00
|
|
|
};
|
|
|
|
|
2020-04-03 17:44:08 +02:00
|
|
|
for(String context : contexts){
|
2017-04-13 17:35:47 +02:00
|
|
|
logger.info("\n\n\n-------------------------------------------------------------------------");
|
2020-04-03 17:44:08 +02:00
|
|
|
ContextTest.setContextByName(context);
|
2017-04-13 17:35:47 +02:00
|
|
|
try{
|
2017-04-14 11:51:20 +02:00
|
|
|
Map<String, Object> inputs = new HashMap<String, Object>();
|
|
|
|
inputs.put(ISSweeperPlugin.EXPIRING_MINUTES_TIMEOUT, 30);
|
|
|
|
inputs.put(ISSweeperPlugin.DEAD_DAYS_TIMEOUT, 1);
|
|
|
|
logger.debug("Inputs : {}", inputs);
|
2017-04-13 17:35:47 +02:00
|
|
|
ISSweeperPlugin isExporterPlugin = new ISSweeperPlugin(new ISSweeperPluginDeclaration());
|
2017-04-14 11:51:20 +02:00
|
|
|
isExporterPlugin.launch(inputs);
|
2017-04-13 17:35:47 +02:00
|
|
|
}catch (Exception e) {
|
|
|
|
logger.error("Sweeper error on {}", ScopeProvider.instance.get(), e);
|
|
|
|
}
|
|
|
|
logger.info("\n\n\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|