You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2020/07/03 07:52:47 UTC
[shardingsphere-elasticjob-lite] branch master updated: Remove
JobType (#916)
This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere-elasticjob-lite.git
The following commit(s) were added to refs/heads/master by this push:
new 38f4603 Remove JobType (#916)
38f4603 is described below
commit 38f4603a32c0b016290349e001853e83e1605b20
Author: Liang Zhang <te...@163.com>
AuthorDate: Fri Jul 3 15:52:37 2020 +0800
Remove JobType (#916)
* Remove usage of JobConfiguration.jobType
* Remove JobConfiguration.jobType
* Remove usage of YamlJobConfiguration.jobType
* Remove YamlJobConfiguration.jobType
* Remove JobType
* Remove JobType from UI
---
.../console/html/status/job/job_config.html | 8 -------
.../resources/console/i18n/message_en.properties | 1 -
.../resources/console/i18n/message_zh.properties | 1 -
.../resources/console/js/status/job/job_config.js | 3 +--
.../console/js/status/job/jobs_status_overview.js | 11 +++------
.../elasticjob/lite/api/type/JobType.java | 26 ----------------------
.../elasticjob/lite/config/JobConfiguration.java | 13 +++--------
.../internal/config/yaml/YamlJobConfiguration.java | 6 +----
.../lite/config/JobConfigurationTest.java | 16 ++++---------
.../type/impl/DataflowJobExecutorTest.java | 3 +--
.../executor/type/impl/SimpleJobExecutorTest.java | 3 +--
.../executor/type/impl/WrongJobExecutorTest.java | 3 +--
.../elasticjob/lite/fixture/LiteYamlConstants.java | 1 -
.../lite/fixture/util/JobConfigurationUtil.java | 5 ++---
.../oneoff/OneOffDisabledJobIntegrateTest.java | 3 +--
.../schedule/ScheduleDisabledJobIntegrateTest.java | 3 +--
.../dataflow/OneOffDataflowElasticJobTest.java | 3 +--
...ingDataflowElasticJobForExecuteFailureTest.java | 3 +--
...lowElasticJobForExecuteThrowsExceptionTest.java | 3 +--
...ngDataflowElasticJobForMultipleThreadsTest.java | 3 +--
...reamingDataflowElasticJobForNotMonitorTest.java | 3 +--
.../dataflow/StreamingDataflowElasticJobTest.java | 3 +--
.../enable/oneoff/script/ScriptElasticJobTest.java | 3 +--
.../enable/oneoff/simple/SimpleElasticJobTest.java | 3 +--
.../dataflow/OneOffDataflowElasticJobTest.java | 3 +--
...ingDataflowElasticJobForExecuteFailureTest.java | 3 +--
...lowElasticJobForExecuteThrowsExceptionTest.java | 3 +--
...ngDataflowElasticJobForMultipleThreadsTest.java | 3 +--
...reamingDataflowElasticJobForNotMonitorTest.java | 3 +--
.../dataflow/StreamingDataflowElasticJobTest.java | 3 +--
.../schedule/script/ScriptElasticJobTest.java | 3 +--
.../schedule/simple/SimpleElasticJobTest.java | 3 +--
.../config/yaml/YamlJobConfigurationTest.java | 6 +----
.../failover/FailoverListenerManagerTest.java | 11 +++++----
.../internal/guarantee/GuaranteeServiceTest.java | 7 +++---
.../internal/monitor/BaseMonitorServiceTest.java | 3 +--
.../internal/reconcile/ReconcileServiceTest.java | 3 +--
.../lite/internal/schedule/LiteJobFacadeTest.java | 19 ++++++++--------
.../lite/internal/setup/SetUpFacadeTest.java | 11 +--------
.../sharding/ExecutionContextServiceTest.java | 7 +++---
.../internal/sharding/ExecutionServiceTest.java | 25 ++++++++++-----------
.../internal/sharding/ShardingServiceTest.java | 13 +++++------
.../elasticjob/lite/util/yaml/YamlEngineTest.java | 7 ------
.../lite/lifecycle/domain/JobSettings.java | 4 ----
.../internal/settings/JobSettingsAPIImpl.java | 19 ++++------------
.../lifecycle/fixture/LifecycleYamlConstants.java | 3 ---
.../internal/settings/JobSettingsAPIImplTest.java | 17 +++++---------
.../common/AbstractJobBeanDefinitionParser.java | 4 ----
.../dataflow/DataflowJobBeanDefinitionParser.java | 6 -----
.../script/ScriptJobBeanDefinitionParser.java | 6 -----
.../simple/SimpleJobBeanDefinitionParser.java | 6 -----
.../elasticjob/lite/example/JavaMain.java | 7 +++---
.../lite/example/config/DataflowJobConfig.java | 3 +--
.../lite/example/config/SimpleJobConfig.java | 3 +--
54 files changed, 91 insertions(+), 253 deletions(-)
diff --git a/elastic-job-lite-console/src/main/resources/console/html/status/job/job_config.html b/elastic-job-lite-console/src/main/resources/console/html/status/job/job_config.html
index cda8469..2ee1e3b 100644
--- a/elastic-job-lite-console/src/main/resources/console/html/status/job/job_config.html
+++ b/elastic-job-lite-console/src/main/resources/console/html/status/job/job_config.html
@@ -27,14 +27,6 @@
</div>
</div>
</div>
- <div class="col-sm-3">
- <div class="form-group">
- <label for="job-type" class="col-sm-6 control-label" data-lang="job-type"></label>
- <div class="col-sm-6">
- <input type="text" id="job-type" name="jobType" class="form-control" disabled />
- </div>
- </div>
- </div>
</div>
<div class="row">
<div class="col-sm-4">
diff --git a/elastic-job-lite-console/src/main/resources/console/i18n/message_en.properties b/elastic-job-lite-console/src/main/resources/console/i18n/message_en.properties
index 0e7b431..3ee7f05 100644
--- a/elastic-job-lite-console/src/main/resources/console/i18n/message_en.properties
+++ b/elastic-job-lite-console/src/main/resources/console/i18n/message_en.properties
@@ -83,7 +83,6 @@ job-detail=Job detail
update-job=Update job
job-name=Job name
job-shardings-detail=Job shardings detail
-job-type=Job type
job-class=Job class
job-parameter=Job parameter
job-sharding-strategy-type=Job sharding strategy type
diff --git a/elastic-job-lite-console/src/main/resources/console/i18n/message_zh.properties b/elastic-job-lite-console/src/main/resources/console/i18n/message_zh.properties
index 877ea2d..22f85d4 100644
--- a/elastic-job-lite-console/src/main/resources/console/i18n/message_zh.properties
+++ b/elastic-job-lite-console/src/main/resources/console/i18n/message_zh.properties
@@ -83,7 +83,6 @@ job-detail=分片状态
update-job=修改作业
job-name=作业名称
job-shardings-detail=作业分片详情
-job-type=作业类型
job-class=作业实现类
job-parameter=自定义参数
job-sharding-strategy-type=作业分片策略类型
diff --git a/elastic-job-lite-console/src/main/resources/console/js/status/job/job_config.js b/elastic-job-lite-console/src/main/resources/console/js/status/job/job_config.js
index dc63a70..5360182 100644
--- a/elastic-job-lite-console/src/main/resources/console/js/status/job/job_config.js
+++ b/elastic-job-lite-console/src/main/resources/console/js/status/job/job_config.js
@@ -48,7 +48,6 @@ function bindSubmitJobSettingsForm() {
bootstrapValidator.validate();
if (bootstrapValidator.isValid()) {
var jobName = $("#job-name").val();
- var jobType = $("#job-type").val();
var shardingTotalCount = $("#sharding-total-count").val();
var jobParameter = $("#job-parameter").val();
var cron = $("#cron").val();
@@ -69,7 +68,7 @@ function bindSubmitJobSettingsForm() {
var jobErrorHandler = $("#job-error-handler").val();
var description = $("#description").val();
var reconcileIntervalMinutes = $("#reconcile-interval-minutes").val();
- var postJson = {jobName: jobName, jobType : jobType, shardingTotalCount: shardingTotalCount, jobParameter: jobParameter, cron: cron, streamingProcess: streamingProcess, maxTimeDiffSeconds: maxTimeDiffSeconds, monitorExecution: monitorExecution, failover: failover, misfire: misfire, shardingItemParameters: shardingItemParameters, jobShardingStrategyType: jobShardingStrategyType, jobExecutorServiceHandler: jobExecutorServiceHandler, jobErrorHandler: jobErrorHandler, description [...]
+ var postJson = {jobName: jobName, shardingTotalCount: shardingTotalCount, jobParameter: jobParameter, cron: cron, streamingProcess: streamingProcess, maxTimeDiffSeconds: maxTimeDiffSeconds, monitorExecution: monitorExecution, failover: failover, misfire: misfire, shardingItemParameters: shardingItemParameters, jobShardingStrategyType: jobShardingStrategyType, jobExecutorServiceHandler: jobExecutorServiceHandler, jobErrorHandler: jobErrorHandler, description: description, scri [...]
var jobParams = getJobParams();
if (jobParams.monitorExecution !== monitorExecution || jobParams.failover !== failover || jobParams.misfire !== misfire) {
showUpdateConfirmModal();
diff --git a/elastic-job-lite-console/src/main/resources/console/js/status/job/jobs_status_overview.js b/elastic-job-lite-console/src/main/resources/console/js/status/job/jobs_status_overview.js
index 61ad5a7..32aa66c 100644
--- a/elastic-job-lite-console/src/main/resources/console/js/status/job/jobs_status_overview.js
+++ b/elastic-job-lite-console/src/main/resources/console/js/status/job/jobs_status_overview.js
@@ -222,7 +222,6 @@ function bindRemoveButton() {
function renderJob(data) {
$("#job-name").attr("value", data.jobName);
- $("#job-type").attr("value", data.jobType);
$("#sharding-total-count").attr("value", data.shardingTotalCount);
$("#cron").attr("value", data.cron);
$("#sharding-item-parameters").text(data.shardingItemParameters);
@@ -230,18 +229,14 @@ function renderJob(data) {
$("#monitor-execution").attr("checked", data.monitorExecution);
$("#failover").attr("checked", data.failover);
$("#misfire").attr("checked", data.misfire);
- $("#streaming-process").attr("checked", data.streamingProcess);
$("#max-time-diff-seconds").attr("value", data.maxTimeDiffSeconds);
$("#job-sharding-strategy-type").attr("value", data.jobShardingStrategyType);
$("#job-executor-service-handler").attr("value", data.jobExecutorServiceHandlerType);
$("#job-error-handler").attr("value", data.jobErrorHandlerType);
$("#reconcile-interval-minutes").attr("value", data.reconcileIntervalMinutes);
$("#description").text(data.description);
+ $("#streaming-process").attr("checked", data.streamingProcess);
+ $("#streaming-process-group").show();
$("#script-command-line").attr("value", data.scriptCommandLine);
- if ("DATAFLOW" === $("#job-type").val()) {
- $("#streaming-process-group").show();
- }
- if ("SCRIPT" === $("#job-type").val()) {
- $("#script-commandLine-group").show();
- }
+ $("#script-commandLine-group").show();
}
diff --git a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/api/type/JobType.java b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/api/type/JobType.java
deleted file mode 100644
index 62e4a5b..0000000
--- a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/api/type/JobType.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.elasticjob.lite.api.type;
-
-/**
- * Job type.
- */
-public enum JobType {
-
- SIMPLE, DATAFLOW, SCRIPT
-}
diff --git a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/config/JobConfiguration.java b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/config/JobConfiguration.java
index 704ad51..f9cd1c9 100644
--- a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/config/JobConfiguration.java
+++ b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/config/JobConfiguration.java
@@ -23,7 +23,6 @@ import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import java.util.Properties;
@@ -36,8 +35,6 @@ public final class JobConfiguration {
private final String jobName;
- private final JobType jobType;
-
private final String cron;
private final int shardingTotalCount;
@@ -74,12 +71,11 @@ public final class JobConfiguration {
* Create ElasticJob configuration builder.
*
* @param jobName job name
- * @param jobType job type
* @param shardingTotalCount sharding total count
* @return ElasticJob configuration builder
*/
- public static Builder newBuilder(final String jobName, final JobType jobType, final int shardingTotalCount) {
- return new Builder(jobName, jobType, shardingTotalCount);
+ public static Builder newBuilder(final String jobName, final int shardingTotalCount) {
+ return new Builder(jobName, shardingTotalCount);
}
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
@@ -87,8 +83,6 @@ public final class JobConfiguration {
private final String jobName;
- private final JobType jobType;
-
private String cron;
private final int shardingTotalCount;
@@ -345,9 +339,8 @@ public final class JobConfiguration {
*/
public final JobConfiguration build() {
Preconditions.checkArgument(!Strings.isNullOrEmpty(jobName), "jobName can not be empty.");
- Preconditions.checkNotNull(jobType, "jobType can not be null.");
Preconditions.checkArgument(shardingTotalCount > 0, "shardingTotalCount should larger than zero.");
- return new JobConfiguration(jobName, jobType, cron, shardingTotalCount, shardingItemParameters, jobParameter,
+ return new JobConfiguration(jobName, cron, shardingTotalCount, shardingItemParameters, jobParameter,
monitorExecution, failover, misfire, maxTimeDiffSeconds, reconcileIntervalMinutes,
jobShardingStrategyType, jobExecutorServiceHandlerType, jobErrorHandlerType, description, props, disabled, overwrite);
}
diff --git a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/yaml/YamlJobConfiguration.java b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/yaml/YamlJobConfiguration.java
index 59c1552..bb7c131 100644
--- a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/yaml/YamlJobConfiguration.java
+++ b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/yaml/YamlJobConfiguration.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.elasticjob.lite.internal.config.yaml;
import lombok.Getter;
import lombok.Setter;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import java.util.Properties;
@@ -33,8 +32,6 @@ public final class YamlJobConfiguration {
private String jobName;
- private JobType jobType;
-
private String cron;
private int shardingTotalCount;
@@ -73,7 +70,7 @@ public final class YamlJobConfiguration {
* @return job configuration
*/
public JobConfiguration toJobConfiguration() {
- JobConfiguration result = JobConfiguration.newBuilder(jobName, jobType, shardingTotalCount)
+ JobConfiguration result = JobConfiguration.newBuilder(jobName, shardingTotalCount)
.cron(cron).shardingItemParameters(shardingItemParameters).jobParameter(jobParameter)
.monitorExecution(monitorExecution).failover(failover).misfire(misfire)
.maxTimeDiffSeconds(maxTimeDiffSeconds).reconcileIntervalMinutes(reconcileIntervalMinutes)
@@ -94,7 +91,6 @@ public final class YamlJobConfiguration {
public static YamlJobConfiguration fromJobConfiguration(final JobConfiguration jobConfiguration) {
YamlJobConfiguration result = new YamlJobConfiguration();
result.setJobName(jobConfiguration.getJobName());
- result.setJobType(jobConfiguration.getJobType());
result.setCron(jobConfiguration.getCron());
result.setShardingTotalCount(jobConfiguration.getShardingTotalCount());
result.setShardingItemParameters(jobConfiguration.getShardingItemParameters());
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/config/JobConfigurationTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/config/JobConfigurationTest.java
index c48a224..f8a1428 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/config/JobConfigurationTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/config/JobConfigurationTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.config;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
@@ -30,7 +29,7 @@ public final class JobConfigurationTest {
@Test
public void assertBuildAllProperties() {
- JobConfiguration actual = JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3)
+ JobConfiguration actual = JobConfiguration.newBuilder("test_job", 3)
.cron("0/1 * * * * ?")
.shardingItemParameters("0=a,1=b,2=c").jobParameter("param")
.monitorExecution(false).failover(true).misfire(false)
@@ -39,7 +38,6 @@ public final class JobConfigurationTest {
.description("desc").setProperty("key", "value")
.disabled(true).overwrite(true).build();
assertThat(actual.getJobName(), is("test_job"));
- assertThat(actual.getJobType(), is(JobType.SIMPLE));
assertThat(actual.getCron(), is("0/1 * * * * ?"));
assertThat(actual.getShardingTotalCount(), is(3));
assertThat(actual.getShardingItemParameters(), is("0=a,1=b,2=c"));
@@ -60,9 +58,8 @@ public final class JobConfigurationTest {
@Test
public void assertBuildRequiredProperties() {
- JobConfiguration actual = JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").build();
+ JobConfiguration actual = JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").build();
assertThat(actual.getJobName(), is("test_job"));
- assertThat(actual.getJobType(), is(JobType.SIMPLE));
assertThat(actual.getCron(), is("0/1 * * * * ?"));
assertThat(actual.getShardingTotalCount(), is(3));
assertThat(actual.getShardingItemParameters(), is(""));
@@ -83,16 +80,11 @@ public final class JobConfigurationTest {
@Test(expected = IllegalArgumentException.class)
public void assertBuildWithEmptyJobName() {
- JobConfiguration.newBuilder("", JobType.SIMPLE, 3).cron("0/1 * * * * ?").build();
- }
-
- @Test(expected = NullPointerException.class)
- public void assertBuildWithNullJobType() {
- JobConfiguration.newBuilder("test_job", null, 3).cron("0/1 * * * * ?").build();
+ JobConfiguration.newBuilder("", 3).cron("0/1 * * * * ?").build();
}
@Test(expected = IllegalArgumentException.class)
public void assertBuildWithInvalidShardingTotalCount() {
- JobConfiguration.newBuilder("test_job", JobType.SIMPLE, -1).cron("0/1 * * * * ?").build();
+ JobConfiguration.newBuilder("test_job", -1).cron("0/1 * * * * ?").build();
}
}
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/DataflowJobExecutorTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/DataflowJobExecutorTest.java
index 89726cd..3a01495 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/DataflowJobExecutorTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/DataflowJobExecutorTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.executor.type.impl;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.executor.ElasticJobExecutor;
import org.apache.shardingsphere.elasticjob.lite.executor.JobFacade;
@@ -170,7 +169,7 @@ public final class DataflowJobExecutorTest {
private void setUp(final boolean isStreamingProcess, final ShardingContexts shardingContexts) {
this.shardingContexts = shardingContexts;
- JobConfiguration jobConfig = JobConfiguration.newBuilder(ShardingContextsBuilder.JOB_NAME, JobType.DATAFLOW, 3)
+ JobConfiguration jobConfig = JobConfiguration.newBuilder(ShardingContextsBuilder.JOB_NAME, 3)
.cron("0/1 * * * * ?").jobErrorHandlerType("IGNORE").setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.toString(isStreamingProcess)).build();
when(jobFacade.getShardingContexts()).thenReturn(shardingContexts);
elasticJobExecutor = new ElasticJobExecutor(regCenter, new TestDataflowJob(jobCaller), jobConfig, Collections.emptyList(), null);
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/SimpleJobExecutorTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/SimpleJobExecutorTest.java
index 481742e..f6cbc34 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/SimpleJobExecutorTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/SimpleJobExecutorTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.executor.type.impl;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.exception.JobExecutionEnvironmentException;
import org.apache.shardingsphere.elasticjob.lite.exception.JobSystemException;
@@ -68,7 +67,7 @@ public final class SimpleJobExecutorTest {
}
private JobConfiguration createJobConfiguration(final String jobExecutorServiceHandlerType, final String jobErrorHandlerType) {
- return JobConfiguration.newBuilder(ShardingContextsBuilder.JOB_NAME, JobType.SIMPLE, 3)
+ return JobConfiguration.newBuilder(ShardingContextsBuilder.JOB_NAME, 3)
.cron("0/1 * * * * ?").shardingItemParameters("0=A,1=B,2=C").jobParameter("param").failover(true).misfire(false)
.jobExecutorServiceHandlerType(jobExecutorServiceHandlerType).jobErrorHandlerType(jobErrorHandlerType).description("desc").build();
}
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/WrongJobExecutorTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/WrongJobExecutorTest.java
index 8b69b87..fb9b6e3 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/WrongJobExecutorTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/WrongJobExecutorTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.executor.type.impl;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.executor.ElasticJobExecutor;
import org.apache.shardingsphere.elasticjob.lite.executor.JobFacade;
@@ -58,7 +57,7 @@ public final class WrongJobExecutorTest {
}
private JobConfiguration createJobConfiguration() {
- return JobConfiguration.newBuilder(ShardingContextsBuilder.JOB_NAME, JobType.SIMPLE, 3)
+ return JobConfiguration.newBuilder(ShardingContextsBuilder.JOB_NAME, 3)
.cron("0/1 * * * * ?").shardingItemParameters("0=A,1=B,2=C").jobParameter("param").failover(true).misfire(false).jobErrorHandlerType("THROW").description("desc").build();
}
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/fixture/LiteYamlConstants.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/fixture/LiteYamlConstants.java
index 14c43b8..fe592c5 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/fixture/LiteYamlConstants.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/fixture/LiteYamlConstants.java
@@ -24,7 +24,6 @@ import lombok.NoArgsConstructor;
public final class LiteYamlConstants {
private static final String JOB_YAML = "jobName: test_job\n"
- + "jobType: SIMPLE\n"
+ "cron: 0/1 * * * * ?\n"
+ "shardingTotalCount: 3\n"
+ "jobParameter: 'param'\n"
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/fixture/util/JobConfigurationUtil.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/fixture/util/JobConfigurationUtil.java
index 6da7c3a..7a14335 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/fixture/util/JobConfigurationUtil.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/fixture/util/JobConfigurationUtil.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.elasticjob.lite.fixture.util;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@@ -31,7 +30,7 @@ public final class JobConfigurationUtil {
* @return job configuration
*/
public static JobConfiguration createSimpleJobConfiguration() {
- return JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").build();
+ return JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").build();
}
/**
@@ -41,6 +40,6 @@ public final class JobConfigurationUtil {
* @return job configuration
*/
public static JobConfiguration createSimpleJobConfiguration(final boolean overwrite) {
- return JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").overwrite(overwrite).build();
+ return JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").overwrite(overwrite).build();
}
}
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/disable/oneoff/OneOffDisabledJobIntegrateTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/disable/oneoff/OneOffDisabledJobIntegrateTest.java
index 43c7dc6..cf05f96 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/disable/oneoff/OneOffDisabledJobIntegrateTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/disable/oneoff/OneOffDisabledJobIntegrateTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.integrate.assertion.disable.oneoff;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.integrate.DisabledJobIntegrateTest;
@@ -29,6 +28,6 @@ public final class OneOffDisabledJobIntegrateTest extends DisabledJobIntegrateTe
@Override
protected JobConfiguration getJobConfiguration(final String jobName) {
- return JobConfiguration.newBuilder(jobName, JobType.SIMPLE, 3).shardingItemParameters("0=A,1=B,2=C").disabled(true).overwrite(true).build();
+ return JobConfiguration.newBuilder(jobName, 3).shardingItemParameters("0=A,1=B,2=C").disabled(true).overwrite(true).build();
}
}
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/disable/schedule/ScheduleDisabledJobIntegrateTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/disable/schedule/ScheduleDisabledJobIntegrateTest.java
index 679e15e..7ad9bd6 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/disable/schedule/ScheduleDisabledJobIntegrateTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/disable/schedule/ScheduleDisabledJobIntegrateTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.integrate.assertion.disable.schedule;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.integrate.DisabledJobIntegrateTest;
@@ -29,6 +28,6 @@ public final class ScheduleDisabledJobIntegrateTest extends DisabledJobIntegrate
@Override
protected JobConfiguration getJobConfiguration(final String jobName) {
- return JobConfiguration.newBuilder(jobName, JobType.SIMPLE, 3).cron("0/1 * * * * ?").shardingItemParameters("0=A,1=B,2=C").disabled(true).overwrite(true).build();
+ return JobConfiguration.newBuilder(jobName, 3).cron("0/1 * * * * ?").shardingItemParameters("0=A,1=B,2=C").disabled(true).overwrite(true).build();
}
}
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/dataflow/OneOffDataflowElasticJobTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/dataflow/OneOffDataflowElasticJobTest.java
index b557d13..5214481 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/dataflow/OneOffDataflowElasticJobTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/dataflow/OneOffDataflowElasticJobTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.integrate.assertion.enable.oneoff.dataflow;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.executor.type.impl.DataflowJobExecutor;
import org.apache.shardingsphere.elasticjob.lite.integrate.EnabledJobIntegrateTest;
@@ -43,7 +42,7 @@ public final class OneOffDataflowElasticJobTest extends EnabledJobIntegrateTest
@Override
protected JobConfiguration getJobConfiguration(final String jobName) {
- return JobConfiguration.newBuilder(jobName, JobType.DATAFLOW, 3).shardingItemParameters("0=A,1=B,2=C").misfire(false).overwrite(true)
+ return JobConfiguration.newBuilder(jobName, 3).shardingItemParameters("0=A,1=B,2=C").misfire(false).overwrite(true)
.setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.FALSE.toString()).build();
}
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/dataflow/StreamingDataflowElasticJobForExecuteFailureTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/dataflow/StreamingDataflowElasticJobForExecuteFailureTest.java
index 3cdd3e3..44aee6e 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/dataflow/StreamingDataflowElasticJobForExecuteFailureTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/dataflow/StreamingDataflowElasticJobForExecuteFailureTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.integrate.assertion.enable.oneoff.dataflow;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.executor.type.impl.DataflowJobExecutor;
import org.apache.shardingsphere.elasticjob.lite.integrate.EnabledJobIntegrateTest;
@@ -43,7 +42,7 @@ public final class StreamingDataflowElasticJobForExecuteFailureTest extends Enab
@Override
protected JobConfiguration getJobConfiguration(final String jobName) {
- return JobConfiguration.newBuilder(jobName, JobType.DATAFLOW, 3)
+ return JobConfiguration.newBuilder(jobName, 3)
.shardingItemParameters("0=A,1=B,2=C").overwrite(true).setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build();
}
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/dataflow/StreamingDataflowElasticJobForExecuteThrowsExceptionTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/dataflow/StreamingDataflowElasticJobForExecuteThrowsExceptionTest.java
index 153499a..a0c0900 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/dataflow/StreamingDataflowElasticJobForExecuteThrowsExceptionTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/dataflow/StreamingDataflowElasticJobForExecuteThrowsExceptionTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.integrate.assertion.enable.oneoff.dataflow;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.executor.type.impl.DataflowJobExecutor;
import org.apache.shardingsphere.elasticjob.lite.integrate.EnabledJobIntegrateTest;
@@ -43,7 +42,7 @@ public final class StreamingDataflowElasticJobForExecuteThrowsExceptionTest exte
@Override
protected JobConfiguration getJobConfiguration(final String jobName) {
- return JobConfiguration.newBuilder(jobName, JobType.DATAFLOW, 3)
+ return JobConfiguration.newBuilder(jobName, 3)
.shardingItemParameters("0=A,1=B,2=C").jobErrorHandlerType("IGNORE").overwrite(true).setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build();
}
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/dataflow/StreamingDataflowElasticJobForMultipleThreadsTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/dataflow/StreamingDataflowElasticJobForMultipleThreadsTest.java
index fc5e7a2..b6e88ef 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/dataflow/StreamingDataflowElasticJobForMultipleThreadsTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/dataflow/StreamingDataflowElasticJobForMultipleThreadsTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.integrate.assertion.enable.oneoff.dataflow;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.executor.type.impl.DataflowJobExecutor;
import org.apache.shardingsphere.elasticjob.lite.integrate.EnabledJobIntegrateTest;
@@ -43,7 +42,7 @@ public final class StreamingDataflowElasticJobForMultipleThreadsTest extends Ena
@Override
protected JobConfiguration getJobConfiguration(final String jobName) {
- return JobConfiguration.newBuilder(jobName, JobType.DATAFLOW, 3)
+ return JobConfiguration.newBuilder(jobName, 3)
.shardingItemParameters("0=A,1=B,2=C").overwrite(true).setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build();
}
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/dataflow/StreamingDataflowElasticJobForNotMonitorTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/dataflow/StreamingDataflowElasticJobForNotMonitorTest.java
index d519be2..365defa 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/dataflow/StreamingDataflowElasticJobForNotMonitorTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/dataflow/StreamingDataflowElasticJobForNotMonitorTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.integrate.assertion.enable.oneoff.dataflow;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.executor.type.impl.DataflowJobExecutor;
import org.apache.shardingsphere.elasticjob.lite.integrate.EnabledJobIntegrateTest;
@@ -43,7 +42,7 @@ public final class StreamingDataflowElasticJobForNotMonitorTest extends EnabledJ
@Override
protected JobConfiguration getJobConfiguration(final String jobName) {
- return JobConfiguration.newBuilder(jobName, JobType.DATAFLOW, 3)
+ return JobConfiguration.newBuilder(jobName, 3)
.shardingItemParameters("0=A,1=B,2=C").monitorExecution(false).overwrite(true)
.setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build();
}
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/dataflow/StreamingDataflowElasticJobTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/dataflow/StreamingDataflowElasticJobTest.java
index a652adc..42ccf6e 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/dataflow/StreamingDataflowElasticJobTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/dataflow/StreamingDataflowElasticJobTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.integrate.assertion.enable.oneoff.dataflow;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.executor.type.impl.DataflowJobExecutor;
import org.apache.shardingsphere.elasticjob.lite.integrate.EnabledJobIntegrateTest;
@@ -43,7 +42,7 @@ public final class StreamingDataflowElasticJobTest extends EnabledJobIntegrateTe
@Override
protected JobConfiguration getJobConfiguration(final String jobName) {
- return JobConfiguration.newBuilder(jobName, JobType.DATAFLOW, 3)
+ return JobConfiguration.newBuilder(jobName, 3)
.shardingItemParameters("0=A,1=B,2=C").overwrite(true).setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build();
}
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/script/ScriptElasticJobTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/script/ScriptElasticJobTest.java
index 2f71556..b4333da 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/script/ScriptElasticJobTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/script/ScriptElasticJobTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.integrate.assertion.enable.oneoff.script;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.integrate.EnabledJobIntegrateTest;
import org.apache.shardingsphere.elasticjob.lite.internal.config.yaml.YamlJobConfiguration;
@@ -37,7 +36,7 @@ public final class ScriptElasticJobTest extends EnabledJobIntegrateTest {
@Override
protected JobConfiguration getJobConfiguration(final String jobName) {
- return JobConfiguration.newBuilder(jobName, JobType.SCRIPT, 3).shardingItemParameters("0=A,1=B,2=C").overwrite(true).setProperty(ScriptJob.SCRIPT_KEY, "echo").build();
+ return JobConfiguration.newBuilder(jobName, 3).shardingItemParameters("0=A,1=B,2=C").overwrite(true).setProperty(ScriptJob.SCRIPT_KEY, "echo").build();
}
@Test
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/simple/SimpleElasticJobTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/simple/SimpleElasticJobTest.java
index c8c1374..e3df2f6 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/simple/SimpleElasticJobTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/oneoff/simple/SimpleElasticJobTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.integrate.assertion.enable.oneoff.simple;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.integrate.EnabledJobIntegrateTest;
import org.apache.shardingsphere.elasticjob.lite.integrate.fixture.simple.FooSimpleElasticJob;
@@ -42,7 +41,7 @@ public final class SimpleElasticJobTest extends EnabledJobIntegrateTest {
@Override
protected JobConfiguration getJobConfiguration(final String jobName) {
- return JobConfiguration.newBuilder(jobName, JobType.SIMPLE, 3).shardingItemParameters("0=A,1=B,2=C").overwrite(true).build();
+ return JobConfiguration.newBuilder(jobName, 3).shardingItemParameters("0=A,1=B,2=C").overwrite(true).build();
}
@Test
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/dataflow/OneOffDataflowElasticJobTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/dataflow/OneOffDataflowElasticJobTest.java
index d70601b..96220d1 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/dataflow/OneOffDataflowElasticJobTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/dataflow/OneOffDataflowElasticJobTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.integrate.assertion.enable.schedule.dataflow;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.executor.type.impl.DataflowJobExecutor;
import org.apache.shardingsphere.elasticjob.lite.integrate.EnabledJobIntegrateTest;
@@ -43,7 +42,7 @@ public final class OneOffDataflowElasticJobTest extends EnabledJobIntegrateTest
@Override
protected JobConfiguration getJobConfiguration(final String jobName) {
- return JobConfiguration.newBuilder(jobName, JobType.DATAFLOW, 3).cron("0/1 * * * * ?").shardingItemParameters("0=A,1=B,2=C").misfire(false).overwrite(true)
+ return JobConfiguration.newBuilder(jobName, 3).cron("0/1 * * * * ?").shardingItemParameters("0=A,1=B,2=C").misfire(false).overwrite(true)
.setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.FALSE.toString()).build();
}
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/dataflow/StreamingDataflowElasticJobForExecuteFailureTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/dataflow/StreamingDataflowElasticJobForExecuteFailureTest.java
index f187f6d..4b85363 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/dataflow/StreamingDataflowElasticJobForExecuteFailureTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/dataflow/StreamingDataflowElasticJobForExecuteFailureTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.integrate.assertion.enable.schedule.dataflow;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.executor.type.impl.DataflowJobExecutor;
import org.apache.shardingsphere.elasticjob.lite.integrate.EnabledJobIntegrateTest;
@@ -43,7 +42,7 @@ public final class StreamingDataflowElasticJobForExecuteFailureTest extends Enab
@Override
protected JobConfiguration getJobConfiguration(final String jobName) {
- return JobConfiguration.newBuilder(jobName, JobType.DATAFLOW, 3).cron("0/1 * * * * ?")
+ return JobConfiguration.newBuilder(jobName, 3).cron("0/1 * * * * ?")
.shardingItemParameters("0=A,1=B,2=C").overwrite(true).setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build();
}
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/dataflow/StreamingDataflowElasticJobForExecuteThrowsExceptionTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/dataflow/StreamingDataflowElasticJobForExecuteThrowsExceptionTest.java
index 88670bd..078760c 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/dataflow/StreamingDataflowElasticJobForExecuteThrowsExceptionTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/dataflow/StreamingDataflowElasticJobForExecuteThrowsExceptionTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.integrate.assertion.enable.schedule.dataflow;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.executor.type.impl.DataflowJobExecutor;
import org.apache.shardingsphere.elasticjob.lite.integrate.EnabledJobIntegrateTest;
@@ -43,7 +42,7 @@ public final class StreamingDataflowElasticJobForExecuteThrowsExceptionTest exte
@Override
protected JobConfiguration getJobConfiguration(final String jobName) {
- return JobConfiguration.newBuilder(jobName, JobType.DATAFLOW, 3).cron("0/1 * * * * ?")
+ return JobConfiguration.newBuilder(jobName, 3).cron("0/1 * * * * ?")
.shardingItemParameters("0=A,1=B,2=C").jobErrorHandlerType("IGNORE").overwrite(true).setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build();
}
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/dataflow/StreamingDataflowElasticJobForMultipleThreadsTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/dataflow/StreamingDataflowElasticJobForMultipleThreadsTest.java
index 5485109..6ebb46b 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/dataflow/StreamingDataflowElasticJobForMultipleThreadsTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/dataflow/StreamingDataflowElasticJobForMultipleThreadsTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.integrate.assertion.enable.schedule.dataflow;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.executor.type.impl.DataflowJobExecutor;
import org.apache.shardingsphere.elasticjob.lite.integrate.EnabledJobIntegrateTest;
@@ -43,7 +42,7 @@ public final class StreamingDataflowElasticJobForMultipleThreadsTest extends Ena
@Override
protected JobConfiguration getJobConfiguration(final String jobName) {
- return JobConfiguration.newBuilder(jobName, JobType.DATAFLOW, 3).cron("0/1 * * * * ?")
+ return JobConfiguration.newBuilder(jobName, 3).cron("0/1 * * * * ?")
.shardingItemParameters("0=A,1=B,2=C").overwrite(true).setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build();
}
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/dataflow/StreamingDataflowElasticJobForNotMonitorTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/dataflow/StreamingDataflowElasticJobForNotMonitorTest.java
index 0322e85..ce87ec2 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/dataflow/StreamingDataflowElasticJobForNotMonitorTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/dataflow/StreamingDataflowElasticJobForNotMonitorTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.integrate.assertion.enable.schedule.dataflow;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.executor.type.impl.DataflowJobExecutor;
import org.apache.shardingsphere.elasticjob.lite.integrate.EnabledJobIntegrateTest;
@@ -43,7 +42,7 @@ public final class StreamingDataflowElasticJobForNotMonitorTest extends EnabledJ
@Override
protected JobConfiguration getJobConfiguration(final String jobName) {
- return JobConfiguration.newBuilder(jobName, JobType.DATAFLOW, 3).cron("0/1 * * * * ?")
+ return JobConfiguration.newBuilder(jobName, 3).cron("0/1 * * * * ?")
.shardingItemParameters("0=A,1=B,2=C").monitorExecution(false).overwrite(true)
.setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build();
}
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/dataflow/StreamingDataflowElasticJobTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/dataflow/StreamingDataflowElasticJobTest.java
index b8ccdaa..bd41b48 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/dataflow/StreamingDataflowElasticJobTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/dataflow/StreamingDataflowElasticJobTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.integrate.assertion.enable.schedule.dataflow;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.executor.type.impl.DataflowJobExecutor;
import org.apache.shardingsphere.elasticjob.lite.integrate.EnabledJobIntegrateTest;
@@ -43,7 +42,7 @@ public final class StreamingDataflowElasticJobTest extends EnabledJobIntegrateTe
@Override
protected JobConfiguration getJobConfiguration(final String jobName) {
- return JobConfiguration.newBuilder(jobName, JobType.DATAFLOW, 3).cron("0/1 * * * * ?")
+ return JobConfiguration.newBuilder(jobName, 3).cron("0/1 * * * * ?")
.shardingItemParameters("0=A,1=B,2=C").overwrite(true).setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build();
}
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/script/ScriptElasticJobTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/script/ScriptElasticJobTest.java
index a98eb2c..a0463d1 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/script/ScriptElasticJobTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/script/ScriptElasticJobTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.integrate.assertion.enable.schedule.script;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.integrate.EnabledJobIntegrateTest;
import org.apache.shardingsphere.elasticjob.lite.internal.config.yaml.YamlJobConfiguration;
@@ -37,7 +36,7 @@ public final class ScriptElasticJobTest extends EnabledJobIntegrateTest {
@Override
protected JobConfiguration getJobConfiguration(final String jobName) {
- return JobConfiguration.newBuilder(jobName, JobType.SCRIPT, 3).cron("0/1 * * * * ?").shardingItemParameters("0=A,1=B,2=C").overwrite(true).setProperty(ScriptJob.SCRIPT_KEY, "echo").build();
+ return JobConfiguration.newBuilder(jobName, 3).cron("0/1 * * * * ?").shardingItemParameters("0=A,1=B,2=C").overwrite(true).setProperty(ScriptJob.SCRIPT_KEY, "echo").build();
}
@Test
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/simple/SimpleElasticJobTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/simple/SimpleElasticJobTest.java
index d6277c3..fa09e34 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/simple/SimpleElasticJobTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/assertion/enable/schedule/simple/SimpleElasticJobTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.integrate.assertion.enable.schedule.simple;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.integrate.EnabledJobIntegrateTest;
import org.apache.shardingsphere.elasticjob.lite.integrate.fixture.simple.FooSimpleElasticJob;
@@ -42,7 +41,7 @@ public final class SimpleElasticJobTest extends EnabledJobIntegrateTest {
@Override
protected JobConfiguration getJobConfiguration(final String jobName) {
- return JobConfiguration.newBuilder(jobName, JobType.SIMPLE, 3).cron("0/1 * * * * ?").shardingItemParameters("0=A,1=B,2=C").overwrite(true).build();
+ return JobConfiguration.newBuilder(jobName, 3).cron("0/1 * * * * ?").shardingItemParameters("0=A,1=B,2=C").overwrite(true).build();
}
@Test
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/config/yaml/YamlJobConfigurationTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/config/yaml/YamlJobConfigurationTest.java
index 3ff0356..60bd0f0 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/config/yaml/YamlJobConfigurationTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/config/yaml/YamlJobConfigurationTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.internal.config.yaml;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.junit.Test;
@@ -31,7 +30,6 @@ public final class YamlJobConfigurationTest {
public void assertToJobConfiguration() {
YamlJobConfiguration yamlJobConfiguration = new YamlJobConfiguration();
yamlJobConfiguration.setJobName("test_job");
- yamlJobConfiguration.setJobType(JobType.SIMPLE);
yamlJobConfiguration.setCron("0/1 * * * * ?");
yamlJobConfiguration.setShardingTotalCount(3);
yamlJobConfiguration.setShardingItemParameters("0=A,1=B,2=C");
@@ -48,7 +46,6 @@ public final class YamlJobConfigurationTest {
yamlJobConfiguration.setOverwrite(true);
JobConfiguration actual = yamlJobConfiguration.toJobConfiguration();
assertThat(actual.getJobName(), is("test_job"));
- assertThat(actual.getJobType(), is(JobType.SIMPLE));
assertThat(actual.getCron(), is("0/1 * * * * ?"));
assertThat(actual.getShardingTotalCount(), is(3));
assertThat(actual.getShardingItemParameters(), is("0=A,1=B,2=C"));
@@ -67,7 +64,7 @@ public final class YamlJobConfigurationTest {
@Test
public void assertFromJobConfiguration() {
- JobConfiguration jobConfiguration = JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3)
+ JobConfiguration jobConfiguration = JobConfiguration.newBuilder("test_job", 3)
.cron("0/1 * * * * ?")
.shardingItemParameters("0=A,1=B,2=C").jobParameter("param")
.monitorExecution(true).failover(true).misfire(true)
@@ -76,7 +73,6 @@ public final class YamlJobConfigurationTest {
.disabled(true).overwrite(true).build();
YamlJobConfiguration actual = YamlJobConfiguration.fromJobConfiguration(jobConfiguration);
assertThat(actual.getJobName(), is("test_job"));
- assertThat(actual.getJobType(), is(JobType.SIMPLE));
assertThat(actual.getCron(), is("0/1 * * * * ?"));
assertThat(actual.getShardingTotalCount(), is(3));
assertThat(actual.getShardingItemParameters(), is("0=A,1=B,2=C"));
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/failover/FailoverListenerManagerTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/failover/FailoverListenerManagerTest.java
index 1289a99..a7a0116 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/failover/FailoverListenerManagerTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/failover/FailoverListenerManagerTest.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.elasticjob.lite.internal.failover;
import org.apache.curator.framework.recipes.cache.TreeCacheEvent.Type;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.fixture.LiteYamlConstants;
import org.apache.shardingsphere.elasticjob.lite.handler.sharding.JobInstance;
@@ -87,7 +86,7 @@ public final class FailoverListenerManagerTest {
public void assertJobCrashedJobListenerWhenIsNotNodeRemoved() {
JobRegistry.getInstance().addJobInstance("test_job", new JobInstance("127.0.0.1@-@0"));
JobRegistry.getInstance().registerJob("test_job", jobScheduleController);
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(true).build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").failover(true).build());
failoverListenerManager.new JobCrashedJobListener().dataChanged("/test_job/instances/127.0.0.1@-@0", Type.NODE_ADDED, "");
verify(failoverService, times(0)).failoverIfNecessary();
JobRegistry.getInstance().shutdown("test_job");
@@ -97,7 +96,7 @@ public final class FailoverListenerManagerTest {
public void assertJobCrashedJobListenerWhenIsNotInstancesPath() {
JobRegistry.getInstance().addJobInstance("test_job", new JobInstance("127.0.0.1@-@0"));
JobRegistry.getInstance().registerJob("test_job", jobScheduleController);
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(true).build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").failover(true).build());
failoverListenerManager.new JobCrashedJobListener().dataChanged("/test_job/other/127.0.0.1@-@0", Type.NODE_REMOVED, "");
verify(failoverService, times(0)).failoverIfNecessary();
JobRegistry.getInstance().shutdown("test_job");
@@ -107,7 +106,7 @@ public final class FailoverListenerManagerTest {
public void assertJobCrashedJobListenerWhenIsSameInstance() {
JobRegistry.getInstance().addJobInstance("test_job", new JobInstance("127.0.0.1@-@0"));
JobRegistry.getInstance().registerJob("test_job", jobScheduleController);
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(true).build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").failover(true).build());
failoverListenerManager.new JobCrashedJobListener().dataChanged("/test_job/instances/127.0.0.1@-@0", Type.NODE_REMOVED, "");
verify(failoverService, times(0)).failoverIfNecessary();
JobRegistry.getInstance().shutdown("test_job");
@@ -117,7 +116,7 @@ public final class FailoverListenerManagerTest {
public void assertJobCrashedJobListenerWhenIsOtherInstanceCrashed() {
JobRegistry.getInstance().addJobInstance("test_job", new JobInstance("127.0.0.1@-@0"));
JobRegistry.getInstance().registerJob("test_job", jobScheduleController);
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(true).build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").failover(true).build());
when(shardingService.getShardingItems("127.0.0.1@-@1")).thenReturn(Arrays.asList(0, 2));
failoverListenerManager.new JobCrashedJobListener().dataChanged("/test_job/instances/127.0.0.1@-@1", Type.NODE_REMOVED, "");
verify(failoverService).setCrashedFailoverFlag(0);
@@ -130,7 +129,7 @@ public final class FailoverListenerManagerTest {
public void assertJobCrashedJobListenerWhenIsOtherFailoverInstanceCrashed() {
JobRegistry.getInstance().addJobInstance("test_job", new JobInstance("127.0.0.1@-@0"));
JobRegistry.getInstance().registerJob("test_job", jobScheduleController);
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(true).build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").failover(true).build());
when(failoverService.getFailoverItems("127.0.0.1@-@1")).thenReturn(Collections.singletonList(1));
failoverListenerManager.new JobCrashedJobListener().dataChanged("/test_job/instances/127.0.0.1@-@1", Type.NODE_REMOVED, "");
verify(failoverService).setCrashedFailoverFlag(1);
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/guarantee/GuaranteeServiceTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/guarantee/GuaranteeServiceTest.java
index 83057eb..a15d34b 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/guarantee/GuaranteeServiceTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/guarantee/GuaranteeServiceTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.internal.guarantee;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.executor.type.impl.DataflowJobExecutor;
import org.apache.shardingsphere.elasticjob.lite.internal.config.ConfigurationService;
@@ -69,7 +68,7 @@ public final class GuaranteeServiceTest {
@Test
public void assertIsNotAllStarted() {
when(configService.load(false)).thenReturn(
- JobConfiguration.newBuilder("test_job", JobType.DATAFLOW, 3).cron("0/1 * * * * ?").setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build());
+ JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build());
when(jobNodeStorage.isJobNodeExisted("guarantee/started")).thenReturn(true);
when(jobNodeStorage.getJobNodeChildrenKeys("guarantee/started")).thenReturn(Arrays.asList("0", "1"));
assertFalse(guaranteeService.isAllStarted());
@@ -78,7 +77,7 @@ public final class GuaranteeServiceTest {
@Test
public void assertIsAllStarted() {
when(jobNodeStorage.isJobNodeExisted("guarantee/started")).thenReturn(true);
- when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").build());
+ when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").build());
when(jobNodeStorage.getJobNodeChildrenKeys("guarantee/started")).thenReturn(Arrays.asList("0", "1", "2"));
assertTrue(guaranteeService.isAllStarted());
}
@@ -111,7 +110,7 @@ public final class GuaranteeServiceTest {
@Test
public void assertIsAllCompleted() {
when(jobNodeStorage.isJobNodeExisted("guarantee/completed")).thenReturn(true);
- when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").build());
+ when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").build());
when(jobNodeStorage.getJobNodeChildrenKeys("guarantee/completed")).thenReturn(Arrays.asList("0", "1", "2"));
assertTrue(guaranteeService.isAllCompleted());
}
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/monitor/BaseMonitorServiceTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/monitor/BaseMonitorServiceTest.java
index adecb5c..b8b7538 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/monitor/BaseMonitorServiceTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/monitor/BaseMonitorServiceTest.java
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.elasticjob.lite.internal.monitor;
import lombok.AccessLevel;
import lombok.Getter;
import org.apache.shardingsphere.elasticjob.lite.api.ElasticJob;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.api.bootstrap.ScheduleJobBootstrap;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.fixture.EmbedTestingServer;
@@ -50,7 +49,7 @@ public abstract class BaseMonitorServiceTest {
private final String jobName = System.nanoTime() + "_test_job";
public BaseMonitorServiceTest(final ElasticJob elasticJob) {
- bootstrap = new ScheduleJobBootstrap(regCenter, elasticJob, JobConfiguration.newBuilder(jobName, JobType.SIMPLE, 3).cron("0/1 * * * * ?").overwrite(true).build());
+ bootstrap = new ScheduleJobBootstrap(regCenter, elasticJob, JobConfiguration.newBuilder(jobName, 3).cron("0/1 * * * * ?").overwrite(true).build());
}
@BeforeClass
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/reconcile/ReconcileServiceTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/reconcile/ReconcileServiceTest.java
index 70c13bf..a92a3ea 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/reconcile/ReconcileServiceTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/reconcile/ReconcileServiceTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.internal.reconcile;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.handler.sharding.JobInstance;
import org.apache.shardingsphere.elasticjob.lite.internal.config.ConfigurationService;
@@ -60,7 +59,7 @@ public final class ReconcileServiceTest {
@Test
public void assertReconcile() {
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").reconcileIntervalMinutes(1).build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").reconcileIntervalMinutes(1).build());
when(shardingService.isNeedSharding()).thenReturn(false);
when(shardingService.hasShardingInfoInOfflineServers()).thenReturn(true);
when(leaderService.isLeaderUntilBlock()).thenReturn(true);
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/schedule/LiteJobFacadeTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/schedule/LiteJobFacadeTest.java
index a798f71..218c03e 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/schedule/LiteJobFacadeTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/schedule/LiteJobFacadeTest.java
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.elasticjob.lite.internal.schedule;
import com.google.common.collect.Lists;
import org.apache.shardingsphere.elasticjob.lite.api.listener.fixture.ElasticJobListenerCaller;
import org.apache.shardingsphere.elasticjob.lite.api.listener.fixture.TestElasticJobListener;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.exception.JobExecutionEnvironmentException;
import org.apache.shardingsphere.elasticjob.lite.executor.ShardingContexts;
@@ -85,7 +84,7 @@ public final class LiteJobFacadeTest {
@Test
public void assertLoad() {
- JobConfiguration expected = JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").build();
+ JobConfiguration expected = JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").build();
when(configService.load(true)).thenReturn(expected);
assertThat(liteJobFacade.loadJobConfiguration(true), is(expected));
}
@@ -98,14 +97,14 @@ public final class LiteJobFacadeTest {
@Test
public void assertFailoverIfUnnecessary() {
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(false).build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").failover(false).build());
liteJobFacade.failoverIfNecessary();
verify(failoverService, times(0)).failoverIfNecessary();
}
@Test
public void assertFailoverIfNecessary() {
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(true).monitorExecution(true).build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").failover(true).monitorExecution(true).build());
liteJobFacade.failoverIfNecessary();
verify(failoverService).failoverIfNecessary();
}
@@ -120,7 +119,7 @@ public final class LiteJobFacadeTest {
@Test
public void assertRegisterJobCompletedWhenFailoverDisabled() {
ShardingContexts shardingContexts = new ShardingContexts("fake_task_id", "test_job", 10, "", Collections.emptyMap());
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(false).build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").failover(false).build());
liteJobFacade.registerJobCompleted(shardingContexts);
verify(executionService).registerJobCompleted(shardingContexts);
verify(failoverService, times(0)).updateFailoverComplete(shardingContexts.getShardingItemParameters().keySet());
@@ -129,7 +128,7 @@ public final class LiteJobFacadeTest {
@Test
public void assertRegisterJobCompletedWhenFailoverEnabled() {
ShardingContexts shardingContexts = new ShardingContexts("fake_task_id", "test_job", 10, "", Collections.emptyMap());
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(true).monitorExecution(true).build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").failover(true).monitorExecution(true).build());
liteJobFacade.registerJobCompleted(shardingContexts);
verify(executionService).registerJobCompleted(shardingContexts);
verify(failoverService).updateFailoverComplete(shardingContexts.getShardingItemParameters().keySet());
@@ -138,7 +137,7 @@ public final class LiteJobFacadeTest {
@Test
public void assertGetShardingContextWhenIsFailoverEnableAndFailover() {
ShardingContexts shardingContexts = new ShardingContexts("fake_task_id", "test_job", 10, "", Collections.emptyMap());
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(true).monitorExecution(true).build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").failover(true).monitorExecution(true).build());
when(failoverService.getLocalFailoverItems()).thenReturn(Collections.singletonList(1));
when(executionContextService.getJobShardingContext(Collections.singletonList(1))).thenReturn(shardingContexts);
assertThat(liteJobFacade.getShardingContexts(), is(shardingContexts));
@@ -148,7 +147,7 @@ public final class LiteJobFacadeTest {
@Test
public void assertGetShardingContextWhenIsFailoverEnableAndNotFailover() {
ShardingContexts shardingContexts = new ShardingContexts("fake_task_id", "test_job", 10, "", Collections.emptyMap());
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(true).monitorExecution(true).build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").failover(true).monitorExecution(true).build());
when(failoverService.getLocalFailoverItems()).thenReturn(Collections.emptyList());
when(shardingService.getLocalShardingItems()).thenReturn(Lists.newArrayList(0, 1));
when(failoverService.getLocalTakeOffItems()).thenReturn(Collections.singletonList(0));
@@ -160,7 +159,7 @@ public final class LiteJobFacadeTest {
@Test
public void assertGetShardingContextWhenIsFailoverDisable() {
ShardingContexts shardingContexts = new ShardingContexts("fake_task_id", "test_job", 10, "", Collections.emptyMap());
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(false).build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").failover(false).build());
when(shardingService.getLocalShardingItems()).thenReturn(Lists.newArrayList(0, 1));
when(executionContextService.getJobShardingContext(Lists.newArrayList(0, 1))).thenReturn(shardingContexts);
assertThat(liteJobFacade.getShardingContexts(), is(shardingContexts));
@@ -170,7 +169,7 @@ public final class LiteJobFacadeTest {
@Test
public void assertGetShardingContextWhenHasDisabledItems() {
ShardingContexts shardingContexts = new ShardingContexts("fake_task_id", "test_job", 10, "", Collections.emptyMap());
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(false).build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").failover(false).build());
when(shardingService.getLocalShardingItems()).thenReturn(Lists.newArrayList(0, 1));
when(executionService.getDisabledItems(Lists.newArrayList(0, 1))).thenReturn(Collections.singletonList(1));
when(executionContextService.getJobShardingContext(Lists.newArrayList(0))).thenReturn(shardingContexts);
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/setup/SetUpFacadeTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/setup/SetUpFacadeTest.java
index fb5969a..2f2b859 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/setup/SetUpFacadeTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/setup/SetUpFacadeTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.internal.setup;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.executor.type.impl.DataflowJobExecutor;
import org.apache.shardingsphere.elasticjob.lite.fixture.TestDataflowJob;
@@ -28,10 +27,8 @@ import org.apache.shardingsphere.elasticjob.lite.internal.instance.InstanceServi
import org.apache.shardingsphere.elasticjob.lite.internal.listener.ListenerManager;
import org.apache.shardingsphere.elasticjob.lite.internal.reconcile.ReconcileService;
import org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobRegistry;
-import org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduleController;
import org.apache.shardingsphere.elasticjob.lite.internal.server.ServerService;
import org.apache.shardingsphere.elasticjob.lite.internal.sharding.ShardingService;
-import org.apache.shardingsphere.elasticjob.lite.reg.base.CoordinatorRegistryCenter;
import org.apache.shardingsphere.elasticjob.lite.util.ReflectionUtils;
import org.junit.Before;
import org.junit.Test;
@@ -50,12 +47,6 @@ import static org.mockito.Mockito.when;
public final class SetUpFacadeTest {
@Mock
- private CoordinatorRegistryCenter regCenter;
-
- @Mock
- private JobScheduleController jobScheduleController;
-
- @Mock
private ConfigurationService configService;
@Mock
@@ -93,7 +84,7 @@ public final class SetUpFacadeTest {
@Test
public void assertSetUpJobConfiguration() {
- JobConfiguration jobConfig = JobConfiguration.newBuilder("test_job", JobType.DATAFLOW, 3)
+ JobConfiguration jobConfig = JobConfiguration.newBuilder("test_job", 3)
.cron("0/1 * * * * ?").setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build();
when(configService.setUpJobConfiguration(TestDataflowJob.class.getName(), jobConfig)).thenReturn(jobConfig);
assertThat(setUpFacade.setUpJobConfiguration(TestDataflowJob.class.getName(), jobConfig), is(jobConfig));
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ExecutionContextServiceTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ExecutionContextServiceTest.java
index a15d979..6849e64 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ExecutionContextServiceTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ExecutionContextServiceTest.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.elasticjob.lite.internal.sharding;
import com.google.common.collect.Lists;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.executor.ShardingContexts;
import org.apache.shardingsphere.elasticjob.lite.executor.type.impl.DataflowJobExecutor;
@@ -63,7 +62,7 @@ public final class ExecutionContextServiceTest {
@Test
public void assertGetShardingContextWhenNotAssignShardingItem() {
- when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.DATAFLOW, 3)
+ when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", 3)
.cron("0/1 * * * * ?").setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).monitorExecution(false).build());
ShardingContexts shardingContexts = executionContextService.getJobShardingContext(Collections.emptyList());
assertTrue(shardingContexts.getTaskId().startsWith("test_job@-@@-@READY@-@"));
@@ -72,7 +71,7 @@ public final class ExecutionContextServiceTest {
@Test
public void assertGetShardingContextWhenAssignShardingItems() {
- when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.DATAFLOW, 3)
+ when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", 3)
.cron("0/1 * * * * ?").shardingItemParameters("0=A,1=B,2=C").setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).monitorExecution(false).build());
Map<Integer, String> map = new HashMap<>(3);
map.put(0, "A");
@@ -83,7 +82,7 @@ public final class ExecutionContextServiceTest {
@Test
public void assertGetShardingContextWhenHasRunningItems() {
- when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.DATAFLOW, 3)
+ when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", 3)
.cron("0/1 * * * * ?").shardingItemParameters("0=A,1=B,2=C").setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).monitorExecution(true).build());
when(jobNodeStorage.isJobNodeExisted("sharding/0/running")).thenReturn(false);
when(jobNodeStorage.isJobNodeExisted("sharding/1/running")).thenReturn(true);
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ExecutionServiceTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ExecutionServiceTest.java
index f2539b9..ec9a2ec 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ExecutionServiceTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ExecutionServiceTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.internal.sharding;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.executor.ShardingContexts;
import org.apache.shardingsphere.elasticjob.lite.internal.config.ConfigurationService;
@@ -69,7 +68,7 @@ public final class ExecutionServiceTest {
@Test
public void assertRegisterJobBeginWithoutMonitorExecution() {
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").monitorExecution(false).build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").monitorExecution(false).build());
executionService.registerJobBegin(getShardingContext());
verify(jobNodeStorage, times(0)).fillEphemeralJobNode(any(), any());
assertTrue(JobRegistry.getInstance().isJobRunning("test_job"));
@@ -77,7 +76,7 @@ public final class ExecutionServiceTest {
@Test
public void assertRegisterJobBeginWithMonitorExecution() {
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").monitorExecution(true).build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").monitorExecution(true).build());
executionService.registerJobBegin(getShardingContext());
verify(jobNodeStorage).fillEphemeralJobNode("sharding/0/running", "");
verify(jobNodeStorage).fillEphemeralJobNode("sharding/1/running", "");
@@ -88,7 +87,7 @@ public final class ExecutionServiceTest {
@Test
public void assertRegisterJobCompletedWithoutMonitorExecution() {
JobRegistry.getInstance().setJobRunning("test_job", true);
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").monitorExecution(false).build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").monitorExecution(false).build());
executionService.registerJobCompleted(new ShardingContexts("fake_task_id", "test_job", 10, "", Collections.emptyMap()));
verify(jobNodeStorage, times(0)).removeJobNodeIfExisted(any());
verify(jobNodeStorage, times(0)).createJobNodeIfNeeded(any());
@@ -98,7 +97,7 @@ public final class ExecutionServiceTest {
@Test
public void assertRegisterJobCompletedWithMonitorExecution() {
JobRegistry.getInstance().setJobRunning("test_job", true);
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").monitorExecution(true).build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").monitorExecution(true).build());
executionService.registerJobCompleted(getShardingContext());
verify(jobNodeStorage).removeJobNodeIfExisted("sharding/0/running");
verify(jobNodeStorage).removeJobNodeIfExisted("sharding/1/running");
@@ -108,7 +107,7 @@ public final class ExecutionServiceTest {
@Test
public void assertClearAllRunningInfo() {
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").monitorExecution(false).build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").monitorExecution(false).build());
executionService.clearAllRunningInfo();
verify(jobNodeStorage).removeJobNodeIfExisted("sharding/0/running");
verify(jobNodeStorage).removeJobNodeIfExisted("sharding/1/running");
@@ -124,13 +123,13 @@ public final class ExecutionServiceTest {
@Test
public void assertNotHaveRunningItemsWithoutMonitorExecution() {
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").monitorExecution(false).build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").monitorExecution(false).build());
assertFalse(executionService.hasRunningItems(Arrays.asList(0, 1, 2)));
}
@Test
public void assertHasRunningItemsWithMonitorExecution() {
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").monitorExecution(true).build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").monitorExecution(true).build());
when(jobNodeStorage.isJobNodeExisted("sharding/0/running")).thenReturn(false);
when(jobNodeStorage.isJobNodeExisted("sharding/1/running")).thenReturn(true);
assertTrue(executionService.hasRunningItems(Arrays.asList(0, 1, 2)));
@@ -138,7 +137,7 @@ public final class ExecutionServiceTest {
@Test
public void assertNotHaveRunningItems() {
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").monitorExecution(true).build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").monitorExecution(true).build());
when(jobNodeStorage.isJobNodeExisted("sharding/0/running")).thenReturn(false);
when(jobNodeStorage.isJobNodeExisted("sharding/1/running")).thenReturn(false);
when(jobNodeStorage.isJobNodeExisted("sharding/2/running")).thenReturn(false);
@@ -147,7 +146,7 @@ public final class ExecutionServiceTest {
@Test
public void assertHasRunningItemsForAll() {
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").build());
when(jobNodeStorage.isJobNodeExisted("sharding/0/running")).thenReturn(false);
when(jobNodeStorage.isJobNodeExisted("sharding/1/running")).thenReturn(true);
assertTrue(executionService.hasRunningItems());
@@ -155,7 +154,7 @@ public final class ExecutionServiceTest {
@Test
public void assertNotHaveRunningItemsForAll() {
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").build());
when(jobNodeStorage.isJobNodeExisted("sharding/0/running")).thenReturn(false);
when(jobNodeStorage.isJobNodeExisted("sharding/1/running")).thenReturn(false);
when(jobNodeStorage.isJobNodeExisted("sharding/2/running")).thenReturn(false);
@@ -164,7 +163,7 @@ public final class ExecutionServiceTest {
@Test
public void assertMisfireIfNotRunning() {
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").monitorExecution(true).build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").monitorExecution(true).build());
when(jobNodeStorage.isJobNodeExisted("sharding/0/running")).thenReturn(false);
when(jobNodeStorage.isJobNodeExisted("sharding/1/running")).thenReturn(false);
when(jobNodeStorage.isJobNodeExisted("sharding/2/running")).thenReturn(false);
@@ -173,7 +172,7 @@ public final class ExecutionServiceTest {
@Test
public void assertMisfireIfRunning() {
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").monitorExecution(true).build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").monitorExecution(true).build());
when(jobNodeStorage.isJobNodeExisted("sharding/0/running")).thenReturn(false);
when(jobNodeStorage.isJobNodeExisted("sharding/1/running")).thenReturn(true);
assertTrue(executionService.misfireIfHasRunningItems(Arrays.asList(0, 1, 2)));
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ShardingServiceTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ShardingServiceTest.java
index 345423a..c5e9af7 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ShardingServiceTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ShardingServiceTest.java
@@ -21,7 +21,6 @@ import org.apache.curator.framework.api.transaction.CuratorTransactionBridge;
import org.apache.curator.framework.api.transaction.CuratorTransactionFinal;
import org.apache.curator.framework.api.transaction.TransactionCreateBuilder;
import org.apache.curator.framework.api.transaction.TransactionDeleteBuilder;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.handler.sharding.JobInstance;
import org.apache.shardingsphere.elasticjob.lite.internal.config.ConfigurationService;
@@ -137,7 +136,7 @@ public final class ShardingServiceTest {
when(instanceService.getAvailableJobInstances()).thenReturn(Collections.singletonList(new JobInstance("127.0.0.1@-@0")));
when(jobNodeStorage.isJobNodeExisted("leader/sharding/necessary")).thenReturn(true);
when(leaderService.isLeaderUntilBlock()).thenReturn(true);
- when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").monitorExecution(true).build());
+ when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").monitorExecution(true).build());
when(executionService.hasRunningItems()).thenReturn(true, false);
when(jobNodeStorage.getJobNodeChildrenKeys(ShardingNode.ROOT)).thenReturn(Arrays.asList("0", "1"));
shardingService.shardingIfNecessary();
@@ -157,7 +156,7 @@ public final class ShardingServiceTest {
when(instanceService.getAvailableJobInstances()).thenReturn(Collections.singletonList(new JobInstance("127.0.0.1@-@0")));
when(jobNodeStorage.isJobNodeExisted("leader/sharding/necessary")).thenReturn(true);
when(leaderService.isLeaderUntilBlock()).thenReturn(true);
- when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").monitorExecution(false).build());
+ when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").monitorExecution(false).build());
when(jobNodeStorage.getJobNodeChildrenKeys(ShardingNode.ROOT)).thenReturn(Arrays.asList("0", "1", "2", "3"));
shardingService.shardingIfNecessary();
verify(jobNodeStorage).removeJobNodeIfExisted("sharding/0/instance");
@@ -182,7 +181,7 @@ public final class ShardingServiceTest {
JobRegistry.getInstance().registerRegistryCenter("test_job", regCenter);
JobRegistry.getInstance().registerJob("test_job", jobScheduleController);
when(serverService.isAvailableServer("127.0.0.1")).thenReturn(true);
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").build());
when(jobNodeStorage.getJobNodeData("sharding/0/instance")).thenReturn("127.0.0.1@-@0");
when(jobNodeStorage.getJobNodeData("sharding/1/instance")).thenReturn("127.0.0.1@-@1");
when(jobNodeStorage.getJobNodeData("sharding/2/instance")).thenReturn("127.0.0.1@-@0");
@@ -208,7 +207,7 @@ public final class ShardingServiceTest {
JobRegistry.getInstance().registerRegistryCenter("test_job", regCenter);
JobRegistry.getInstance().registerJob("test_job", jobScheduleController);
when(serverService.isAvailableServer("127.0.0.1")).thenReturn(true);
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").build());
when(jobNodeStorage.getJobNodeData("sharding/0/instance")).thenReturn("127.0.0.1@-@0");
when(jobNodeStorage.getJobNodeData("sharding/1/instance")).thenReturn("127.0.0.1@-@1");
when(jobNodeStorage.getJobNodeData("sharding/2/instance")).thenReturn("127.0.0.1@-@0");
@@ -219,7 +218,7 @@ public final class ShardingServiceTest {
@Test
public void assertHasShardingInfoInOfflineServers() {
when(jobNodeStorage.getJobNodeChildrenKeys(InstanceNode.ROOT)).thenReturn(Arrays.asList("host0@-@0", "host0@-@1"));
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").build());
when(jobNodeStorage.getJobNodeData(ShardingNode.getInstanceNode(0))).thenReturn("host0@-@0");
when(jobNodeStorage.getJobNodeData(ShardingNode.getInstanceNode(1))).thenReturn("host0@-@1");
when(jobNodeStorage.getJobNodeData(ShardingNode.getInstanceNode(2))).thenReturn("host0@-@2");
@@ -229,7 +228,7 @@ public final class ShardingServiceTest {
@Test
public void assertHasNotShardingInfoInOfflineServers() {
when(jobNodeStorage.getJobNodeChildrenKeys(InstanceNode.ROOT)).thenReturn(Arrays.asList("host0@-@0", "host0@-@1"));
- when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").build());
+ when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").build());
when(jobNodeStorage.getJobNodeData(ShardingNode.getInstanceNode(0))).thenReturn("host0@-@0");
when(jobNodeStorage.getJobNodeData(ShardingNode.getInstanceNode(1))).thenReturn("host0@-@1");
when(jobNodeStorage.getJobNodeData(ShardingNode.getInstanceNode(2))).thenReturn("host0@-@0");
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/util/yaml/YamlEngineTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/util/yaml/YamlEngineTest.java
index 896adca..151d879 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/util/yaml/YamlEngineTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/util/yaml/YamlEngineTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.util.yaml;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.internal.config.yaml.YamlJobConfiguration;
import org.junit.Test;
@@ -38,7 +37,6 @@ public final class YamlEngineTest {
+ "jobName: test_job\n"
+ "jobParameter: param\n"
+ "jobShardingStrategyType: AVG_ALLOCATION\n"
- + "jobType: SIMPLE\n"
+ "maxTimeDiffSeconds: 0\n"
+ "misfire: false\n"
+ "monitorExecution: false\n"
@@ -53,7 +51,6 @@ public final class YamlEngineTest {
+ "disabled: false\n"
+ "failover: false\n"
+ "jobName: test_job\n"
- + "jobType: SIMPLE\n"
+ "maxTimeDiffSeconds: 0\n"
+ "misfire: false\n"
+ "monitorExecution: false\n"
@@ -65,7 +62,6 @@ public final class YamlEngineTest {
public void assertMarshal() {
YamlJobConfiguration yamlJobConfiguration = new YamlJobConfiguration();
yamlJobConfiguration.setJobName("test_job");
- yamlJobConfiguration.setJobType(JobType.SIMPLE);
yamlJobConfiguration.setCron("0/1 * * * * ?");
yamlJobConfiguration.setShardingTotalCount(3);
yamlJobConfiguration.setShardingItemParameters("0=A,1=B,2=C");
@@ -82,7 +78,6 @@ public final class YamlEngineTest {
public void assertMarshalWithNullValue() {
YamlJobConfiguration yamlJobConfiguration = new YamlJobConfiguration();
yamlJobConfiguration.setJobName("test_job");
- yamlJobConfiguration.setJobType(JobType.SIMPLE);
yamlJobConfiguration.setCron("0/1 * * * * ?");
yamlJobConfiguration.setShardingTotalCount(3);
assertThat(YamlEngine.marshal(yamlJobConfiguration), is(YAML_WITH_NULL));
@@ -92,7 +87,6 @@ public final class YamlEngineTest {
public void assertUnmarshal() {
YamlJobConfiguration yamlJobConfiguration = YamlEngine.unmarshal(YAML, YamlJobConfiguration.class);
assertThat(yamlJobConfiguration.getJobName(), is("test_job"));
- assertThat(yamlJobConfiguration.getJobType(), is(JobType.SIMPLE));
assertThat(yamlJobConfiguration.getCron(), is("0/1 * * * * ?"));
assertThat(yamlJobConfiguration.getShardingTotalCount(), is(3));
assertThat(yamlJobConfiguration.getShardingItemParameters(), is("0=A,1=B,2=C"));
@@ -111,7 +105,6 @@ public final class YamlEngineTest {
public void assertUnmarshalWithNullValue() {
YamlJobConfiguration yamlJobConfiguration = YamlEngine.unmarshal(YAML_WITH_NULL, YamlJobConfiguration.class);
assertThat(yamlJobConfiguration.getJobName(), is("test_job"));
- assertThat(yamlJobConfiguration.getJobType(), is(JobType.SIMPLE));
assertThat(yamlJobConfiguration.getCron(), is("0/1 * * * * ?"));
assertThat(yamlJobConfiguration.getShardingTotalCount(), is(3));
assertNull(yamlJobConfiguration.getShardingItemParameters());
diff --git a/elastic-job-lite-lifecycle/src/main/java/org/apache/shardingsphere/elasticjob/lite/lifecycle/domain/JobSettings.java b/elastic-job-lite-lifecycle/src/main/java/org/apache/shardingsphere/elasticjob/lite/lifecycle/domain/JobSettings.java
index 851497e..352435a 100644
--- a/elastic-job-lite-lifecycle/src/main/java/org/apache/shardingsphere/elasticjob/lite/lifecycle/domain/JobSettings.java
+++ b/elastic-job-lite-lifecycle/src/main/java/org/apache/shardingsphere/elasticjob/lite/lifecycle/domain/JobSettings.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.elasticjob.lite.lifecycle.domain;
import lombok.Getter;
import lombok.Setter;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.executor.type.impl.DataflowJobExecutor;
import org.apache.shardingsphere.elasticjob.lite.internal.config.yaml.YamlJobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.job.impl.ScriptJob;
@@ -37,8 +36,6 @@ public final class JobSettings implements Serializable {
private String jobName;
- private String jobType;
-
private String cron;
private int shardingTotalCount;
@@ -77,7 +74,6 @@ public final class JobSettings implements Serializable {
public YamlJobConfiguration toYamlJobConfiguration() {
YamlJobConfiguration result = new YamlJobConfiguration();
result.setJobName(jobName);
- result.setJobType(JobType.valueOf(jobType));
result.setCron(cron);
result.setShardingTotalCount(shardingTotalCount);
result.setShardingItemParameters(shardingItemParameters);
diff --git a/elastic-job-lite-lifecycle/src/main/java/org/apache/shardingsphere/elasticjob/lite/lifecycle/internal/settings/JobSettingsAPIImpl.java b/elastic-job-lite-lifecycle/src/main/java/org/apache/shardingsphere/elasticjob/lite/lifecycle/internal/settings/JobSettingsAPIImpl.java
index 4694bbd..2cf8755 100644
--- a/elastic-job-lite-lifecycle/src/main/java/org/apache/shardingsphere/elasticjob/lite/lifecycle/internal/settings/JobSettingsAPIImpl.java
+++ b/elastic-job-lite-lifecycle/src/main/java/org/apache/shardingsphere/elasticjob/lite/lifecycle/internal/settings/JobSettingsAPIImpl.java
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.elasticjob.lite.lifecycle.internal.settings;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.executor.type.impl.DataflowJobExecutor;
import org.apache.shardingsphere.elasticjob.lite.internal.config.yaml.YamlJobConfiguration;
@@ -44,20 +43,18 @@ public final class JobSettingsAPIImpl implements JobSettingsAPI {
JobSettings result = new JobSettings();
JobNodePath jobNodePath = new JobNodePath(jobName);
JobConfiguration jobConfig = YamlEngine.unmarshal(regCenter.get(jobNodePath.getConfigNodePath()), YamlJobConfiguration.class).toJobConfiguration();
- String jobType = jobConfig.getJobType().name();
buildSimpleJobSettings(jobName, result, jobConfig);
- if (JobType.DATAFLOW.name().equals(jobType)) {
- buildDataflowJobSettings(result, jobConfig);
+ if (jobConfig.getProps().containsKey(DataflowJobExecutor.STREAM_PROCESS_KEY)) {
+ result.setStreamingProcess(Boolean.parseBoolean(jobConfig.getProps().get(DataflowJobExecutor.STREAM_PROCESS_KEY).toString()));
}
- if (JobType.SCRIPT.name().equals(jobType)) {
- buildScriptJobSettings(result, jobConfig);
+ if (jobConfig.getProps().containsKey(ScriptJob.SCRIPT_KEY)) {
+ result.setScriptCommandLine(jobConfig.getProps().getProperty(ScriptJob.SCRIPT_KEY));
}
return result;
}
private void buildSimpleJobSettings(final String jobName, final JobSettings jobSettings, final JobConfiguration jobConfig) {
jobSettings.setJobName(jobName);
- jobSettings.setJobType(jobConfig.getJobType().name());
jobSettings.setShardingTotalCount(jobConfig.getShardingTotalCount());
jobSettings.setCron(jobConfig.getCron());
jobSettings.setShardingItemParameters(jobConfig.getShardingItemParameters());
@@ -73,14 +70,6 @@ public final class JobSettingsAPIImpl implements JobSettingsAPI {
jobSettings.setDescription(jobConfig.getDescription());
}
- private void buildDataflowJobSettings(final JobSettings jobSettings, final JobConfiguration config) {
- jobSettings.setStreamingProcess(Boolean.parseBoolean(config.getProps().getOrDefault(DataflowJobExecutor.STREAM_PROCESS_KEY, false).toString()));
- }
-
- private void buildScriptJobSettings(final JobSettings jobSettings, final JobConfiguration config) {
- jobSettings.setScriptCommandLine(config.getProps().getProperty(ScriptJob.SCRIPT_KEY));
- }
-
@Override
public void updateJobSettings(final JobSettings jobSettings) {
Preconditions.checkArgument(!Strings.isNullOrEmpty(jobSettings.getJobName()), "jobName can not be empty.");
diff --git a/elastic-job-lite-lifecycle/src/test/java/org/apache/shardingsphere/elasticjob/lite/lifecycle/fixture/LifecycleYamlConstants.java b/elastic-job-lite-lifecycle/src/test/java/org/apache/shardingsphere/elasticjob/lite/lifecycle/fixture/LifecycleYamlConstants.java
index 2475f29..b9e2db8 100644
--- a/elastic-job-lite-lifecycle/src/test/java/org/apache/shardingsphere/elasticjob/lite/lifecycle/fixture/LifecycleYamlConstants.java
+++ b/elastic-job-lite-lifecycle/src/test/java/org/apache/shardingsphere/elasticjob/lite/lifecycle/fixture/LifecycleYamlConstants.java
@@ -24,7 +24,6 @@ import lombok.NoArgsConstructor;
public final class LifecycleYamlConstants {
private static final String SIMPLE_JOB_YAML = "jobName: %s\n"
- + "jobType: SIMPLE\n"
+ "cron: 0/1 * * * * ?\n"
+ "shardingTotalCount: 3\n"
+ "jobParameter: param\n"
@@ -43,7 +42,6 @@ public final class LifecycleYamlConstants {
+ "failover: false\n"
+ "jobName: test_job\n"
+ "jobParameter: param\n"
- + "jobType: DATAFLOW\n"
+ "maxTimeDiffSeconds: -1\n"
+ "misfire: true\n"
+ "monitorExecution: true\n"
@@ -54,7 +52,6 @@ public final class LifecycleYamlConstants {
+ "shardingTotalCount: 3\n";
private static final String SCRIPT_JOB_YAML = "jobName: test_job\n"
- + "jobType: SCRIPT\n"
+ "cron: 0/1 * * * * ?\n"
+ "shardingTotalCount: 3\n"
+ "jobParameter: param\n"
diff --git a/elastic-job-lite-lifecycle/src/test/java/org/apache/shardingsphere/elasticjob/lite/lifecycle/internal/settings/JobSettingsAPIImplTest.java b/elastic-job-lite-lifecycle/src/test/java/org/apache/shardingsphere/elasticjob/lite/lifecycle/internal/settings/JobSettingsAPIImplTest.java
index 2c470ae..57bccab 100644
--- a/elastic-job-lite-lifecycle/src/test/java/org/apache/shardingsphere/elasticjob/lite/lifecycle/internal/settings/JobSettingsAPIImplTest.java
+++ b/elastic-job-lite-lifecycle/src/test/java/org/apache/shardingsphere/elasticjob/lite/lifecycle/internal/settings/JobSettingsAPIImplTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.lifecycle.internal.settings;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.lifecycle.api.JobSettingsAPI;
import org.apache.shardingsphere.elasticjob.lite.lifecycle.domain.JobSettings;
import org.apache.shardingsphere.elasticjob.lite.lifecycle.fixture.LifecycleYamlConstants;
@@ -53,7 +52,8 @@ public final class JobSettingsAPIImplTest {
public void assertGetDataflowJobSettings() {
when(regCenter.get("/test_job/config")).thenReturn(LifecycleYamlConstants.getDataflowJobYaml());
JobSettings actual = jobSettingsAPI.getJobSettings("test_job");
- assertJobSettings(actual, "DATAFLOW");
+ assertJobSettings(actual);
+ assertTrue(actual.isStreamingProcess());
verify(regCenter).get("/test_job/config");
}
@@ -61,13 +61,13 @@ public final class JobSettingsAPIImplTest {
public void assertGetScriptJobSettings() {
when(regCenter.get("/test_job/config")).thenReturn(LifecycleYamlConstants.getScriptJobYaml());
JobSettings actual = jobSettingsAPI.getJobSettings("test_job");
- assertJobSettings(actual, "SCRIPT");
+ assertJobSettings(actual);
+ assertThat(actual.getScriptCommandLine(), is("echo"));
verify(regCenter).get("/test_job/config");
}
- private void assertJobSettings(final JobSettings jobSettings, final String jobType) {
+ private void assertJobSettings(final JobSettings jobSettings) {
assertThat(jobSettings.getJobName(), is("test_job"));
- assertThat(jobSettings.getJobType(), is(jobType));
assertThat(jobSettings.getShardingTotalCount(), is(3));
assertThat(jobSettings.getCron(), is("0/1 * * * * ?"));
assertThat(jobSettings.getShardingItemParameters(), is(""));
@@ -79,19 +79,12 @@ public final class JobSettingsAPIImplTest {
assertNull(jobSettings.getJobShardingStrategyType());
assertThat(jobSettings.getReconcileIntervalMinutes(), is(10));
assertThat(jobSettings.getDescription(), is(""));
- if ("DATAFLOW".equals(jobType)) {
- assertTrue(jobSettings.isStreamingProcess());
- }
- if ("SCRIPT".equals(jobType)) {
- assertThat(jobSettings.getScriptCommandLine(), is("echo"));
- }
}
@Test
public void assertUpdateJobSettings() {
JobSettings jobSettings = new JobSettings();
jobSettings.setJobName("test_job");
- jobSettings.setJobType(JobType.DATAFLOW.toString());
jobSettings.setCron("0/1 * * * * ?");
jobSettings.setShardingTotalCount(3);
jobSettings.setJobParameter("param");
diff --git a/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/parser/common/AbstractJobBeanDefinitionParser.java b/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/parser/common/AbstractJobBeanDefinitionParser.java
index c5f2a3a..1b031f2 100644
--- a/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/parser/common/AbstractJobBeanDefinitionParser.java
+++ b/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/parser/common/AbstractJobBeanDefinitionParser.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.elasticjob.lite.spring.job.parser.common;
import com.google.common.base.Strings;
import lombok.SneakyThrows;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.api.bootstrap.OneOffJobBootstrap;
import org.apache.shardingsphere.elasticjob.lite.api.bootstrap.ScheduleJobBootstrap;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
@@ -69,7 +68,6 @@ public abstract class AbstractJobBeanDefinitionParser extends AbstractBeanDefini
private BeanDefinition createJobConfigurationBeanDefinition(final Element element) {
BeanDefinitionBuilder result = BeanDefinitionBuilder.rootBeanDefinition(JobConfiguration.class);
result.addConstructorArgValue(element.getAttribute(ID_ATTRIBUTE));
- result.addConstructorArgValue(getJobType());
result.addConstructorArgValue(element.getAttribute(BaseJobBeanDefinitionParserTag.CRON_ATTRIBUTE));
result.addConstructorArgValue(element.getAttribute(BaseJobBeanDefinitionParserTag.SHARDING_TOTAL_COUNT_ATTRIBUTE));
result.addConstructorArgValue(element.getAttribute(BaseJobBeanDefinitionParserTag.SHARDING_ITEM_PARAMETERS_ATTRIBUTE));
@@ -125,6 +123,4 @@ public abstract class AbstractJobBeanDefinitionParser extends AbstractBeanDefini
}
protected abstract Properties getProps(Element element);
-
- protected abstract JobType getJobType();
}
diff --git a/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/parser/dataflow/DataflowJobBeanDefinitionParser.java b/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/parser/dataflow/DataflowJobBeanDefinitionParser.java
index ec0b75e..c391b88 100644
--- a/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/parser/dataflow/DataflowJobBeanDefinitionParser.java
+++ b/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/parser/dataflow/DataflowJobBeanDefinitionParser.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.spring.job.parser.dataflow;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.executor.type.impl.DataflowJobExecutor;
import org.apache.shardingsphere.elasticjob.lite.spring.job.parser.common.AbstractJobBeanDefinitionParser;
import org.w3c.dom.Element;
@@ -35,9 +34,4 @@ public final class DataflowJobBeanDefinitionParser extends AbstractJobBeanDefini
result.setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, element.getAttribute(DataflowJobBeanDefinitionParserTag.STREAMING_PROCESS_ATTRIBUTE));
return result;
}
-
- @Override
- protected JobType getJobType() {
- return JobType.DATAFLOW;
- }
}
diff --git a/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/parser/script/ScriptJobBeanDefinitionParser.java b/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/parser/script/ScriptJobBeanDefinitionParser.java
index accdbe5..74b88cc 100644
--- a/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/parser/script/ScriptJobBeanDefinitionParser.java
+++ b/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/parser/script/ScriptJobBeanDefinitionParser.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.spring.job.parser.script;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.job.impl.ScriptJob;
import org.apache.shardingsphere.elasticjob.lite.spring.job.parser.common.AbstractJobBeanDefinitionParser;
import org.w3c.dom.Element;
@@ -35,9 +34,4 @@ public final class ScriptJobBeanDefinitionParser extends AbstractJobBeanDefiniti
result.setProperty(ScriptJob.SCRIPT_KEY, element.getAttribute(ScriptJobBeanDefinitionParserTag.SCRIPT_COMMAND_LINE_ATTRIBUTE));
return result;
}
-
- @Override
- protected JobType getJobType() {
- return JobType.SCRIPT;
- }
}
diff --git a/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/parser/simple/SimpleJobBeanDefinitionParser.java b/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/parser/simple/SimpleJobBeanDefinitionParser.java
index 17d6253..717f979 100644
--- a/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/parser/simple/SimpleJobBeanDefinitionParser.java
+++ b/elastic-job-lite-spring/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/job/parser/simple/SimpleJobBeanDefinitionParser.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.spring.job.parser.simple;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.spring.job.parser.common.AbstractJobBeanDefinitionParser;
import org.w3c.dom.Element;
@@ -32,9 +31,4 @@ public final class SimpleJobBeanDefinitionParser extends AbstractJobBeanDefiniti
protected Properties getProps(final Element element) {
return new Properties();
}
-
- @Override
- protected JobType getJobType() {
- return JobType.SIMPLE;
- }
}
diff --git a/examples/elastic-job-example-lite-java/src/main/java/org/apache/shardingsphere/elasticjob/lite/example/JavaMain.java b/examples/elastic-job-example-lite-java/src/main/java/org/apache/shardingsphere/elasticjob/lite/example/JavaMain.java
index e91e81b..df4e14d 100644
--- a/examples/elastic-job-example-lite-java/src/main/java/org/apache/shardingsphere/elasticjob/lite/example/JavaMain.java
+++ b/examples/elastic-job-example-lite-java/src/main/java/org/apache/shardingsphere/elasticjob/lite/example/JavaMain.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.elasticjob.lite.example;
import org.apache.commons.dbcp.BasicDataSource;
import org.apache.shardingsphere.elasticjob.lite.api.bootstrap.ScheduleJobBootstrap;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.example.job.dataflow.JavaDataflowJob;
import org.apache.shardingsphere.elasticjob.lite.example.job.simple.JavaSimpleJob;
@@ -85,18 +84,18 @@ public final class JavaMain {
}
private static void setUpSimpleJob(final CoordinatorRegistryCenter regCenter, final TracingConfiguration tracingConfig) {
- new ScheduleJobBootstrap(regCenter, new JavaSimpleJob(), JobConfiguration.newBuilder("javaSimpleJob", JobType.SIMPLE, 3)
+ new ScheduleJobBootstrap(regCenter, new JavaSimpleJob(), JobConfiguration.newBuilder("javaSimpleJob", 3)
.cron("0/5 * * * * ?").shardingItemParameters("0=Beijing,1=Shanghai,2=Guangzhou").build(), tracingConfig).schedule();
}
private static void setUpDataflowJob(final CoordinatorRegistryCenter regCenter, final TracingConfiguration tracingConfig) {
- new ScheduleJobBootstrap(regCenter, new JavaDataflowJob(), JobConfiguration.newBuilder("javaDataflowElasticJob", JobType.DATAFLOW, 3)
+ new ScheduleJobBootstrap(regCenter, new JavaDataflowJob(), JobConfiguration.newBuilder("javaDataflowElasticJob", 3)
.cron("0/5 * * * * ?").shardingItemParameters("0=Beijing,1=Shanghai,2=Guangzhou")
.setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build(), tracingConfig).schedule();
}
private static void setUpScriptJob(final CoordinatorRegistryCenter regCenter, final TracingConfiguration tracingConfig) throws IOException {
- new ScheduleJobBootstrap(regCenter, "SCRIPT", JobConfiguration.newBuilder("scriptElasticJob", JobType.SCRIPT, 3)
+ new ScheduleJobBootstrap(regCenter, "SCRIPT", JobConfiguration.newBuilder("scriptElasticJob", 3)
.cron("0/5 * * * * ?").setProperty(ScriptJob.SCRIPT_KEY, buildScriptCommandLine()).build(), tracingConfig).schedule();
}
diff --git a/examples/elastic-job-example-lite-springboot/src/main/java/org/apache/shardingsphere/elasticjob/lite/example/config/DataflowJobConfig.java b/examples/elastic-job-example-lite-springboot/src/main/java/org/apache/shardingsphere/elasticjob/lite/example/config/DataflowJobConfig.java
index 940eeac..b0eb449 100644
--- a/examples/elastic-job-example-lite-springboot/src/main/java/org/apache/shardingsphere/elasticjob/lite/example/config/DataflowJobConfig.java
+++ b/examples/elastic-job-example-lite-springboot/src/main/java/org/apache/shardingsphere/elasticjob/lite/example/config/DataflowJobConfig.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.example.config;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.api.bootstrap.ScheduleJobBootstrap;
import org.apache.shardingsphere.elasticjob.lite.api.type.dataflow.DataflowJob;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
@@ -53,7 +52,7 @@ public class DataflowJobConfig {
}
private JobConfiguration getJobConfiguration(final Class<? extends DataflowJob> jobClass, final String cron, final int shardingTotalCount, final String shardingItemParameters) {
- return JobConfiguration.newBuilder(jobClass.getName(), JobType.DATAFLOW, shardingTotalCount)
+ return JobConfiguration.newBuilder(jobClass.getName(), shardingTotalCount)
.cron(cron).shardingItemParameters(shardingItemParameters).setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).overwrite(true).build();
}
}
diff --git a/examples/elastic-job-example-lite-springboot/src/main/java/org/apache/shardingsphere/elasticjob/lite/example/config/SimpleJobConfig.java b/examples/elastic-job-example-lite-springboot/src/main/java/org/apache/shardingsphere/elasticjob/lite/example/config/SimpleJobConfig.java
index f2cfb26..527d696 100644
--- a/examples/elastic-job-example-lite-springboot/src/main/java/org/apache/shardingsphere/elasticjob/lite/example/config/SimpleJobConfig.java
+++ b/examples/elastic-job-example-lite-springboot/src/main/java/org/apache/shardingsphere/elasticjob/lite/example/config/SimpleJobConfig.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.example.config;
-import org.apache.shardingsphere.elasticjob.lite.api.type.JobType;
import org.apache.shardingsphere.elasticjob.lite.api.bootstrap.ScheduleJobBootstrap;
import org.apache.shardingsphere.elasticjob.lite.api.type.simple.SimpleJob;
import org.apache.shardingsphere.elasticjob.lite.config.JobConfiguration;
@@ -51,6 +50,6 @@ public class SimpleJobConfig {
}
private JobConfiguration getJobConfiguration(final Class<? extends SimpleJob> jobClass, final String cron, final int shardingTotalCount, final String shardingItemParameters) {
- return JobConfiguration.newBuilder(jobClass.getName(), JobType.SIMPLE, shardingTotalCount).cron(cron).shardingItemParameters(shardingItemParameters).overwrite(true).build();
+ return JobConfiguration.newBuilder(jobClass.getName(), shardingTotalCount).cron(cron).shardingItemParameters(shardingItemParameters).overwrite(true).build();
}
}