use of com.dangdang.ddframe.job.fixture.config.TestDataflowJobConfiguration in project elastic-job by dangdangdotcom.
the class JobExecutorFactoryTest method assertGetJobExecutorTwice.
@Test
public void assertGetJobExecutorTwice() {
when(jobFacade.getShardingContexts()).thenReturn(new ShardingContexts("fake_task_id", "twice_test_job", 10, "", Collections.<Integer, String>emptyMap()));
when(jobFacade.loadJobRootConfiguration(true)).thenReturn(new TestDataflowJobConfiguration(false));
AbstractElasticJobExecutor executor = JobExecutorFactory.getJobExecutor(new TestSimpleJob(null), jobFacade);
AbstractElasticJobExecutor anotherExecutor = JobExecutorFactory.getJobExecutor(new TestSimpleJob(null), jobFacade);
assertTrue(executor.hashCode() != anotherExecutor.hashCode());
}
use of com.dangdang.ddframe.job.fixture.config.TestDataflowJobConfiguration in project elastic-job by dangdangdotcom.
the class JobExecutorFactoryTest method assertGetJobExecutorForDataflowJob.
@Test
public void assertGetJobExecutorForDataflowJob() {
when(jobFacade.getShardingContexts()).thenReturn(new ShardingContexts("fake_task_id", "dataflow_test_job", 10, "", Collections.<Integer, String>emptyMap()));
when(jobFacade.loadJobRootConfiguration(true)).thenReturn(new TestDataflowJobConfiguration(false));
assertThat(JobExecutorFactory.getJobExecutor(new TestDataflowJob(null), jobFacade), instanceOf(DataflowJobExecutor.class));
}
use of com.dangdang.ddframe.job.fixture.config.TestDataflowJobConfiguration in project elastic-job by dangdangdotcom.
the class DataflowJobExecutorTest method setUp.
private void setUp(final boolean isStreamingProcess, final ShardingContexts shardingContexts) {
this.shardingContexts = shardingContexts;
when(jobFacade.loadJobRootConfiguration(true)).thenReturn(new TestDataflowJobConfiguration(isStreamingProcess));
when(jobFacade.getShardingContexts()).thenReturn(shardingContexts);
dataflowJobExecutor = new DataflowJobExecutor(new TestDataflowJob(jobCaller), jobFacade);
ElasticJobVerify.prepareForIsNotMisfire(jobFacade, shardingContexts);
}
use of com.dangdang.ddframe.job.fixture.config.TestDataflowJobConfiguration in project elastic-job by dangdangdotcom.
the class JobConfigurationGsonTypeAdapterTest method assertFromDataflowJobJson.
@Test
public void assertFromDataflowJobJson() {
TestJobRootConfiguration actual = GsonFactory.getGson().fromJson(APIJsonConstants.getDataflowJobJson(IgnoreJobExceptionHandler.class.getCanonicalName()), TestJobRootConfiguration.class);
TestJobRootConfiguration expected = new TestJobRootConfiguration(new TestDataflowJobConfiguration(true).getTypeConfig());
assertThat(GsonFactory.getGson().toJson(actual), is(GsonFactory.getGson().toJson(expected)));
}
Aggregations