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:23:59 UTC

[incubator-eventmesh] branch storage-api updated: [ISSUE #1808] add StorageSQLTest 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 261e860b [ISSUE #1808] add StorageSQLTest for Storage-Connector module
     new 8d969cfb Merge pull request #1811 from githublaohu/jdbc-connector-storage
261e860b is described below

commit 261e860b62fd53f3d71a03cff0cce9e748779eb9
Author: githublaohu <23...@qq.com>
AuthorDate: Mon Oct 24 17:21:00 2022 +0800

    [ISSUE #1808] add StorageSQLTest for Storage-Connector module
---
 .../connector/storage/jdbc/SQL/StorageSQLTest.java | 46 ++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/eventmesh-connector-plugin/eventmesh-connector-storage-jdbc/src/test/java/org/apache/eventmesh/connector/storage/jdbc/SQL/StorageSQLTest.java b/eventmesh-connector-plugin/eventmesh-connector-storage-jdbc/src/test/java/org/apache/eventmesh/connector/storage/jdbc/SQL/StorageSQLTest.java
new file mode 100644
index 00000000..5632a929
--- /dev/null
+++ b/eventmesh-connector-plugin/eventmesh-connector-storage-jdbc/src/test/java/org/apache/eventmesh/connector/storage/jdbc/SQL/StorageSQLTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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 StorageSQLTest {
+	
+	public static final String TABLE_NAME = "cloud_event_test";
+
+	MySQLStorageSQL storageSQL = new MySQLStorageSQL();
+	
+	@Test
+	public void testReplySelectSQL() {
+		String sql = storageSQL.replySelectSQL(TABLE_NAME, 5);
+		Assert.assertEquals("select * from cloud_event_test where cloud_event_info_id in(?,?,?,?,?) and cloud_event_reply_data is not null", sql);
+	}
+	
+	@Test
+	public void testReplyResult() {
+		String sql = storageSQL.replyResult(TABLE_NAME);
+		Assert.assertEquals(sql , " update cloud_event_test  set  cloud_event_reply_data = ? , cloud_event_reply_state = 'NOTHING' where cloud_event_info_id = ?");
+	}
+	
+	@Test
+	public void testUpdateOffsetSQL() {
+		String sql = storageSQL.updateOffsetSQL(TABLE_NAME);
+		Assert.assertEquals(sql , "update cloud_event_test set cloud_event_state = 'SUCCESS'  where cloud_event_info_id = ?");
+	}
+}


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