Search in sources :

Example 16 with LiteJobConfiguration

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));
}
Also used : LiteJobConfiguration(com.dangdang.ddframe.job.lite.config.LiteJobConfiguration) Test(org.junit.Test)

Example 17 with LiteJobConfiguration

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));
}
Also used : LiteJobConfiguration(com.dangdang.ddframe.job.lite.config.LiteJobConfiguration) Test(org.junit.Test)

Example 18 with LiteJobConfiguration

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));
}
Also used : LiteJobConfiguration(com.dangdang.ddframe.job.lite.config.LiteJobConfiguration) SimpleJobConfiguration(com.dangdang.ddframe.job.config.simple.SimpleJobConfiguration) Test(org.junit.Test)

Example 19 with LiteJobConfiguration

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));
}
Also used : LiteJobConfiguration(com.dangdang.ddframe.job.lite.config.LiteJobConfiguration) DataflowJobConfiguration(com.dangdang.ddframe.job.config.dataflow.DataflowJobConfiguration) TestDataflowJob(com.dangdang.ddframe.job.lite.fixture.TestDataflowJob) Test(org.junit.Test)

Example 20 with LiteJobConfiguration

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));
}
Also used : LiteJobConfiguration(com.dangdang.ddframe.job.lite.config.LiteJobConfiguration) Test(org.junit.Test)

Aggregations

LiteJobConfiguration (com.dangdang.ddframe.job.lite.config.LiteJobConfiguration)20 Test (org.junit.Test)14 ScriptJobConfiguration (com.dangdang.ddframe.job.config.script.ScriptJobConfiguration)2 JobNodePath (com.dangdang.ddframe.job.lite.internal.storage.JobNodePath)2 DataflowJobConfiguration (com.dangdang.ddframe.job.config.dataflow.DataflowJobConfiguration)1 SimpleJobConfiguration (com.dangdang.ddframe.job.config.simple.SimpleJobConfiguration)1 ShardingContexts (com.dangdang.ddframe.job.executor.ShardingContexts)1 JobShardingStrategy (com.dangdang.ddframe.job.lite.api.strategy.JobShardingStrategy)1 JobShardingStrategyOption (com.dangdang.ddframe.job.lite.api.strategy.JobShardingStrategyOption)1 TestDataflowJob (com.dangdang.ddframe.job.lite.fixture.TestDataflowJob)1 AbstractBaseStdJobAutoInitTest (com.dangdang.ddframe.job.lite.integrate.AbstractBaseStdJobAutoInitTest)1 JobBriefInfo (com.dangdang.ddframe.job.lite.lifecycle.domain.JobBriefInfo)1 JobSettings (com.dangdang.ddframe.job.lite.lifecycle.domain.JobSettings)1 ShardingItemParameters (com.dangdang.ddframe.job.util.config.ShardingItemParameters)1