You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2021/06/30 11:07:11 UTC
[shardingsphere] branch master updated: unit test for
ResourceDataSource (#11068)
This is an automated email from the ASF dual-hosted git repository.
panjuan 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 7b7c1bb unit test for ResourceDataSource (#11068)
7b7c1bb is described below
commit 7b7c1bb2815732f27e1c7d3daf371d49506303ea
Author: namitad <de...@gmail.com>
AuthorDate: Wed Jun 30 16:36:35 2021 +0530
unit test for ResourceDataSource (#11068)
* unit test for ResourceDataSource
* declare test class as final
---
.../transaction/core/ResourceDataSourceTest.java | 36 ++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/shardingsphere-transaction/shardingsphere-transaction-core/src/test/java/org/apache/shardingsphere/transaction/core/ResourceDataSourceTest.java b/shardingsphere-transaction/shardingsphere-transaction-core/src/test/java/org/apache/shardingsphere/transaction/core/ResourceDataSourceTest.java
new file mode 100644
index 0000000..58d6b1b
--- /dev/null
+++ b/shardingsphere-transaction/shardingsphere-transaction-core/src/test/java/org/apache/shardingsphere/transaction/core/ResourceDataSourceTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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.transaction.core;
+
+import org.apache.commons.dbcp2.BasicDataSource;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public final class ResourceDataSourceTest {
+
+ @Test
+ public void assertNewInstance() {
+ ResourceDataSource testResourceDataSource = new ResourceDataSource("sampleDataSource", new BasicDataSource());
+ assertEquals("sampleDataSource", testResourceDataSource.getOriginalName());
+ assertTrue(testResourceDataSource.getDataSource() instanceof BasicDataSource);
+ assertTrue(testResourceDataSource.getUniqueResourceName().contains("resource"));
+ assertTrue(testResourceDataSource.getUniqueResourceName().contains("sampleDataSource"));
+ }
+}