Ayaka Koshibe | 4822922 | 2016-05-16 18:04:26 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Ayaka Koshibe | 4822922 | 2016-05-16 18:04:26 -0700 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.onosproject.cluster; |
| 17 | |
| 18 | import org.onlab.packet.IpAddress; |
| 19 | |
| 20 | import com.google.common.collect.Sets; |
Jordan Halterman | 07f052b | 2017-10-08 14:22:41 -0700 | [diff] [blame] | 21 | import org.onosproject.core.Version; |
Ayaka Koshibe | 4822922 | 2016-05-16 18:04:26 -0700 | [diff] [blame] | 22 | |
| 23 | /** |
| 24 | * Test adapter for the ClusterMetadata service. |
| 25 | */ |
| 26 | public class ClusterMetadataServiceAdapter implements ClusterMetadataService { |
| 27 | |
| 28 | @Override |
| 29 | public ClusterMetadata getClusterMetadata() { |
| 30 | final NodeId nid = new NodeId("test-node"); |
| 31 | final IpAddress addr = IpAddress.valueOf(0); |
Jordan Halterman | 07f052b | 2017-10-08 14:22:41 -0700 | [diff] [blame] | 32 | final Partition p = new DefaultPartition(PartitionId.from(1), Version.version("1.0.0"), Sets.newHashSet(nid)); |
Ayaka Koshibe | 4822922 | 2016-05-16 18:04:26 -0700 | [diff] [blame] | 33 | return new ClusterMetadata("test-cluster", |
| 34 | Sets.newHashSet(new DefaultControllerNode(nid, addr)), |
| 35 | Sets.newHashSet(p)); |
| 36 | } |
| 37 | |
| 38 | @Override |
| 39 | public ControllerNode getLocalNode() { |
| 40 | return null; |
| 41 | } |
| 42 | |
| 43 | @Override |
| 44 | public void addListener(ClusterMetadataEventListener listener) { |
| 45 | } |
| 46 | |
| 47 | @Override |
| 48 | public void removeListener(ClusterMetadataEventListener listener) { |
| 49 | } |
| 50 | |
| 51 | } |