diff --git a/api/pom.xml b/api/pom.xml
index e36f819104..d168821667 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -25,4 +25,11 @@
elasticjob-api
${project.artifactId}
+
+
+
+ org.apache.shardingsphere
+ shardingsphere-infra-spi
+
+
diff --git a/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/item/JobItemExecutor.java b/api/src/main/java/org/apache/shardingsphere/elasticjob/spi/JobItemExecutor.java
similarity index 76%
rename from ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/item/JobItemExecutor.java
rename to api/src/main/java/org/apache/shardingsphere/elasticjob/spi/JobItemExecutor.java
index 39c249e0ca..5e1ead8f1a 100644
--- a/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/item/JobItemExecutor.java
+++ b/api/src/main/java/org/apache/shardingsphere/elasticjob/spi/JobItemExecutor.java
@@ -15,12 +15,12 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.executor.item;
+package org.apache.shardingsphere.elasticjob.spi;
import org.apache.shardingsphere.elasticjob.api.ElasticJob;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
-import org.apache.shardingsphere.elasticjob.executor.JobFacade;
+import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext;
+import org.apache.shardingsphere.elasticjob.spi.param.JobRuntimeService;
/**
* Job item executor.
@@ -34,8 +34,8 @@ public interface JobItemExecutor {
*
* @param elasticJob elastic job
* @param jobConfig job configuration
- * @param jobFacade job facade
+ * @param jobRuntimeService job runtime service
* @param shardingContext sharding context
*/
- void process(T elasticJob, JobConfiguration jobConfig, JobFacade jobFacade, ShardingContext shardingContext);
+ void process(T elasticJob, JobConfiguration jobConfig, JobRuntimeService jobRuntimeService, ShardingContext shardingContext);
}
diff --git a/ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/fixture/job/FooJob.java b/api/src/main/java/org/apache/shardingsphere/elasticjob/spi/param/JobRuntimeService.java
similarity index 70%
rename from ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/fixture/job/FooJob.java
rename to api/src/main/java/org/apache/shardingsphere/elasticjob/spi/param/JobRuntimeService.java
index 006a07a848..a09ddd8c95 100644
--- a/ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/fixture/job/FooJob.java
+++ b/api/src/main/java/org/apache/shardingsphere/elasticjob/spi/param/JobRuntimeService.java
@@ -15,17 +15,17 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.executor.fixture.job;
+package org.apache.shardingsphere.elasticjob.spi.param;
-import org.apache.shardingsphere.elasticjob.api.ElasticJob;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
-
-public interface FooJob extends ElasticJob {
+/**
+ * Job runtime service.
+ */
+public interface JobRuntimeService {
/**
- * Do job.
+ * Judge job whether to need resharding.
*
- * @param shardingContext sharding context
+ * @return need resharding or not
*/
- void foo(ShardingContext shardingContext);
+ boolean isNeedSharding();
}
diff --git a/api/src/main/java/org/apache/shardingsphere/elasticjob/api/ShardingContext.java b/api/src/main/java/org/apache/shardingsphere/elasticjob/spi/param/ShardingContext.java
similarity index 95%
rename from api/src/main/java/org/apache/shardingsphere/elasticjob/api/ShardingContext.java
rename to api/src/main/java/org/apache/shardingsphere/elasticjob/spi/param/ShardingContext.java
index dfbe098ec4..fe89ac0161 100644
--- a/api/src/main/java/org/apache/shardingsphere/elasticjob/api/ShardingContext.java
+++ b/api/src/main/java/org/apache/shardingsphere/elasticjob/spi/param/ShardingContext.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.api;
+package org.apache.shardingsphere.elasticjob.spi.param;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
diff --git a/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/item/impl/ClassedJobItemExecutor.java b/api/src/main/java/org/apache/shardingsphere/elasticjob/spi/type/ClassedJobItemExecutor.java
similarity index 89%
rename from ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/item/impl/ClassedJobItemExecutor.java
rename to api/src/main/java/org/apache/shardingsphere/elasticjob/spi/type/ClassedJobItemExecutor.java
index 63b8a06881..643348685b 100644
--- a/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/item/impl/ClassedJobItemExecutor.java
+++ b/api/src/main/java/org/apache/shardingsphere/elasticjob/spi/type/ClassedJobItemExecutor.java
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.executor.item.impl;
+package org.apache.shardingsphere.elasticjob.spi.type;
import org.apache.shardingsphere.elasticjob.api.ElasticJob;
-import org.apache.shardingsphere.elasticjob.executor.item.JobItemExecutor;
+import org.apache.shardingsphere.elasticjob.spi.JobItemExecutor;
import org.apache.shardingsphere.infra.spi.annotation.SingletonSPI;
/**
diff --git a/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/item/impl/TypedJobItemExecutor.java b/api/src/main/java/org/apache/shardingsphere/elasticjob/spi/type/TypedJobItemExecutor.java
similarity index 89%
rename from ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/item/impl/TypedJobItemExecutor.java
rename to api/src/main/java/org/apache/shardingsphere/elasticjob/spi/type/TypedJobItemExecutor.java
index 32091f40a0..c5c816c035 100644
--- a/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/item/impl/TypedJobItemExecutor.java
+++ b/api/src/main/java/org/apache/shardingsphere/elasticjob/spi/type/TypedJobItemExecutor.java
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.executor.item.impl;
+package org.apache.shardingsphere.elasticjob.spi.type;
import org.apache.shardingsphere.elasticjob.api.ElasticJob;
-import org.apache.shardingsphere.elasticjob.executor.item.JobItemExecutor;
+import org.apache.shardingsphere.elasticjob.spi.JobItemExecutor;
import org.apache.shardingsphere.infra.spi.annotation.SingletonSPI;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPI;
diff --git a/api/src/test/java/org/apache/shardingsphere/elasticjob/annotation/job/CustomJob.java b/api/src/test/java/org/apache/shardingsphere/elasticjob/annotation/job/CustomJob.java
index e47b9e54cc..febffd8d50 100644
--- a/api/src/test/java/org/apache/shardingsphere/elasticjob/annotation/job/CustomJob.java
+++ b/api/src/test/java/org/apache/shardingsphere/elasticjob/annotation/job/CustomJob.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.elasticjob.annotation.job;
import org.apache.shardingsphere.elasticjob.api.ElasticJob;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
+import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext;
public interface CustomJob extends ElasticJob {
diff --git a/api/src/test/java/org/apache/shardingsphere/elasticjob/annotation/job/impl/SimpleTestJob.java b/api/src/test/java/org/apache/shardingsphere/elasticjob/annotation/job/impl/SimpleTestJob.java
index af2b4dda9f..5e18ef55c1 100644
--- a/api/src/test/java/org/apache/shardingsphere/elasticjob/annotation/job/impl/SimpleTestJob.java
+++ b/api/src/test/java/org/apache/shardingsphere/elasticjob/annotation/job/impl/SimpleTestJob.java
@@ -21,7 +21,7 @@
import org.apache.shardingsphere.elasticjob.annotation.ElasticJobProp;
import org.apache.shardingsphere.elasticjob.annotation.SimpleTracingConfigurationFactory;
import org.apache.shardingsphere.elasticjob.annotation.job.CustomJob;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
+import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext;
@ElasticJobConfiguration(
cron = "0/5 * * * * ?",
diff --git a/ecosystem/error-handler/type/dingtalk/pom.xml b/ecosystem/error-handler/type/dingtalk/pom.xml
index 1805e72790..814ddcdfbe 100644
--- a/ecosystem/error-handler/type/dingtalk/pom.xml
+++ b/ecosystem/error-handler/type/dingtalk/pom.xml
@@ -31,11 +31,6 @@
elasticjob-error-handler-spi
${project.parent.version}
-
- org.apache.shardingsphere.elasticjob
- elasticjob-error-handler-general
- ${project.parent.version}
-
org.apache.shardingsphere.elasticjob
elasticjob-restful
diff --git a/ecosystem/error-handler/type/dingtalk/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/dingtalk/DingtalkJobErrorHandlerPropertiesValidator.java b/ecosystem/error-handler/type/dingtalk/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/dingtalk/DingtalkJobErrorHandlerPropertiesValidator.java
index f5e7a6d75b..a652779f07 100644
--- a/ecosystem/error-handler/type/dingtalk/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/dingtalk/DingtalkJobErrorHandlerPropertiesValidator.java
+++ b/ecosystem/error-handler/type/dingtalk/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/dingtalk/DingtalkJobErrorHandlerPropertiesValidator.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.elasticjob.error.handler.dingtalk;
import org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandlerPropertiesValidator;
-import org.apache.shardingsphere.elasticjob.error.handler.JobPropertiesValidateRule;
+import org.apache.shardingsphere.elasticjob.infra.validate.JobPropertiesValidateRule;
import java.util.Properties;
diff --git a/ecosystem/error-handler/type/email/pom.xml b/ecosystem/error-handler/type/email/pom.xml
index add0f0569c..82932ddd94 100644
--- a/ecosystem/error-handler/type/email/pom.xml
+++ b/ecosystem/error-handler/type/email/pom.xml
@@ -31,11 +31,6 @@
elasticjob-error-handler-spi
${project.parent.version}
-
- org.apache.shardingsphere.elasticjob
- elasticjob-error-handler-general
- ${project.parent.version}
-
com.sun.mail
diff --git a/ecosystem/error-handler/type/email/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/email/EmailJobErrorHandlerPropertiesValidator.java b/ecosystem/error-handler/type/email/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/email/EmailJobErrorHandlerPropertiesValidator.java
index 0d47e8e938..3b0fa050ad 100644
--- a/ecosystem/error-handler/type/email/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/email/EmailJobErrorHandlerPropertiesValidator.java
+++ b/ecosystem/error-handler/type/email/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/email/EmailJobErrorHandlerPropertiesValidator.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.elasticjob.error.handler.email;
import org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandlerPropertiesValidator;
-import org.apache.shardingsphere.elasticjob.error.handler.JobPropertiesValidateRule;
+import org.apache.shardingsphere.elasticjob.infra.validate.JobPropertiesValidateRule;
import java.util.Properties;
diff --git a/ecosystem/error-handler/type/general/pom.xml b/ecosystem/error-handler/type/general/pom.xml
deleted file mode 100644
index 3ba89be212..0000000000
--- a/ecosystem/error-handler/type/general/pom.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
- 4.0.0
-
- org.apache.shardingsphere.elasticjob
- elasticjob-error-handler-type
- 3.1.0-SNAPSHOT
-
- elasticjob-error-handler-general
-
-
-
- org.apache.shardingsphere.elasticjob
- elasticjob-error-handler-spi
- ${project.parent.version}
-
-
- org.apache.shardingsphere.elasticjob
- elasticjob-infra
- ${project.parent.version}
-
-
-
diff --git a/ecosystem/error-handler/type/general/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandler b/ecosystem/error-handler/type/general/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandler
deleted file mode 100644
index 02da0be3a9..0000000000
--- a/ecosystem/error-handler/type/general/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandler
+++ /dev/null
@@ -1,20 +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.
-#
-
-org.apache.shardingsphere.elasticjob.error.handler.general.LogJobErrorHandler
-org.apache.shardingsphere.elasticjob.error.handler.general.IgnoreJobErrorHandler
-org.apache.shardingsphere.elasticjob.error.handler.general.ThrowJobErrorHandler
diff --git a/ecosystem/error-handler/type/general/src/test/resources/logback-test.xml b/ecosystem/error-handler/type/general/src/test/resources/logback-test.xml
deleted file mode 100644
index daeed13adc..0000000000
--- a/ecosystem/error-handler/type/general/src/test/resources/logback-test.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/ecosystem/error-handler/type/pom.xml b/ecosystem/error-handler/type/pom.xml
index c4147c1488..5a66cdd343 100644
--- a/ecosystem/error-handler/type/pom.xml
+++ b/ecosystem/error-handler/type/pom.xml
@@ -27,7 +27,6 @@
pom
- general
email
wechat
dingtalk
diff --git a/ecosystem/error-handler/type/wechat/pom.xml b/ecosystem/error-handler/type/wechat/pom.xml
index 531af35e0f..6e4d6848cf 100644
--- a/ecosystem/error-handler/type/wechat/pom.xml
+++ b/ecosystem/error-handler/type/wechat/pom.xml
@@ -31,11 +31,6 @@
elasticjob-error-handler-spi
${project.parent.version}
-
- org.apache.shardingsphere.elasticjob
- elasticjob-error-handler-general
- ${project.parent.version}
-
org.apache.shardingsphere.elasticjob
elasticjob-restful
diff --git a/ecosystem/error-handler/type/wechat/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/wechat/WechatJobErrorHandlerPropertiesValidator.java b/ecosystem/error-handler/type/wechat/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/wechat/WechatJobErrorHandlerPropertiesValidator.java
index 79385c10f4..b0b07ff544 100644
--- a/ecosystem/error-handler/type/wechat/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/wechat/WechatJobErrorHandlerPropertiesValidator.java
+++ b/ecosystem/error-handler/type/wechat/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/wechat/WechatJobErrorHandlerPropertiesValidator.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.elasticjob.error.handler.wechat;
import org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandlerPropertiesValidator;
-import org.apache.shardingsphere.elasticjob.error.handler.JobPropertiesValidateRule;
+import org.apache.shardingsphere.elasticjob.infra.validate.JobPropertiesValidateRule;
import java.util.Properties;
diff --git a/ecosystem/executor/kernel/pom.xml b/ecosystem/executor/kernel/pom.xml
deleted file mode 100644
index fda6b0f7b4..0000000000
--- a/ecosystem/executor/kernel/pom.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
-
- 4.0.0
-
- org.apache.shardingsphere.elasticjob
- elasticjob-executor
- 3.1.0-SNAPSHOT
-
- elasticjob-executor-kernel
- ${project.artifactId}
-
-
-
- org.apache.shardingsphere.elasticjob
- elasticjob-api
- ${project.parent.version}
-
-
- org.apache.shardingsphere.elasticjob
- elasticjob-infra
- ${project.parent.version}
-
-
- org.apache.shardingsphere.elasticjob
- elasticjob-tracing-api
- ${project.parent.version}
-
-
- org.apache.shardingsphere.elasticjob
- elasticjob-error-handler-general
- ${project.parent.version}
-
-
-
- org.awaitility
- awaitility
-
-
-
diff --git a/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/JobFacade.java b/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/JobFacade.java
deleted file mode 100644
index 40b2cda64f..0000000000
--- a/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/JobFacade.java
+++ /dev/null
@@ -1,133 +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.executor;
-
-import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
-import org.apache.shardingsphere.elasticjob.infra.exception.JobExecutionEnvironmentException;
-import org.apache.shardingsphere.elasticjob.infra.listener.ShardingContexts;
-import org.apache.shardingsphere.elasticjob.tracing.event.JobExecutionEvent;
-import org.apache.shardingsphere.elasticjob.tracing.event.JobStatusTraceEvent.State;
-
-import java.util.Collection;
-
-/**
- * Job facade.
- */
-public interface JobFacade {
-
- /**
- * Load job configuration.
- *
- * @param fromCache load from cache or not
- * @return job configuration
- */
- JobConfiguration loadJobConfiguration(boolean fromCache);
-
- /**
- * Check job execution environment.
- *
- * @throws JobExecutionEnvironmentException job execution environment exception
- */
- void checkJobExecutionEnvironment() throws JobExecutionEnvironmentException;
-
- /**
- * Failover If necessary.
- */
- void failoverIfNecessary();
-
- /**
- * Register job begin.
- *
- * @param shardingContexts sharding contexts
- */
- void registerJobBegin(ShardingContexts shardingContexts);
-
- /**
- * Register job completed.
- *
- * @param shardingContexts sharding contexts
- */
- void registerJobCompleted(ShardingContexts shardingContexts);
-
- /**
- * Get sharding contexts.
- *
- * @return sharding contexts
- */
- ShardingContexts getShardingContexts();
-
- /**
- * Set task misfire flag.
- *
- * @param shardingItems sharding items to be set misfire flag
- * @return whether satisfy misfire condition
- */
- boolean misfireIfRunning(Collection shardingItems);
-
- /**
- * Clear misfire flag.
- *
- * @param shardingItems sharding items to be cleared misfire flag
- */
- void clearMisfire(Collection shardingItems);
-
- /**
- * Judge job whether need to execute misfire tasks.
- *
- * @param shardingItems sharding items
- * @return whether need to execute misfire tasks
- */
- boolean isExecuteMisfired(Collection shardingItems);
-
- /**
- * Judge job whether need resharding.
- *
- * @return whether need resharding
- */
- boolean isNeedSharding();
-
- /**
- * Call before job executed.
- *
- * @param shardingContexts sharding contexts
- */
- void beforeJobExecuted(ShardingContexts shardingContexts);
-
- /**
- * Call after job executed.
- *
- * @param shardingContexts sharding contexts
- */
- void afterJobExecuted(ShardingContexts shardingContexts);
-
- /**
- * Post job execution event.
- *
- * @param jobExecutionEvent job execution event
- */
- void postJobExecutionEvent(JobExecutionEvent jobExecutionEvent);
-
- /**
- * Post job status trace event.
- *
- * @param taskId task Id
- * @param state job state
- * @param message job message
- */
- void postJobStatusTraceEvent(String taskId, State state, String message);
-}
diff --git a/ecosystem/executor/kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.executor.item.impl.ClassedJobItemExecutor b/ecosystem/executor/kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.executor.item.impl.ClassedJobItemExecutor
deleted file mode 100644
index 19f0f2829c..0000000000
--- a/ecosystem/executor/kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.executor.item.impl.ClassedJobItemExecutor
+++ /dev/null
@@ -1,18 +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.
-#
-
-org.apache.shardingsphere.elasticjob.executor.fixture.executor.ClassedFooJobExecutor
diff --git a/ecosystem/executor/pom.xml b/ecosystem/executor/pom.xml
index b0558251d3..602069602e 100644
--- a/ecosystem/executor/pom.xml
+++ b/ecosystem/executor/pom.xml
@@ -28,7 +28,6 @@
${project.artifactId}
- kernel
type
diff --git a/ecosystem/executor/type/dataflow/pom.xml b/ecosystem/executor/type/dataflow/pom.xml
index ca7d15387b..0aea857214 100644
--- a/ecosystem/executor/type/dataflow/pom.xml
+++ b/ecosystem/executor/type/dataflow/pom.xml
@@ -29,7 +29,7 @@
org.apache.shardingsphere.elasticjob
- elasticjob-executor-kernel
+ elasticjob-infra
${project.parent.version}
diff --git a/ecosystem/executor/type/dataflow/src/main/java/org/apache/shardingsphere/elasticjob/dataflow/executor/DataflowJobExecutor.java b/ecosystem/executor/type/dataflow/src/main/java/org/apache/shardingsphere/elasticjob/dataflow/executor/DataflowJobExecutor.java
index 2eea1de495..96745d8b86 100644
--- a/ecosystem/executor/type/dataflow/src/main/java/org/apache/shardingsphere/elasticjob/dataflow/executor/DataflowJobExecutor.java
+++ b/ecosystem/executor/type/dataflow/src/main/java/org/apache/shardingsphere/elasticjob/dataflow/executor/DataflowJobExecutor.java
@@ -18,11 +18,11 @@
package org.apache.shardingsphere.elasticjob.dataflow.executor;
import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
+import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext;
import org.apache.shardingsphere.elasticjob.dataflow.job.DataflowJob;
import org.apache.shardingsphere.elasticjob.dataflow.props.DataflowJobProperties;
-import org.apache.shardingsphere.elasticjob.executor.JobFacade;
-import org.apache.shardingsphere.elasticjob.executor.item.impl.ClassedJobItemExecutor;
+import org.apache.shardingsphere.elasticjob.spi.param.JobRuntimeService;
+import org.apache.shardingsphere.elasticjob.spi.type.ClassedJobItemExecutor;
import java.util.List;
@@ -32,27 +32,27 @@
public final class DataflowJobExecutor implements ClassedJobItemExecutor {
@Override
- public void process(final DataflowJob elasticJob, final JobConfiguration jobConfig, final JobFacade jobFacade, final ShardingContext shardingContext) {
+ public void process(final DataflowJob elasticJob, final JobConfiguration jobConfig, final JobRuntimeService jobRuntimeService, final ShardingContext shardingContext) {
if (Boolean.parseBoolean(jobConfig.getProps().getOrDefault(DataflowJobProperties.STREAM_PROCESS_KEY, false).toString())) {
- streamingExecute(elasticJob, jobConfig, jobFacade, shardingContext);
+ streamingExecute(elasticJob, jobConfig, jobRuntimeService, shardingContext);
} else {
oneOffExecute(elasticJob, shardingContext);
}
}
- private void streamingExecute(final DataflowJob elasticJob, final JobConfiguration jobConfig, final JobFacade jobFacade, final ShardingContext shardingContext) {
+ private void streamingExecute(final DataflowJob elasticJob, final JobConfiguration jobConfig, final JobRuntimeService jobRuntimeService, final ShardingContext shardingContext) {
List
-
- org.apache.shardingsphere
- shardingsphere-infra-spi
-
-
org.apache.commons
commons-lang3
diff --git a/infra/src/main/java/org/apache/shardingsphere/elasticjob/infra/listener/ShardingContexts.java b/infra/src/main/java/org/apache/shardingsphere/elasticjob/infra/listener/ShardingContexts.java
index 50fef3a0af..e1db270f87 100644
--- a/infra/src/main/java/org/apache/shardingsphere/elasticjob/infra/listener/ShardingContexts.java
+++ b/infra/src/main/java/org/apache/shardingsphere/elasticjob/infra/listener/ShardingContexts.java
@@ -21,7 +21,7 @@
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
+import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext;
import java.io.Serializable;
import java.util.Map;
diff --git a/ecosystem/error-handler/type/general/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/JobPropertiesValidateRule.java b/infra/src/main/java/org/apache/shardingsphere/elasticjob/infra/validate/JobPropertiesValidateRule.java
similarity index 97%
rename from ecosystem/error-handler/type/general/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/JobPropertiesValidateRule.java
rename to infra/src/main/java/org/apache/shardingsphere/elasticjob/infra/validate/JobPropertiesValidateRule.java
index 79cc3ae05a..a13d04ad03 100644
--- a/ecosystem/error-handler/type/general/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/JobPropertiesValidateRule.java
+++ b/infra/src/main/java/org/apache/shardingsphere/elasticjob/infra/validate/JobPropertiesValidateRule.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.error.handler;
+package org.apache.shardingsphere.elasticjob.infra.validate;
import com.google.common.base.Preconditions;
import lombok.AccessLevel;
diff --git a/infra/src/test/java/org/apache/shardingsphere/elasticjob/infra/listener/ShardingContextsTest.java b/infra/src/test/java/org/apache/shardingsphere/elasticjob/infra/listener/ShardingContextsTest.java
index 36139d5c17..51845f3f2e 100644
--- a/infra/src/test/java/org/apache/shardingsphere/elasticjob/infra/listener/ShardingContextsTest.java
+++ b/infra/src/test/java/org/apache/shardingsphere/elasticjob/infra/listener/ShardingContextsTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.elasticjob.infra.listener;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
+import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext;
import org.junit.jupiter.api.Test;
import java.util.HashMap;
diff --git a/ecosystem/error-handler/type/general/src/test/java/org/apache/shardingsphere/elasticjob/error/handler/JobPropertiesValidateRuleTest.java b/infra/src/test/java/org/apache/shardingsphere/elasticjob/infra/validate/JobPropertiesValidateRuleTest.java
similarity index 77%
rename from ecosystem/error-handler/type/general/src/test/java/org/apache/shardingsphere/elasticjob/error/handler/JobPropertiesValidateRuleTest.java
rename to infra/src/test/java/org/apache/shardingsphere/elasticjob/infra/validate/JobPropertiesValidateRuleTest.java
index 89ea1872dd..aed6124fec 100644
--- a/ecosystem/error-handler/type/general/src/test/java/org/apache/shardingsphere/elasticjob/error/handler/JobPropertiesValidateRuleTest.java
+++ b/infra/src/test/java/org/apache/shardingsphere/elasticjob/infra/validate/JobPropertiesValidateRuleTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.error.handler;
+package org.apache.shardingsphere.elasticjob.infra.validate;
import org.junit.jupiter.api.Test;
@@ -37,9 +37,9 @@ void assertValidateIsRequiredWithValidateError() {
@Test
void assertValidateIsRequiredWithNormal() {
- Properties properties = new Properties();
- properties.setProperty("key", "value");
- JobPropertiesValidateRule.validateIsRequired(properties, "key");
+ Properties props = new Properties();
+ props.setProperty("key", "value");
+ JobPropertiesValidateRule.validateIsRequired(props, "key");
}
@Test
@@ -49,17 +49,17 @@ void assertValidateIsPositiveIntegerWithValueNoExist() {
@Test
void assertValidateIsPositiveIntegerWithNormal() {
- Properties properties = new Properties();
- properties.setProperty("key", "1");
- JobPropertiesValidateRule.validateIsPositiveInteger(new Properties(), "key");
+ Properties props = new Properties();
+ props.setProperty("key", "1");
+ JobPropertiesValidateRule.validateIsPositiveInteger(props, "key");
}
@Test
void assertValidateIsPositiveIntegerWithWrongString() {
- Properties properties = new Properties();
- properties.setProperty("key", "wrong_value");
+ Properties props = new Properties();
+ props.setProperty("key", "wrong_value");
try {
- JobPropertiesValidateRule.validateIsPositiveInteger(properties, "key");
+ JobPropertiesValidateRule.validateIsPositiveInteger(props, "key");
} catch (IllegalArgumentException ex) {
assertThat(ex.getMessage(), is(String.format("The property `%s` should be integer.", "key")));
}
@@ -67,10 +67,10 @@ void assertValidateIsPositiveIntegerWithWrongString() {
@Test
void assertValidateIsPositiveIntegerWithNegativeNumber() {
- Properties properties = new Properties();
- properties.setProperty("key", "-1");
+ Properties props = new Properties();
+ props.setProperty("key", "-1");
try {
- JobPropertiesValidateRule.validateIsPositiveInteger(properties, "key");
+ JobPropertiesValidateRule.validateIsPositiveInteger(props, "key");
} catch (IllegalArgumentException ex) {
assertThat(ex.getMessage(), is(String.format("The property `%s` should be positive.", "key")));
}
diff --git a/kernel/pom.xml b/kernel/pom.xml
index 3c9238bc99..7f354083da 100644
--- a/kernel/pom.xml
+++ b/kernel/pom.xml
@@ -37,6 +37,11 @@
elasticjob-infra
${project.parent.version}
+
+ org.apache.shardingsphere.elasticjob
+ elasticjob-error-handler-spi
+ ${project.parent.version}
+
org.apache.shardingsphere.elasticjob
diff --git a/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/ElasticJobExecutor.java b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/ElasticJobExecutor.java
similarity index 94%
rename from ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/ElasticJobExecutor.java
rename to kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/ElasticJobExecutor.java
index 817d18229d..9518529861 100644
--- a/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/ElasticJobExecutor.java
+++ b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/ElasticJobExecutor.java
@@ -15,21 +15,21 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.executor;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.elasticjob.api.ElasticJob;
import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
import org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandler;
-import org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandlerReloader;
-import org.apache.shardingsphere.elasticjob.executor.item.JobItemExecutor;
-import org.apache.shardingsphere.elasticjob.executor.item.JobItemExecutorFactory;
-import org.apache.shardingsphere.elasticjob.executor.item.impl.TypedJobItemExecutor;
+import org.apache.shardingsphere.elasticjob.kernel.internal.executor.error.handler.JobErrorHandlerReloader;
+import org.apache.shardingsphere.elasticjob.spi.JobItemExecutor;
+import org.apache.shardingsphere.elasticjob.kernel.internal.executor.item.JobItemExecutorFactory;
+import org.apache.shardingsphere.elasticjob.spi.type.TypedJobItemExecutor;
+import org.apache.shardingsphere.elasticjob.kernel.internal.executor.threadpool.ExecutorServiceReloader;
import org.apache.shardingsphere.elasticjob.infra.env.IpUtils;
import org.apache.shardingsphere.elasticjob.infra.exception.ExceptionUtils;
import org.apache.shardingsphere.elasticjob.infra.exception.JobExecutionEnvironmentException;
import org.apache.shardingsphere.elasticjob.infra.listener.ShardingContexts;
-import org.apache.shardingsphere.elasticjob.executor.threadpool.ExecutorServiceReloader;
import org.apache.shardingsphere.elasticjob.tracing.event.JobExecutionEvent;
import org.apache.shardingsphere.elasticjob.tracing.event.JobExecutionEvent.ExecutionSource;
import org.apache.shardingsphere.elasticjob.tracing.event.JobStatusTraceEvent.State;
@@ -178,7 +178,7 @@ private void process(final JobConfiguration jobConfig, final ShardingContexts sh
log.trace("Job '{}' executing, item is: '{}'.", jobConfig.getJobName(), item);
JobExecutionEvent completeEvent;
try {
- jobItemExecutor.process(elasticJob, jobConfig, jobFacade, shardingContexts.createShardingContext(item));
+ jobItemExecutor.process(elasticJob, jobConfig, jobFacade.getJobRuntimeService(), shardingContexts.createShardingContext(item));
completeEvent = startEvent.executionSuccess();
log.trace("Job '{}' executed, item is: '{}'.", jobConfig.getJobName(), item);
jobFacade.postJobExecutionEvent(completeEvent);
diff --git a/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/schedule/LiteJobFacade.java b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/JobFacade.java
similarity index 75%
rename from kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/schedule/LiteJobFacade.java
rename to kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/JobFacade.java
index 98eff5cd59..49c3ed6092 100644
--- a/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/schedule/LiteJobFacade.java
+++ b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/JobFacade.java
@@ -15,22 +15,22 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.kernel.internal.schedule;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor;
import com.google.common.base.Strings;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
-import org.apache.shardingsphere.elasticjob.executor.JobFacade;
-import org.apache.shardingsphere.elasticjob.kernel.internal.context.TaskContext;
import org.apache.shardingsphere.elasticjob.infra.exception.JobExecutionEnvironmentException;
import org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListener;
import org.apache.shardingsphere.elasticjob.infra.listener.ShardingContexts;
import org.apache.shardingsphere.elasticjob.kernel.internal.config.ConfigurationService;
+import org.apache.shardingsphere.elasticjob.kernel.internal.context.TaskContext;
import org.apache.shardingsphere.elasticjob.kernel.internal.failover.FailoverService;
import org.apache.shardingsphere.elasticjob.kernel.internal.sharding.ExecutionContextService;
import org.apache.shardingsphere.elasticjob.kernel.internal.sharding.ExecutionService;
import org.apache.shardingsphere.elasticjob.kernel.internal.sharding.ShardingService;
import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter;
+import org.apache.shardingsphere.elasticjob.spi.param.JobRuntimeService;
import org.apache.shardingsphere.elasticjob.tracing.JobTracingEventBus;
import org.apache.shardingsphere.elasticjob.tracing.api.TracingConfiguration;
import org.apache.shardingsphere.elasticjob.tracing.event.JobExecutionEvent;
@@ -43,10 +43,10 @@
import java.util.stream.Collectors;
/**
- * Lite job facade.
+ * Job facade.
*/
@Slf4j
-public final class LiteJobFacade implements JobFacade {
+public final class JobFacade {
private final ConfigurationService configService;
@@ -62,7 +62,7 @@ public final class LiteJobFacade implements JobFacade {
private final JobTracingEventBus jobTracingEventBus;
- public LiteJobFacade(final CoordinatorRegistryCenter regCenter, final String jobName, final Collection elasticJobListeners, final TracingConfiguration> tracingConfig) {
+ public JobFacade(final CoordinatorRegistryCenter regCenter, final String jobName, final Collection elasticJobListeners, final TracingConfiguration> tracingConfig) {
configService = new ConfigurationService(regCenter, jobName);
shardingService = new ShardingService(regCenter, jobName);
executionContextService = new ExecutionContextService(regCenter, jobName);
@@ -72,29 +72,48 @@ public LiteJobFacade(final CoordinatorRegistryCenter regCenter, final String job
this.jobTracingEventBus = null == tracingConfig ? new JobTracingEventBus() : new JobTracingEventBus(tracingConfig);
}
- @Override
+ /**
+ * Load job configuration.
+ *
+ * @param fromCache load from cache or not
+ * @return job configuration
+ */
public JobConfiguration loadJobConfiguration(final boolean fromCache) {
return configService.load(fromCache);
}
- @Override
+ /**
+ * Check job execution environment.
+ *
+ * @throws JobExecutionEnvironmentException job execution environment exception
+ */
public void checkJobExecutionEnvironment() throws JobExecutionEnvironmentException {
configService.checkMaxTimeDiffSecondsTolerable();
}
- @Override
+ /**
+ * Failover If necessary.
+ */
public void failoverIfNecessary() {
if (configService.load(true).isFailover()) {
failoverService.failoverIfNecessary();
}
}
- @Override
+ /**
+ * Register job begin.
+ *
+ * @param shardingContexts sharding contexts
+ */
public void registerJobBegin(final ShardingContexts shardingContexts) {
executionService.registerJobBegin(shardingContexts);
}
- @Override
+ /**
+ * Register job completed.
+ *
+ * @param shardingContexts sharding contexts
+ */
public void registerJobCompleted(final ShardingContexts shardingContexts) {
executionService.registerJobCompleted(shardingContexts);
if (configService.load(true).isFailover()) {
@@ -102,7 +121,11 @@ public void registerJobCompleted(final ShardingContexts shardingContexts) {
}
}
- @Override
+ /**
+ * Get sharding contexts.
+ *
+ * @return sharding contexts
+ */
public ShardingContexts getShardingContexts() {
boolean isFailover = configService.load(true).isFailover();
if (isFailover) {
@@ -120,46 +143,82 @@ public ShardingContexts getShardingContexts() {
return executionContextService.getJobShardingContext(shardingItems);
}
- @Override
+ /**
+ * Set task misfire flag.
+ *
+ * @param shardingItems sharding items to be set misfire flag
+ * @return whether satisfy misfire condition
+ */
public boolean misfireIfRunning(final Collection shardingItems) {
return executionService.misfireIfHasRunningItems(shardingItems);
}
- @Override
+ /**
+ * Clear misfire flag.
+ *
+ * @param shardingItems sharding items to be cleared misfire flag
+ */
public void clearMisfire(final Collection shardingItems) {
executionService.clearMisfire(shardingItems);
}
- @Override
+ /**
+ * Judge job whether to need to execute misfire tasks.
+ *
+ * @param shardingItems sharding items
+ * @return need to execute misfire tasks or not
+ */
public boolean isExecuteMisfired(final Collection shardingItems) {
return configService.load(true).isMisfire() && !isNeedSharding() && !executionService.getMisfiredJobItems(shardingItems).isEmpty();
}
- @Override
+ /**
+ * Judge job whether to need resharding.
+ *
+ * @return need resharding or not
+ */
public boolean isNeedSharding() {
return shardingService.isNeedSharding();
}
- @Override
+ /**
+ * Call before job executed.
+ *
+ * @param shardingContexts sharding contexts
+ */
public void beforeJobExecuted(final ShardingContexts shardingContexts) {
for (ElasticJobListener each : elasticJobListeners) {
each.beforeJobExecuted(shardingContexts);
}
}
- @Override
+ /**
+ * Call after job executed.
+ *
+ * @param shardingContexts sharding contexts
+ */
public void afterJobExecuted(final ShardingContexts shardingContexts) {
for (ElasticJobListener each : elasticJobListeners) {
each.afterJobExecuted(shardingContexts);
}
}
- @Override
+ /**
+ * Post job execution event.
+ *
+ * @param jobExecutionEvent job execution event
+ */
public void postJobExecutionEvent(final JobExecutionEvent jobExecutionEvent) {
jobTracingEventBus.post(jobExecutionEvent);
}
- @Override
+ /**
+ * Post job status trace event.
+ *
+ * @param taskId task Id
+ * @param state job state
+ * @param message job message
+ */
public void postJobStatusTraceEvent(final String taskId, final State state, final String message) {
TaskContext taskContext = TaskContext.from(taskId);
jobTracingEventBus.post(new JobStatusTraceEvent(taskContext.getMetaInfo().getJobName(), taskContext.getId(),
@@ -168,4 +227,13 @@ public void postJobStatusTraceEvent(final String taskId, final State state, fina
log.trace(message);
}
}
+
+ /**
+ * Get job runtime service.
+ *
+ * @return job runtime service
+ */
+ public JobRuntimeService getJobRuntimeService() {
+ return new JobJobRuntimeServiceImpl(this);
+ }
}
diff --git a/ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/fixture/executor/ClassedFooJobExecutor.java b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/JobJobRuntimeServiceImpl.java
similarity index 51%
rename from ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/fixture/executor/ClassedFooJobExecutor.java
rename to kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/JobJobRuntimeServiceImpl.java
index e5554dcd29..47d965c37f 100644
--- a/ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/fixture/executor/ClassedFooJobExecutor.java
+++ b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/JobJobRuntimeServiceImpl.java
@@ -15,23 +15,21 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.executor.fixture.executor;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor;
-import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
-import org.apache.shardingsphere.elasticjob.executor.JobFacade;
-import org.apache.shardingsphere.elasticjob.executor.fixture.job.FooJob;
-import org.apache.shardingsphere.elasticjob.executor.item.impl.ClassedJobItemExecutor;
+import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.elasticjob.spi.param.JobRuntimeService;
-public final class ClassedFooJobExecutor implements ClassedJobItemExecutor {
+/**
+ * Job runtime service implementation.
+ */
+@RequiredArgsConstructor
+public final class JobJobRuntimeServiceImpl implements JobRuntimeService {
- @Override
- public void process(final FooJob elasticJob, final JobConfiguration jobConfig, final JobFacade jobFacade, final ShardingContext shardingContext) {
- elasticJob.foo(shardingContext);
- }
+ private final JobFacade jobFacade;
@Override
- public Class getElasticJobClass() {
- return FooJob.class;
+ public boolean isNeedSharding() {
+ return jobFacade.isNeedSharding();
}
}
diff --git a/ecosystem/error-handler/type/general/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/JobErrorHandlerReloader.java b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/error/handler/JobErrorHandlerReloader.java
similarity index 92%
rename from ecosystem/error-handler/type/general/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/JobErrorHandlerReloader.java
rename to kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/error/handler/JobErrorHandlerReloader.java
index 3d5a68a8e5..39881ca5ae 100644
--- a/ecosystem/error-handler/type/general/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/JobErrorHandlerReloader.java
+++ b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/error/handler/JobErrorHandlerReloader.java
@@ -15,10 +15,11 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.error.handler;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor.error.handler;
import lombok.Getter;
import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
+import org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandler;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import java.io.Closeable;
diff --git a/ecosystem/error-handler/type/general/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/general/IgnoreJobErrorHandler.java b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/error/handler/general/IgnoreJobErrorHandler.java
similarity index 92%
rename from ecosystem/error-handler/type/general/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/general/IgnoreJobErrorHandler.java
rename to kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/error/handler/general/IgnoreJobErrorHandler.java
index 5a7978e21c..84a9990bb4 100644
--- a/ecosystem/error-handler/type/general/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/general/IgnoreJobErrorHandler.java
+++ b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/error/handler/general/IgnoreJobErrorHandler.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.error.handler.general;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor.error.handler.general;
import org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandler;
diff --git a/ecosystem/error-handler/type/general/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/general/LogJobErrorHandler.java b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/error/handler/general/LogJobErrorHandler.java
similarity index 93%
rename from ecosystem/error-handler/type/general/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/general/LogJobErrorHandler.java
rename to kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/error/handler/general/LogJobErrorHandler.java
index 75723b7103..0ab9bc3643 100644
--- a/ecosystem/error-handler/type/general/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/general/LogJobErrorHandler.java
+++ b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/error/handler/general/LogJobErrorHandler.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.error.handler.general;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor.error.handler.general;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandler;
diff --git a/ecosystem/error-handler/type/general/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/general/ThrowJobErrorHandler.java b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/error/handler/general/ThrowJobErrorHandler.java
similarity index 93%
rename from ecosystem/error-handler/type/general/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/general/ThrowJobErrorHandler.java
rename to kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/error/handler/general/ThrowJobErrorHandler.java
index 8883e8e5f5..9e24463ee6 100644
--- a/ecosystem/error-handler/type/general/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/general/ThrowJobErrorHandler.java
+++ b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/error/handler/general/ThrowJobErrorHandler.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.error.handler.general;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor.error.handler.general;
import org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandler;
import org.apache.shardingsphere.elasticjob.infra.exception.JobSystemException;
diff --git a/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/item/JobItemExecutorFactory.java b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/item/JobItemExecutorFactory.java
similarity index 89%
rename from ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/item/JobItemExecutorFactory.java
rename to kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/item/JobItemExecutorFactory.java
index 4632f8ce36..f2a9848f84 100644
--- a/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/item/JobItemExecutorFactory.java
+++ b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/item/JobItemExecutorFactory.java
@@ -15,12 +15,13 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.executor.item;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor.item;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.elasticjob.api.ElasticJob;
-import org.apache.shardingsphere.elasticjob.executor.item.impl.ClassedJobItemExecutor;
+import org.apache.shardingsphere.elasticjob.spi.JobItemExecutor;
+import org.apache.shardingsphere.elasticjob.spi.type.ClassedJobItemExecutor;
import org.apache.shardingsphere.elasticjob.infra.exception.JobConfigurationException;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
diff --git a/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/threadpool/ElasticJobExecutorService.java b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/ElasticJobExecutorService.java
similarity index 96%
rename from ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/threadpool/ElasticJobExecutorService.java
rename to kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/ElasticJobExecutorService.java
index 0dc38cb80e..bef37b753e 100644
--- a/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/threadpool/ElasticJobExecutorService.java
+++ b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/ElasticJobExecutorService.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.executor.threadpool;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor.threadpool;
import com.google.common.util.concurrent.MoreExecutors;
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
diff --git a/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/threadpool/ExecutorServiceReloader.java b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/ExecutorServiceReloader.java
similarity index 96%
rename from ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/threadpool/ExecutorServiceReloader.java
rename to kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/ExecutorServiceReloader.java
index 6c3e771934..6cd7b505ba 100644
--- a/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/threadpool/ExecutorServiceReloader.java
+++ b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/ExecutorServiceReloader.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.executor.threadpool;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor.threadpool;
import lombok.Getter;
import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
diff --git a/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/threadpool/JobExecutorThreadPoolSizeProvider.java b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/JobExecutorThreadPoolSizeProvider.java
similarity index 93%
rename from ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/threadpool/JobExecutorThreadPoolSizeProvider.java
rename to kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/JobExecutorThreadPoolSizeProvider.java
index a2e29883b6..64ce2d5080 100644
--- a/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/threadpool/JobExecutorThreadPoolSizeProvider.java
+++ b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/JobExecutorThreadPoolSizeProvider.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.executor.threadpool;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor.threadpool;
import org.apache.shardingsphere.infra.spi.annotation.SingletonSPI;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPI;
diff --git a/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/threadpool/type/CPUUsageJobExecutorThreadPoolSizeProvider.java b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/type/CPUUsageJobExecutorThreadPoolSizeProvider.java
similarity index 86%
rename from ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/threadpool/type/CPUUsageJobExecutorThreadPoolSizeProvider.java
rename to kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/type/CPUUsageJobExecutorThreadPoolSizeProvider.java
index 1903142c9f..9fa4f55f22 100644
--- a/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/threadpool/type/CPUUsageJobExecutorThreadPoolSizeProvider.java
+++ b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/type/CPUUsageJobExecutorThreadPoolSizeProvider.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.executor.threadpool.type;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor.threadpool.type;
-import org.apache.shardingsphere.elasticjob.executor.threadpool.JobExecutorThreadPoolSizeProvider;
+import org.apache.shardingsphere.elasticjob.kernel.internal.executor.threadpool.JobExecutorThreadPoolSizeProvider;
/**
* Job executor pool size provider with use CPU available processors.
diff --git a/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/threadpool/type/SingleThreadJobExecutorThreadPoolSizeProvider.java b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/type/SingleThreadJobExecutorThreadPoolSizeProvider.java
similarity index 84%
rename from ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/threadpool/type/SingleThreadJobExecutorThreadPoolSizeProvider.java
rename to kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/type/SingleThreadJobExecutorThreadPoolSizeProvider.java
index 1248e30579..ed5e9f5580 100644
--- a/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/threadpool/type/SingleThreadJobExecutorThreadPoolSizeProvider.java
+++ b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/type/SingleThreadJobExecutorThreadPoolSizeProvider.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.executor.threadpool.type;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor.threadpool.type;
-import org.apache.shardingsphere.elasticjob.executor.threadpool.JobExecutorThreadPoolSizeProvider;
+import org.apache.shardingsphere.elasticjob.kernel.internal.executor.threadpool.JobExecutorThreadPoolSizeProvider;
/**
* Job executor pool size provider with single thread.
diff --git a/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/schedule/JobScheduler.java b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/schedule/JobScheduler.java
index d27dac9224..5030f0ae85 100644
--- a/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/schedule/JobScheduler.java
+++ b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/schedule/JobScheduler.java
@@ -23,8 +23,9 @@
import org.apache.shardingsphere.elasticjob.api.ElasticJob;
import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
import org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandlerPropertiesValidator;
-import org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor;
+import org.apache.shardingsphere.elasticjob.kernel.internal.executor.ElasticJobExecutor;
import org.apache.shardingsphere.elasticjob.infra.exception.JobSystemException;
+import org.apache.shardingsphere.elasticjob.kernel.internal.executor.JobFacade;
import org.apache.shardingsphere.elasticjob.kernel.internal.sharding.JobInstance;
import org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListener;
import org.apache.shardingsphere.elasticjob.kernel.api.listener.AbstractDistributeOnceElasticJobListener;
@@ -64,7 +65,7 @@ public final class JobScheduler {
private final SchedulerFacade schedulerFacade;
- private final LiteJobFacade jobFacade;
+ private final JobFacade jobFacade;
private final ElasticJobExecutor jobExecutor;
@@ -79,7 +80,7 @@ public JobScheduler(final CoordinatorRegistryCenter regCenter, final ElasticJob
Collection jobListeners = getElasticJobListeners(this.jobConfig);
setUpFacade = new SetUpFacade(regCenter, this.jobConfig.getJobName(), jobListeners);
schedulerFacade = new SchedulerFacade(regCenter, this.jobConfig.getJobName());
- jobFacade = new LiteJobFacade(regCenter, this.jobConfig.getJobName(), jobListeners, findTracingConfiguration().orElse(null));
+ jobFacade = new JobFacade(regCenter, this.jobConfig.getJobName(), jobListeners, findTracingConfiguration().orElse(null));
validateJobProperties();
jobExecutor = new ElasticJobExecutor(elasticJob, this.jobConfig, jobFacade);
setGuaranteeServiceForElasticJobListeners(regCenter, jobListeners);
@@ -93,7 +94,7 @@ public JobScheduler(final CoordinatorRegistryCenter regCenter, final String elas
Collection jobListeners = getElasticJobListeners(this.jobConfig);
setUpFacade = new SetUpFacade(regCenter, this.jobConfig.getJobName(), jobListeners);
schedulerFacade = new SchedulerFacade(regCenter, this.jobConfig.getJobName());
- jobFacade = new LiteJobFacade(regCenter, this.jobConfig.getJobName(), jobListeners, findTracingConfiguration().orElse(null));
+ jobFacade = new JobFacade(regCenter, this.jobConfig.getJobName(), jobListeners, findTracingConfiguration().orElse(null));
validateJobProperties();
jobExecutor = new ElasticJobExecutor(elasticJobType, this.jobConfig, jobFacade);
setGuaranteeServiceForElasticJobListeners(regCenter, jobListeners);
diff --git a/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/schedule/LiteJob.java b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/schedule/LiteJob.java
index 8189e05c06..252465f484 100644
--- a/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/schedule/LiteJob.java
+++ b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/schedule/LiteJob.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.elasticjob.kernel.internal.schedule;
import lombok.Setter;
-import org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor;
+import org.apache.shardingsphere.elasticjob.kernel.internal.executor.ElasticJobExecutor;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
diff --git a/ecosystem/error-handler/type/general/src/main/resources/META-INF/services/org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandler b/kernel/src/main/resources/META-INF/services/org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandler
similarity index 71%
rename from ecosystem/error-handler/type/general/src/main/resources/META-INF/services/org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandler
rename to kernel/src/main/resources/META-INF/services/org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandler
index 02da0be3a9..9b191fc16d 100644
--- a/ecosystem/error-handler/type/general/src/main/resources/META-INF/services/org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandler
+++ b/kernel/src/main/resources/META-INF/services/org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandler
@@ -15,6 +15,6 @@
# limitations under the License.
#
-org.apache.shardingsphere.elasticjob.error.handler.general.LogJobErrorHandler
-org.apache.shardingsphere.elasticjob.error.handler.general.IgnoreJobErrorHandler
-org.apache.shardingsphere.elasticjob.error.handler.general.ThrowJobErrorHandler
+org.apache.shardingsphere.elasticjob.kernel.internal.executor.error.handler.general.LogJobErrorHandler
+org.apache.shardingsphere.elasticjob.kernel.internal.executor.error.handler.general.IgnoreJobErrorHandler
+org.apache.shardingsphere.elasticjob.kernel.internal.executor.error.handler.general.ThrowJobErrorHandler
diff --git a/ecosystem/executor/kernel/src/main/resources/META-INF/services/org.apache.shardingsphere.elasticjob.executor.threadpool.JobExecutorThreadPoolSizeProvider b/kernel/src/main/resources/META-INF/services/org.apache.shardingsphere.elasticjob.kernel.internal.executor.threadpool.JobExecutorThreadPoolSizeProvider
similarity index 76%
rename from ecosystem/executor/kernel/src/main/resources/META-INF/services/org.apache.shardingsphere.elasticjob.executor.threadpool.JobExecutorThreadPoolSizeProvider
rename to kernel/src/main/resources/META-INF/services/org.apache.shardingsphere.elasticjob.kernel.internal.executor.threadpool.JobExecutorThreadPoolSizeProvider
index 40f0e643db..5b7167c4f0 100644
--- a/ecosystem/executor/kernel/src/main/resources/META-INF/services/org.apache.shardingsphere.elasticjob.executor.threadpool.JobExecutorThreadPoolSizeProvider
+++ b/kernel/src/main/resources/META-INF/services/org.apache.shardingsphere.elasticjob.kernel.internal.executor.threadpool.JobExecutorThreadPoolSizeProvider
@@ -15,5 +15,5 @@
# limitations under the License.
#
-org.apache.shardingsphere.elasticjob.executor.threadpool.type.CPUUsageJobExecutorThreadPoolSizeProvider
-org.apache.shardingsphere.elasticjob.executor.threadpool.type.SingleThreadJobExecutorThreadPoolSizeProvider
+org.apache.shardingsphere.elasticjob.kernel.internal.executor.threadpool.type.CPUUsageJobExecutorThreadPoolSizeProvider
+org.apache.shardingsphere.elasticjob.kernel.internal.executor.threadpool.type.SingleThreadJobExecutorThreadPoolSizeProvider
diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/LiteYamlConstants.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/YamlConstants.java
similarity index 98%
rename from kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/LiteYamlConstants.java
rename to kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/YamlConstants.java
index c7820a9f46..fdc3a4c3d3 100644
--- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/LiteYamlConstants.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/YamlConstants.java
@@ -21,7 +21,7 @@
import lombok.NoArgsConstructor;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class LiteYamlConstants {
+public final class YamlConstants {
private static final String JOB_YAML = "jobName: test_job\n"
+ "cron: 0/1 * * * * ?\n"
diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/executor/ClassedFooJobExecutor.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/executor/ClassedFooJobExecutor.java
index 7c033faafe..507d0e1f20 100644
--- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/executor/ClassedFooJobExecutor.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/executor/ClassedFooJobExecutor.java
@@ -18,15 +18,15 @@
package org.apache.shardingsphere.elasticjob.kernel.fixture.executor;
import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
-import org.apache.shardingsphere.elasticjob.executor.JobFacade;
-import org.apache.shardingsphere.elasticjob.executor.item.impl.ClassedJobItemExecutor;
+import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext;
+import org.apache.shardingsphere.elasticjob.spi.param.JobRuntimeService;
+import org.apache.shardingsphere.elasticjob.spi.type.ClassedJobItemExecutor;
import org.apache.shardingsphere.elasticjob.kernel.fixture.job.FooJob;
public final class ClassedFooJobExecutor implements ClassedJobItemExecutor {
@Override
- public void process(final FooJob elasticJob, final JobConfiguration jobConfig, final JobFacade jobFacade, final ShardingContext shardingContext) {
+ public void process(final FooJob elasticJob, final JobConfiguration jobConfig, final JobRuntimeService jobRuntimeService, final ShardingContext shardingContext) {
elasticJob.foo(shardingContext);
}
diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/job/AnnotationSimpleJob.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/job/AnnotationSimpleJob.java
index 74aedd3b12..a6c4a39b01 100644
--- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/job/AnnotationSimpleJob.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/job/AnnotationSimpleJob.java
@@ -20,7 +20,7 @@
import lombok.Getter;
import org.apache.shardingsphere.elasticjob.annotation.ElasticJobConfiguration;
import org.apache.shardingsphere.elasticjob.annotation.ElasticJobProp;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
+import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
@Getter
diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/job/AnnotationUnShardingJob.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/job/AnnotationUnShardingJob.java
index a75257759b..eda26d1eea 100644
--- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/job/AnnotationUnShardingJob.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/job/AnnotationUnShardingJob.java
@@ -19,7 +19,7 @@
import lombok.Getter;
import org.apache.shardingsphere.elasticjob.annotation.ElasticJobConfiguration;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
+import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
@Getter
diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/job/DetailedFooJob.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/job/DetailedFooJob.java
index 7d3f5087b6..c21446e3b9 100644
--- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/job/DetailedFooJob.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/job/DetailedFooJob.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.elasticjob.kernel.fixture.job;
import lombok.Getter;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
+import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext;
import java.util.Collection;
import java.util.concurrent.CopyOnWriteArraySet;
diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/job/FooJob.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/job/FooJob.java
index f0fe640568..e2d02c3c53 100644
--- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/job/FooJob.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/fixture/job/FooJob.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.elasticjob.kernel.fixture.job;
import org.apache.shardingsphere.elasticjob.api.ElasticJob;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
+import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext;
public interface FooJob extends ElasticJob {
diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/config/ConfigurationServiceTest.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/config/ConfigurationServiceTest.java
index e10e08c81a..3b445d3ee6 100644
--- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/config/ConfigurationServiceTest.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/config/ConfigurationServiceTest.java
@@ -22,7 +22,7 @@
import org.apache.shardingsphere.elasticjob.infra.exception.JobConfigurationException;
import org.apache.shardingsphere.elasticjob.infra.exception.JobExecutionEnvironmentException;
import org.apache.shardingsphere.elasticjob.infra.yaml.YamlEngine;
-import org.apache.shardingsphere.elasticjob.kernel.fixture.LiteYamlConstants;
+import org.apache.shardingsphere.elasticjob.kernel.fixture.YamlConstants;
import org.apache.shardingsphere.elasticjob.kernel.internal.storage.JobNodeStorage;
import org.apache.shardingsphere.elasticjob.kernel.util.ReflectionUtils;
import org.junit.jupiter.api.BeforeEach;
@@ -53,7 +53,7 @@ void setUp() {
@Test
void assertLoadDirectly() {
- when(jobNodeStorage.getJobNodeDataDirectly(ConfigurationNode.ROOT)).thenReturn(LiteYamlConstants.getJobYaml());
+ when(jobNodeStorage.getJobNodeDataDirectly(ConfigurationNode.ROOT)).thenReturn(YamlConstants.getJobYaml());
JobConfiguration actual = configService.load(false);
assertThat(actual.getJobName(), is("test_job"));
assertThat(actual.getCron(), is("0/1 * * * * ?"));
@@ -62,7 +62,7 @@ void assertLoadDirectly() {
@Test
void assertLoadFromCache() {
- when(jobNodeStorage.getJobNodeData(ConfigurationNode.ROOT)).thenReturn(LiteYamlConstants.getJobYaml());
+ when(jobNodeStorage.getJobNodeData(ConfigurationNode.ROOT)).thenReturn(YamlConstants.getJobYaml());
JobConfiguration actual = configService.load(true);
assertThat(actual.getJobName(), is("test_job"));
assertThat(actual.getCron(), is("0/1 * * * * ?"));
@@ -72,7 +72,7 @@ void assertLoadFromCache() {
@Test
void assertLoadFromCacheButNull() {
when(jobNodeStorage.getJobNodeData(ConfigurationNode.ROOT)).thenReturn(null);
- when(jobNodeStorage.getJobNodeDataDirectly(ConfigurationNode.ROOT)).thenReturn(LiteYamlConstants.getJobYaml());
+ when(jobNodeStorage.getJobNodeDataDirectly(ConfigurationNode.ROOT)).thenReturn(YamlConstants.getJobYaml());
JobConfiguration actual = configService.load(true);
assertThat(actual.getJobName(), is("test_job"));
assertThat(actual.getCron(), is("0/1 * * * * ?"));
@@ -120,13 +120,13 @@ void assertSetUpJobConfigurationExistedJobConfigurationAndNotOverwrite() {
@Test
void assertIsMaxTimeDiffSecondsTolerableWithDefaultValue() throws JobExecutionEnvironmentException {
- when(jobNodeStorage.getJobNodeData(ConfigurationNode.ROOT)).thenReturn(LiteYamlConstants.getJobYaml(-1));
+ when(jobNodeStorage.getJobNodeData(ConfigurationNode.ROOT)).thenReturn(YamlConstants.getJobYaml(-1));
configService.checkMaxTimeDiffSecondsTolerable();
}
@Test
void assertIsMaxTimeDiffSecondsTolerable() throws JobExecutionEnvironmentException {
- when(jobNodeStorage.getJobNodeData(ConfigurationNode.ROOT)).thenReturn(LiteYamlConstants.getJobYaml());
+ when(jobNodeStorage.getJobNodeData(ConfigurationNode.ROOT)).thenReturn(YamlConstants.getJobYaml());
when(jobNodeStorage.getRegistryCenterTime()).thenReturn(System.currentTimeMillis());
configService.checkMaxTimeDiffSecondsTolerable();
verify(jobNodeStorage).getRegistryCenterTime();
@@ -135,7 +135,7 @@ void assertIsMaxTimeDiffSecondsTolerable() throws JobExecutionEnvironmentExcepti
@Test
void assertIsNotMaxTimeDiffSecondsTolerable() {
assertThrows(JobExecutionEnvironmentException.class, () -> {
- when(jobNodeStorage.getJobNodeData(ConfigurationNode.ROOT)).thenReturn(LiteYamlConstants.getJobYaml());
+ when(jobNodeStorage.getJobNodeData(ConfigurationNode.ROOT)).thenReturn(YamlConstants.getJobYaml());
when(jobNodeStorage.getRegistryCenterTime()).thenReturn(0L);
try {
configService.checkMaxTimeDiffSecondsTolerable();
diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/config/RescheduleListenerManagerTest.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/config/RescheduleListenerManagerTest.java
index 9f2ddd25d1..dd2006808d 100644
--- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/config/RescheduleListenerManagerTest.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/config/RescheduleListenerManagerTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.elasticjob.kernel.internal.config;
import org.apache.shardingsphere.elasticjob.kernel.internal.sharding.JobInstance;
-import org.apache.shardingsphere.elasticjob.kernel.fixture.LiteYamlConstants;
+import org.apache.shardingsphere.elasticjob.kernel.fixture.YamlConstants;
import org.apache.shardingsphere.elasticjob.kernel.internal.schedule.JobRegistry;
import org.apache.shardingsphere.elasticjob.kernel.internal.schedule.JobScheduleController;
import org.apache.shardingsphere.elasticjob.kernel.internal.storage.JobNodeStorage;
@@ -63,19 +63,19 @@ void assertStart() {
@Test
void assertCronSettingChangedJobListenerWhenIsNotCronPath() {
- rescheduleListenerManager.new CronSettingAndJobEventChangedJobListener().onChange(new DataChangedEvent(DataChangedEvent.Type.ADDED, "/test_job/config/other", LiteYamlConstants.getJobYaml()));
+ rescheduleListenerManager.new CronSettingAndJobEventChangedJobListener().onChange(new DataChangedEvent(DataChangedEvent.Type.ADDED, "/test_job/config/other", YamlConstants.getJobYaml()));
verify(jobScheduleController, times(0)).rescheduleJob(any(), any());
}
@Test
void assertCronSettingChangedJobListenerWhenIsCronPathButNotUpdate() {
- rescheduleListenerManager.new CronSettingAndJobEventChangedJobListener().onChange(new DataChangedEvent(DataChangedEvent.Type.ADDED, "/test_job/config", LiteYamlConstants.getJobYaml()));
+ rescheduleListenerManager.new CronSettingAndJobEventChangedJobListener().onChange(new DataChangedEvent(DataChangedEvent.Type.ADDED, "/test_job/config", YamlConstants.getJobYaml()));
verify(jobScheduleController, times(0)).rescheduleJob(any(), any());
}
@Test
void assertCronSettingChangedJobListenerWhenIsCronPathAndUpdateButCannotFindJob() {
- rescheduleListenerManager.new CronSettingAndJobEventChangedJobListener().onChange(new DataChangedEvent(DataChangedEvent.Type.UPDATED, "/test_job/config", LiteYamlConstants.getJobYaml()));
+ rescheduleListenerManager.new CronSettingAndJobEventChangedJobListener().onChange(new DataChangedEvent(DataChangedEvent.Type.UPDATED, "/test_job/config", YamlConstants.getJobYaml()));
verify(jobScheduleController, times(0)).rescheduleJob(any(), any());
}
@@ -84,7 +84,7 @@ void assertCronSettingChangedJobListenerWhenIsCronPathAndUpdateAndFindJob() {
JobRegistry.getInstance().addJobInstance("test_job", new JobInstance("127.0.0.1@-@0"));
JobRegistry.getInstance().registerRegistryCenter("test_job", regCenter);
JobRegistry.getInstance().registerJob("test_job", jobScheduleController);
- rescheduleListenerManager.new CronSettingAndJobEventChangedJobListener().onChange(new DataChangedEvent(DataChangedEvent.Type.UPDATED, "/test_job/config", LiteYamlConstants.getJobYaml()));
+ rescheduleListenerManager.new CronSettingAndJobEventChangedJobListener().onChange(new DataChangedEvent(DataChangedEvent.Type.UPDATED, "/test_job/config", YamlConstants.getJobYaml()));
verify(jobScheduleController).rescheduleJob("0/1 * * * * ?", null);
JobRegistry.getInstance().shutdown("test_job");
}
diff --git a/ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/ElasticJobExecutorTest.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/ElasticJobExecutorTest.java
similarity index 91%
rename from ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/ElasticJobExecutorTest.java
rename to kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/ElasticJobExecutorTest.java
index 2e3abe8cd8..984801d19a 100644
--- a/ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/ElasticJobExecutorTest.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/ElasticJobExecutorTest.java
@@ -15,21 +15,24 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.executor;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor;
import lombok.SneakyThrows;
import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
-import org.apache.shardingsphere.elasticjob.executor.fixture.executor.ClassedFooJobExecutor;
-import org.apache.shardingsphere.elasticjob.executor.fixture.job.FooJob;
import org.apache.shardingsphere.elasticjob.infra.exception.JobExecutionEnvironmentException;
import org.apache.shardingsphere.elasticjob.infra.exception.JobSystemException;
import org.apache.shardingsphere.elasticjob.infra.listener.ShardingContexts;
+import org.apache.shardingsphere.elasticjob.kernel.fixture.executor.ClassedFooJobExecutor;
+import org.apache.shardingsphere.elasticjob.kernel.fixture.job.FooJob;
+import org.apache.shardingsphere.elasticjob.spi.param.JobRuntimeService;
import org.apache.shardingsphere.elasticjob.tracing.event.JobStatusTraceEvent.State;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
+import org.mockito.junit.jupiter.MockitoSettings;
+import org.mockito.quality.Strictness;
import java.lang.reflect.Field;
import java.util.Collections;
@@ -47,6 +50,7 @@
import static org.mockito.Mockito.when;
@ExtendWith(MockitoExtension.class)
+@MockitoSettings(strictness = Strictness.LENIENT)
class ElasticJobExecutorTest {
@Mock
@@ -57,6 +61,9 @@ class ElasticJobExecutorTest {
@Mock
private JobFacade jobFacade;
+ @Mock
+ private JobRuntimeService jobRuntimeService;
+
@Mock
private ClassedFooJobExecutor jobItemExecutor;
@@ -66,6 +73,7 @@ class ElasticJobExecutorTest {
void setUp() {
jobConfig = createJobConfiguration();
when(jobFacade.loadJobConfiguration(anyBoolean())).thenReturn(jobConfig);
+ when(jobFacade.getJobRuntimeService()).thenReturn(jobRuntimeService);
elasticJobExecutor = new ElasticJobExecutor(fooJob, jobConfig, jobFacade);
setJobItemExecutor();
}
@@ -89,7 +97,7 @@ void assertExecuteWhenCheckMaxTimeDiffSecondsIntolerable() {
try {
elasticJobExecutor.execute();
} finally {
- verify(jobItemExecutor, times(0)).process(eq(fooJob), eq(jobConfig), eq(jobFacade), any());
+ verify(jobItemExecutor, times(0)).process(eq(fooJob), eq(jobConfig), eq(jobRuntimeService), any());
}
});
}
@@ -103,7 +111,7 @@ void assertExecuteWhenPreviousJobStillRunning() {
verify(jobFacade).postJobStatusTraceEvent(shardingContexts.getTaskId(), State.TASK_STAGING, "Job 'test_job' execute begin.");
verify(jobFacade).postJobStatusTraceEvent(shardingContexts.getTaskId(), State.TASK_FINISHED,
"Previous job 'test_job' - shardingItems '[]' is still running, misfired job will start after previous job completed.");
- verify(jobItemExecutor, times(0)).process(eq(fooJob), eq(jobConfig), eq(jobFacade), any());
+ verify(jobItemExecutor, times(0)).process(eq(fooJob), eq(jobConfig), eq(jobRuntimeService), any());
}
@Test
@@ -113,7 +121,7 @@ void assertExecuteWhenShardingItemsIsEmpty() {
elasticJobExecutor.execute();
verify(jobFacade).postJobStatusTraceEvent(shardingContexts.getTaskId(), State.TASK_STAGING, "Job 'test_job' execute begin.");
verify(jobFacade).postJobStatusTraceEvent(shardingContexts.getTaskId(), State.TASK_FINISHED, "Sharding item for job 'test_job' is empty.");
- verify(jobItemExecutor, times(0)).process(eq(fooJob), eq(jobConfig), eq(jobFacade), any());
+ verify(jobItemExecutor, times(0)).process(eq(fooJob), eq(jobConfig), eq(jobRuntimeService), any());
}
@Test
@@ -128,7 +136,7 @@ void assertExecuteFailureWhenThrowExceptionForMultipleShardingItems() {
private void assertExecuteFailureWhenThrowException(final ShardingContexts shardingContexts) {
prepareForIsNotMisfire(jobFacade, shardingContexts);
- doThrow(RuntimeException.class).when(jobItemExecutor).process(eq(fooJob), eq(jobConfig), eq(jobFacade), any());
+ doThrow(RuntimeException.class).when(jobItemExecutor).process(eq(fooJob), eq(jobConfig), eq(jobRuntimeService), any());
try {
elasticJobExecutor.execute();
} finally {
@@ -136,7 +144,7 @@ private void assertExecuteFailureWhenThrowException(final ShardingContexts shard
verify(jobFacade).postJobStatusTraceEvent(shardingContexts.getTaskId(), State.TASK_RUNNING, "");
verify(jobFacade).postJobStatusTraceEvent(shardingContexts.getTaskId(), State.TASK_ERROR, getErrorMessage(shardingContexts));
verify(jobFacade).registerJobBegin(shardingContexts);
- verify(jobItemExecutor, times(shardingContexts.getShardingTotalCount())).process(eq(fooJob), eq(jobConfig), eq(jobFacade), any());
+ verify(jobItemExecutor, times(shardingContexts.getShardingTotalCount())).process(eq(fooJob), eq(jobConfig), eq(jobRuntimeService), any());
verify(jobFacade).registerJobCompleted(shardingContexts);
}
}
@@ -163,7 +171,7 @@ private void assertExecuteSuccess(final ShardingContexts shardingContexts) {
verify(jobFacade).postJobStatusTraceEvent(shardingContexts.getTaskId(), State.TASK_STAGING, "Job 'test_job' execute begin.");
verify(jobFacade).postJobStatusTraceEvent(shardingContexts.getTaskId(), State.TASK_FINISHED, "");
verifyForIsNotMisfire(jobFacade, shardingContexts);
- verify(jobItemExecutor, times(shardingContexts.getShardingTotalCount())).process(eq(fooJob), eq(jobConfig), eq(jobFacade), any());
+ verify(jobItemExecutor, times(shardingContexts.getShardingTotalCount())).process(eq(fooJob), eq(jobConfig), eq(jobRuntimeService), any());
}
@Test
@@ -172,7 +180,7 @@ void assertExecuteWithMisfireIsEmpty() {
when(jobFacade.getShardingContexts()).thenReturn(shardingContexts);
elasticJobExecutor.execute();
verifyForIsNotMisfire(jobFacade, shardingContexts);
- verify(jobItemExecutor, times(2)).process(eq(fooJob), eq(jobConfig), eq(jobFacade), any());
+ verify(jobItemExecutor, times(2)).process(eq(fooJob), eq(jobConfig), eq(jobRuntimeService), any());
}
@Test
@@ -181,7 +189,7 @@ void assertExecuteWithMisfireIsNotEmptyButIsNotEligibleForJobRunning() {
when(jobFacade.getShardingContexts()).thenReturn(shardingContexts);
elasticJobExecutor.execute();
verifyForIsNotMisfire(jobFacade, shardingContexts);
- verify(jobItemExecutor, times(2)).process(eq(fooJob), eq(jobConfig), eq(jobFacade), any());
+ verify(jobItemExecutor, times(2)).process(eq(fooJob), eq(jobConfig), eq(jobRuntimeService), any());
verify(jobFacade, times(0)).clearMisfire(shardingContexts.getShardingItemParameters().keySet());
}
@@ -195,7 +203,7 @@ void assertExecuteWithMisfire() {
verify(jobFacade, times(2)).postJobStatusTraceEvent(shardingContexts.getTaskId(), State.TASK_RUNNING, "");
verify(jobFacade).misfireIfRunning(shardingContexts.getShardingItemParameters().keySet());
verify(jobFacade, times(2)).registerJobBegin(shardingContexts);
- verify(jobItemExecutor, times(4)).process(eq(fooJob), eq(jobConfig), eq(jobFacade), any());
+ verify(jobItemExecutor, times(4)).process(eq(fooJob), eq(jobConfig), eq(jobRuntimeService), any());
verify(jobFacade, times(2)).registerJobCompleted(shardingContexts);
}
@@ -208,7 +216,7 @@ void assertBeforeJobExecutedFailure() {
try {
elasticJobExecutor.execute();
} finally {
- verify(jobItemExecutor, times(0)).process(eq(fooJob), eq(jobConfig), eq(jobFacade), any());
+ verify(jobItemExecutor, times(0)).process(eq(fooJob), eq(jobConfig), eq(jobRuntimeService), any());
}
});
}
@@ -222,7 +230,7 @@ void assertAfterJobExecutedFailure() {
try {
elasticJobExecutor.execute();
} finally {
- verify(jobItemExecutor, times(2)).process(eq(fooJob), eq(jobConfig), eq(jobFacade), any());
+ verify(jobItemExecutor, times(2)).process(eq(fooJob), eq(jobConfig), eq(jobRuntimeService), any());
}
});
}
diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/schedule/LiteJobFacadeTest.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/JobFacadeTest.java
similarity index 80%
rename from kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/schedule/LiteJobFacadeTest.java
rename to kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/JobFacadeTest.java
index 79a25322cf..2ab96dba5a 100644
--- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/schedule/LiteJobFacadeTest.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/JobFacadeTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.kernel.internal.schedule;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor;
import com.google.common.collect.Lists;
import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
@@ -46,7 +46,7 @@
import static org.mockito.Mockito.when;
@ExtendWith(MockitoExtension.class)
-class LiteJobFacadeTest {
+class JobFacadeTest {
@Mock
private ConfigurationService configService;
@@ -69,55 +69,54 @@ class LiteJobFacadeTest {
@Mock
private ElasticJobListenerCaller caller;
- private LiteJobFacade liteJobFacade;
+ private JobFacade jobFacade;
private StringBuilder orderResult;
@BeforeEach
void setUp() {
orderResult = new StringBuilder();
- TestElasticJobListener l1 = new TestElasticJobListener(caller, "l1", 2, orderResult);
- TestElasticJobListener l2 = new TestElasticJobListener(caller, "l2", 1, orderResult);
- liteJobFacade = new LiteJobFacade(null, "test_job", Lists.newArrayList(l1, l2), null);
- ReflectionUtils.setFieldValue(liteJobFacade, "configService", configService);
- ReflectionUtils.setFieldValue(liteJobFacade, "shardingService", shardingService);
- ReflectionUtils.setFieldValue(liteJobFacade, "executionContextService", executionContextService);
- ReflectionUtils.setFieldValue(liteJobFacade, "executionService", executionService);
- ReflectionUtils.setFieldValue(liteJobFacade, "failoverService", failoverService);
- ReflectionUtils.setFieldValue(liteJobFacade, "jobTracingEventBus", jobTracingEventBus);
+ jobFacade = new JobFacade(null, "test_job",
+ Arrays.asList(new TestElasticJobListener(caller, "l1", 2, orderResult), new TestElasticJobListener(caller, "l2", 1, orderResult)), null);
+ ReflectionUtils.setFieldValue(jobFacade, "configService", configService);
+ ReflectionUtils.setFieldValue(jobFacade, "shardingService", shardingService);
+ ReflectionUtils.setFieldValue(jobFacade, "executionContextService", executionContextService);
+ ReflectionUtils.setFieldValue(jobFacade, "executionService", executionService);
+ ReflectionUtils.setFieldValue(jobFacade, "failoverService", failoverService);
+ ReflectionUtils.setFieldValue(jobFacade, "jobTracingEventBus", jobTracingEventBus);
}
@Test
void assertLoad() {
JobConfiguration expected = JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").build();
when(configService.load(true)).thenReturn(expected);
- assertThat(liteJobFacade.loadJobConfiguration(true), is(expected));
+ assertThat(jobFacade.loadJobConfiguration(true), is(expected));
}
@Test
void assertCheckMaxTimeDiffSecondsTolerable() throws JobExecutionEnvironmentException {
- liteJobFacade.checkJobExecutionEnvironment();
+ jobFacade.checkJobExecutionEnvironment();
verify(configService).checkMaxTimeDiffSecondsTolerable();
}
@Test
void assertFailoverIfUnnecessary() {
when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").failover(false).build());
- liteJobFacade.failoverIfNecessary();
+ jobFacade.failoverIfNecessary();
verify(failoverService, times(0)).failoverIfNecessary();
}
@Test
void assertFailoverIfNecessary() {
when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").failover(true).monitorExecution(true).build());
- liteJobFacade.failoverIfNecessary();
+ jobFacade.failoverIfNecessary();
verify(failoverService).failoverIfNecessary();
}
@Test
void assertRegisterJobBegin() {
ShardingContexts shardingContexts = new ShardingContexts("fake_task_id", "test_job", 10, "", Collections.emptyMap());
- liteJobFacade.registerJobBegin(shardingContexts);
+ jobFacade.registerJobBegin(shardingContexts);
verify(executionService).registerJobBegin(shardingContexts);
}
@@ -125,7 +124,7 @@ void assertRegisterJobBegin() {
void assertRegisterJobCompletedWhenFailoverDisabled() {
ShardingContexts shardingContexts = new ShardingContexts("fake_task_id", "test_job", 10, "", Collections.emptyMap());
when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").failover(false).build());
- liteJobFacade.registerJobCompleted(shardingContexts);
+ jobFacade.registerJobCompleted(shardingContexts);
verify(executionService).registerJobCompleted(shardingContexts);
verify(failoverService, times(0)).updateFailoverComplete(shardingContexts.getShardingItemParameters().keySet());
}
@@ -134,7 +133,7 @@ void assertRegisterJobCompletedWhenFailoverDisabled() {
void assertRegisterJobCompletedWhenFailoverEnabled() {
ShardingContexts shardingContexts = new ShardingContexts("fake_task_id", "test_job", 10, "", Collections.emptyMap());
when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").failover(true).monitorExecution(true).build());
- liteJobFacade.registerJobCompleted(shardingContexts);
+ jobFacade.registerJobCompleted(shardingContexts);
verify(executionService).registerJobCompleted(shardingContexts);
verify(failoverService).updateFailoverComplete(shardingContexts.getShardingItemParameters().keySet());
}
@@ -145,7 +144,7 @@ void assertGetShardingContextWhenIsFailoverEnableAndFailover() {
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));
+ assertThat(jobFacade.getShardingContexts(), is(shardingContexts));
verify(shardingService, times(0)).shardingIfNecessary();
}
@@ -157,7 +156,7 @@ void assertGetShardingContextWhenIsFailoverEnableAndNotFailover() {
when(shardingService.getLocalShardingItems()).thenReturn(Lists.newArrayList(0, 1));
when(failoverService.getLocalTakeOffItems()).thenReturn(Collections.singletonList(0));
when(executionContextService.getJobShardingContext(Collections.singletonList(1))).thenReturn(shardingContexts);
- assertThat(liteJobFacade.getShardingContexts(), is(shardingContexts));
+ assertThat(jobFacade.getShardingContexts(), is(shardingContexts));
verify(shardingService).shardingIfNecessary();
}
@@ -167,7 +166,7 @@ void assertGetShardingContextWhenIsFailoverDisable() {
when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").failover(false).build());
when(shardingService.getLocalShardingItems()).thenReturn(Arrays.asList(0, 1));
when(executionContextService.getJobShardingContext(Arrays.asList(0, 1))).thenReturn(shardingContexts);
- assertThat(liteJobFacade.getShardingContexts(), is(shardingContexts));
+ assertThat(jobFacade.getShardingContexts(), is(shardingContexts));
verify(shardingService).shardingIfNecessary();
}
@@ -178,45 +177,45 @@ void assertGetShardingContextWhenHasDisabledItems() {
when(shardingService.getLocalShardingItems()).thenReturn(Lists.newArrayList(0, 1));
when(executionService.getDisabledItems(Arrays.asList(0, 1))).thenReturn(Collections.singletonList(1));
when(executionContextService.getJobShardingContext(Collections.singletonList(0))).thenReturn(shardingContexts);
- assertThat(liteJobFacade.getShardingContexts(), is(shardingContexts));
+ assertThat(jobFacade.getShardingContexts(), is(shardingContexts));
verify(shardingService).shardingIfNecessary();
}
@Test
void assertMisfireIfRunning() {
when(executionService.misfireIfHasRunningItems(Arrays.asList(0, 1))).thenReturn(true);
- assertThat(liteJobFacade.misfireIfRunning(Arrays.asList(0, 1)), is(true));
+ assertThat(jobFacade.misfireIfRunning(Arrays.asList(0, 1)), is(true));
}
@Test
void assertClearMisfire() {
- liteJobFacade.clearMisfire(Arrays.asList(0, 1));
+ jobFacade.clearMisfire(Arrays.asList(0, 1));
verify(executionService).clearMisfire(Arrays.asList(0, 1));
}
@Test
void assertIsNeedSharding() {
when(shardingService.isNeedSharding()).thenReturn(true);
- assertThat(liteJobFacade.isNeedSharding(), is(true));
+ assertThat(jobFacade.isNeedSharding(), is(true));
}
@Test
void assertBeforeJobExecuted() {
- liteJobFacade.beforeJobExecuted(new ShardingContexts("fake_task_id", "test_job", 10, "", Collections.emptyMap()));
+ jobFacade.beforeJobExecuted(new ShardingContexts("fake_task_id", "test_job", 10, "", Collections.emptyMap()));
verify(caller, times(2)).before();
assertThat(orderResult.toString(), is("l2l1"));
}
@Test
void assertAfterJobExecuted() {
- liteJobFacade.afterJobExecuted(new ShardingContexts("fake_task_id", "test_job", 10, "", Collections.emptyMap()));
+ jobFacade.afterJobExecuted(new ShardingContexts("fake_task_id", "test_job", 10, "", Collections.emptyMap()));
verify(caller, times(2)).after();
assertThat(orderResult.toString(), is("l2l1"));
}
@Test
void assertPostJobExecutionEvent() {
- liteJobFacade.postJobExecutionEvent(null);
+ jobFacade.postJobExecutionEvent(null);
verify(jobTracingEventBus).post(null);
}
}
diff --git a/ecosystem/error-handler/type/general/src/test/java/org/apache/shardingsphere/elasticjob/error/handler/JobErrorHandlerReloaderTest.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/error/handler/JobErrorHandlerReloaderTest.java
similarity index 92%
rename from ecosystem/error-handler/type/general/src/test/java/org/apache/shardingsphere/elasticjob/error/handler/JobErrorHandlerReloaderTest.java
rename to kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/error/handler/JobErrorHandlerReloaderTest.java
index faf4a697dd..741b22113f 100644
--- a/ecosystem/error-handler/type/general/src/test/java/org/apache/shardingsphere/elasticjob/error/handler/JobErrorHandlerReloaderTest.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/error/handler/JobErrorHandlerReloaderTest.java
@@ -15,12 +15,13 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.error.handler;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor.error.handler;
import lombok.SneakyThrows;
import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
-import org.apache.shardingsphere.elasticjob.error.handler.general.IgnoreJobErrorHandler;
-import org.apache.shardingsphere.elasticjob.error.handler.general.LogJobErrorHandler;
+import org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandler;
+import org.apache.shardingsphere.elasticjob.kernel.internal.executor.error.handler.general.IgnoreJobErrorHandler;
+import org.apache.shardingsphere.elasticjob.kernel.internal.executor.error.handler.general.LogJobErrorHandler;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
diff --git a/ecosystem/error-handler/type/general/src/test/java/org/apache/shardingsphere/elasticjob/error/handler/general/IgnoreJobErrorHandlerTest.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/error/handler/general/IgnoreJobErrorHandlerTest.java
similarity index 93%
rename from ecosystem/error-handler/type/general/src/test/java/org/apache/shardingsphere/elasticjob/error/handler/general/IgnoreJobErrorHandlerTest.java
rename to kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/error/handler/general/IgnoreJobErrorHandlerTest.java
index 7bb3f14d98..9bb99f4a50 100644
--- a/ecosystem/error-handler/type/general/src/test/java/org/apache/shardingsphere/elasticjob/error/handler/general/IgnoreJobErrorHandlerTest.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/error/handler/general/IgnoreJobErrorHandlerTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.error.handler.general;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor.error.handler.general;
import org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandler;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
diff --git a/ecosystem/error-handler/type/general/src/test/java/org/apache/shardingsphere/elasticjob/error/handler/general/LogJobErrorHandlerTest.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/error/handler/general/LogJobErrorHandlerTest.java
similarity index 96%
rename from ecosystem/error-handler/type/general/src/test/java/org/apache/shardingsphere/elasticjob/error/handler/general/LogJobErrorHandlerTest.java
rename to kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/error/handler/general/LogJobErrorHandlerTest.java
index 64bd48d023..e658c41dab 100644
--- a/ecosystem/error-handler/type/general/src/test/java/org/apache/shardingsphere/elasticjob/error/handler/general/LogJobErrorHandlerTest.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/error/handler/general/LogJobErrorHandlerTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.error.handler.general;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor.error.handler.general;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.spi.LoggingEvent;
diff --git a/ecosystem/error-handler/type/general/src/test/java/org/apache/shardingsphere/elasticjob/error/handler/general/ThrowJobErrorHandlerTest.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/error/handler/general/ThrowJobErrorHandlerTest.java
similarity index 93%
rename from ecosystem/error-handler/type/general/src/test/java/org/apache/shardingsphere/elasticjob/error/handler/general/ThrowJobErrorHandlerTest.java
rename to kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/error/handler/general/ThrowJobErrorHandlerTest.java
index 8b8da22380..9c401430f5 100644
--- a/ecosystem/error-handler/type/general/src/test/java/org/apache/shardingsphere/elasticjob/error/handler/general/ThrowJobErrorHandlerTest.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/error/handler/general/ThrowJobErrorHandlerTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.error.handler.general;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor.error.handler.general;
import org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandler;
import org.apache.shardingsphere.elasticjob.infra.exception.JobSystemException;
diff --git a/ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/fixture/executor/TypedFooJobExecutor.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/fixture/executor/TypedFooJobExecutor.java
similarity index 73%
rename from ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/fixture/executor/TypedFooJobExecutor.java
rename to kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/fixture/executor/TypedFooJobExecutor.java
index 3e46cbf9b0..766927ba2d 100644
--- a/ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/fixture/executor/TypedFooJobExecutor.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/fixture/executor/TypedFooJobExecutor.java
@@ -15,18 +15,18 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.executor.fixture.executor;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor.fixture.executor;
import org.apache.shardingsphere.elasticjob.api.ElasticJob;
import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
-import org.apache.shardingsphere.elasticjob.executor.JobFacade;
-import org.apache.shardingsphere.elasticjob.executor.item.impl.TypedJobItemExecutor;
+import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext;
+import org.apache.shardingsphere.elasticjob.spi.param.JobRuntimeService;
+import org.apache.shardingsphere.elasticjob.spi.type.TypedJobItemExecutor;
public final class TypedFooJobExecutor implements TypedJobItemExecutor {
@Override
- public void process(final ElasticJob elasticJob, final JobConfiguration jobConfig, final JobFacade jobFacade, final ShardingContext shardingContext) {
+ public void process(final ElasticJob elasticJob, final JobConfiguration jobConfig, final JobRuntimeService jobRuntimeService, final ShardingContext shardingContext) {
}
@Override
diff --git a/ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/fixture/job/DetailedFooJob.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/fixture/job/DetailedFooJob.java
similarity index 85%
rename from ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/fixture/job/DetailedFooJob.java
rename to kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/fixture/job/DetailedFooJob.java
index c0101e7f53..7ef0cf84be 100644
--- a/ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/fixture/job/DetailedFooJob.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/fixture/job/DetailedFooJob.java
@@ -15,10 +15,11 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.executor.fixture.job;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor.fixture.job;
import lombok.Getter;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
+import org.apache.shardingsphere.elasticjob.kernel.fixture.job.FooJob;
+import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext;
import java.util.Collection;
import java.util.concurrent.CopyOnWriteArraySet;
diff --git a/ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/fixture/job/FailedJob.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/fixture/job/FailedJob.java
similarity index 91%
rename from ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/fixture/job/FailedJob.java
rename to kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/fixture/job/FailedJob.java
index ad2deef881..326cc2cb00 100644
--- a/ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/fixture/job/FailedJob.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/fixture/job/FailedJob.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.executor.fixture.job;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor.fixture.job;
import org.apache.shardingsphere.elasticjob.api.ElasticJob;
diff --git a/ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/item/JobItemExecutorFactoryTest.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/item/JobItemExecutorFactoryTest.java
similarity index 80%
rename from ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/item/JobItemExecutorFactoryTest.java
rename to kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/item/JobItemExecutorFactoryTest.java
index 0695a8bd24..c4baf90808 100644
--- a/ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/item/JobItemExecutorFactoryTest.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/item/JobItemExecutorFactoryTest.java
@@ -15,13 +15,13 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.executor.item;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor.item;
-import org.apache.shardingsphere.elasticjob.executor.fixture.executor.ClassedFooJobExecutor;
-import org.apache.shardingsphere.elasticjob.executor.fixture.job.DetailedFooJob;
-import org.apache.shardingsphere.elasticjob.executor.fixture.job.FailedJob;
-import org.apache.shardingsphere.elasticjob.executor.fixture.job.FooJob;
import org.apache.shardingsphere.elasticjob.infra.exception.JobConfigurationException;
+import org.apache.shardingsphere.elasticjob.kernel.fixture.executor.ClassedFooJobExecutor;
+import org.apache.shardingsphere.elasticjob.kernel.fixture.job.DetailedFooJob;
+import org.apache.shardingsphere.elasticjob.kernel.fixture.job.FooJob;
+import org.apache.shardingsphere.elasticjob.kernel.internal.executor.fixture.job.FailedJob;
import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.instanceOf;
diff --git a/ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/threadpool/ElasticJobExecutorServiceTest.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/ElasticJobExecutorServiceTest.java
similarity index 97%
rename from ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/threadpool/ElasticJobExecutorServiceTest.java
rename to kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/ElasticJobExecutorServiceTest.java
index 293bfbf62e..9e0066941e 100644
--- a/ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/threadpool/ElasticJobExecutorServiceTest.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/ElasticJobExecutorServiceTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.executor.threadpool;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor.threadpool;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
diff --git a/ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/threadpool/ExecutorServiceReloaderTest.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/ExecutorServiceReloaderTest.java
similarity index 98%
rename from ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/threadpool/ExecutorServiceReloaderTest.java
rename to kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/ExecutorServiceReloaderTest.java
index 92f54d8773..e2bc5e5cd7 100644
--- a/ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/threadpool/ExecutorServiceReloaderTest.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/ExecutorServiceReloaderTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.executor.threadpool;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor.threadpool;
import lombok.SneakyThrows;
import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
diff --git a/ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/threadpool/type/CPUUsageJobExecutorThreadPoolSizeProviderTest.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/type/CPUUsageJobExecutorThreadPoolSizeProviderTest.java
similarity index 86%
rename from ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/threadpool/type/CPUUsageJobExecutorThreadPoolSizeProviderTest.java
rename to kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/type/CPUUsageJobExecutorThreadPoolSizeProviderTest.java
index 50b61a8642..fd99b1b0b8 100644
--- a/ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/threadpool/type/CPUUsageJobExecutorThreadPoolSizeProviderTest.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/type/CPUUsageJobExecutorThreadPoolSizeProviderTest.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.executor.threadpool.type;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor.threadpool.type;
-import org.apache.shardingsphere.elasticjob.executor.threadpool.JobExecutorThreadPoolSizeProvider;
+import org.apache.shardingsphere.elasticjob.kernel.internal.executor.threadpool.JobExecutorThreadPoolSizeProvider;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.junit.jupiter.api.Test;
diff --git a/ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/threadpool/type/SingleThreadJobExecutorThreadPoolSizeProviderTest.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/type/SingleThreadJobExecutorThreadPoolSizeProviderTest.java
similarity index 86%
rename from ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/threadpool/type/SingleThreadJobExecutorThreadPoolSizeProviderTest.java
rename to kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/type/SingleThreadJobExecutorThreadPoolSizeProviderTest.java
index 97119b5cec..a99df1b194 100644
--- a/ecosystem/executor/kernel/src/test/java/org/apache/shardingsphere/elasticjob/executor/threadpool/type/SingleThreadJobExecutorThreadPoolSizeProviderTest.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/executor/threadpool/type/SingleThreadJobExecutorThreadPoolSizeProviderTest.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.executor.threadpool.type;
+package org.apache.shardingsphere.elasticjob.kernel.internal.executor.threadpool.type;
-import org.apache.shardingsphere.elasticjob.executor.threadpool.JobExecutorThreadPoolSizeProvider;
+import org.apache.shardingsphere.elasticjob.kernel.internal.executor.threadpool.JobExecutorThreadPoolSizeProvider;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.junit.jupiter.api.Test;
diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/failover/FailoverListenerManagerTest.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/failover/FailoverListenerManagerTest.java
index 3ff61b6e86..ed83b72c79 100644
--- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/failover/FailoverListenerManagerTest.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/failover/FailoverListenerManagerTest.java
@@ -19,7 +19,7 @@
import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
import org.apache.shardingsphere.elasticjob.kernel.internal.sharding.JobInstance;
-import org.apache.shardingsphere.elasticjob.kernel.fixture.LiteYamlConstants;
+import org.apache.shardingsphere.elasticjob.kernel.fixture.YamlConstants;
import org.apache.shardingsphere.elasticjob.kernel.internal.config.ConfigurationService;
import org.apache.shardingsphere.elasticjob.kernel.internal.instance.InstanceNode;
import org.apache.shardingsphere.elasticjob.kernel.internal.instance.InstanceService;
@@ -163,7 +163,7 @@ void assertJobCrashedJobListenerWhenIsOtherFailoverInstanceCrashed() {
@Test
void assertFailoverSettingsChangedJobListenerWhenIsNotFailoverPath() {
- failoverListenerManager.new FailoverSettingsChangedJobListener().onChange(new DataChangedEvent(Type.ADDED, "/test_job/other", LiteYamlConstants.getJobYaml()));
+ failoverListenerManager.new FailoverSettingsChangedJobListener().onChange(new DataChangedEvent(Type.ADDED, "/test_job/other", YamlConstants.getJobYaml()));
verify(failoverService, times(0)).removeFailoverInfo();
}
@@ -175,13 +175,13 @@ void assertFailoverSettingsChangedJobListenerWhenIsFailoverPathButNotUpdate() {
@Test
void assertFailoverSettingsChangedJobListenerWhenIsFailoverPathAndUpdateButEnableFailover() {
- failoverListenerManager.new FailoverSettingsChangedJobListener().onChange(new DataChangedEvent(Type.UPDATED, "/test_job/config", LiteYamlConstants.getJobYaml()));
+ failoverListenerManager.new FailoverSettingsChangedJobListener().onChange(new DataChangedEvent(Type.UPDATED, "/test_job/config", YamlConstants.getJobYaml()));
verify(failoverService, times(0)).removeFailoverInfo();
}
@Test
void assertFailoverSettingsChangedJobListenerWhenIsFailoverPathAndUpdateButDisableFailover() {
- failoverListenerManager.new FailoverSettingsChangedJobListener().onChange(new DataChangedEvent(Type.UPDATED, "/test_job/config", LiteYamlConstants.getJobYamlWithFailover(false)));
+ failoverListenerManager.new FailoverSettingsChangedJobListener().onChange(new DataChangedEvent(Type.UPDATED, "/test_job/config", YamlConstants.getJobYamlWithFailover(false)));
verify(failoverService).removeFailoverInfo();
}
diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/sharding/MonitorExecutionListenerManagerTest.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/sharding/MonitorExecutionListenerManagerTest.java
index 20fa06d6dd..b492175833 100644
--- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/sharding/MonitorExecutionListenerManagerTest.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/sharding/MonitorExecutionListenerManagerTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.elasticjob.kernel.internal.sharding;
-import org.apache.shardingsphere.elasticjob.kernel.fixture.LiteYamlConstants;
+import org.apache.shardingsphere.elasticjob.kernel.fixture.YamlConstants;
import org.apache.shardingsphere.elasticjob.kernel.internal.storage.JobNodeStorage;
import org.apache.shardingsphere.elasticjob.kernel.util.ReflectionUtils;
import org.apache.shardingsphere.elasticjob.reg.listener.DataChangedEvent;
@@ -50,7 +50,7 @@ void setUp() {
@Test
void assertMonitorExecutionSettingsChangedJobListenerWhenIsNotFailoverPath() {
- monitorExecutionListenerManager.new MonitorExecutionSettingsChangedJobListener().onChange(new DataChangedEvent(DataChangedEvent.Type.ADDED, "/test_job/other", LiteYamlConstants.getJobYaml()));
+ monitorExecutionListenerManager.new MonitorExecutionSettingsChangedJobListener().onChange(new DataChangedEvent(DataChangedEvent.Type.ADDED, "/test_job/other", YamlConstants.getJobYaml()));
verify(executionService, times(0)).clearAllRunningInfo();
}
@@ -62,13 +62,13 @@ void assertMonitorExecutionSettingsChangedJobListenerWhenIsFailoverPathButNotUpd
@Test
void assertMonitorExecutionSettingsChangedJobListenerWhenIsFailoverPathAndUpdateButEnableFailover() {
- monitorExecutionListenerManager.new MonitorExecutionSettingsChangedJobListener().onChange(new DataChangedEvent(Type.UPDATED, "/test_job/config", LiteYamlConstants.getJobYaml()));
+ monitorExecutionListenerManager.new MonitorExecutionSettingsChangedJobListener().onChange(new DataChangedEvent(Type.UPDATED, "/test_job/config", YamlConstants.getJobYaml()));
verify(executionService, times(0)).clearAllRunningInfo();
}
@Test
void assertMonitorExecutionSettingsChangedJobListenerWhenIsFailoverPathAndUpdateButDisableFailover() {
- DataChangedEvent event = new DataChangedEvent(Type.UPDATED, "/test_job/config", LiteYamlConstants.getJobYamlWithMonitorExecution(false));
+ DataChangedEvent event = new DataChangedEvent(Type.UPDATED, "/test_job/config", YamlConstants.getJobYamlWithMonitorExecution(false));
monitorExecutionListenerManager.new MonitorExecutionSettingsChangedJobListener().onChange(event);
verify(executionService).clearAllRunningInfo();
}
diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/sharding/ShardingListenerManagerTest.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/sharding/ShardingListenerManagerTest.java
index 5782f8d51f..2006512257 100644
--- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/sharding/ShardingListenerManagerTest.java
+++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/internal/sharding/ShardingListenerManagerTest.java
@@ -19,7 +19,7 @@
import com.google.common.collect.Lists;
import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
-import org.apache.shardingsphere.elasticjob.kernel.fixture.LiteYamlConstants;
+import org.apache.shardingsphere.elasticjob.kernel.fixture.YamlConstants;
import org.apache.shardingsphere.elasticjob.kernel.internal.config.ConfigurationService;
import org.apache.shardingsphere.elasticjob.kernel.internal.schedule.JobRegistry;
import org.apache.shardingsphere.elasticjob.kernel.internal.schedule.JobScheduleController;
@@ -83,14 +83,14 @@ void assertShardingTotalCountChangedJobListenerWhenIsNotConfigPath() {
@Test
void assertShardingTotalCountChangedJobListenerWhenIsConfigPathButCurrentShardingTotalCountIsZero() {
- shardingListenerManager.new ShardingTotalCountChangedJobListener().onChange(new DataChangedEvent(Type.ADDED, "/test_job/config", LiteYamlConstants.getJobYaml()));
+ shardingListenerManager.new ShardingTotalCountChangedJobListener().onChange(new DataChangedEvent(Type.ADDED, "/test_job/config", YamlConstants.getJobYaml()));
verify(shardingService, times(0)).setReshardingFlag();
}
@Test
void assertShardingTotalCountChangedJobListenerWhenIsConfigPathAndCurrentShardingTotalCountIsEqualToNewShardingTotalCount() {
JobRegistry.getInstance().setCurrentShardingTotalCount("test_job", 3);
- shardingListenerManager.new ShardingTotalCountChangedJobListener().onChange(new DataChangedEvent(Type.ADDED, "/test_job/config", LiteYamlConstants.getJobYaml()));
+ shardingListenerManager.new ShardingTotalCountChangedJobListener().onChange(new DataChangedEvent(Type.ADDED, "/test_job/config", YamlConstants.getJobYaml()));
verify(shardingService, times(0)).setReshardingFlag();
JobRegistry.getInstance().setCurrentShardingTotalCount("test_job", 0);
}
@@ -98,7 +98,7 @@ void assertShardingTotalCountChangedJobListenerWhenIsConfigPathAndCurrentShardin
@Test
void assertShardingTotalCountChangedJobListenerWhenIsConfigPathAndCurrentShardingTotalCountIsNotEqualToNewShardingTotalCount() {
JobRegistry.getInstance().setCurrentShardingTotalCount("test_job", 5);
- shardingListenerManager.new ShardingTotalCountChangedJobListener().onChange(new DataChangedEvent(Type.UPDATED, "/test_job/config", LiteYamlConstants.getJobYaml()));
+ shardingListenerManager.new ShardingTotalCountChangedJobListener().onChange(new DataChangedEvent(Type.UPDATED, "/test_job/config", YamlConstants.getJobYaml()));
verify(shardingService).setReshardingFlag();
JobRegistry.getInstance().setCurrentShardingTotalCount("test_job", 0);
}
diff --git a/kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.executor.item.impl.ClassedJobItemExecutor b/kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.spi.type.ClassedJobItemExecutor
similarity index 100%
rename from kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.executor.item.impl.ClassedJobItemExecutor
rename to kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.spi.type.ClassedJobItemExecutor
diff --git a/ecosystem/executor/kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.executor.item.impl.TypedJobItemExecutor b/kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.spi.type.TypedJobItemExecutor
similarity index 88%
rename from ecosystem/executor/kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.executor.item.impl.TypedJobItemExecutor
rename to kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.spi.type.TypedJobItemExecutor
index 9fde771ab1..2199d1f8fa 100644
--- a/ecosystem/executor/kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.executor.item.impl.TypedJobItemExecutor
+++ b/kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.spi.type.TypedJobItemExecutor
@@ -15,4 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.elasticjob.executor.fixture.executor.TypedFooJobExecutor
+org.apache.shardingsphere.elasticjob.kernel.internal.executor.fixture.executor.TypedFooJobExecutor
diff --git a/kernel/src/test/resources/logback-test.xml b/kernel/src/test/resources/logback-test.xml
index 72a2eade8a..ae5d682429 100644
--- a/kernel/src/test/resources/logback-test.xml
+++ b/kernel/src/test/resources/logback-test.xml
@@ -33,6 +33,7 @@
${log.pattern}
+
@@ -41,4 +42,7 @@
+
+
+
diff --git a/spring/boot-starter/src/test/java/org/apache/shardingsphere/elasticjob/spring/boot/job/executor/CustomClassedJobExecutor.java b/spring/boot-starter/src/test/java/org/apache/shardingsphere/elasticjob/spring/boot/job/executor/CustomClassedJobExecutor.java
index eb558d1a64..8a7032dae6 100644
--- a/spring/boot-starter/src/test/java/org/apache/shardingsphere/elasticjob/spring/boot/job/executor/CustomClassedJobExecutor.java
+++ b/spring/boot-starter/src/test/java/org/apache/shardingsphere/elasticjob/spring/boot/job/executor/CustomClassedJobExecutor.java
@@ -18,15 +18,15 @@
package org.apache.shardingsphere.elasticjob.spring.boot.job.executor;
import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
-import org.apache.shardingsphere.elasticjob.executor.JobFacade;
-import org.apache.shardingsphere.elasticjob.executor.item.impl.ClassedJobItemExecutor;
+import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext;
+import org.apache.shardingsphere.elasticjob.spi.param.JobRuntimeService;
+import org.apache.shardingsphere.elasticjob.spi.type.ClassedJobItemExecutor;
import org.apache.shardingsphere.elasticjob.spring.boot.job.fixture.job.CustomJob;
public final class CustomClassedJobExecutor implements ClassedJobItemExecutor {
@Override
- public void process(final CustomJob elasticJob, final JobConfiguration jobConfig, final JobFacade jobFacade, final ShardingContext shardingContext) {
+ public void process(final CustomJob elasticJob, final JobConfiguration jobConfig, final JobRuntimeService jobRuntimeService, final ShardingContext shardingContext) {
elasticJob.execute(shardingContext);
}
diff --git a/spring/boot-starter/src/test/java/org/apache/shardingsphere/elasticjob/spring/boot/job/executor/PrintJobExecutor.java b/spring/boot-starter/src/test/java/org/apache/shardingsphere/elasticjob/spring/boot/job/executor/PrintJobExecutor.java
index 35479eb174..35a0c3fe8b 100644
--- a/spring/boot-starter/src/test/java/org/apache/shardingsphere/elasticjob/spring/boot/job/executor/PrintJobExecutor.java
+++ b/spring/boot-starter/src/test/java/org/apache/shardingsphere/elasticjob/spring/boot/job/executor/PrintJobExecutor.java
@@ -20,15 +20,15 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.elasticjob.api.ElasticJob;
import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
-import org.apache.shardingsphere.elasticjob.executor.JobFacade;
-import org.apache.shardingsphere.elasticjob.executor.item.impl.TypedJobItemExecutor;
+import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext;
+import org.apache.shardingsphere.elasticjob.spi.param.JobRuntimeService;
+import org.apache.shardingsphere.elasticjob.spi.type.TypedJobItemExecutor;
@Slf4j
public final class PrintJobExecutor implements TypedJobItemExecutor {
@Override
- public void process(final ElasticJob elasticJob, final JobConfiguration jobConfig, final JobFacade jobFacade, final ShardingContext shardingContext) {
+ public void process(final ElasticJob elasticJob, final JobConfiguration jobConfig, final JobRuntimeService jobRuntimeService, final ShardingContext shardingContext) {
log.info(jobConfig.getProps().getProperty(PrintJobProperties.CONTENT_KEY));
}
diff --git a/spring/boot-starter/src/test/java/org/apache/shardingsphere/elasticjob/spring/boot/job/fixture/job/CustomJob.java b/spring/boot-starter/src/test/java/org/apache/shardingsphere/elasticjob/spring/boot/job/fixture/job/CustomJob.java
index 5533160ff8..d204129f1a 100644
--- a/spring/boot-starter/src/test/java/org/apache/shardingsphere/elasticjob/spring/boot/job/fixture/job/CustomJob.java
+++ b/spring/boot-starter/src/test/java/org/apache/shardingsphere/elasticjob/spring/boot/job/fixture/job/CustomJob.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.elasticjob.spring.boot.job.fixture.job;
import org.apache.shardingsphere.elasticjob.api.ElasticJob;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
+import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext;
public interface CustomJob extends ElasticJob {
diff --git a/spring/boot-starter/src/test/java/org/apache/shardingsphere/elasticjob/spring/boot/job/fixture/job/impl/AnnotationCustomJob.java b/spring/boot-starter/src/test/java/org/apache/shardingsphere/elasticjob/spring/boot/job/fixture/job/impl/AnnotationCustomJob.java
index 7ce8dcf247..1b5ac1ef44 100644
--- a/spring/boot-starter/src/test/java/org/apache/shardingsphere/elasticjob/spring/boot/job/fixture/job/impl/AnnotationCustomJob.java
+++ b/spring/boot-starter/src/test/java/org/apache/shardingsphere/elasticjob/spring/boot/job/fixture/job/impl/AnnotationCustomJob.java
@@ -21,7 +21,7 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.elasticjob.annotation.ElasticJobConfiguration;
import org.apache.shardingsphere.elasticjob.annotation.ElasticJobProp;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
+import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext;
import org.apache.shardingsphere.elasticjob.spring.boot.job.fixture.job.CustomJob;
import org.springframework.transaction.annotation.Transactional;
diff --git a/spring/boot-starter/src/test/java/org/apache/shardingsphere/elasticjob/spring/boot/job/fixture/job/impl/CustomTestJob.java b/spring/boot-starter/src/test/java/org/apache/shardingsphere/elasticjob/spring/boot/job/fixture/job/impl/CustomTestJob.java
index 19633b9202..abc8712270 100644
--- a/spring/boot-starter/src/test/java/org/apache/shardingsphere/elasticjob/spring/boot/job/fixture/job/impl/CustomTestJob.java
+++ b/spring/boot-starter/src/test/java/org/apache/shardingsphere/elasticjob/spring/boot/job/fixture/job/impl/CustomTestJob.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.elasticjob.spring.boot.job.fixture.job.impl;
import lombok.extern.slf4j.Slf4j;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
+import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext;
import org.apache.shardingsphere.elasticjob.spring.boot.job.fixture.job.CustomJob;
import org.apache.shardingsphere.elasticjob.spring.boot.job.repository.BarRepository;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/spring/boot-starter/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.executor.item.impl.ClassedJobItemExecutor b/spring/boot-starter/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.spi.type.ClassedJobItemExecutor
similarity index 100%
rename from spring/boot-starter/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.executor.item.impl.ClassedJobItemExecutor
rename to spring/boot-starter/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.spi.type.ClassedJobItemExecutor
diff --git a/spring/boot-starter/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.executor.item.impl.TypedJobItemExecutor b/spring/boot-starter/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.spi.type.TypedJobItemExecutor
similarity index 100%
rename from spring/boot-starter/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.executor.item.impl.TypedJobItemExecutor
rename to spring/boot-starter/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.spi.type.TypedJobItemExecutor
diff --git a/spring/core/src/test/java/org/apache/shardingsphere/elasticjob/spring/core/util/TargetJob.java b/spring/core/src/test/java/org/apache/shardingsphere/elasticjob/spring/core/util/TargetJob.java
index cb71cde0ed..32c8b0ab6e 100644
--- a/spring/core/src/test/java/org/apache/shardingsphere/elasticjob/spring/core/util/TargetJob.java
+++ b/spring/core/src/test/java/org/apache/shardingsphere/elasticjob/spring/core/util/TargetJob.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.elasticjob.spring.core.util;
import org.apache.shardingsphere.elasticjob.api.ElasticJob;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
+import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext;
public class TargetJob implements ElasticJob {
diff --git a/spring/core/src/test/resources/META-INF/logback-test.xml b/spring/core/src/test/resources/META-INF/logback-test.xml
index c169e22ca8..cb19e66db2 100644
--- a/spring/core/src/test/resources/META-INF/logback-test.xml
+++ b/spring/core/src/test/resources/META-INF/logback-test.xml
@@ -38,5 +38,5 @@
-
+
diff --git a/spring/namespace/src/test/java/org/apache/shardingsphere/elasticjob/spring/namespace/fixture/job/DataflowElasticJob.java b/spring/namespace/src/test/java/org/apache/shardingsphere/elasticjob/spring/namespace/fixture/job/DataflowElasticJob.java
index 6693833b52..13fdb6fddc 100644
--- a/spring/namespace/src/test/java/org/apache/shardingsphere/elasticjob/spring/namespace/fixture/job/DataflowElasticJob.java
+++ b/spring/namespace/src/test/java/org/apache/shardingsphere/elasticjob/spring/namespace/fixture/job/DataflowElasticJob.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.elasticjob.spring.namespace.fixture.job;
import lombok.Getter;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
+import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext;
import org.apache.shardingsphere.elasticjob.dataflow.job.DataflowJob;
import java.util.Collections;
diff --git a/spring/namespace/src/test/java/org/apache/shardingsphere/elasticjob/spring/namespace/fixture/job/FooSimpleElasticJob.java b/spring/namespace/src/test/java/org/apache/shardingsphere/elasticjob/spring/namespace/fixture/job/FooSimpleElasticJob.java
index 1bbcb567aa..dd96a6920f 100644
--- a/spring/namespace/src/test/java/org/apache/shardingsphere/elasticjob/spring/namespace/fixture/job/FooSimpleElasticJob.java
+++ b/spring/namespace/src/test/java/org/apache/shardingsphere/elasticjob/spring/namespace/fixture/job/FooSimpleElasticJob.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.elasticjob.spring.namespace.fixture.job;
import lombok.Getter;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
+import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
public class FooSimpleElasticJob implements SimpleJob {
diff --git a/spring/namespace/src/test/java/org/apache/shardingsphere/elasticjob/spring/namespace/fixture/job/annotation/AnnotationSimpleJob.java b/spring/namespace/src/test/java/org/apache/shardingsphere/elasticjob/spring/namespace/fixture/job/annotation/AnnotationSimpleJob.java
index 67fcdb6413..fbcc8e0008 100644
--- a/spring/namespace/src/test/java/org/apache/shardingsphere/elasticjob/spring/namespace/fixture/job/annotation/AnnotationSimpleJob.java
+++ b/spring/namespace/src/test/java/org/apache/shardingsphere/elasticjob/spring/namespace/fixture/job/annotation/AnnotationSimpleJob.java
@@ -20,7 +20,7 @@
import lombok.Getter;
import org.apache.shardingsphere.elasticjob.annotation.ElasticJobConfiguration;
import org.apache.shardingsphere.elasticjob.annotation.ElasticJobProp;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
+import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
@Getter
diff --git a/spring/namespace/src/test/java/org/apache/shardingsphere/elasticjob/spring/namespace/fixture/job/ref/RefFooDataflowElasticJob.java b/spring/namespace/src/test/java/org/apache/shardingsphere/elasticjob/spring/namespace/fixture/job/ref/RefFooDataflowElasticJob.java
index d607a29072..3456ba7eaa 100644
--- a/spring/namespace/src/test/java/org/apache/shardingsphere/elasticjob/spring/namespace/fixture/job/ref/RefFooDataflowElasticJob.java
+++ b/spring/namespace/src/test/java/org/apache/shardingsphere/elasticjob/spring/namespace/fixture/job/ref/RefFooDataflowElasticJob.java
@@ -19,7 +19,7 @@
import lombok.Getter;
import lombok.Setter;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
+import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext;
import org.apache.shardingsphere.elasticjob.dataflow.job.DataflowJob;
import org.apache.shardingsphere.elasticjob.spring.namespace.fixture.service.FooService;
diff --git a/spring/namespace/src/test/java/org/apache/shardingsphere/elasticjob/spring/namespace/fixture/job/ref/RefFooSimpleElasticJob.java b/spring/namespace/src/test/java/org/apache/shardingsphere/elasticjob/spring/namespace/fixture/job/ref/RefFooSimpleElasticJob.java
index 4ad7fdf0c4..d2f9889c22 100644
--- a/spring/namespace/src/test/java/org/apache/shardingsphere/elasticjob/spring/namespace/fixture/job/ref/RefFooSimpleElasticJob.java
+++ b/spring/namespace/src/test/java/org/apache/shardingsphere/elasticjob/spring/namespace/fixture/job/ref/RefFooSimpleElasticJob.java
@@ -19,7 +19,7 @@
import lombok.Getter;
import lombok.Setter;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
+import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
import org.apache.shardingsphere.elasticjob.spring.namespace.fixture.service.FooService;
diff --git a/spring/namespace/src/test/resources/logback-test.xml b/spring/namespace/src/test/resources/logback-test.xml
index c169e22ca8..cb19e66db2 100644
--- a/spring/namespace/src/test/resources/logback-test.xml
+++ b/spring/namespace/src/test/resources/logback-test.xml
@@ -38,5 +38,5 @@
-
+