Ayaka Koshibe
Committed by Yuta HIGUCHI

LldpLinkProviderTest uses ClusterMetadataServiceAdapter.

Change-Id: I3b47dcfa2efda1ad044ea6afd47a2722a16b3502
...@@ -29,18 +29,10 @@ import org.junit.Before; ...@@ -29,18 +29,10 @@ import org.junit.Before;
29 import org.junit.Test; 29 import org.junit.Test;
30 import org.onlab.packet.ChassisId; 30 import org.onlab.packet.ChassisId;
31 import org.onlab.packet.Ethernet; 31 import org.onlab.packet.Ethernet;
32 -import org.onlab.packet.IpAddress;
33 import org.onlab.packet.ONOSLLDP; 32 import org.onlab.packet.ONOSLLDP;
34 import org.onosproject.cfg.ComponentConfigAdapter; 33 import org.onosproject.cfg.ComponentConfigAdapter;
35 -import org.onosproject.cluster.ClusterMetadata; 34 +import org.onosproject.cluster.ClusterMetadataServiceAdapter;
36 -import org.onosproject.cluster.ClusterMetadataEventListener;
37 -import org.onosproject.cluster.ClusterMetadataService;
38 -import org.onosproject.cluster.ControllerNode;
39 -import org.onosproject.cluster.DefaultControllerNode;
40 -import org.onosproject.cluster.DefaultPartition;
41 import org.onosproject.cluster.NodeId; 35 import org.onosproject.cluster.NodeId;
42 -import org.onosproject.cluster.Partition;
43 -import org.onosproject.cluster.PartitionId;
44 import org.onosproject.cluster.RoleInfo; 36 import org.onosproject.cluster.RoleInfo;
45 import org.onosproject.core.ApplicationId; 37 import org.onosproject.core.ApplicationId;
46 import org.onosproject.core.CoreService; 38 import org.onosproject.core.CoreService;
...@@ -83,7 +75,6 @@ import com.google.common.collect.ImmutableList; ...@@ -83,7 +75,6 @@ import com.google.common.collect.ImmutableList;
83 import com.google.common.collect.ImmutableMap; 75 import com.google.common.collect.ImmutableMap;
84 import com.google.common.collect.ImmutableSet; 76 import com.google.common.collect.ImmutableSet;
85 import com.google.common.collect.Lists; 77 import com.google.common.collect.Lists;
86 -import com.google.common.collect.Sets;
87 78
88 import static org.easymock.EasyMock.createMock; 79 import static org.easymock.EasyMock.createMock;
89 import static org.easymock.EasyMock.expect; 80 import static org.easymock.EasyMock.expect;
...@@ -152,7 +143,7 @@ public class LldpLinkProviderTest { ...@@ -152,7 +143,7 @@ public class LldpLinkProviderTest {
152 provider.packetService = packetService; 143 provider.packetService = packetService;
153 provider.providerRegistry = linkRegistry; 144 provider.providerRegistry = linkRegistry;
154 provider.masterService = masterService; 145 provider.masterService = masterService;
155 - provider.clusterMetadataService = new TestMetadataService(); 146 + provider.clusterMetadataService = new ClusterMetadataServiceAdapter();
156 147
157 provider.activate(null); 148 provider.activate(null);
158 149
...@@ -900,29 +891,4 @@ public class LldpLinkProviderTest { ...@@ -900,29 +891,4 @@ public class LldpLinkProviderTest {
900 return this; 891 return this;
901 } 892 }
902 } 893 }
903 -
904 - private final class TestMetadataService implements ClusterMetadataService {
905 - @Override
906 - public ClusterMetadata getClusterMetadata() {
907 - final NodeId nid = new NodeId("test-node");
908 - final IpAddress addr = IpAddress.valueOf(0);
909 - final Partition p = new DefaultPartition(PartitionId.from(1), Sets.newHashSet(nid));
910 - return new ClusterMetadata("test-cluster",
911 - Sets.newHashSet(new DefaultControllerNode(nid, addr)),
912 - Sets.newHashSet(p));
913 - }
914 -
915 - @Override
916 - public ControllerNode getLocalNode() {
917 - return null;
918 - }
919 -
920 - @Override
921 - public void addListener(ClusterMetadataEventListener listener) {
922 - }
923 -
924 - @Override
925 - public void removeListener(ClusterMetadataEventListener listener) {
926 - }
927 - }
928 } 894 }
......