You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2020/08/04 09:37:04 UTC

[shardingsphere] branch master updated: Add: add test case for MySQLServerInfo setServerVersion(#6574) (#6607)

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

zhangliang 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 a95ee5d  Add: add test case for MySQLServerInfo setServerVersion(#6574) (#6607)
a95ee5d is described below

commit a95ee5dc9e43d3e53f31d35f4aac278c7222a9e7
Author: 孙念君 Sun Nianjun <su...@huobi.com>
AuthorDate: Tue Aug 4 17:36:53 2020 +0800

    Add: add test case for MySQLServerInfo setServerVersion(#6574) (#6607)
    
    * Add: add test case for MySQLServerInfo setServerVersion(#6574)
    
    * Add: add assertion for null condition (#6590)
    
    * Refactor: remove the final modifier
    
    * Refactor: removed the fileds
    
    * Refactor: add final modifier to class sinace there is no need for inheritance
    
    * Add: add the licence content
---
 .../mysql/constant/MySQLServerInfoTest.java        | 38 ++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLServerInfoTest.java b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLServerInfoTest.java
new file mode 100644
index 0000000..8f31395
--- /dev/null
+++ b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLServerInfoTest.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.db.protocol.mysql.constant;
+
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public final class MySQLServerInfoTest {
+
+    @Test
+    public void assertSetServerVersion() {
+        MySQLServerInfo.setServerVersion("5.1.47");
+        assertThat(MySQLServerInfo.getServerVersion(), is("5.1.47-ShardingSphere-Proxy 5.0.0-RC1"));
+    }
+
+    @Test
+    public void assertSetServerVersionForNull() {
+        MySQLServerInfo.setServerVersion(null);
+        assertThat(MySQLServerInfo.getServerVersion(), is("null-ShardingSphere-Proxy 5.0.0-RC1"));
+    }
+}