Search in sources :

Example 1 with TestJobRootConfiguration

use of com.dangdang.ddframe.job.fixture.config.TestJobRootConfiguration in project elastic-job by dangdangdotcom.

the class JobConfigurationGsonTypeAdapterTest method assertFromSimpleJobJson.

@Test
public void assertFromSimpleJobJson() {
    TestJobRootConfiguration actual = GsonFactory.getGson().fromJson(APIJsonConstants.getSimpleJobJson(ThrowJobExceptionHandler.class.getCanonicalName()), TestJobRootConfiguration.class);
    TestJobRootConfiguration expected = new TestJobRootConfiguration(new TestSimpleJobConfiguration(ThrowJobExceptionHandler.class.getCanonicalName(), DefaultExecutorServiceHandler.class.getCanonicalName()).getTypeConfig());
    assertThat(GsonFactory.getGson().toJson(actual), is(GsonFactory.getGson().toJson(expected)));
}
Also used : TestSimpleJobConfiguration(com.dangdang.ddframe.job.fixture.config.TestSimpleJobConfiguration) ThrowJobExceptionHandler(com.dangdang.ddframe.job.fixture.handler.ThrowJobExceptionHandler) DefaultExecutorServiceHandler(com.dangdang.ddframe.job.executor.handler.impl.DefaultExecutorServiceHandler) TestJobRootConfiguration(com.dangdang.ddframe.job.fixture.config.TestJobRootConfiguration) Test(org.junit.Test)

Example 2 with TestJobRootConfiguration

use of com.dangdang.ddframe.job.fixture.config.TestJobRootConfiguration in project elastic-job by dangdangdotcom.

the class JobConfigurationGsonTypeAdapterTest method assertFromScriptJobJson.

@Test
public void assertFromScriptJobJson() {
    TestJobRootConfiguration actual = GsonFactory.getGson().fromJson(APIJsonConstants.getScriptJobJson(ThrowJobExceptionHandler.class.getCanonicalName()), TestJobRootConfiguration.class);
    TestJobRootConfiguration expected = new TestJobRootConfiguration(new TestScriptJobConfiguration("test.sh", ThrowJobExceptionHandler.class).getTypeConfig());
    assertThat(GsonFactory.getGson().toJson(actual), is(GsonFactory.getGson().toJson(expected)));
}
Also used : TestScriptJobConfiguration(com.dangdang.ddframe.job.fixture.config.TestScriptJobConfiguration) TestJobRootConfiguration(com.dangdang.ddframe.job.fixture.config.TestJobRootConfiguration) Test(org.junit.Test)

Example 3 with TestJobRootConfiguration

use of com.dangdang.ddframe.job.fixture.config.TestJobRootConfiguration 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)));
}
Also used : TestDataflowJobConfiguration(com.dangdang.ddframe.job.fixture.config.TestDataflowJobConfiguration) TestJobRootConfiguration(com.dangdang.ddframe.job.fixture.config.TestJobRootConfiguration) Test(org.junit.Test)

Aggregations

TestJobRootConfiguration (com.dangdang.ddframe.job.fixture.config.TestJobRootConfiguration)3 Test (org.junit.Test)3 DefaultExecutorServiceHandler (com.dangdang.ddframe.job.executor.handler.impl.DefaultExecutorServiceHandler)1 TestDataflowJobConfiguration (com.dangdang.ddframe.job.fixture.config.TestDataflowJobConfiguration)1 TestScriptJobConfiguration (com.dangdang.ddframe.job.fixture.config.TestScriptJobConfiguration)1 TestSimpleJobConfiguration (com.dangdang.ddframe.job.fixture.config.TestSimpleJobConfiguration)1 ThrowJobExceptionHandler (com.dangdang.ddframe.job.fixture.handler.ThrowJobExceptionHandler)1