Fix UT
This commit is contained in:
parent
b725826cb6
commit
747b804919
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.dubbo.config;
|
||||
|
||||
import org.apache.dubbo.common.config.Environment;
|
||||
import org.apache.dubbo.common.utils.ConfigUtils;
|
||||
import org.apache.dubbo.config.api.Greeting;
|
||||
import org.apache.dubbo.config.support.Parameter;
|
||||
|
||||
|
|
@ -32,6 +33,7 @@ import java.lang.annotation.Target;
|
|||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
|
|
@ -346,7 +348,7 @@ public class AbstractConfigTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRefreshProperties() {
|
||||
public void testRefreshProperties() throws Exception{
|
||||
try {
|
||||
Environment.getInstance().setExternalConfigMap(new HashMap<>());
|
||||
OverrideConfig overrideConfig = new OverrideConfig();
|
||||
|
|
@ -354,6 +356,10 @@ public class AbstractConfigTest {
|
|||
overrideConfig.setProtocol("override-config");
|
||||
overrideConfig.setEscape("override-config://");
|
||||
|
||||
Properties properties = new Properties();
|
||||
properties.load(this.getClass().getResourceAsStream("/dubbo.properties"));
|
||||
ConfigUtils.setProperties(properties);
|
||||
|
||||
overrideConfig.refresh();
|
||||
|
||||
Assert.assertEquals("override-config://127.0.0.1:2181", overrideConfig.getAddress());
|
||||
|
|
@ -362,6 +368,7 @@ public class AbstractConfigTest {
|
|||
Assert.assertEquals("properties", overrideConfig.getUseKeyAsProperty());
|
||||
} finally {
|
||||
Environment.getInstance().clearExternalConfigs();
|
||||
ConfigUtils.setProperties(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue