use of org.apache.sling.commons.scheduler.ScheduleOptions 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();
}
}
use of org.apache.sling.commons.scheduler.ScheduleOptions in project sling by apache.
the class RemoteEventDistributionTriggerTest method testRegister.
@Test
public void testRegister() throws Exception {
DistributionRequestHandler handler = mock(DistributionRequestHandler.class);
String endpoint = "";
DistributionTransportSecretProvider distributionTransportSecretProvider = mock(DistributionTransportSecretProvider.class);
Scheduler scheduler = mock(Scheduler.class);
ScheduleOptions options = mock(ScheduleOptions.class);
when(options.name(handler.toString())).thenReturn(options);
when(scheduler.NOW()).thenReturn(options);
RemoteEventDistributionTrigger remoteEventdistributionTrigger = new RemoteEventDistributionTrigger(endpoint, distributionTransportSecretProvider, scheduler);
remoteEventdistributionTrigger.register(handler);
}
use of org.apache.sling.commons.scheduler.ScheduleOptions in project acs-aem-commons by Adobe-Consulting-Services.
the class EnsureOakIndex method apply.
/**
* {@inheritDoc}
*/
@Override
public final void apply(boolean force) {
if (!force && this.applied) {
return;
}
log.info("Ensuring Oak Indexes [ {} ~> {} ]", ensureDefinitionsPath, oakIndexesPath);
// Start the indexing process asynchronously, so the activate won't get blocked
// by rebuilding a synchronous index
EnsureOakIndexJobHandler jobHandler = new EnsureOakIndexJobHandler(this, oakIndexesPath, ensureDefinitionsPath);
ScheduleOptions options = scheduler.NOW();
options.name(toString());
options.canRunConcurrently(false);
scheduler.schedule(jobHandler, options);
applied = true;
log.info("Job scheduled for ensuring Oak Indexes [ {} ~> {} ]", ensureDefinitionsPath, oakIndexesPath);
}
use of org.apache.sling.commons.scheduler.ScheduleOptions in project acs-aem-commons by Adobe-Consulting-Services.
the class AEMWorkflowRunnerImpl method getOptions.
@Override
public ScheduleOptions getOptions(Config config) {
ScheduleOptions options = scheduler.NOW(-1, config.getInterval());
options.canRunConcurrently(false);
options.onLeaderOnly(true);
options.name(config.getWorkspace().getJobName());
return options;
}
use of org.apache.sling.commons.scheduler.ScheduleOptions in project acs-aem-commons by Adobe-Consulting-Services.
the class AEMTransientWorkflowRunnerImpl method getOptions.
@Override
public ScheduleOptions getOptions(Config config) {
ScheduleOptions options = scheduler.NOW(-1, config.getInterval());
options.canRunConcurrently(false);
options.onLeaderOnly(true);
options.name(config.getWorkspace().getJobName());
return options;
}
Aggregations