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 bb7461dd4d6 Remove useless MultiSourceProperties (#36256)
bb7461dd4d6 is described below
commit bb7461dd4d6cf63398c86904c0857fac4c8ae289
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Aug 11 21:00:38 2025 +0800
Remove useless MultiSourceProperties (#36256)
---
.../infra/util/props/MultiSourceProperties.java | 55 ---------------------
.../util/props/MultiSourcePropertiesTest.java | 56 ----------------------
2 files changed, 111 deletions(-)
diff --git
a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/props/MultiSourceProperties.java
b/infra/util/src/main/java/org/apache/shardingsphere/infra/util/props/MultiSourceProperties.java
deleted file mode 100644
index 6a126aeee95..00000000000
---
a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/props/MultiSourceProperties.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.infra.util.props;
-
-import java.util.Properties;
-
-/**
- * Multi source properties.
- */
-public final class MultiSourceProperties extends Properties {
-
- private static final long serialVersionUID = 4196837300230442865L;
-
- private final Properties[] multiProps;
-
- public MultiSourceProperties(final Properties... multiProps) {
- this.multiProps = multiProps;
- }
-
- @Override
- public String getProperty(final String key) {
- String value = super.getProperty(key);
- if (null != value) {
- return value;
- }
- for (Properties each : multiProps) {
- value = each.getProperty(key);
- if (null != value) {
- return value;
- }
- }
- return null;
- }
-
- @Override
- public String getProperty(final String key, final String defaultValue) {
- String value = getProperty(key);
- return null == value ? defaultValue : value;
- }
-}
diff --git
a/infra/util/src/test/java/org/apache/shardingsphere/infra/util/props/MultiSourcePropertiesTest.java
b/infra/util/src/test/java/org/apache/shardingsphere/infra/util/props/MultiSourcePropertiesTest.java
deleted file mode 100644
index ca06899199b..00000000000
---
a/infra/util/src/test/java/org/apache/shardingsphere/infra/util/props/MultiSourcePropertiesTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.infra.util.props;
-
-import org.apache.shardingsphere.infra.util.props.PropertiesBuilder.Property;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import java.util.Properties;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertNull;
-
-class MultiSourcePropertiesTest {
-
- private MultiSourceProperties multiSourceProperties;
-
- @BeforeEach
- void setUp() {
- Properties propsA = PropertiesBuilder.build(new Property("keyA",
"valueA"));
- Properties propsB = new Properties(PropertiesBuilder.build(new
Property("keyA", "valueB"), new Property("keyB", "valueB")));
- multiSourceProperties = new MultiSourceProperties(propsA, propsB);
- multiSourceProperties.setProperty("originalKey", "originalValue");
- }
-
- @Test
- void assertGetProperty() {
- assertThat(multiSourceProperties.getProperty("originalKey"),
is("originalValue"));
- assertThat(multiSourceProperties.getProperty("keyA"), is("valueA"));
- assertThat(multiSourceProperties.getProperty("keyB"), is("valueB"));
- assertNull(multiSourceProperties.getProperty("keyC"));
- }
-
- @Test
- void assertGetPropertyWithDefaultValue() {
- assertThat(multiSourceProperties.getProperty("keyA", "defaultValue"),
is("valueA"));
- assertThat(multiSourceProperties.getProperty("keyB", "defaultValue"),
is("valueB"));
- assertThat(multiSourceProperties.getProperty("keyC", "defaultValue"),
is("defaultValue"));
- }
-}