Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
apollo
Commits
38b1a312
Commit
38b1a312
authored
Jun 22, 2016
by
Jason Song
Committed by
GitHub
Jun 22, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #281 from nobodyiam/notification-ut-fix
fix notification ut
parents
5359d441
47aa81fd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
NotificationControllerIntegrationTest.java
...ce/integration/NotificationControllerIntegrationTest.java
+9
-4
No files found.
apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/integration/NotificationControllerIntegrationTest.java
View file @
38b1a312
...
...
@@ -50,7 +50,7 @@ public class NotificationControllerIntegrationTest extends AbstractBaseIntegrati
@Sql
(
scripts
=
"/integration-test/cleanup.sql"
,
executionPhase
=
Sql
.
ExecutionPhase
.
AFTER_TEST_METHOD
)
public
void
testPollNotificationWithDefaultNamespace
()
throws
Exception
{
AtomicBoolean
stop
=
new
AtomicBoolean
();
perodicSendMessage
(
assembleKey
(
someAppId
,
someCluster
,
defaultNamespace
),
stop
);
per
i
odicSendMessage
(
assembleKey
(
someAppId
,
someCluster
,
defaultNamespace
),
stop
);
ResponseEntity
<
ApolloConfigNotification
>
result
=
restTemplate
.
getForEntity
(
"{baseurl}/notifications?appId={appId}&cluster={clusterName}&namespace={namespace}"
,
...
...
@@ -104,7 +104,7 @@ public class NotificationControllerIntegrationTest extends AbstractBaseIntegrati
String
publicAppId
=
"somePublicAppId"
;
AtomicBoolean
stop
=
new
AtomicBoolean
();
perodicSendMessage
(
assembleKey
(
publicAppId
,
ConfigConsts
.
CLUSTER_NAME_DEFAULT
,
somePublicNamespace
),
stop
);
per
i
odicSendMessage
(
assembleKey
(
publicAppId
,
ConfigConsts
.
CLUSTER_NAME_DEFAULT
,
somePublicNamespace
),
stop
);
ResponseEntity
<
ApolloConfigNotification
>
result
=
restTemplate
.
getForEntity
(
...
...
@@ -128,7 +128,7 @@ public class NotificationControllerIntegrationTest extends AbstractBaseIntegrati
String
someDC
=
"someDC"
;
AtomicBoolean
stop
=
new
AtomicBoolean
();
perodicSendMessage
(
assembleKey
(
publicAppId
,
someDC
,
somePublicNamespace
),
stop
);
per
i
odicSendMessage
(
assembleKey
(
publicAppId
,
someDC
,
somePublicNamespace
),
stop
);
ResponseEntity
<
ApolloConfigNotification
>
result
=
restTemplate
.
getForEntity
(
...
...
@@ -165,7 +165,7 @@ public class NotificationControllerIntegrationTest extends AbstractBaseIntegrati
return
Joiner
.
on
(
ConfigConsts
.
CLUSTER_NAMESPACE_SEPARATOR
).
join
(
appId
,
cluster
,
namespace
);
}
private
void
perodicSendMessage
(
String
message
,
AtomicBoolean
stop
)
{
private
void
per
i
odicSendMessage
(
String
message
,
AtomicBoolean
stop
)
{
executorService
.
submit
((
Runnable
)
()
->
{
//wait for the request connected to server
while
(!
stop
.
get
()
&&
!
Thread
.
currentThread
().
isInterrupted
())
{
...
...
@@ -174,6 +174,11 @@ public class NotificationControllerIntegrationTest extends AbstractBaseIntegrati
}
catch
(
InterruptedException
e
)
{
}
//double check
if
(
stop
.
get
())
{
break
;
}
ReleaseMessage
releaseMessage
=
new
ReleaseMessage
(
message
);
releaseMessageRepository
.
save
(
releaseMessage
);
}
...
...
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