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 3aeacd8f16a Create PipelineDataSourceFactoryTest.java (#19288) 3aeacd8f16a is described below commit 3aeacd8f16a6a0556d72ae3bd5e50307e8f4c0ae Author: skai <sunkai....@gmail.com> AuthorDate: Mon Jul 18 23:39:13 2022 +0800 Create PipelineDataSourceFactoryTest.java (#19288) * Create PipelineDataSourceFactoryTest.java * change from review * fix error from checkstyle * change from review Co-authored-by: skai <sk...@topode.com> --- .../datasource/PipelineDataSourceFactoryTest.java | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/test/java/org/apache/shardingsphere/data/pipeline/core/datasource/PipelineDataSourceFactoryTest.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/test/java/org/apache/shardingsphere/data/pipeline/core/datasource/PipelineDataSourceFactoryTest.java new file mode 100644 index 00000000000..4a64766adea --- /dev/null +++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/test/java/org/apache/shardingsphere/data/pipeline/core/datasource/PipelineDataSourceFactoryTest.java @@ -0,0 +1,42 @@ +/* + * 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.core.datasource; + +import org.apache.shardingsphere.data.pipeline.api.datasource.PipelineDataSourceWrapper; +import org.apache.shardingsphere.data.pipeline.api.datasource.config.impl.StandardPipelineDataSourceConfiguration; +import org.junit.Test; + +import java.util.HashMap; +import java.util.Map; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; + +public final class PipelineDataSourceFactoryTest { + + @Test + public void assertNewInstance() { + Map<String, Object> yamlDataSourceConfig = new HashMap<>(3, 1); + yamlDataSourceConfig.put("url", "jdbc:mysql://localhost:3306/database"); + yamlDataSourceConfig.put("username", "username"); + yamlDataSourceConfig.put("password", "password"); + StandardPipelineDataSourceConfiguration standardPipelineDataSourceConfiguration = new StandardPipelineDataSourceConfiguration(yamlDataSourceConfig); + PipelineDataSourceWrapper pipelineDataSourceWrapper = PipelineDataSourceFactory.newInstance(standardPipelineDataSourceConfiguration); + assertThat(pipelineDataSourceWrapper.getDatabaseType(), is(standardPipelineDataSourceConfiguration.getDatabaseType())); + } +}