You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eventmesh.apache.org by mi...@apache.org on 2022/10/24 09:09:15 UTC

[incubator-eventmesh] branch storage-api updated: [ISSUE #1805] add AbstractStorageSQLTest for Storage-Connector module

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

mikexue pushed a commit to branch storage-api
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git


The following commit(s) were added to refs/heads/storage-api by this push:
     new 20dd8485 [ISSUE #1805] add AbstractStorageSQLTest for Storage-Connector module
     new e9aff7cb Merge pull request #1806 from githublaohu/jdbc-connector-storage
20dd8485 is described below

commit 20dd84859ecdb6ae6761e56ee65b81c06618155a
Author: githublaohu <23...@qq.com>
AuthorDate: Mon Oct 24 16:12:22 2022 +0800

    [ISSUE #1805] add AbstractStorageSQLTest for Storage-Connector module
---
 .../storage/jdbc/SQL/AbstractStorageSQLTest.java   | 54 ++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/eventmesh-connector-plugin/eventmesh-connector-storage-jdbc/src/test/java/org/apache/eventmesh/connector/storage/jdbc/SQL/AbstractStorageSQLTest.java b/eventmesh-connector-plugin/eventmesh-connector-storage-jdbc/src/test/java/org/apache/eventmesh/connector/storage/jdbc/SQL/AbstractStorageSQLTest.java
new file mode 100644
index 00000000..c9bbed88
--- /dev/null
+++ b/eventmesh-connector-plugin/eventmesh-connector-storage-jdbc/src/test/java/org/apache/eventmesh/connector/storage/jdbc/SQL/AbstractStorageSQLTest.java
@@ -0,0 +1,54 @@
+/*
+ * 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.eventmesh.connector.storage.jdbc.SQL;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class AbstractStorageSQLTest {
+
+    MySQLStorageSQL storageSQL = new MySQLStorageSQL();
+
+    @Test
+    public void testLocationEventSQL() {
+        String sql = storageSQL.locationEventSQL(StorageSQLTest.TABLE_NAME);
+        Assert.assertEquals(sql,
+            "update cloud_event_test set json_set( cloud_event_consume_location , ? ,? ) where cloud_event_info_id > ? and json_extract(cloud_event_consume_location, ?) is null limit 200");
+    }
+
+    @Test
+    public void testQueryLocationEventSQL() {
+        String sql = storageSQL.queryLocationEventSQL(StorageSQLTest.TABLE_NAME);
+        Assert.assertEquals(sql,
+            "select * from cloud_event_test where cloud_event_info_id > ? and JSON_CONTAINS_PATH(cloud_event_consume_location, 'one', ?)");
+    }
+
+    @Test
+    public void testSelectFastMessageSQL() {
+        String sql = storageSQL.selectFastMessageSQL(StorageSQLTest.TABLE_NAME);
+        Assert.assertEquals(sql,
+            "select 'cloud_event_test' as tableName , cloud_event_info_id from cloud_event_test  order by  cloud_event_info_id limit 1");
+    }
+
+    @Test
+    public void testSelectLastMessageSQL() {
+        String sql = storageSQL.selectLastMessageSQL(StorageSQLTest.TABLE_NAME);
+        Assert.assertEquals(sql,
+            "select 'cloud_event_test' as tableName , cloud_event_info_id from cloud_event_test  order by  cloud_event_info_id desc  limit 1");
+    }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: commits-help@eventmesh.apache.org