diff --git a/ecosystem/tracing/rdb/src/main/java/org/apache/shardingsphere/elasticjob/tracing/rdb/datasource/DataSourceConfiguration.java b/ecosystem/tracing/rdb/src/main/java/org/apache/shardingsphere/elasticjob/tracing/rdb/datasource/DataSourceConfiguration.java index 1e43e0d966..ec335f101f 100644 --- a/ecosystem/tracing/rdb/src/main/java/org/apache/shardingsphere/elasticjob/tracing/rdb/datasource/DataSourceConfiguration.java +++ b/ecosystem/tracing/rdb/src/main/java/org/apache/shardingsphere/elasticjob/tracing/rdb/datasource/DataSourceConfiguration.java @@ -40,8 +40,8 @@ /** * Data source configuration. */ -@Getter @RequiredArgsConstructor +@Getter public final class DataSourceConfiguration implements TracingStorageConfiguration { private static final String GETTER_PREFIX = "get"; diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/JobTracingEventBusTest.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/JobTracingEventBusTest.java index 664328ba06..72e23cd874 100644 --- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/JobTracingEventBusTest.java +++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/JobTracingEventBusTest.java @@ -21,8 +21,8 @@ import org.apache.shardingsphere.elasticjob.kernel.tracing.api.TracingConfiguration; import org.apache.shardingsphere.elasticjob.kernel.tracing.event.JobEvent; import org.apache.shardingsphere.elasticjob.kernel.tracing.event.JobExecutionEvent; -import org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.JobEventCaller; -import org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.TestTracingListener; +import org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.config.TracingStorageFixture; +import org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.listener.TestTracingListener; import org.apache.shardingsphere.elasticjob.test.util.ReflectionUtils; import org.awaitility.Awaitility; import org.junit.jupiter.api.Test; @@ -42,7 +42,7 @@ class JobTracingEventBusTest { @Mock - private JobEventCaller jobEventCaller; + private TracingStorageFixture tracingStorage; @Mock private EventBus eventBus; @@ -57,11 +57,11 @@ void assertRegisterFailure() { @Test void assertPost() { - jobTracingEventBus = new JobTracingEventBus(new TracingConfiguration<>("TEST", jobEventCaller)); + jobTracingEventBus = new JobTracingEventBus(new TracingConfiguration<>("TEST", tracingStorage)); assertTrue((Boolean) ReflectionUtils.getFieldValue(jobTracingEventBus, "isRegistered")); jobTracingEventBus.post(new JobExecutionEvent("localhost", "127.0.0.1", "fake_task_id", "test_event_bus_job", JobExecutionEvent.ExecutionSource.NORMAL_TRIGGER, 0)); Awaitility.await().pollDelay(100L, TimeUnit.MILLISECONDS).until(TestTracingListener::isExecutionEventCalled); - verify(jobEventCaller).call(); + verify(tracingStorage).call(); } @Test diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/JobEventCallerConfiguration.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/config/TracingStorageConfigurationFixture.java similarity index 75% rename from kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/JobEventCallerConfiguration.java rename to kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/config/TracingStorageConfigurationFixture.java index 03e626d0d3..93576263d5 100644 --- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/JobEventCallerConfiguration.java +++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/config/TracingStorageConfigurationFixture.java @@ -15,21 +15,15 @@ * limitations under the License. */ -package org.apache.shardingsphere.elasticjob.kernel.tracing.fixture; +package org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.config; +import lombok.Getter; import lombok.RequiredArgsConstructor; import org.apache.shardingsphere.elasticjob.kernel.tracing.api.TracingStorageConfiguration; -/** - * {@link TracingStorageConfiguration} for {@link JobEventCaller}. - */ @RequiredArgsConstructor -public final class JobEventCallerConfiguration implements TracingStorageConfiguration { - - private final JobEventCaller jobEventCaller; +@Getter +public final class TracingStorageConfigurationFixture implements TracingStorageConfiguration { - @Override - public JobEventCaller getStorage() { - return jobEventCaller; - } + private final TracingStorageFixture storage; } diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/JobEventCaller.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/config/TracingStorageFixture.java similarity index 93% rename from kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/JobEventCaller.java rename to kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/config/TracingStorageFixture.java index e980ac97c6..c01563f2b1 100644 --- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/JobEventCaller.java +++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/config/TracingStorageFixture.java @@ -15,12 +15,12 @@ * limitations under the License. */ -package org.apache.shardingsphere.elasticjob.kernel.tracing.fixture; +package org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.config; -public interface JobEventCaller { +public interface TracingStorageFixture { /** - * Execute call. + * Call. */ void call(); } diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/JobEventCallerConverter.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/config/TracingStorageFixtureConverter.java similarity index 71% rename from kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/JobEventCallerConverter.java rename to kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/config/TracingStorageFixtureConverter.java index 7328f089e9..8ea3d16dc1 100644 --- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/JobEventCallerConverter.java +++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/config/TracingStorageFixtureConverter.java @@ -15,23 +15,20 @@ * limitations under the License. */ -package org.apache.shardingsphere.elasticjob.kernel.tracing.fixture; +package org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.config; import org.apache.shardingsphere.elasticjob.kernel.tracing.api.TracingStorageConfiguration; import org.apache.shardingsphere.elasticjob.kernel.tracing.storage.TracingStorageConverter; -/** - * {@link TracingStorageConverter} for {@link JobEventCaller}. - */ -public final class JobEventCallerConverter implements TracingStorageConverter { +public final class TracingStorageFixtureConverter implements TracingStorageConverter { @Override - public TracingStorageConfiguration convertObjectToConfiguration(final JobEventCaller storage) { - return new JobEventCallerConfiguration(storage); + public TracingStorageConfiguration convertObjectToConfiguration(final TracingStorageFixture storage) { + return new TracingStorageConfigurationFixture(storage); } @Override - public Class storageType() { - return JobEventCaller.class; + public Class storageType() { + return TracingStorageFixture.class; } } diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/TestTracingFailureConfiguration.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/listener/TestTracingFailureConfiguration.java similarity index 99% rename from kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/TestTracingFailureConfiguration.java rename to kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/listener/TestTracingFailureConfiguration.java index c5f3de380c..7175f02d16 100644 --- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/TestTracingFailureConfiguration.java +++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/listener/TestTracingFailureConfiguration.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.elasticjob.kernel.tracing.fixture; +package org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.listener; import org.apache.shardingsphere.elasticjob.kernel.tracing.listener.TracingListenerConfiguration; import org.apache.shardingsphere.elasticjob.kernel.tracing.listener.TracingListener; diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/TestTracingListener.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/listener/TestTracingListener.java similarity index 87% rename from kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/TestTracingListener.java rename to kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/listener/TestTracingListener.java index c3b173e16e..85d4375328 100644 --- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/TestTracingListener.java +++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/listener/TestTracingListener.java @@ -15,10 +15,11 @@ * limitations under the License. */ -package org.apache.shardingsphere.elasticjob.kernel.tracing.fixture; +package org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.listener; import lombok.Getter; import lombok.RequiredArgsConstructor; +import org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.config.TracingStorageFixture; import org.apache.shardingsphere.elasticjob.kernel.tracing.listener.TracingListener; import org.apache.shardingsphere.elasticjob.kernel.tracing.event.JobExecutionEvent; import org.apache.shardingsphere.elasticjob.kernel.tracing.event.JobStatusTraceEvent; @@ -29,17 +30,17 @@ public final class TestTracingListener implements TracingListener { @Getter private static volatile boolean executionEventCalled; - private final JobEventCaller jobEventCaller; + private final TracingStorageFixture tracingStorageFixture; @Override public void listen(final JobExecutionEvent jobExecutionEvent) { - jobEventCaller.call(); + tracingStorageFixture.call(); executionEventCalled = true; } @Override public void listen(final JobStatusTraceEvent jobStatusTraceEvent) { - jobEventCaller.call(); + tracingStorageFixture.call(); } /** diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/TestTracingListenerConfiguration.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/listener/TestTracingListenerConfiguration.java similarity index 83% rename from kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/TestTracingListenerConfiguration.java rename to kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/listener/TestTracingListenerConfiguration.java index e665257804..238bfc5b33 100644 --- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/TestTracingListenerConfiguration.java +++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/fixture/listener/TestTracingListenerConfiguration.java @@ -15,15 +15,16 @@ * limitations under the License. */ -package org.apache.shardingsphere.elasticjob.kernel.tracing.fixture; +package org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.listener; +import org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.config.TracingStorageFixture; import org.apache.shardingsphere.elasticjob.kernel.tracing.listener.TracingListenerConfiguration; import org.apache.shardingsphere.elasticjob.kernel.tracing.listener.TracingListener; -public final class TestTracingListenerConfiguration implements TracingListenerConfiguration { +public final class TestTracingListenerConfiguration implements TracingListenerConfiguration { @Override - public TracingListener createTracingListener(final JobEventCaller storage) { + public TracingListener createTracingListener(final TracingStorageFixture storage) { return new TestTracingListener(storage); } diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/storage/TracingStorageConverterFactoryTest.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/storage/TracingStorageConverterFactoryTest.java index b6a93e14be..e3f7f71255 100644 --- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/storage/TracingStorageConverterFactoryTest.java +++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/storage/TracingStorageConverterFactoryTest.java @@ -17,7 +17,7 @@ package org.apache.shardingsphere.elasticjob.kernel.tracing.storage; -import org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.JobEventCaller; +import org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.config.TracingStorageFixture; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -27,7 +27,7 @@ class TracingStorageConverterFactoryTest { @Test void assertConverterExists() { - assertTrue(TracingStorageConverterFactory.findConverter(JobEventCaller.class).isPresent()); + assertTrue(TracingStorageConverterFactory.findConverter(TracingStorageFixture.class).isPresent()); } @Test diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/yaml/YamlJobEventCallerConfiguration.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/yaml/YamlJobEventCallerConfiguration.java index 267678b1f3..ae9fb238e1 100644 --- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/yaml/YamlJobEventCallerConfiguration.java +++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/yaml/YamlJobEventCallerConfiguration.java @@ -20,22 +20,22 @@ import lombok.Getter; import lombok.Setter; import org.apache.shardingsphere.elasticjob.kernel.tracing.api.TracingStorageConfiguration; -import org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.JobEventCaller; -import org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.JobEventCallerConfiguration; +import org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.config.TracingStorageFixture; +import org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.config.TracingStorageConfigurationFixture; /** * YAML JobEventCaller configuration. */ @Getter @Setter -public final class YamlJobEventCallerConfiguration implements YamlTracingStorageConfiguration { +public final class YamlJobEventCallerConfiguration implements YamlTracingStorageConfiguration { private static final long serialVersionUID = -3152825887223378472L; - private JobEventCaller jobEventCaller; + private TracingStorageFixture tracingStorageFixture; @Override - public TracingStorageConfiguration toConfiguration() { - return new JobEventCallerConfiguration(jobEventCaller); + public TracingStorageConfiguration toConfiguration() { + return new TracingStorageConfigurationFixture(tracingStorageFixture); } } diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/yaml/YamlJobEventCallerConfigurationConverter.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/yaml/YamlJobEventCallerConfigurationConverter.java index 9a385de01b..89394eb7ea 100644 --- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/yaml/YamlJobEventCallerConfigurationConverter.java +++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/yaml/YamlJobEventCallerConfigurationConverter.java @@ -19,24 +19,26 @@ import org.apache.shardingsphere.elasticjob.kernel.infra.yaml.config.YamlConfigurationConverter; import org.apache.shardingsphere.elasticjob.kernel.tracing.api.TracingStorageConfiguration; -import org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.JobEventCaller; -import org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.JobEventCallerConfiguration; +import org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.config.TracingStorageFixture; +import org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.config.TracingStorageConfigurationFixture; /** * YAML JobEventCaller configuration converter. */ @SuppressWarnings({"unchecked", "rawtypes"}) -public final class YamlJobEventCallerConfigurationConverter implements YamlConfigurationConverter, YamlTracingStorageConfiguration> { +public final class YamlJobEventCallerConfigurationConverter + implements + YamlConfigurationConverter, YamlTracingStorageConfiguration> { @Override - public YamlTracingStorageConfiguration convertToYamlConfiguration(final TracingStorageConfiguration data) { + public YamlTracingStorageConfiguration convertToYamlConfiguration(final TracingStorageConfiguration data) { YamlJobEventCallerConfiguration result = new YamlJobEventCallerConfiguration(); - result.setJobEventCaller(data.getStorage()); + result.setTracingStorageFixture(data.getStorage()); return result; } @Override public Class getType() { - return JobEventCallerConfiguration.class; + return TracingStorageConfigurationFixture.class; } } diff --git a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/yaml/YamlTracingConfigurationConverterTest.java b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/yaml/YamlTracingConfigurationConverterTest.java index f371b29bfb..acb9312ada 100644 --- a/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/yaml/YamlTracingConfigurationConverterTest.java +++ b/kernel/src/test/java/org/apache/shardingsphere/elasticjob/kernel/tracing/yaml/YamlTracingConfigurationConverterTest.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.elasticjob.kernel.tracing.yaml; import org.apache.shardingsphere.elasticjob.kernel.tracing.api.TracingConfiguration; -import org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.JobEventCaller; +import org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.config.TracingStorageFixture; import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.is; @@ -30,15 +30,15 @@ class YamlTracingConfigurationConverterTest { @Test void assertConvertTracingConfiguration() { - JobEventCaller expectedStorage = () -> { + TracingStorageFixture expectedStorage = () -> { }; - TracingConfiguration tracingConfig = new TracingConfiguration<>("TEST", expectedStorage); - YamlTracingConfigurationConverter converter = new YamlTracingConfigurationConverter<>(); - YamlTracingConfiguration actual = converter.convertToYamlConfiguration(tracingConfig); + TracingConfiguration tracingConfig = new TracingConfiguration<>("TEST", expectedStorage); + YamlTracingConfigurationConverter converter = new YamlTracingConfigurationConverter<>(); + YamlTracingConfiguration actual = converter.convertToYamlConfiguration(tracingConfig); assertThat(actual.getType(), is("TEST")); assertNotNull(actual.getTracingStorageConfiguration()); assertTrue(actual.getTracingStorageConfiguration() instanceof YamlJobEventCallerConfiguration); YamlJobEventCallerConfiguration result = (YamlJobEventCallerConfiguration) actual.getTracingStorageConfiguration(); - assertThat(result.getJobEventCaller(), is(expectedStorage)); + assertThat(result.getTracingStorageFixture(), is(expectedStorage)); } } diff --git a/kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.kernel.tracing.listener.TracingListenerConfiguration b/kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.kernel.tracing.listener.TracingListenerConfiguration index e96753af53..24e9ed4f63 100644 --- a/kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.kernel.tracing.listener.TracingListenerConfiguration +++ b/kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.kernel.tracing.listener.TracingListenerConfiguration @@ -15,5 +15,5 @@ # limitations under the License. # -org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.TestTracingListenerConfiguration -org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.TestTracingFailureConfiguration +org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.listener.TestTracingListenerConfiguration +org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.listener.TestTracingFailureConfiguration diff --git a/kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.kernel.tracing.storage.TracingStorageConverter b/kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.kernel.tracing.storage.TracingStorageConverter index 5a448e5588..2e11a5dec6 100644 --- a/kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.kernel.tracing.storage.TracingStorageConverter +++ b/kernel/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.kernel.tracing.storage.TracingStorageConverter @@ -15,4 +15,4 @@ # limitations under the License. # -org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.JobEventCallerConverter +org.apache.shardingsphere.elasticjob.kernel.tracing.fixture.config.TracingStorageFixtureConverter