Luca Frosini 6 years ago
parent 961a63d1c5
commit 45efb179f2

@ -94,6 +94,13 @@
<scope>test</scope>
</dependency>
-->
<dependency>
<groupId>org.gcube.data.publishing</groupId>
<artifactId>document-store-lib-accounting-service</artifactId>
<version>[1.0.1-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>test</scope>
</dependency>
<!-- END Document Store Lib -->
<dependency>
@ -164,7 +171,8 @@
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
<scope>test</scope>
</dependency>
<dependency>
<!-- dependency>
<groupId>org.gcube.information-system</groupId>
<artifactId>is-exporter-se-plugin</artifactId>
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
@ -177,7 +185,7 @@
<artifactId>resource-registry</artifactId>
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
<scope>test</scope>
</dependency>
</dependency -->
<dependency>

@ -3,6 +3,7 @@
*/
package org.gcube.documentstore.persistence;
import java.io.File;
import java.util.Calendar;
import org.gcube.accounting.datamodel.UsageRecord;
@ -106,4 +107,28 @@ public class PersistenceBackendTest extends ScopedTest {
}
@Test
public void test() {
File f = new File("test");
PersistenceBackend fallbackPersistenceBackend = new FallbackPersistenceBackend(f);
if(fallbackPersistenceBackend instanceof FallbackPersistenceBackend) {
logger.trace("{} is an instance of {}", fallbackPersistenceBackend, FallbackPersistenceBackend.class.getSimpleName());
}
PersistenceBackend rediscovered = new PersistenceAccountingService();
if(!rediscovered.getClass().equals(fallbackPersistenceBackend.getClass())){
logger.debug("New {} found : {}", PersistenceBackend.class.getSimpleName(), rediscovered.getClass().getSimpleName());
}else {
logger.trace("{} is still a {}. We will see if next time we will be more lucky.",
PersistenceBackend.class.getSimpleName(),
FallbackPersistenceBackend.class.getSimpleName());
}
}
}

@ -33,7 +33,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
public class ISExporterPluginSmartExecutorSchedulerTest extends ScopedTest {
private static Logger logger = LoggerFactory.getLogger(ISExporterPluginSmartExecutorSchedulerTest.class);
/*
public UUID scheduleTest(Scheduling scheduling) throws Exception {
Map<String, Object> inputs = new HashMap<String, Object>();
inputs.put(ISExporterPlugin.FILTERED_REPORT, true);
@ -182,5 +182,5 @@ public class ISExporterPluginSmartExecutorSchedulerTest extends ScopedTest {
}
*/
}

@ -0,0 +1,49 @@
package org.gcube.testutility;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import org.gcube.documentstore.persistence.ExecutorUtils;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ScheduledThreadTest {
public static final Logger logger = LoggerFactory.getLogger(ScheduledThreadTest.class);
public static final long TIME_RELOAD_CONFIGURATION = 2;
public ScheduledThreadTest() {
}
protected ScheduledFuture<?> futureReload;
protected void reloadConfiguration() {
futureReload = ExecutorUtils.CONFIGURATION_REDISCOVERY_POOL.scheduleAtFixedRate(new ReloaderThread(),
3, TIME_RELOAD_CONFIGURATION, TimeUnit.SECONDS);
}
public class ReloaderThread extends Thread {
public ReloaderThread() {
super();
}
public void run() {
logger.debug("Hello, I'm going to fail");
throw new RuntimeException();
}
}
@Test
public void test() throws InterruptedException {
reloadConfiguration();
Thread.sleep(TimeUnit.MINUTES.toMillis(3));
}
}
Loading…
Cancel
Save