Commit 3c0d953d by Nepxion

修改测试用例

parent eb7fb816
...@@ -38,21 +38,19 @@ public class DiscoveryPluginConfigSimulator { ...@@ -38,21 +38,19 @@ public class DiscoveryPluginConfigSimulator {
public void run() { public void run() {
// 本地文件模拟代替远程文件,随机读取 // 本地文件模拟代替远程文件,随机读取
int index = threadLocalRandom.nextInt(4) + 1; int index = threadLocalRandom.nextInt(4) + 1;
InputStream inputStream = createInputStream("src/main/resources/discovery" + index + ".xml"); InputStream inputStream = getInputStream("src/main/resources/discovery" + index + ".xml");
discoveryPluginConfigPublisher.publish(inputStream); discoveryPluginConfigPublisher.publish(inputStream);
} }
}, 0L, 15000L); }, 0L, 15000L);
} }
private InputStream createInputStream(String fileName) { private InputStream getInputStream(String fileName) {
File file = new File(fileName);
InputStream inputStream = null;
try { try {
inputStream = new FileInputStream(file); return new FileInputStream(new File(fileName));
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} }
return inputStream; return null;
} }
} }
\ No newline at end of file
...@@ -22,7 +22,7 @@ public class DiscoveryPluginFileLoader extends AbstractFileLoader { ...@@ -22,7 +22,7 @@ public class DiscoveryPluginFileLoader extends AbstractFileLoader {
@Override @Override
public InputStream getRemoteInputStream() throws IOException { public InputStream getRemoteInputStream() throws IOException {
// 本地文件模拟代替远程文件 // 本地文件模拟代替远程文件
return createInputStream("src/main/resources/discovery1.xml"); return getInputStream("src/main/resources/discovery1.xml");
} }
@Override @Override
...@@ -31,18 +31,16 @@ public class DiscoveryPluginFileLoader extends AbstractFileLoader { ...@@ -31,18 +31,16 @@ public class DiscoveryPluginFileLoader extends AbstractFileLoader {
return "classpath:discovery1.xml"; return "classpath:discovery1.xml";
// 配置文件放在工程根目录下 // 配置文件放在工程根目录下
// return "file:discovery.xml"; // return "file:discovery1.xml";
} }
private InputStream createInputStream(String fileName) { private InputStream getInputStream(String fileName) {
File file = new File(fileName);
InputStream inputStream = null;
try { try {
inputStream = new FileInputStream(file); return new FileInputStream(new File(fileName));
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} }
return inputStream; return null;
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment