use of org.apache.sling.distribution.queue.DistributionQueueProcessor in project sling by apache.
the class SimpleDistributionQueueProviderTest method testEnableQueueProcessing.
@Test
public void testEnableQueueProcessing() throws Exception {
Scheduler scheduler = mock(Scheduler.class);
ScheduleOptions options = mock(ScheduleOptions.class);
when(scheduler.NOW(-1, 1)).thenReturn(options);
when(options.canRunConcurrently(false)).thenReturn(options);
when(options.name(any(String.class))).thenReturn(options);
String name = "dummy-agent";
SimpleDistributionQueueProvider simpledistributionQueueProvider = new SimpleDistributionQueueProvider(scheduler, name, false);
DistributionQueueProcessor processor = mock(DistributionQueueProcessor.class);
simpledistributionQueueProvider.enableQueueProcessing(processor);
}
use of org.apache.sling.distribution.queue.DistributionQueueProcessor in project sling by apache.
the class SimpleDistributionQueueProcessorTest method testRunWithNoQueue.
@Test
public void testRunWithNoQueue() throws Exception {
DistributionQueue queue = mock(DistributionQueue.class);
DistributionQueueProcessor queueProcessor = mock(DistributionQueueProcessor.class);
SimpleDistributionQueueProcessor simpleDistributionQueueProcessor = new SimpleDistributionQueueProcessor(queue, queueProcessor);
simpleDistributionQueueProcessor.run();
}
use of org.apache.sling.distribution.queue.DistributionQueueProcessor in project sling by apache.
the class SimpleDistributionQueueProcessorTest method testRunWithOneNonEmptyQueue.
@Test
public void testRunWithOneNonEmptyQueue() throws Exception {
SimpleDistributionQueueProvider queueProvider = mock(SimpleDistributionQueueProvider.class);
Collection<SimpleDistributionQueue> queues = new LinkedList<SimpleDistributionQueue>();
SimpleDistributionQueue queue = mock(SimpleDistributionQueue.class);
DistributionQueueItem item = mock(DistributionQueueItem.class);
when(queue.getHead()).thenReturn(new DistributionQueueEntry(null, item, null)).thenReturn(null);
queues.add(queue);
when(queueProvider.getQueues()).thenReturn(queues);
DistributionQueueProcessor queueProcessor = mock(DistributionQueueProcessor.class);
SimpleDistributionQueueProcessor simpleDistributionQueueProcessor = new SimpleDistributionQueueProcessor(queue, queueProcessor);
simpleDistributionQueueProcessor.run();
}
use of org.apache.sling.distribution.queue.DistributionQueueProcessor in project sling by apache.
the class SimpleDistributionQueueProcessorTest method testRunWithOneEmptyQueue.
@Test
public void testRunWithOneEmptyQueue() throws Exception {
SimpleDistributionQueueProvider queueProvider = mock(SimpleDistributionQueueProvider.class);
Collection<SimpleDistributionQueue> queues = new LinkedList<SimpleDistributionQueue>();
SimpleDistributionQueue queue = mock(SimpleDistributionQueue.class);
when(queue.getHead()).thenReturn(null);
queues.add(queue);
when(queueProvider.getQueues()).thenReturn(queues);
DistributionQueueProcessor queueProcessor = mock(DistributionQueueProcessor.class);
SimpleDistributionQueueProcessor simpleDistributionQueueProcessor = new SimpleDistributionQueueProcessor(queue, queueProcessor);
simpleDistributionQueueProcessor.run();
}
use of org.apache.sling.distribution.queue.DistributionQueueProcessor in project sling by apache.
the class SimpleDistributionQueueProviderTest method testEnableQueueProcessingWithCheckpointing.
@Test
public void testEnableQueueProcessingWithCheckpointing() throws Exception {
String name = "dummy-agent";
try {
Scheduler scheduler = mock(Scheduler.class);
ScheduleOptions options = mock(ScheduleOptions.class);
when(scheduler.NOW(-1, 1)).thenReturn(options);
when(options.canRunConcurrently(false)).thenReturn(options);
when(options.name(any(String.class))).thenReturn(options);
SimpleDistributionQueueProvider simpledistributionQueueProvider = new SimpleDistributionQueueProvider(scheduler, name, true);
DistributionQueueProcessor processor = mock(DistributionQueueProcessor.class);
simpledistributionQueueProvider.enableQueueProcessing(processor);
} finally {
new File(name + "-simple-queues-checkpoints").deleteOnExit();
}
}
Aggregations