This is an automated email from the ASF dual-hosted git repository.

zhaojinchao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 50896d15c09 Add test cases on TimestampLoadingSQLProvider (#33042)
50896d15c09 is described below

commit 50896d15c092490fed3fafa623cdcd910634f759
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Sep 29 00:01:34 2024 +0800

    Add test cases on TimestampLoadingSQLProvider (#33042)
    
    * Add test cases on TimestampLoadingSQLProvider
    
    * Add test cases on TimestampLoadingSQLProvider
---
 .../MySQLTimestampLoadingSQLProviderTest.java      | 42 ++++++++++++++++++++++
 .../OracleTimestampLoadingSQLProviderTest.java     | 42 ++++++++++++++++++++++
 .../PostgreSQLTimestampLoadingSQLProviderTest.java | 42 ++++++++++++++++++++++
 .../SQLServerTimestampLoadingSQLProviderTest.java  | 42 ++++++++++++++++++++++
 4 files changed, 168 insertions(+)

diff --git 
a/kernel/time-service/type/database/src/test/java/org/apache/shardingsphere/timeservice/type/database/provider/dialect/MySQLTimestampLoadingSQLProviderTest.java
 
b/kernel/time-service/type/database/src/test/java/org/apache/shardingsphere/timeservice/type/database/provider/dialect/MySQLTimestampLoadingSQLProviderTest.java
new file mode 100644
index 00000000000..2d99170db74
--- /dev/null
+++ 
b/kernel/time-service/type/database/src/test/java/org/apache/shardingsphere/timeservice/type/database/provider/dialect/MySQLTimestampLoadingSQLProviderTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.timeservice.type.database.provider.dialect;
+
+import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import 
org.apache.shardingsphere.timeservice.type.database.provider.TimestampLoadingSQLProvider;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class MySQLTimestampLoadingSQLProviderTest {
+    
+    private TimestampLoadingSQLProvider provider;
+    
+    @BeforeEach
+    void setUp() {
+        provider = 
TypedSPILoader.getService(TimestampLoadingSQLProvider.class, 
TypedSPILoader.getService(DatabaseType.class, "MySQL"));
+    }
+    
+    @Test
+    void assertGetTimestampLoadingSQL() {
+        assertThat(provider.getTimestampLoadingSQL(), is("SELECT NOW()"));
+    }
+}
diff --git 
a/kernel/time-service/type/database/src/test/java/org/apache/shardingsphere/timeservice/type/database/provider/dialect/OracleTimestampLoadingSQLProviderTest.java
 
b/kernel/time-service/type/database/src/test/java/org/apache/shardingsphere/timeservice/type/database/provider/dialect/OracleTimestampLoadingSQLProviderTest.java
new file mode 100644
index 00000000000..8bbd5759389
--- /dev/null
+++ 
b/kernel/time-service/type/database/src/test/java/org/apache/shardingsphere/timeservice/type/database/provider/dialect/OracleTimestampLoadingSQLProviderTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.timeservice.type.database.provider.dialect;
+
+import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import 
org.apache.shardingsphere.timeservice.type.database.provider.TimestampLoadingSQLProvider;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class OracleTimestampLoadingSQLProviderTest {
+    
+    private TimestampLoadingSQLProvider provider;
+    
+    @BeforeEach
+    void setUp() {
+        provider = 
TypedSPILoader.getService(TimestampLoadingSQLProvider.class, 
TypedSPILoader.getService(DatabaseType.class, "Oracle"));
+    }
+    
+    @Test
+    void assertGetTimestampLoadingSQL() {
+        assertThat(provider.getTimestampLoadingSQL(), is("SELECT sysdate FROM 
DUAL"));
+    }
+}
diff --git 
a/kernel/time-service/type/database/src/test/java/org/apache/shardingsphere/timeservice/type/database/provider/dialect/PostgreSQLTimestampLoadingSQLProviderTest.java
 
b/kernel/time-service/type/database/src/test/java/org/apache/shardingsphere/timeservice/type/database/provider/dialect/PostgreSQLTimestampLoadingSQLProviderTest.java
new file mode 100644
index 00000000000..2754d0c255f
--- /dev/null
+++ 
b/kernel/time-service/type/database/src/test/java/org/apache/shardingsphere/timeservice/type/database/provider/dialect/PostgreSQLTimestampLoadingSQLProviderTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.timeservice.type.database.provider.dialect;
+
+import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import 
org.apache.shardingsphere.timeservice.type.database.provider.TimestampLoadingSQLProvider;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class PostgreSQLTimestampLoadingSQLProviderTest {
+    
+    private TimestampLoadingSQLProvider provider;
+    
+    @BeforeEach
+    void setUp() {
+        provider = 
TypedSPILoader.getService(TimestampLoadingSQLProvider.class, 
TypedSPILoader.getService(DatabaseType.class, "PostgreSQL"));
+    }
+    
+    @Test
+    void assertGetTimestampLoadingSQL() {
+        assertThat(provider.getTimestampLoadingSQL(), is("SELECT NOW()"));
+    }
+}
diff --git 
a/kernel/time-service/type/database/src/test/java/org/apache/shardingsphere/timeservice/type/database/provider/dialect/SQLServerTimestampLoadingSQLProviderTest.java
 
b/kernel/time-service/type/database/src/test/java/org/apache/shardingsphere/timeservice/type/database/provider/dialect/SQLServerTimestampLoadingSQLProviderTest.java
new file mode 100644
index 00000000000..cb928d2e73f
--- /dev/null
+++ 
b/kernel/time-service/type/database/src/test/java/org/apache/shardingsphere/timeservice/type/database/provider/dialect/SQLServerTimestampLoadingSQLProviderTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.timeservice.type.database.provider.dialect;
+
+import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import 
org.apache.shardingsphere.timeservice.type.database.provider.TimestampLoadingSQLProvider;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class SQLServerTimestampLoadingSQLProviderTest {
+    
+    private TimestampLoadingSQLProvider provider;
+    
+    @BeforeEach
+    void setUp() {
+        provider = 
TypedSPILoader.getService(TimestampLoadingSQLProvider.class, 
TypedSPILoader.getService(DatabaseType.class, "SQLServer"));
+    }
+    
+    @Test
+    void assertGetTimestampLoadingSQL() {
+        assertThat(provider.getTimestampLoadingSQL(), is("SELECT GETDATE()"));
+    }
+}

Reply via email to