Skip to content

Commit

Permalink
Polish apache#4905 : Add test cases for FileSystemDynamicConfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
mercyblitz committed Aug 29, 2019
1 parent b3c9c54 commit 5d0b4f8
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.apache.dubbo.common.URL;

import org.apache.commons.io.FileUtils;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -49,12 +50,18 @@ public class FileSystemDynamicConfigurationTest {

@BeforeEach
public void init() {
String classPath = getClassPath();
URL url = valueOf("dubbo://127.0.0.1:20880").addParameter(CONFIG_CENTER_DIR_PARAM_NAME, classPath + File.separator + "config-center");
File rootDirectory = new File(getClassPath(), "config-center");
rootDirectory.mkdirs();
URL url = valueOf("dubbo://127.0.0.1:20880").addParameter(CONFIG_CENTER_DIR_PARAM_NAME, rootDirectory.getAbsolutePath());
configuration = new FileSystemDynamicConfiguration(url);
deleteQuietly(configuration.getRootDirectory());
}

@AfterEach
public void destroy() throws Exception {
configuration.close();
}

private String getClassPath() {
return getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
}
Expand Down

0 comments on commit 5d0b4f8

Please sign in to comment.