本文整理汇总了Java中io.bootique.job.runtime.JobModule类的典型用法代码示例。如果您正苦于以下问题:Java JobModule类的具体用法?Java JobModule怎么用?Java JobModule使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JobModule类属于io.bootique.job.runtime包,在下文中一共展示了JobModule类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testScheduleCommand_AllJobs
import io.bootique.job.runtime.JobModule; //导入依赖的package包/类
@Test
public void testScheduleCommand_AllJobs() {
BQRuntime runtime = testFactory.app()
.args("--schedule", "-c", "classpath:io/bootique/job/fixture/scheduler_test_command.yml")
.module(JobModule.class)
.module(b -> JobModule.extend(b).addJob(ScheduledJob1.class).addJob(ScheduledJob2.class))
.createRuntime();
Scheduler scheduler = runtime.getInstance(Scheduler.class);
assertFalse(scheduler.isStarted());
runtime.run();
assertTrue(scheduler.isStarted());
assertEquals(2, scheduler.getScheduledJobs().size());
}
示例2: testScheduleCommand_SelectedJobs
import io.bootique.job.runtime.JobModule; //导入依赖的package包/类
@Test
public void testScheduleCommand_SelectedJobs() {
BQRuntime runtime = testFactory.app()
.args("--schedule", "--job=scheduledjob1", "-c", "classpath:io/bootique/job/fixture/scheduler_test_triggers.yml")
.module(JobModule.class)
.module(b -> JobModule.extend(b).addJob(ScheduledJob1.class).addJob(ScheduledJob2.class))
.createRuntime();
Scheduler scheduler = runtime.getInstance(Scheduler.class);
runtime.run();
assertTrue(scheduler.isStarted());
assertEquals(1, scheduler.getScheduledJobs().size());
assertEquals("scheduledjob1", scheduler.getScheduledJobs().iterator().next().getJobName());
}
示例3: executeJobs
import io.bootique.job.runtime.JobModule; //导入依赖的package包/类
protected CommandOutcome executeJobs(Collection<? extends Job> jobs, String... args) {
return testFactory.app(args)
.module(new JobModule())
.module(binder -> {
JobModuleExtender extender = JobModule.extend(binder);
jobs.forEach(extender::addJob);
}).createRuntime()
.run();
}
示例4: before
import io.bootique.job.runtime.JobModule; //导入依赖的package包/类
@Before
public void before() {
listener = new ExecutionRateListener();
runtime = testFactory.app("-c", "classpath:io/bootique/job/fixture/scheduler_test_triggers.yml")
.module(JobModule.class)
.module(b -> JobModule.extend(b).addJob(ScheduledJob1.class).addListener(listener))
.createRuntime();
}
示例5: setUp
import io.bootique.job.runtime.JobModule; //导入依赖的package包/类
@Before
public void setUp() {
runtime = testFactory.app()
.module(JobModule.class)
.module(b -> JobModule.extend(b).addJob(SerialJob1.class))
.createRuntime();
executor = Executors.newFixedThreadPool(10);
}
示例6: testExecution_ParameterizedJob1_ParametersOverriddenWithProps
import io.bootique.job.runtime.JobModule; //导入依赖的package包/类
@Test
public void testExecution_ParameterizedJob1_ParametersOverriddenWithProps() {
ParameterizedJob2 job = new ParameterizedJob2();
testFactory.app("--exec", "--job=parameterizedjob2")
.autoLoadModules()
.module(b -> JobModule.extend(b).addJob(job))
.module(b -> BQCoreModule.extend(b).setProperty("bq.jobs.parameterizedjob2.params.longp", "35"))
.createRuntime()
.run();
assertExecutedWithParams(job, Collections.singletonMap("longp", 35l));
}
示例7: testExecution_ParameterizedJob1_ParametersOverriddenWithVars
import io.bootique.job.runtime.JobModule; //导入依赖的package包/类
@Test
public void testExecution_ParameterizedJob1_ParametersOverriddenWithVars() {
ParameterizedJob2 job = new ParameterizedJob2();
testFactory.app("--exec", "--job=parameterizedjob2")
.autoLoadModules()
.module(b -> JobModule.extend(b).addJob(job))
.module(b -> BQCoreModule.extend(b).declareVar("jobs.parameterizedjob2.params.longp", "TEST_PARAM"))
.module(b -> BQCoreModule.extend(b).setVar("TEST_PARAM", "35"))
.createRuntime()
.run();
assertExecutedWithParams(job, Collections.singletonMap("longp", 35l));
}
示例8: configure
import io.bootique.job.runtime.JobModule; //导入依赖的package包/类
@Override
protected void configure(Bootique bootique) {
bootique.module(JobModule.class).module(this);
}
示例9: configure
import io.bootique.job.runtime.JobModule; //导入依赖的package包/类
@Override
public void configure(Binder binder) {
// contribute available jobs to the JobModule
JobModule.extend(binder).addJob(SimpleJob.class).addJob(SimpleJob1.class).addJob(InjectionJob.class).addJob(ParameterizedJob.class);
}
示例10: configure
import io.bootique.job.runtime.JobModule; //导入依赖的package包/类
@Override
public void configure(Binder binder) {
JobModule.extend(binder).addListener(InstrumentedJobListener.class);
}