This is an automated email from the ASF dual-hosted git repository.
kimmking 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 3433faa Add unit test for heartbeat with spring namespace (#6105)
3433faa is described below
commit 3433faa289a371ce59cde724a8642135c21efaf0
Author: Haoran Meng <[email protected]>
AuthorDate: Thu Jun 18 15:45:32 2020 +0800
Add unit test for heartbeat with spring namespace (#6105)
---
.../orchestration/ClusterNamespaceTest.java | 45 ++++++++++++++++++++++
.../META-INF/rdb/namespace/clusterNamespace.xml | 29 ++++++++++++++
2 files changed, 74 insertions(+)
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/orchestration/ClusterNamespaceTest.java
b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/orchestration/ClusterNamespaceTest.java
new file mode 100644
index 0000000..488c23a
--- /dev/null
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/orchestration/ClusterNamespaceTest.java
@@ -0,0 +1,45 @@
+/*
+ * 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.spring.namespace.orchestration;
+
+import
org.apache.shardingsphere.cluster.configuration.config.ClusterConfiguration;
+import org.junit.Test;
+import org.springframework.test.context.ContextConfiguration;
+import
org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+
+@ContextConfiguration(locations =
"classpath:META-INF/rdb/namespace/clusterNamespace.xml")
+public final class ClusterNamespaceTest extends
AbstractJUnit4SpringContextTests {
+
+ @Test
+ public void assertClusterConfiguration() {
+ ClusterConfiguration clusterConfiguration =
applicationContext.getBean("cluster", ClusterConfiguration.class);
+ assertNotNull(clusterConfiguration);
+ assertNotNull(clusterConfiguration.getHeartbeat());
+ assertThat(clusterConfiguration.getHeartbeat().getSql(), is("select
1"));
+ assertThat(clusterConfiguration.getHeartbeat().getInterval(), is(60));
+ assertThat(clusterConfiguration.getHeartbeat().getThreadCount(),
is(1));
+ assertFalse(clusterConfiguration.getHeartbeat().getRetryEnable());
+ assertThat(clusterConfiguration.getHeartbeat().getRetryMaximum(),
is(3));
+ assertThat(clusterConfiguration.getHeartbeat().getRetryInterval(),
is(3));
+ }
+}
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/test/resources/META-INF/rdb/namespace/clusterNamespace.xml
b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/test/resources/META-INF/rdb/namespace/clusterNamespace.xml
new file mode 100644
index 0000000..9bdfe82
--- /dev/null
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/test/resources/META-INF/rdb/namespace/clusterNamespace.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xmlns:orchestration="http://shardingsphere.apache.org/schema/shardingsphere/orchestration"
+ xmlns="http://www.springframework.org/schema/beans"
+
xmlns:cluster="http://shardingsphere.apache.org/schema/shardingsphere/cluster"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+
http://www.springframework.org/schema/beans/spring-beans.xsd
+
http://shardingsphere.apache.org/schema/shardingsphere/cluster
+
http://shardingsphere.apache.org/schema/shardingsphere/orchestration/cluster.xsd
+ ">
+ <cluster:heartbeat id="cluster" threadCount="1" interval="60" sql="select
1" retryEnable="false" retryInterval="3" retryMaximum="3"/>
+</beans>