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
Yuta HIGUCHI
2014-10-15 23:22:17 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b35a3819ee63fdfcceeff70ea29f6bff8d0b2fc7
b35a3819
1 parent
b0995dfa
bugfix Function input is Nullable
Change-Id: Ie492fd070e300bbe6a2796805ba5f2c8a50c7248
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
core/api/src/main/java/org/onlab/onos/cluster/ControllerNodeToNodeId.java
core/api/src/test/java/org/onlab/onos/cluster/ControllerNodeToNodeIdTest.java
core/api/src/main/java/org/onlab/onos/cluster/ControllerNodeToNodeId.java
View file @
b35a381
...
...
@@ -12,7 +12,11 @@ public final class ControllerNodeToNodeId
@Override
public
NodeId
apply
(
ControllerNode
input
)
{
return
input
.
id
();
if
(
input
==
null
)
{
return
null
;
}
else
{
return
input
.
id
();
}
}
/**
...
...
core/api/src/test/java/org/onlab/onos/cluster/ControllerNodeToNodeIdTest.java
View file @
b35a381
package
org
.
onlab
.
onos
.
cluster
;
import
static
com
.
google
.
common
.
base
.
Predicates
.
notNull
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
onlab
.
onos
.
cluster
.
ControllerNodeToNodeId
.
toNodeId
;
...
...
@@ -30,12 +31,13 @@ public class ControllerNodeToNodeIdTest {
@Test
public
final
void
testToNodeId
()
{
final
Iterable
<
ControllerNode
>
nodes
=
Arrays
.
asList
(
CN1
,
CN2
,
CN3
);
final
Iterable
<
ControllerNode
>
nodes
=
Arrays
.
asList
(
CN1
,
CN2
,
CN3
,
null
);
final
List
<
NodeId
>
nodeIds
=
Arrays
.
asList
(
NID1
,
NID2
,
NID3
);
assertEquals
(
nodeIds
,
FluentIterable
.
from
(
nodes
)
.
transform
(
toNodeId
())
.
filter
(
notNull
())
.
toList
());
}
...
...
Please
register
or
login
to post a comment