diff --git a/kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListener b/kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListener index 69fd14c6e0..ec26735634 100644 --- a/kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListener +++ b/kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListener @@ -17,5 +17,3 @@ org.apache.shardingsphere.elasticjob.kernel.api.listener.fixture.TestDistributeOnceElasticJobListener org.apache.shardingsphere.elasticjob.kernel.api.listener.fixture.TestElasticJobListener -org.apache.shardingsphere.elasticjob.kernel.integrate.listener.TestDistributeOnceElasticJobListener -org.apache.shardingsphere.elasticjob.kernel.integrate.listener.TestElasticJobListener diff --git a/test/e2e/pom.xml b/test/e2e/pom.xml new file mode 100644 index 0000000000..28a202ca25 --- /dev/null +++ b/test/e2e/pom.xml @@ -0,0 +1,51 @@ + + + + + 4.0.0 + + org.apache.shardingsphere.elasticjob + elasticjob-test + 3.1.0-SNAPSHOT + + elasticjob-test-e2e + ${project.artifactId} + + + true + + + + + org.apache.shardingsphere.elasticjob + elasticjob-kernel + ${project.parent.version} + + + + org.apache.shardingsphere.elasticjob + elasticjob-test-util + ${project.parent.version} + + + + org.awaitility + awaitility + + + diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/BaseIntegrateTest.java b/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/BaseE2ETest.java similarity index 95% rename from kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/BaseIntegrateTest.java rename to test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/BaseE2ETest.java index 3a8b340c6c..2deb0ea66f 100644 --- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/BaseIntegrateTest.java +++ b/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/BaseE2ETest.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.elasticjob.kernel.integrate; +package org.apache.shardingsphere.elasticjob.test.e2e; import lombok.AccessLevel; import lombok.Getter; @@ -36,7 +36,7 @@ import org.junit.jupiter.api.BeforeEach; @Getter(AccessLevel.PROTECTED) -public abstract class BaseIntegrateTest { +public abstract class BaseE2ETest { private static final EmbedTestingServer EMBED_TESTING_SERVER = new EmbedTestingServer(7181); @@ -55,7 +55,7 @@ public abstract class BaseIntegrateTest { private final String jobName = System.nanoTime() + "_test_job"; - protected BaseIntegrateTest(final TestType type, final ElasticJob elasticJob) { + protected BaseE2ETest(final TestType type, final ElasticJob elasticJob) { this.elasticJob = elasticJob; jobConfiguration = getJobConfiguration(jobName); jobBootstrap = createJobBootstrap(type, elasticJob); diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/disable/DisabledJobIntegrateTest.java b/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/disable/DisabledJobE2ETest.java similarity index 87% rename from kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/disable/DisabledJobIntegrateTest.java rename to test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/disable/DisabledJobE2ETest.java index 4a0da3de21..7c37ed9e7a 100644 --- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/disable/DisabledJobIntegrateTest.java +++ b/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/disable/DisabledJobE2ETest.java @@ -15,30 +15,30 @@ * limitations under the License. */ -package org.apache.shardingsphere.elasticjob.kernel.integrate.disable; +package org.apache.shardingsphere.elasticjob.test.e2e.disable; import org.apache.shardingsphere.elasticjob.api.JobConfiguration; import org.apache.shardingsphere.elasticjob.infra.env.IpUtils; -import org.apache.shardingsphere.elasticjob.kernel.internal.config.JobConfigurationPOJO; import org.apache.shardingsphere.elasticjob.infra.yaml.YamlEngine; import org.apache.shardingsphere.elasticjob.kernel.api.bootstrap.impl.ScheduleJobBootstrap; -import org.apache.shardingsphere.elasticjob.kernel.fixture.job.DetailedFooJob; -import org.apache.shardingsphere.elasticjob.kernel.integrate.BaseIntegrateTest; +import org.apache.shardingsphere.elasticjob.kernel.internal.config.JobConfigurationPOJO; import org.apache.shardingsphere.elasticjob.kernel.internal.schedule.JobRegistry; import org.apache.shardingsphere.elasticjob.kernel.internal.server.ServerStatus; +import org.apache.shardingsphere.elasticjob.test.e2e.BaseE2ETest; +import org.apache.shardingsphere.elasticjob.test.e2e.fixture.job.E2EFixtureJobImpl; import org.awaitility.Awaitility; import org.hamcrest.core.IsNull; import java.util.concurrent.TimeUnit; import static org.hamcrest.CoreMatchers.is; -import static org.junit.jupiter.api.Assertions.assertNull; import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertNull; -public abstract class DisabledJobIntegrateTest extends BaseIntegrateTest { +public abstract class DisabledJobE2ETest extends BaseE2ETest { - public DisabledJobIntegrateTest(final TestType type) { - super(type, new DetailedFooJob()); + public DisabledJobE2ETest(final TestType type) { + super(type, new E2EFixtureJobImpl()); } protected final void assertDisabledRegCenterInfo() { diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/disable/OneOffDisabledJobIntegrateTest.java b/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/disable/OneOffDisabledJobE2ETest.java similarity index 88% rename from kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/disable/OneOffDisabledJobIntegrateTest.java rename to test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/disable/OneOffDisabledJobE2ETest.java index 4905aebc6e..634962e1b6 100644 --- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/disable/OneOffDisabledJobIntegrateTest.java +++ b/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/disable/OneOffDisabledJobE2ETest.java @@ -15,14 +15,14 @@ * limitations under the License. */ -package org.apache.shardingsphere.elasticjob.kernel.integrate.disable; +package org.apache.shardingsphere.elasticjob.test.e2e.disable; import org.apache.shardingsphere.elasticjob.api.JobConfiguration; import org.junit.jupiter.api.Test; -class OneOffDisabledJobIntegrateTest extends DisabledJobIntegrateTest { +class OneOffDisabledJobE2ETest extends DisabledJobE2ETest { - OneOffDisabledJobIntegrateTest() { + OneOffDisabledJobE2ETest() { super(TestType.ONE_OFF); } diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/disable/ScheduleDisabledJobIntegrateTest.java b/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/disable/ScheduleDisabledJobE2ETest.java similarity index 87% rename from kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/disable/ScheduleDisabledJobIntegrateTest.java rename to test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/disable/ScheduleDisabledJobE2ETest.java index a2fc80c17c..0b2ded9da3 100644 --- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/disable/ScheduleDisabledJobIntegrateTest.java +++ b/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/disable/ScheduleDisabledJobE2ETest.java @@ -15,12 +15,12 @@ * limitations under the License. */ -package org.apache.shardingsphere.elasticjob.kernel.integrate.disable; +package org.apache.shardingsphere.elasticjob.test.e2e.disable; import org.apache.shardingsphere.elasticjob.api.JobConfiguration; -import org.apache.shardingsphere.elasticjob.kernel.fixture.job.DetailedFooJob; import org.apache.shardingsphere.elasticjob.kernel.internal.schedule.JobRegistry; import org.apache.shardingsphere.elasticjob.kernel.internal.server.ServerStatus; +import org.apache.shardingsphere.elasticjob.test.e2e.fixture.job.E2EFixtureJobImpl; import org.awaitility.Awaitility; import org.junit.jupiter.api.Test; @@ -30,9 +30,9 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertTrue; -class ScheduleDisabledJobIntegrateTest extends DisabledJobIntegrateTest { +class ScheduleDisabledJobE2ETest extends DisabledJobE2ETest { - ScheduleDisabledJobIntegrateTest() { + ScheduleDisabledJobE2ETest() { super(TestType.SCHEDULE); } @@ -46,7 +46,7 @@ protected JobConfiguration getJobConfiguration(final String jobName) { void assertJobRunning() { assertDisabledRegCenterInfo(); setJobEnable(); - Awaitility.await().atMost(10L, TimeUnit.SECONDS).untilAsserted(() -> assertThat(((DetailedFooJob) getElasticJob()).isCompleted(), is(true))); + Awaitility.await().atMost(10L, TimeUnit.SECONDS).untilAsserted(() -> assertThat(((E2EFixtureJobImpl) getElasticJob()).isCompleted(), is(true))); assertEnabledRegCenterInfo(); } diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/enable/EnabledJobIntegrateTest.java b/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/enable/EnabledJobE2ETest.java similarity index 90% rename from kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/enable/EnabledJobIntegrateTest.java rename to test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/enable/EnabledJobE2ETest.java index 2766f5a560..c4bac7be9f 100644 --- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/enable/EnabledJobIntegrateTest.java +++ b/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/enable/EnabledJobE2ETest.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.elasticjob.kernel.integrate.enable; +package org.apache.shardingsphere.elasticjob.test.e2e.enable; import org.apache.shardingsphere.elasticjob.api.ElasticJob; import org.apache.shardingsphere.elasticjob.api.JobConfiguration; @@ -23,7 +23,7 @@ import org.apache.shardingsphere.elasticjob.kernel.internal.config.JobConfigurationPOJO; import org.apache.shardingsphere.elasticjob.infra.yaml.YamlEngine; import org.apache.shardingsphere.elasticjob.kernel.api.bootstrap.impl.ScheduleJobBootstrap; -import org.apache.shardingsphere.elasticjob.kernel.integrate.BaseIntegrateTest; +import org.apache.shardingsphere.elasticjob.test.e2e.BaseE2ETest; import org.apache.shardingsphere.elasticjob.kernel.internal.schedule.JobRegistry; import org.apache.shardingsphere.elasticjob.kernel.internal.server.ServerStatus; import org.junit.jupiter.api.BeforeEach; @@ -33,9 +33,9 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; -public abstract class EnabledJobIntegrateTest extends BaseIntegrateTest { +public abstract class EnabledJobE2ETest extends BaseE2ETest { - protected EnabledJobIntegrateTest(final TestType type, final ElasticJob elasticJob) { + protected EnabledJobE2ETest(final TestType type, final ElasticJob elasticJob) { super(type, elasticJob); } diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/enable/OneOffEnabledJobIntegrateTest.java b/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/enable/OneOffEnabledJobE2ETest.java similarity index 80% rename from kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/enable/OneOffEnabledJobIntegrateTest.java rename to test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/enable/OneOffEnabledJobE2ETest.java index 65b4301de7..35a8634b95 100644 --- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/enable/OneOffEnabledJobIntegrateTest.java +++ b/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/enable/OneOffEnabledJobE2ETest.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.shardingsphere.elasticjob.kernel.integrate.enable; +package org.apache.shardingsphere.elasticjob.test.e2e.enable; import org.apache.shardingsphere.elasticjob.api.JobConfiguration; -import org.apache.shardingsphere.elasticjob.kernel.fixture.job.DetailedFooJob; +import org.apache.shardingsphere.elasticjob.test.e2e.fixture.job.E2EFixtureJobImpl; import org.awaitility.Awaitility; import org.junit.jupiter.api.Test; @@ -28,10 +28,10 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertTrue; -class OneOffEnabledJobIntegrateTest extends EnabledJobIntegrateTest { +class OneOffEnabledJobE2ETest extends EnabledJobE2ETest { - OneOffEnabledJobIntegrateTest() { - super(TestType.ONE_OFF, new DetailedFooJob()); + OneOffEnabledJobE2ETest() { + super(TestType.ONE_OFF, new E2EFixtureJobImpl()); } @Override @@ -42,7 +42,7 @@ protected JobConfiguration getJobConfiguration(final String jobName) { @Test void assertJobInit() { - Awaitility.await().atMost(1L, TimeUnit.MINUTES).untilAsserted(() -> assertThat(((DetailedFooJob) getElasticJob()).isCompleted(), is(true))); + Awaitility.await().atMost(1L, TimeUnit.MINUTES).untilAsserted(() -> assertThat(((E2EFixtureJobImpl) getElasticJob()).isCompleted(), is(true))); assertTrue(getREGISTRY_CENTER().isExisted("/" + getJobName() + "/sharding")); } } diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/enable/ScheduleEnabledJobIntegrateTest.java b/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/enable/ScheduleEnabledJobE2ETest.java similarity index 80% rename from kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/enable/ScheduleEnabledJobIntegrateTest.java rename to test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/enable/ScheduleEnabledJobE2ETest.java index c4a6343723..c2630598e7 100644 --- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/enable/ScheduleEnabledJobIntegrateTest.java +++ b/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/enable/ScheduleEnabledJobE2ETest.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.shardingsphere.elasticjob.kernel.integrate.enable; +package org.apache.shardingsphere.elasticjob.test.e2e.enable; import org.apache.shardingsphere.elasticjob.api.JobConfiguration; -import org.apache.shardingsphere.elasticjob.kernel.fixture.job.DetailedFooJob; +import org.apache.shardingsphere.elasticjob.test.e2e.fixture.job.E2EFixtureJobImpl; import org.awaitility.Awaitility; import org.junit.jupiter.api.Test; @@ -28,10 +28,10 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertTrue; -class ScheduleEnabledJobIntegrateTest extends EnabledJobIntegrateTest { +class ScheduleEnabledJobE2ETest extends EnabledJobE2ETest { - ScheduleEnabledJobIntegrateTest() { - super(TestType.SCHEDULE, new DetailedFooJob()); + ScheduleEnabledJobE2ETest() { + super(TestType.SCHEDULE, new E2EFixtureJobImpl()); } @Override @@ -42,7 +42,7 @@ protected JobConfiguration getJobConfiguration(final String jobName) { @Test void assertJobInit() { - Awaitility.await().atMost(10L, TimeUnit.SECONDS).untilAsserted(() -> assertThat(((DetailedFooJob) getElasticJob()).isCompleted(), is(true))); + Awaitility.await().atMost(10L, TimeUnit.SECONDS).untilAsserted(() -> assertThat(((E2EFixtureJobImpl) getElasticJob()).isCompleted(), is(true))); assertTrue(getREGISTRY_CENTER().isExisted("/" + getJobName() + "/sharding")); } } diff --git a/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/fixture/executor/E2EFixtureJobExecutor.java b/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/fixture/executor/E2EFixtureJobExecutor.java new file mode 100644 index 0000000000..56023790a5 --- /dev/null +++ b/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/fixture/executor/E2EFixtureJobExecutor.java @@ -0,0 +1,37 @@ +/* + * 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.test.e2e.fixture.executor; + +import org.apache.shardingsphere.elasticjob.api.JobConfiguration; +import org.apache.shardingsphere.elasticjob.spi.param.JobRuntimeService; +import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext; +import org.apache.shardingsphere.elasticjob.spi.type.ClassedJobItemExecutor; +import org.apache.shardingsphere.elasticjob.test.e2e.fixture.job.E2EFixtureJob; + +public final class E2EFixtureJobExecutor implements ClassedJobItemExecutor { + + @Override + public void process(final E2EFixtureJob elasticJob, final JobConfiguration jobConfig, final JobRuntimeService jobRuntimeService, final ShardingContext shardingContext) { + elasticJob.foo(shardingContext); + } + + @Override + public Class getElasticJobClass() { + return E2EFixtureJob.class; + } +} diff --git a/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/fixture/job/E2EFixtureJob.java b/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/fixture/job/E2EFixtureJob.java new file mode 100644 index 0000000000..56824f0aa7 --- /dev/null +++ b/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/fixture/job/E2EFixtureJob.java @@ -0,0 +1,31 @@ +/* + * 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.test.e2e.fixture.job; + +import org.apache.shardingsphere.elasticjob.api.ElasticJob; +import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext; + +public interface E2EFixtureJob extends ElasticJob { + + /** + * Do job. + * + * @param shardingContext sharding context + */ + void foo(ShardingContext shardingContext); +} diff --git a/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/fixture/job/E2EFixtureJobImpl.java b/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/fixture/job/E2EFixtureJobImpl.java new file mode 100644 index 0000000000..9dc6bb6211 --- /dev/null +++ b/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/fixture/job/E2EFixtureJobImpl.java @@ -0,0 +1,38 @@ +/* + * 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.test.e2e.fixture.job; + +import lombok.Getter; +import org.apache.shardingsphere.elasticjob.spi.param.ShardingContext; + +import java.util.Collection; +import java.util.concurrent.CopyOnWriteArraySet; + +public final class E2EFixtureJobImpl implements E2EFixtureJob { + + private final Collection completedJobItems = new CopyOnWriteArraySet<>(); + + @Getter + private volatile boolean completed; + + @Override + public void foo(final ShardingContext shardingContext) { + completedJobItems.add(shardingContext.getShardingItem()); + completed = completedJobItems.size() == shardingContext.getShardingTotalCount(); + } +} diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/listener/TestDistributeOnceElasticJobListener.java b/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/fixture/listener/DistributeOnceE2EFixtureJobListener.java similarity index 86% rename from kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/listener/TestDistributeOnceElasticJobListener.java rename to test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/fixture/listener/DistributeOnceE2EFixtureJobListener.java index b0c654c77e..b1580c55c0 100644 --- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/listener/TestDistributeOnceElasticJobListener.java +++ b/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/fixture/listener/DistributeOnceE2EFixtureJobListener.java @@ -15,14 +15,14 @@ * limitations under the License. */ -package org.apache.shardingsphere.elasticjob.kernel.integrate.listener; +package org.apache.shardingsphere.elasticjob.test.e2e.fixture.listener; import org.apache.shardingsphere.elasticjob.infra.listener.ShardingContexts; import org.apache.shardingsphere.elasticjob.kernel.api.listener.AbstractDistributeOnceElasticJobListener; -public class TestDistributeOnceElasticJobListener extends AbstractDistributeOnceElasticJobListener { +public class DistributeOnceE2EFixtureJobListener extends AbstractDistributeOnceElasticJobListener { - public TestDistributeOnceElasticJobListener() { + public DistributeOnceE2EFixtureJobListener() { super(100L, 100L); } diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/listener/TestElasticJobListener.java b/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/fixture/listener/E2EFixtureJobListener.java similarity index 90% rename from kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/listener/TestElasticJobListener.java rename to test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/fixture/listener/E2EFixtureJobListener.java index 81fe295709..6f92f7fa20 100644 --- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/integrate/listener/TestElasticJobListener.java +++ b/test/e2e/src/test/java/org/apache/shardingsphere/elasticjob/test/e2e/fixture/listener/E2EFixtureJobListener.java @@ -15,12 +15,12 @@ * limitations under the License. */ -package org.apache.shardingsphere.elasticjob.kernel.integrate.listener; +package org.apache.shardingsphere.elasticjob.test.e2e.fixture.listener; import org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListener; import org.apache.shardingsphere.elasticjob.infra.listener.ShardingContexts; -public class TestElasticJobListener implements ElasticJobListener { +public class E2EFixtureJobListener implements ElasticJobListener { @Override public void beforeJobExecuted(final ShardingContexts shardingContexts) { diff --git a/test/e2e/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListener b/test/e2e/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListener new file mode 100644 index 0000000000..9c94b1d7d5 --- /dev/null +++ b/test/e2e/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListener @@ -0,0 +1,19 @@ +# +# 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.test.e2e.fixture.listener.DistributeOnceE2EFixtureJobListener +org.apache.shardingsphere.elasticjob.test.e2e.fixture.listener.E2EFixtureJobListener diff --git a/test/e2e/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.spi.type.ClassedJobItemExecutor b/test/e2e/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.spi.type.ClassedJobItemExecutor new file mode 100644 index 0000000000..f3a27ae285 --- /dev/null +++ b/test/e2e/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.spi.type.ClassedJobItemExecutor @@ -0,0 +1,18 @@ +# +# 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.test.e2e.fixture.executor.E2EFixtureJobExecutor diff --git a/test/e2e/src/test/resources/logback-test.xml b/test/e2e/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..ae5d682429 --- /dev/null +++ b/test/e2e/src/test/resources/logback-test.xml @@ -0,0 +1,48 @@ + + + + + + + + + ${log.context.name} + + + + + + ERROR + + + ${log.pattern} + + + + + + + + + + + + + + + diff --git a/test/pom.xml b/test/pom.xml index d2a8a291e1..5c11d880af 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -28,6 +28,7 @@ ${project.artifactId} + e2e util