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));
}
use of com.dangdang.ddframe.job.lite.config.LiteJobConfiguration in project LinkAgent by shulieTech.
the class ElasticJobConfig method createJobConfiguration.
public static LiteJobConfiguration createJobConfiguration(final Class<? extends SimpleJob> jobClass, final String cron, final int shardingTotalCount, final String shardingItemParameters) {
// JobCoreConfigurationBuilder
JobCoreConfiguration.Builder JobCoreConfigurationBuilder = JobCoreConfiguration.newBuilder(jobClass.getName(), cron, shardingTotalCount);
// 设置shardingItemParameters
if (!StringUtils.isEmpty(shardingItemParameters)) {
JobCoreConfigurationBuilder.shardingItemParameters(shardingItemParameters);
}
JobCoreConfiguration jobCoreConfiguration = JobCoreConfigurationBuilder.build();
// 创建SimpleJobConfiguration
SimpleJobConfiguration simpleJobConfiguration = new SimpleJobConfiguration(jobCoreConfiguration, jobClass.getCanonicalName());
// 设置dump端口
// 创建LiteJobConfiguration
LiteJobConfiguration liteJobConfiguration = LiteJobConfiguration.newBuilder(simpleJobConfiguration).overwrite(true).build();
return liteJobConfiguration;
}
use of com.dangdang.ddframe.job.lite.config.LiteJobConfiguration in project LinkAgent by shulieTech.
the class ElasticJobConfig method createFlowJobConfiguration.
/**
* 创建支持dataFlow类型的作业的配置信息
*
* @param jobClass
* @param cron
* @param shardingTotalCount
* @param shardingItemParameters
* @return
*/
public static LiteJobConfiguration createFlowJobConfiguration(final Class<? extends ElasticJob> jobClass, final String cron, final int shardingTotalCount, final String shardingItemParameters) {
// JobCoreConfigurationBuilder
JobCoreConfiguration.Builder JobCoreConfigurationBuilder = JobCoreConfiguration.newBuilder(jobClass.getName(), cron, shardingTotalCount);
// 设置shardingItemParameters
if (!StringUtils.isEmpty(shardingItemParameters)) {
JobCoreConfigurationBuilder.shardingItemParameters(shardingItemParameters);
}
JobCoreConfiguration jobCoreConfiguration = JobCoreConfigurationBuilder.build();
// 定义数据流类型任务配置
DataflowJobConfiguration jobConfig = new DataflowJobConfiguration(jobCoreConfiguration, jobClass.getCanonicalName(), true);
// 创建LiteJobConfiguration
LiteJobConfiguration liteJobConfiguration = LiteJobConfiguration.newBuilder(jobConfig).overwrite(true).build();
return liteJobConfiguration;
}
Aggregations