Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
discovery
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
谢捷峰
discovery
Commits
3c0d953d
Commit
3c0d953d
authored
Jun 22, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改测试用例
parent
eb7fb816
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
13 deletions
+11
-13
discovery-springcloud-example-a/src/main/java/com/nepxion/discovery/plugin/example/impl/DiscoveryPluginConfigSimulator.java
+5
-6
discovery-springcloud-example-a/src/main/java/com/nepxion/discovery/plugin/example/impl/DiscoveryPluginFileLoader.java
+6
-7
No files found.
discovery-springcloud-example-a/src/main/java/com/nepxion/discovery/plugin/example/impl/DiscoveryPluginConfigSimulator.java
View file @
3c0d953d
...
...
@@ -38,21 +38,19 @@ public class DiscoveryPluginConfigSimulator {
public
void
run
()
{
// 本地文件模拟代替远程文件,随机读取
int
index
=
threadLocalRandom
.
nextInt
(
4
)
+
1
;
InputStream
inputStream
=
create
InputStream
(
"src/main/resources/discovery"
+
index
+
".xml"
);
InputStream
inputStream
=
get
InputStream
(
"src/main/resources/discovery"
+
index
+
".xml"
);
discoveryPluginConfigPublisher
.
publish
(
inputStream
);
}
},
0L
,
15000L
);
}
private
InputStream
createInputStream
(
String
fileName
)
{
File
file
=
new
File
(
fileName
);
InputStream
inputStream
=
null
;
private
InputStream
getInputStream
(
String
fileName
)
{
try
{
inputStream
=
new
FileInputStream
(
file
);
return
new
FileInputStream
(
new
File
(
fileName
)
);
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
return
inputStream
;
return
null
;
}
}
\ No newline at end of file
discovery-springcloud-example-a/src/main/java/com/nepxion/discovery/plugin/example/impl/DiscoveryPluginFileLoader.java
View file @
3c0d953d
...
...
@@ -22,7 +22,7 @@ public class DiscoveryPluginFileLoader extends AbstractFileLoader {
@Override
public
InputStream
getRemoteInputStream
()
throws
IOException
{
// 本地文件模拟代替远程文件
return
create
InputStream
(
"src/main/resources/discovery1.xml"
);
return
get
InputStream
(
"src/main/resources/discovery1.xml"
);
}
@Override
...
...
@@ -31,18 +31,16 @@ public class DiscoveryPluginFileLoader extends AbstractFileLoader {
return
"classpath:discovery1.xml"
;
// 配置文件放在工程根目录下
// return "file:discovery.xml";
// return "file:discovery
1
.xml";
}
private
InputStream
createInputStream
(
String
fileName
)
{
File
file
=
new
File
(
fileName
);
InputStream
inputStream
=
null
;
private
InputStream
getInputStream
(
String
fileName
)
{
try
{
inputStream
=
new
FileInputStream
(
file
);
return
new
FileInputStream
(
new
File
(
fileName
)
);
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
return
inputStream
;
return
null
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment