pparthenhs commented on a change in pull request #15796:
URL: https://github.com/apache/shardingsphere/pull/15796#discussion_r819546157



##########
File path: 
shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-spi/src/test/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/StandardPipelineDataSourceConfigurationTest.java
##########
@@ -0,0 +1,112 @@
+/*
+ * 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.data.pipeline.api.datasource.config;
+
+import com.zaxxer.hikari.HikariConfig;
+import 
org.apache.shardingsphere.data.pipeline.api.datasource.config.impl.StandardPipelineDataSourceConfiguration;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import java.sql.SQLException;
+import java.util.Properties;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+@RunWith(MockitoJUnitRunner.class)
+public class StandardPipelineDataSourceConfigurationTest {
+
+    private StandardPipelineDataSourceConfiguration 
standardPipelineDataSourceConfiguration;
+
+    @Before
+    public void setUp() throws SQLException {
+        standardPipelineDataSourceConfiguration = new 
StandardPipelineDataSourceConfiguration("jdbc:.*", "userName", "password");
+    }
+
+    @Test
+    public void assertConstructorWithStringSuccess() {
+        String parameter = "jdbcUrl: jdbc:.*\n"
+                 + "username: userName\n"
+                 + "password: password\n";
+        StandardPipelineDataSourceConfiguration 
standardPipelineDataSourceConfigurationOtherInstance = new 
StandardPipelineDataSourceConfiguration(parameter);
+        String actualDatabaseTypeName = 
standardPipelineDataSourceConfigurationOtherInstance.getDatabaseType().getName();
+        String expectedDatabaseTypeName = "SQL92";
+        assertThat(actualDatabaseTypeName, is(expectedDatabaseTypeName));
+    }
+
+    @Test
+    public void assertEqualsAndHashCodeSuccess() {
+        StandardPipelineDataSourceConfiguration 
standardPipelineDataSourceConfigurationOtherInstance = new 
StandardPipelineDataSourceConfiguration("jdbc:.*", "userName", "password");
+        assertThat(standardPipelineDataSourceConfiguration.hashCode(), 
is(standardPipelineDataSourceConfigurationOtherInstance.hashCode()));
+    }
+
+    @Test
+    public void assertGetDatabaseTypeSuccess() {
+        DatabaseType actualDatabaseType = 
standardPipelineDataSourceConfiguration.getDatabaseType();
+        String actualDatabaseTypeName = actualDatabaseType.getName();
+        String expectedDatabaseTypeName = "SQL92";
+        assertThat(actualDatabaseTypeName, is(expectedDatabaseTypeName));
+    }
+
+    @Test
+    public void assertGetHikariConfigSuccess() {
+        HikariConfig actualHikariConfig = 
standardPipelineDataSourceConfiguration.getHikariConfig();
+        long actualActualHikariConfigConnectionTimeout = 
actualHikariConfig.getConnectionTimeout();
+        long expectedActualHikariConfigConnectionTimeout = new Long(30000);
+        assertThat(actualActualHikariConfigConnectionTimeout, 
is(expectedActualHikariConfigConnectionTimeout));
+    }
+
+    @Test
+    public void assertGetParameterSuccess() {
+        String actualParameter = 
standardPipelineDataSourceConfiguration.getParameter();
+        String expectedParameter = "jdbcUrl: jdbc:.*\n"
+               + "username: userName\n"
+               + "password: password\n";
+        assertThat(actualParameter, is(expectedParameter));
+    }
+
+    @Test
+    public void assertGetTypeSuccess() {
+        String actualType = standardPipelineDataSourceConfiguration.getType();
+        String expectedType = "JDBC";
+        assertThat(actualType, is(expectedType));

Review comment:
       Dear @sandynz, 
   
   Thank you for your comment and collaboration.
   
   When we should use the `expectedXXX` pattern ??
   
   I remain always at your disposal.
   
   Best Regards, 
   Panagiotis Parthenis




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to