commit | 38f561c1dff5f40deb73dfe7a3e37f07aed4c0dc | [log] [tgz] |
---|---|---|
author | Sho SHIMIZU <sshimizu@us.fujitsu.com> | Thu Jan 14 09:07:47 2016 -0800 |
committer | Sho SHIMIZU <sshimizu@us.fujitsu.com> | Thu Jan 14 09:07:47 2016 -0800 |
tree | dd690478f2a038a18e69d7aa9b7105397149cc52 | |
parent | dfde6ba92f08a1af96fab4681a0e6be8e66e028a [diff] |
Fix bug that a list is mistakenly added as an element of another list Change-Id: I1e4847b572e55bbf85f99ed8ef8df96da1f7bd7f
diff --git a/core/api/src/main/java/org/onosproject/net/newresource/ResourceId.java b/core/api/src/main/java/org/onosproject/net/newresource/ResourceId.java index f32579f..c18e08b 100644 --- a/core/api/src/main/java/org/onosproject/net/newresource/ResourceId.java +++ b/core/api/src/main/java/org/onosproject/net/newresource/ResourceId.java
@@ -70,7 +70,7 @@ ResourceId child(Object child) { return new ResourceId(ImmutableList.builder() - .add(components) + .addAll(components) .add(child) .build()); }
diff --git a/core/api/src/test/java/org/onosproject/net/newresource/ResourcePathTest.java b/core/api/src/test/java/org/onosproject/net/newresource/ResourcePathTest.java index 83d9b44..ea7ff5e 100644 --- a/core/api/src/test/java/org/onosproject/net/newresource/ResourcePathTest.java +++ b/core/api/src/test/java/org/onosproject/net/newresource/ResourcePathTest.java
@@ -75,6 +75,14 @@ } @Test + public void testChild() { + ResourcePath r1 = ResourcePath.discrete(D1).child(P1); + ResourcePath sameAsR2 = ResourcePath.discrete(D1, P1); + + assertThat(r1, is(sameAsR2)); + } + + @Test public void testThereIsParent() { ResourcePath path = ResourcePath.discrete(D1, P1, VLAN1); ResourcePath parent = ResourcePath.discrete(D1, P1);