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 2022/04/08 15:10:26 UTC

[shardingsphere] branch master updated: add test (#16674)

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 e6132d8e2fe add test (#16674)
e6132d8e2fe is described below

commit e6132d8e2fec08e9c7c4e92992ca63b9aee66b1c
Author: weihubeats <we...@163.com>
AuthorDate: Fri Apr 8 23:10:17 2022 +0800

    add test (#16674)
    
    * add test
    
    * remove package
---
 .../infra/binder/segment/table/TablesContextTest.java         | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/shardingsphere-infra/shardingsphere-infra-binder/src/test/java/org/apache/shardingsphere/infra/binder/segment/table/TablesContextTest.java b/shardingsphere-infra/shardingsphere-infra-binder/src/test/java/org/apache/shardingsphere/infra/binder/segment/table/TablesContextTest.java
index be0b0469cc9..d2ea647540f 100644
--- a/shardingsphere-infra/shardingsphere-infra-binder/src/test/java/org/apache/shardingsphere/infra/binder/segment/table/TablesContextTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-binder/src/test/java/org/apache/shardingsphere/infra/binder/segment/table/TablesContextTest.java
@@ -236,4 +236,15 @@ public final class TablesContextTest {
         tableSegment2.setOwner(new OwnerSegment(0, 0, new IdentifierValue("sharding_db_2")));
         new TablesContext(Arrays.asList(tableSegment1, tableSegment2), DatabaseTypeRegistry.getDefaultDatabaseType()).getDatabaseName();
     }
+
+    @Test
+    public void assertGetSchemaName() {
+        SimpleTableSegment tableSegment1 = createTableSegment("table_1", "tbl_1");
+        tableSegment1.setOwner(new OwnerSegment(0, 0, new IdentifierValue("sharding_db_1")));
+        SimpleTableSegment tableSegment2 = createTableSegment("table_2", "tbl_2");
+        tableSegment2.setOwner(new OwnerSegment(0, 0, new IdentifierValue("sharding_db_1")));
+        TablesContext tablesContext = new TablesContext(Arrays.asList(tableSegment1, tableSegment2), DatabaseTypeRegistry.getDefaultDatabaseType());
+        assertTrue(tablesContext.getSchemaName().isPresent());
+        assertThat(tablesContext.getSchemaName().get(), is("sharding_db_1"));
+    }
 }