@@ -44,13 +44,27 @@ public class IoTDBPipeWriteBackSinkIT extends AbstractPipeDualManualIT {
4444
4545 @ Test
4646 public void testWriteBackSinkWithTargetDatabaseForTreeModel () throws Exception {
47+ testWriteBackSinkWithTargetDatabaseForTreeModel ("root.target.db" );
48+ }
49+
50+ @ Test
51+ public void testWriteBackSinkPreservesTreeModelTargetDatabaseCase () throws Exception {
52+ testWriteBackSinkWithTargetDatabaseForTreeModel ("TargetDB" );
53+ }
54+
55+ private void testWriteBackSinkWithTargetDatabaseForTreeModel (final String targetDatabase )
56+ throws Exception {
57+ final String qualifiedTargetDatabase =
58+ targetDatabase .startsWith ("root." ) ? targetDatabase : "root." + targetDatabase ;
4759 TestUtils .executeNonQueries (
4860 senderEnv ,
4961 Arrays .asList (
5062 "create database root.source" ,
5163 "create timeseries root.source.d1.s1 with datatype=INT32,encoding=PLAIN" ,
52- "create database root.target.db" ,
53- "create timeseries root.target.db.d1.s1 with datatype=INT32,encoding=PLAIN" ),
64+ "create database " + qualifiedTargetDatabase ,
65+ "create timeseries "
66+ + qualifiedTargetDatabase
67+ + ".d1.s1 with datatype=INT32,encoding=PLAIN" ),
5468 null );
5569
5670 try (final SyncConfigNodeIServiceClient client =
@@ -65,7 +79,7 @@ public void testWriteBackSinkWithTargetDatabaseForTreeModel() throws Exception {
6579 sourceAttributes .put ("user" , "root" );
6680
6781 sinkAttributes .put ("sink" , "write-back-sink" );
68- sinkAttributes .put ("sink.database" , "root.target.db" );
82+ sinkAttributes .put ("sink.database" , targetDatabase );
6983 sinkAttributes .put ("user" , "root" );
7084
7185 final TSStatus status =
@@ -89,8 +103,8 @@ public void testWriteBackSinkWithTargetDatabaseForTreeModel() throws Exception {
89103
90104 TestUtils .assertDataEventuallyOnEnv (
91105 senderEnv ,
92- "select * from root.target.db .**" ,
93- "Time,root.target.db .d1.s1," ,
106+ "select * from " + qualifiedTargetDatabase + " .**" ,
107+ "Time," + qualifiedTargetDatabase + " .d1.s1," ,
94108 Collections .unmodifiableSet (new HashSet <>(Arrays .asList ("1,1," , "2,2," ))));
95109 }
96110}
0 commit comments