You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2023/10/10 01:47:45 UTC
[servicecomb-java-chassis] 20/25: [SCB-2008]remove archaius adapters
This is an automated email from the ASF dual-hosted git repository.
liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git
commit f4ac0ec8b9cac13db6c55f2df3e6d214883f78b5
Author: liubao <bi...@qq.com>
AuthorDate: Sun Oct 8 19:20:30 2023 +0800
[SCB-2008]remove archaius adapters
---
.../core/ConfigurationSpringInitializer.java | 2 +-
.../ServiceCombConfigurationEventAdapter.java | 21 +----
.../config/ConcurrentMapConfigurationExt.java | 53 ------------
.../apache/servicecomb/config/ConfigMapping.java | 12 +--
.../scheduler/NeverStartPollingScheduler.java | 35 --------
.../config/archaius/sources/ConfigSourceMaker.java | 28 -------
.../sources/MicroserviceConfigurationSource.java | 49 -----------
.../event/DynamicConfigurationChangedEvent.java | 32 -------
.../event/RefreshGovernanceConfigurationEvent.java | 32 -------
.../sources => file}/AbstractConfigLoader.java | 2 +-
.../{archaius/sources => file}/ConfigModel.java | 2 +-
.../sources => file}/MicroserviceConfigLoader.java | 2 +-
.../sources => file}/YAMLConfigLoader.java | 2 +-
.../sources/TestYAMLConfigurationSource.java | 98 ----------------------
.../TestMicroserviceConfigLoader.java | 4 +-
15 files changed, 12 insertions(+), 362 deletions(-)
diff --git a/core/src/main/java/org/apache/servicecomb/core/ConfigurationSpringInitializer.java b/core/src/main/java/org/apache/servicecomb/core/ConfigurationSpringInitializer.java
index dc602b47d..6465457bd 100644
--- a/core/src/main/java/org/apache/servicecomb/core/ConfigurationSpringInitializer.java
+++ b/core/src/main/java/org/apache/servicecomb/core/ConfigurationSpringInitializer.java
@@ -27,7 +27,7 @@ import java.util.stream.Collectors;
import org.apache.servicecomb.config.ConfigMapping;
import org.apache.servicecomb.config.DynamicPropertiesSource;
import org.apache.servicecomb.config.YAMLUtil;
-import org.apache.servicecomb.config.archaius.sources.MicroserviceConfigLoader;
+import org.apache.servicecomb.config.file.MicroserviceConfigLoader;
import org.apache.servicecomb.foundation.bootstrap.BootStrapService;
import org.apache.servicecomb.foundation.common.utils.SPIServiceUtils;
import org.slf4j.Logger;
diff --git a/core/src/main/java/org/apache/servicecomb/core/governance/ServiceCombConfigurationEventAdapter.java b/core/src/main/java/org/apache/servicecomb/core/governance/ServiceCombConfigurationEventAdapter.java
index bb15d232f..e5ee61cd5 100644
--- a/core/src/main/java/org/apache/servicecomb/core/governance/ServiceCombConfigurationEventAdapter.java
+++ b/core/src/main/java/org/apache/servicecomb/core/governance/ServiceCombConfigurationEventAdapter.java
@@ -18,11 +18,7 @@
package org.apache.servicecomb.core.governance;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.servicecomb.config.event.RefreshGovernanceConfigurationEvent;
+import org.apache.servicecomb.config.ConfigurationChangedEvent;
import org.apache.servicecomb.foundation.common.event.EventManager;
import org.apache.servicecomb.governance.event.GovernanceConfigurationChangedEvent;
import org.apache.servicecomb.governance.event.GovernanceEventManager;
@@ -35,19 +31,8 @@ public class ServiceCombConfigurationEventAdapter {
}
@Subscribe
- public void onConfigurationChangedEvent(RefreshGovernanceConfigurationEvent event) {
- Set<String> changedKeys = new HashSet<>();
- addMap(changedKeys, event.getEvent().getAdded());
- addMap(changedKeys, event.getEvent().getDeleted());
- addMap(changedKeys, event.getEvent().getChanged());
- addMap(changedKeys, event.getEvent().getComplete());
- GovernanceConfigurationChangedEvent newEvent = new GovernanceConfigurationChangedEvent(changedKeys);
+ public void onConfigurationChangedEvent(ConfigurationChangedEvent event) {
+ GovernanceConfigurationChangedEvent newEvent = new GovernanceConfigurationChangedEvent(event.getChanged());
GovernanceEventManager.post(newEvent);
}
-
- private void addMap(Set<String> keys, Map<String, Object> changed) {
- if (changed != null) {
- keys.addAll(changed.keySet());
- }
- }
}
diff --git a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConcurrentMapConfigurationExt.java b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConcurrentMapConfigurationExt.java
deleted file mode 100644
index 814409228..000000000
--- a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConcurrentMapConfigurationExt.java
+++ /dev/null
@@ -1,53 +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.servicecomb.config;
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.commons.configuration.AbstractConfiguration;
-
-import com.netflix.config.ConcurrentMapConfiguration;
-
-/**
- * Disable delimiter parsing for string
- */
-@SuppressWarnings("unchecked")
-public class ConcurrentMapConfigurationExt extends ConcurrentMapConfiguration {
- public ConcurrentMapConfigurationExt() {
- super();
- setDelimiterParsingDisabled(true);
- }
-
- public ConcurrentMapConfigurationExt(Map<String, Object> mapToCopy) {
- super();
- setDelimiterParsingDisabled(true);
- map = new ConcurrentHashMap<>(mapToCopy);
- }
-
- public ConcurrentMapConfigurationExt(AbstractConfiguration config) {
- super();
- config.setDelimiterParsingDisabled(true);
- for (Iterator<String> i = config.getKeys(); i.hasNext(); ) {
- String name = i.next();
- Object value = config.getProperty(name);
- map.put(name, value);
- }
- }
-}
diff --git a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigMapping.java b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigMapping.java
index 3063c8cdd..d80caaa51 100644
--- a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigMapping.java
+++ b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/ConfigMapping.java
@@ -27,8 +27,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import org.apache.commons.configuration.Configuration;
-import org.apache.servicecomb.config.archaius.sources.AbstractConfigLoader;
+import org.apache.servicecomb.config.file.AbstractConfigLoader;
import org.apache.servicecomb.foundation.common.utils.JvmUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -95,15 +94,6 @@ public final class ConfigMapping {
return retMap;
}
- public static Map<String, Object> getConvertedMap(Configuration config) {
- if (configMap == null) {
- return new LinkedHashMap<>();
- }
- Map<String, Object> retMap = new LinkedHashMap<>();
- configMap.entrySet().forEach(entry -> putConfigsToRetMap(retMap, entry, config.getProperty(entry.getKey())));
- return retMap;
- }
-
public static Map<String, Object> getConvertedMap(Environment environment) {
if (configMap == null) {
return new LinkedHashMap<>();
diff --git a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/archaius/scheduler/NeverStartPollingScheduler.java b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/archaius/scheduler/NeverStartPollingScheduler.java
deleted file mode 100644
index fb52d0663..000000000
--- a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/archaius/scheduler/NeverStartPollingScheduler.java
+++ /dev/null
@@ -1,35 +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.servicecomb.config.archaius.scheduler;
-
-import com.netflix.config.AbstractPollingScheduler;
-
-/**
- * Created by on 2017/3/29.
- */
-public class NeverStartPollingScheduler extends AbstractPollingScheduler {
- @Override
- protected void schedule(Runnable runnable) {
- return;
- }
-
- @Override
- public void stop() {
- return;
- }
-}
diff --git a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/archaius/sources/ConfigSourceMaker.java b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/archaius/sources/ConfigSourceMaker.java
deleted file mode 100644
index f822e30d9..000000000
--- a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/archaius/sources/ConfigSourceMaker.java
+++ /dev/null
@@ -1,28 +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.servicecomb.config.archaius.sources;
-
-public class ConfigSourceMaker {
-
- public static MicroserviceConfigurationSource yamlConfigSource() {
- MicroserviceConfigLoader loader = new MicroserviceConfigLoader();
- loader.loadAndSort();
-
- return new MicroserviceConfigurationSource(loader.getConfigModels());
- }
-}
diff --git a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/archaius/sources/MicroserviceConfigurationSource.java b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/archaius/sources/MicroserviceConfigurationSource.java
deleted file mode 100644
index e39c987a7..000000000
--- a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/archaius/sources/MicroserviceConfigurationSource.java
+++ /dev/null
@@ -1,49 +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.servicecomb.config.archaius.sources;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.servicecomb.config.YAMLUtil;
-
-import com.netflix.config.PollResult;
-import com.netflix.config.PolledConfigurationSource;
-
-public class MicroserviceConfigurationSource implements PolledConfigurationSource {
- private final List<ConfigModel> configModels;
-
- public MicroserviceConfigurationSource(List<ConfigModel> configModels) {
- this.configModels = configModels;
- }
-
- public List<ConfigModel> getConfigModels() {
- return configModels;
- }
-
- public PollResult poll(boolean b, Object o) throws Exception {
- Map<String, Object> configurations = new LinkedHashMap<>();
-
- for (ConfigModel configModel : configModels) {
- configurations.putAll(YAMLUtil.retrieveItems("", configModel.getConfig()));
- }
-
- return PollResult.createFull(configurations);
- }
-}
diff --git a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/event/DynamicConfigurationChangedEvent.java b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/event/DynamicConfigurationChangedEvent.java
deleted file mode 100644
index b466d2191..000000000
--- a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/event/DynamicConfigurationChangedEvent.java
+++ /dev/null
@@ -1,32 +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.servicecomb.config.event;
-
-import com.netflix.config.WatchedUpdateResult;
-
-public class DynamicConfigurationChangedEvent {
- private final WatchedUpdateResult event;
-
- public DynamicConfigurationChangedEvent(WatchedUpdateResult event) {
- this.event = event;
- }
-
- public WatchedUpdateResult getEvent() {
- return this.event;
- }
-}
diff --git a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/event/RefreshGovernanceConfigurationEvent.java b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/event/RefreshGovernanceConfigurationEvent.java
deleted file mode 100644
index a3e1d799f..000000000
--- a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/event/RefreshGovernanceConfigurationEvent.java
+++ /dev/null
@@ -1,32 +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.servicecomb.config.event;
-
-import com.netflix.config.WatchedUpdateResult;
-
-public class RefreshGovernanceConfigurationEvent {
- private final WatchedUpdateResult event;
-
- public RefreshGovernanceConfigurationEvent(WatchedUpdateResult event) {
- this.event = event;
- }
-
- public WatchedUpdateResult getEvent() {
- return this.event;
- }
-}
diff --git a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/archaius/sources/AbstractConfigLoader.java b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/file/AbstractConfigLoader.java
similarity index 98%
rename from foundations/foundation-config/src/main/java/org/apache/servicecomb/config/archaius/sources/AbstractConfigLoader.java
rename to foundations/foundation-config/src/main/java/org/apache/servicecomb/config/file/AbstractConfigLoader.java
index 74051441c..085afc8c7 100644
--- a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/archaius/sources/AbstractConfigLoader.java
+++ b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/file/AbstractConfigLoader.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.servicecomb.config.archaius.sources;
+package org.apache.servicecomb.config.file;
import java.io.IOException;
import java.net.URL;
diff --git a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/archaius/sources/ConfigModel.java b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/file/ConfigModel.java
similarity index 96%
rename from foundations/foundation-config/src/main/java/org/apache/servicecomb/config/archaius/sources/ConfigModel.java
rename to foundations/foundation-config/src/main/java/org/apache/servicecomb/config/file/ConfigModel.java
index bb702bf59..41732f9ab 100644
--- a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/archaius/sources/ConfigModel.java
+++ b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/file/ConfigModel.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.servicecomb.config.archaius.sources;
+package org.apache.servicecomb.config.file;
import java.net.URL;
import java.util.Map;
diff --git a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/archaius/sources/MicroserviceConfigLoader.java b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/file/MicroserviceConfigLoader.java
similarity index 98%
rename from foundations/foundation-config/src/main/java/org/apache/servicecomb/config/archaius/sources/MicroserviceConfigLoader.java
rename to foundations/foundation-config/src/main/java/org/apache/servicecomb/config/file/MicroserviceConfigLoader.java
index e9e210255..f33f9cc23 100644
--- a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/archaius/sources/MicroserviceConfigLoader.java
+++ b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/file/MicroserviceConfigLoader.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.servicecomb.config.archaius.sources;
+package org.apache.servicecomb.config.file;
import java.io.IOException;
import java.net.URL;
diff --git a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/archaius/sources/YAMLConfigLoader.java b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/file/YAMLConfigLoader.java
similarity index 95%
rename from foundations/foundation-config/src/main/java/org/apache/servicecomb/config/archaius/sources/YAMLConfigLoader.java
rename to foundations/foundation-config/src/main/java/org/apache/servicecomb/config/file/YAMLConfigLoader.java
index f50451f6d..ac69e8d4d 100644
--- a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/archaius/sources/YAMLConfigLoader.java
+++ b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/file/YAMLConfigLoader.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.servicecomb.config.archaius.sources;
+package org.apache.servicecomb.config.file;
import java.io.IOException;
import java.io.InputStream;
diff --git a/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/archaius/sources/TestYAMLConfigurationSource.java b/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/archaius/sources/TestYAMLConfigurationSource.java
deleted file mode 100644
index 34fbea2cd..000000000
--- a/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/archaius/sources/TestYAMLConfigurationSource.java
+++ /dev/null
@@ -1,98 +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.servicecomb.config.archaius.sources;
-
-import java.net.URL;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.configuration.SystemConfiguration;
-import org.apache.servicecomb.config.archaius.scheduler.NeverStartPollingScheduler;
-import org.junit.Test;
-
-import com.netflix.config.ConcurrentCompositeConfiguration;
-import com.netflix.config.ConcurrentMapConfiguration;
-import com.netflix.config.DynamicConfiguration;
-import com.netflix.config.PollResult;
-import org.junit.jupiter.api.Assertions;
-
-/**
- * Created by on 2017/1/5.
- */
-public class TestYAMLConfigurationSource {
-
- @Test
- public void testPullFromClassPath() throws Exception {
- MicroserviceConfigLoader loader = new MicroserviceConfigLoader();
- loader.loadAndSort();
-
- MicroserviceConfigurationSource configSource = new MicroserviceConfigurationSource(loader.getConfigModels());
- PollResult result = configSource.poll(true, null);
- Map<String, Object> configMap = result.getComplete();
- Assertions.assertNotNull(configMap);
- Assertions.assertEquals(23, configMap.size());
- Assertions.assertNotNull(configMap.get("trace.handler.sampler.percent"));
- Assertions.assertEquals(0.5, configMap.get("trace.handler.sampler.percent"));
- }
-
- @Test
- public void testPullFroGivenURL() throws Exception {
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- URL test1URL = loader.getResource("test1.yaml");
- URL test2URL = loader.getResource("test2.yaml");
- System.setProperty("servicecomb.configurationSource.additionalUrls", test1URL.toString() + "," + test2URL.toString());
- MicroserviceConfigLoader loader1 = new MicroserviceConfigLoader();
- loader1.loadAndSort();
-
- MicroserviceConfigurationSource configSource = new MicroserviceConfigurationSource(loader1.getConfigModels());
- PollResult result = configSource.poll(true, null);
- Map<String, Object> configMap = result.getComplete();
-
- Assertions.assertEquals(3, configSource.getConfigModels().size());
- Assertions.assertNotNull(configMap);
- Assertions.assertEquals(34, configMap.size());
- Assertions.assertNotNull(configMap.get("trace.handler.sampler.percent"));
- Assertions.assertEquals(0.5, configMap.get("trace.handler.sampler.percent"));
-
- System.getProperties().remove("servicecomb.configurationSource.additionalUrls");
- }
-
- @Test
- public void testFullOperation() {
- // configuration from system properties
- ConcurrentMapConfiguration configFromSystemProperties =
- new ConcurrentMapConfiguration(new SystemConfiguration());
- // configuration from yaml file
- MicroserviceConfigLoader loader = new MicroserviceConfigLoader();
- loader.loadAndSort();
-
- DynamicConfiguration configFromYamlFile =
- new DynamicConfiguration(new MicroserviceConfigurationSource(loader.getConfigModels()), new NeverStartPollingScheduler());
- // create a hierarchy of configuration that makes
- // 1) dynamic configuration source override system properties
- ConcurrentCompositeConfiguration finalConfig = new ConcurrentCompositeConfiguration();
- finalConfig.addConfiguration(configFromYamlFile, "yamlConfig");
- finalConfig.addConfiguration(configFromSystemProperties, "systemEnvConfig");
- Assertions.assertEquals(0.5, finalConfig.getDouble("trace.handler.sampler.percent"), 0.5);
-
- Object o = finalConfig.getProperty("zq");
- @SuppressWarnings("unchecked")
- List<Map<String, Object>> listO = (List<Map<String, Object>>) o;
- Assertions.assertEquals(3, listO.size());
- }
-}
diff --git a/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/archaius/sources/TestMicroserviceConfigLoader.java b/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/file/TestMicroserviceConfigLoader.java
similarity index 95%
rename from foundations/foundation-config/src/test/java/org/apache/servicecomb/config/archaius/sources/TestMicroserviceConfigLoader.java
rename to foundations/foundation-config/src/test/java/org/apache/servicecomb/config/file/TestMicroserviceConfigLoader.java
index c9836bf4a..ff6b81260 100644
--- a/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/archaius/sources/TestMicroserviceConfigLoader.java
+++ b/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/file/TestMicroserviceConfigLoader.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.servicecomb.config.archaius.sources;
+package org.apache.servicecomb.config.file;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -25,6 +25,8 @@ import java.net.URL;
import java.util.List;
import java.util.stream.Collectors;
+import org.apache.servicecomb.config.file.ConfigModel;
+import org.apache.servicecomb.config.file.MicroserviceConfigLoader;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;