use of com.dangdang.ddframe.job.lite.config.LiteJobConfiguration in project elastic-job by dangdangdotcom.
the class ConfigurationServiceTest method assertPersistNewJobConfiguration.
@Test
public void assertPersistNewJobConfiguration() {
LiteJobConfiguration liteJobConfig = JobConfigurationUtil.createSimpleLiteJobConfiguration();
configService.persist(liteJobConfig);
verify(jobNodeStorage).replaceJobNode("config", LiteJobConfigurationGsonFactory.toJson(liteJobConfig));
}
use of com.dangdang.ddframe.job.lite.config.LiteJobConfiguration in project elastic-job by dangdangdotcom.
the class ConfigurationServiceTest method assertLoadDirectly.
@Test
public void assertLoadDirectly() {
when(jobNodeStorage.getJobNodeDataDirectly(ConfigurationNode.ROOT)).thenReturn(LiteJsonConstants.getJobJson());
LiteJobConfiguration actual = configService.load(false);
assertThat(actual.getJobName(), is("test_job"));
assertThat(actual.getTypeConfig().getCoreConfig().getCron(), is("0/1 * * * * ?"));
assertThat(actual.getTypeConfig().getCoreConfig().getShardingTotalCount(), is(3));
}
use of com.dangdang.ddframe.job.lite.config.LiteJobConfiguration in project elastic-job by dangdangdotcom.
the class LiteJobConfigurationGsonFactoryTest method assertToJsonForSimpleJob.
@Test
public void assertToJsonForSimpleJob() {
LiteJobConfiguration actual = LiteJobConfiguration.newBuilder(new SimpleJobConfiguration(JobCoreConfiguration.newBuilder("test_job", "0/1 * * * * ?", 3).failover(true).misfire(false).build(), TestSimpleJob.class.getCanonicalName())).monitorExecution(false).maxTimeDiffSeconds(1000).monitorPort(8888).jobShardingStrategyClass("testClass").disabled(true).overwrite(true).reconcileIntervalMinutes(15).build();
assertThat(LiteJobConfigurationGsonFactory.toJson(actual), is(simpleJobJson));
}
use of com.dangdang.ddframe.job.lite.config.LiteJobConfiguration in project elastic-job by dangdangdotcom.
the class LiteJobConfigurationGsonFactoryTest method assertToJsonForDataflowJob.
@Test
public void assertToJsonForDataflowJob() {
LiteJobConfiguration actual = LiteJobConfiguration.newBuilder(new DataflowJobConfiguration(JobCoreConfiguration.newBuilder("test_job", "0/1 * * * * ?", 3).build(), TestDataflowJob.class.getCanonicalName(), true)).build();
assertThat(LiteJobConfigurationGsonFactory.toJson(actual), is(dataflowJobJson));
}
use of com.dangdang.ddframe.job.lite.config.LiteJobConfiguration in project elastic-job by dangdangdotcom.
the class SchedulerFacadeTest method assertLoadJobConfiguration.
@Test
public void assertLoadJobConfiguration() {
LiteJobConfiguration expected = LiteJobConfiguration.newBuilder(null).build();
when(configService.load(false)).thenReturn(expected);
assertThat(schedulerFacade.loadJobConfiguration(), is(expected));
}
Aggregations