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
tom
2014-09-16 16:59:57 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1a4b99543187c0eb74c50e13a3ed20e18391feeb
1a4b9954
1 parent
a9c199f4
Added more unit tests for a few small things.
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
0 deletions
core/api/src/test/java/org/onlab/onos/net/topology/ClusterIdTest.java
core/api/src/test/java/org/onlab/onos/net/topology/DefaultTopologyClusterTest.java
core/api/src/test/java/org/onlab/onos/net/topology/ClusterIdTest.java
0 → 100644
View file @
1a4b995
package
org
.
onlab
.
onos
.
net
.
topology
;
import
com.google.common.testing.EqualsTester
;
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
onlab
.
onos
.
net
.
topology
.
ClusterId
.
clusterId
;
/**
* Test of the cluster ID.
*/
public
class
ClusterIdTest
{
@Test
public
void
testEquals
()
{
new
EqualsTester
()
.
addEqualityGroup
(
clusterId
(
1
),
clusterId
(
1
))
.
addEqualityGroup
(
clusterId
(
3
),
clusterId
(
3
)).
testEquals
();
}
@Test
public
void
basics
()
{
assertEquals
(
"incorrect index"
,
123
,
clusterId
(
123
).
index
());
}
}
\ No newline at end of file
core/api/src/test/java/org/onlab/onos/net/topology/DefaultTopologyClusterTest.java
0 → 100644
View file @
1a4b995
package
org
.
onlab
.
onos
.
net
.
topology
;
import
com.google.common.testing.EqualsTester
;
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
onlab
.
onos
.
net
.
DeviceId
.
deviceId
;
import
static
org
.
onlab
.
onos
.
net
.
topology
.
ClusterId
.
clusterId
;
/**
* Test of the default topology cluster implementation.
*/
public
class
DefaultTopologyClusterTest
{
@Test
public
void
testEquals
()
{
new
EqualsTester
()
.
addEqualityGroup
(
cluster
(
3
,
2
,
1
,
"of:1"
),
cluster
(
3
,
2
,
1
,
"of:1"
))
.
addEqualityGroup
(
cluster
(
3
,
2
,
1
,
"of:2"
),
cluster
(
3
,
2
,
1
,
"of:2"
))
.
addEqualityGroup
(
cluster
(
0
,
2
,
1
,
"of:1"
),
cluster
(
0
,
2
,
1
,
"of:1"
))
.
addEqualityGroup
(
cluster
(
3
,
3
,
1
,
"of:1"
),
cluster
(
3
,
3
,
1
,
"of:1"
))
.
testEquals
();
}
@Test
public
void
basics
()
{
TopologyCluster
cluster
=
cluster
(
6
,
5
,
4
,
"of:111"
);
assertEquals
(
"incorrect id"
,
clusterId
(
6
),
cluster
.
id
());
assertEquals
(
"incorrect id"
,
5
,
cluster
.
deviceCount
());
assertEquals
(
"incorrect id"
,
4
,
cluster
.
linkCount
());
assertEquals
(
"incorrect id"
,
deviceId
(
"of:111"
),
cluster
.
root
());
}
private
TopologyCluster
cluster
(
int
id
,
int
dc
,
int
lc
,
String
root
)
{
return
new
DefaultTopologyCluster
(
clusterId
(
id
),
dc
,
lc
,
deviceId
(
root
));
}
}
\ No newline at end of file
Please
register
or
login
to post a comment