use of org.apache.sling.distribution.queue.DistributionQueue 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.DistributionQueue in project sling by apache.
the class SimpleDistributionQueueProviderTest method testGetOrCreateQueueWithCheckpointing.
@Test
public void testGetOrCreateQueueWithCheckpointing() throws Exception {
String name = "agentName";
try {
SimpleDistributionQueueProvider simpledistributionQueueProvider = new SimpleDistributionQueueProvider(mock(Scheduler.class), name, true);
DistributionQueue queue = simpledistributionQueueProvider.getQueue("default");
assertNotNull(queue);
} finally {
new File(name + "-simple-queues-checkpoints").deleteOnExit();
}
}
use of org.apache.sling.distribution.queue.DistributionQueue in project sling by apache.
the class SimpleDistributionQueueProviderTest method testGetOrCreateQueue.
@Test
public void testGetOrCreateQueue() throws Exception {
SimpleDistributionQueueProvider simpledistributionQueueProvider = new SimpleDistributionQueueProvider(mock(Scheduler.class), "agentName", false);
DistributionQueue queue = simpledistributionQueueProvider.getQueue("default");
assertNotNull(queue);
}
use of org.apache.sling.distribution.queue.DistributionQueue in project sling by apache.
the class MonitoringDistributionQueueProvider method getQueue.
@Override
public DistributionQueue getQueue(String queueName) throws DistributionException {
DistributionQueue distributionQueue = wrapped.getQueue(queueName);
monitorQueue(distributionQueue);
return distributionQueue;
}
use of org.apache.sling.distribution.queue.DistributionQueue in project sling by apache.
the class SimpleDistributionAgent method getState.
@Nonnull
public DistributionAgentState getState() {
DistributionAgentState agentState = DistributionAgentState.IDLE;
// if it is passive and it is not a queueing agent
if (isPassive() && distributionPackageImporter != null) {
return DistributionAgentState.PAUSED;
}
for (String queueName : getQueueNames()) {
DistributionQueue queue = getQueue(queueName);
DistributionQueueState state = queue.getStatus().getState();
if (DistributionQueueState.BLOCKED == state) {
return DistributionAgentState.BLOCKED;
}
if (DistributionQueueState.RUNNING == state) {
agentState = DistributionAgentState.RUNNING;
}
}
return agentState;
}
Aggregations