Fixing tests
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/private/luca.frosini/infrastructure-tests@169851 82a268e6-3cf1-43bd-a215-b396298e98cfmaster
parent
961a63d1c5
commit
45efb179f2
@ -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