Fixing tests
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/private/luca.frosini/infrastructure-tests@169851 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
961a63d1c5
commit
45efb179f2
12
pom.xml
12
pom.xml
|
@ -94,6 +94,13 @@
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</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 -->
|
<!-- END Document Store Lib -->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -164,7 +171,8 @@
|
||||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
|
<!-- dependency>
|
||||||
<groupId>org.gcube.information-system</groupId>
|
<groupId>org.gcube.information-system</groupId>
|
||||||
<artifactId>is-exporter-se-plugin</artifactId>
|
<artifactId>is-exporter-se-plugin</artifactId>
|
||||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||||
|
@ -177,7 +185,7 @@
|
||||||
<artifactId>resource-registry</artifactId>
|
<artifactId>resource-registry</artifactId>
|
||||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency -->
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.documentstore.persistence;
|
package org.gcube.documentstore.persistence;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
|
||||||
import org.gcube.accounting.datamodel.UsageRecord;
|
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 {
|
public class ISExporterPluginSmartExecutorSchedulerTest extends ScopedTest {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(ISExporterPluginSmartExecutorSchedulerTest.class);
|
private static Logger logger = LoggerFactory.getLogger(ISExporterPluginSmartExecutorSchedulerTest.class);
|
||||||
|
/*
|
||||||
public UUID scheduleTest(Scheduling scheduling) throws Exception {
|
public UUID scheduleTest(Scheduling scheduling) throws Exception {
|
||||||
Map<String, Object> inputs = new HashMap<String, Object>();
|
Map<String, Object> inputs = new HashMap<String, Object>();
|
||||||
inputs.put(ISExporterPlugin.FILTERED_REPORT, true);
|
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…
Reference in New Issue