Fixing unit tests, inner class visibility.
This commit is contained in:
@@ -173,7 +173,7 @@ public class QuartzScheduleServiceProvider implements ScheduleServiceProvider {
|
||||
* It is designed to be used for periodic tasks, therefore get() either block or throw
|
||||
* {@link java.util.concurrent.CancellationException}.
|
||||
*/
|
||||
private class ScheduledFutureJobWrapper implements ScheduledFuture<Object> {
|
||||
public class ScheduledFutureJobWrapper implements ScheduledFuture<Object> {
|
||||
|
||||
private final Scheduler scheduler;
|
||||
|
||||
@@ -249,7 +249,7 @@ public class QuartzScheduleServiceProvider implements ScheduleServiceProvider {
|
||||
/**
|
||||
* Wrapper class allowing for Quartz jobs to be interrupted.
|
||||
*/
|
||||
private static class InterruptableMethodInvokingJob extends MethodInvokingJobDetailFactoryBean.MethodInvokingJob
|
||||
public static class InterruptableMethodInvokingJob extends MethodInvokingJobDetailFactoryBean.MethodInvokingJob
|
||||
implements InterruptableJob {
|
||||
|
||||
private Thread executionThread;
|
||||
@@ -275,7 +275,7 @@ public class QuartzScheduleServiceProvider implements ScheduleServiceProvider {
|
||||
private final String name;
|
||||
|
||||
|
||||
public FixedDelayJobListener() {
|
||||
private FixedDelayJobListener() {
|
||||
this.name = generateNameForInstance(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public class TestQuartzScheduleServiceProvider extends AbstractJUnit4SpringConte
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
AtomicBoolean hasRun = new AtomicBoolean(false);
|
||||
scheduleServiceProvider.execute(new SimpleRunnable(latch, hasRun));
|
||||
latch.await(500, TimeUnit.MILLISECONDS);
|
||||
latch.await(1000, TimeUnit.MILLISECONDS);
|
||||
assertTrue(hasRun.get());
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ public class TestQuartzScheduleServiceProvider extends AbstractJUnit4SpringConte
|
||||
AtomicBoolean hasRun = new AtomicBoolean(false);
|
||||
SimpleRunnable runnable = new SimpleRunnable(latch, hasRun);
|
||||
scheduleServiceProvider.scheduleWithFixedDelay(runnable, 500, 500, TimeUnit.MILLISECONDS);
|
||||
latch.await(2000, TimeUnit.MILLISECONDS);
|
||||
latch.await(3000, TimeUnit.MILLISECONDS);
|
||||
assertTrue(hasRun.get());
|
||||
}
|
||||
|
||||
@@ -153,7 +153,6 @@ public class TestQuartzScheduleServiceProvider extends AbstractJUnit4SpringConte
|
||||
}
|
||||
|
||||
public void run() {
|
||||
hasRun.set(latch.getCount() == 1);
|
||||
this.executionTimes.add(new Date().getTime());
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
@@ -162,6 +161,9 @@ public class TestQuartzScheduleServiceProvider extends AbstractJUnit4SpringConte
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
latch.countDown();
|
||||
if (latch.getCount() == 0) {
|
||||
hasRun.set(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user