Toggle navigation
Toggle navigation
This project
Loading...
Sign in
홍길동
/
onos
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Ayaka Koshibe
2014-09-25 17:12:31 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
48239b0306d61e7adb4cfff217ba34302b37a18e
48239b03
1 parent
06dc6b9c
term-related test additions
Change-Id: I9359ab9a53d73a216a83732612a54154b9655c8c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
core/api/src/main/java/org/onlab/onos/cluster/MastershipTerm.java
core/net/src/test/java/org/onlab/onos/cluster/impl/MastershipManagerTest.java
core/api/src/main/java/org/onlab/onos/cluster/MastershipTerm.java
View file @
48239b0
...
...
@@ -31,6 +31,9 @@ public final class MastershipTerm {
@Override
public
boolean
equals
(
Object
other
)
{
if
(
this
==
other
)
{
return
true
;
}
if
(
other
instanceof
MastershipTerm
)
{
MastershipTerm
that
=
(
MastershipTerm
)
other
;
if
(!
this
.
master
.
equals
(
that
.
master
))
{
...
...
core/net/src/test/java/org/onlab/onos/cluster/impl/MastershipManagerTest.java
View file @
48239b0
...
...
@@ -11,6 +11,7 @@ import org.onlab.onos.cluster.ControllerNode;
import
org.onlab.onos.cluster.ControllerNode.State
;
import
org.onlab.onos.cluster.DefaultControllerNode
;
import
org.onlab.onos.cluster.MastershipService
;
import
org.onlab.onos.cluster.MastershipTermService
;
import
org.onlab.onos.cluster.NodeId
;
import
org.onlab.onos.event.impl.TestEventDispatcher
;
import
org.onlab.onos.net.DeviceId
;
...
...
@@ -100,6 +101,20 @@ public class MastershipManagerTest {
assertEquals
(
"should be two devices:"
,
2
,
mgr
.
getDevicesOf
(
NID_LOCAL
).
size
());
}
@Test
public
void
termService
()
{
MastershipTermService
ts
=
mgr
.
requestTermService
();
//term = 0 for both
mgr
.
setRole
(
NID_LOCAL
,
DEV_MASTER
,
MASTER
);
assertEquals
(
"inconsistent term: "
,
0
,
ts
.
getMastershipTerm
(
DEV_MASTER
).
termNumber
());
//hand devices to NID_LOCAL and back: term = 2
mgr
.
setRole
(
NID_OTHER
,
DEV_MASTER
,
MASTER
);
mgr
.
setRole
(
NID_LOCAL
,
DEV_MASTER
,
MASTER
);
assertEquals
(
"inconsistent terms: "
,
2
,
ts
.
getMastershipTerm
(
DEV_MASTER
).
termNumber
());
}
private
final
class
TestClusterService
implements
ClusterService
{
ControllerNode
local
=
new
DefaultControllerNode
(
NID_LOCAL
,
LOCALHOST
);
...
...
Please
register
or
login
to post a comment