Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
Ray Milkey | 34c9590 | 2015-04-15 09:47:53 -0700 | [diff] [blame] | 2 | * Copyright 2014-2015 Open Networking Laboratory |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -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 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net.device.impl; |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 17 | |
Ray Milkey | cc53abd | 2015-02-19 12:31:33 -0800 | [diff] [blame] | 18 | import java.util.ArrayList; |
| 19 | import java.util.Iterator; |
| 20 | import java.util.List; |
| 21 | import java.util.Set; |
Ayaka Koshibe | c404770 | 2014-10-07 14:43:52 -0700 | [diff] [blame] | 22 | |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 23 | import org.junit.After; |
| 24 | import org.junit.Before; |
| 25 | import org.junit.Test; |
Ray Milkey | cc53abd | 2015-02-19 12:31:33 -0800 | [diff] [blame] | 26 | import org.onlab.packet.ChassisId; |
| 27 | import org.onlab.packet.IpAddress; |
| 28 | import org.onosproject.cluster.ClusterServiceAdapter; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 29 | import org.onosproject.cluster.ControllerNode; |
| 30 | import org.onosproject.cluster.DefaultControllerNode; |
| 31 | import org.onosproject.cluster.NodeId; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 32 | import org.onosproject.event.Event; |
| 33 | import org.onosproject.event.impl.TestEventDispatcher; |
| 34 | import org.onosproject.mastership.MastershipServiceAdapter; |
| 35 | import org.onosproject.mastership.MastershipTerm; |
| 36 | import org.onosproject.mastership.MastershipTermService; |
| 37 | import org.onosproject.net.Device; |
| 38 | import org.onosproject.net.DeviceId; |
| 39 | import org.onosproject.net.MastershipRole; |
| 40 | import org.onosproject.net.Port; |
| 41 | import org.onosproject.net.PortNumber; |
| 42 | import org.onosproject.net.device.DefaultDeviceDescription; |
| 43 | import org.onosproject.net.device.DefaultPortDescription; |
| 44 | import org.onosproject.net.device.DeviceAdminService; |
| 45 | import org.onosproject.net.device.DeviceClockProviderService; |
| 46 | import org.onosproject.net.device.DeviceDescription; |
| 47 | import org.onosproject.net.device.DeviceEvent; |
| 48 | import org.onosproject.net.device.DeviceListener; |
| 49 | import org.onosproject.net.device.DeviceProvider; |
| 50 | import org.onosproject.net.device.DeviceProviderRegistry; |
| 51 | import org.onosproject.net.device.DeviceProviderService; |
| 52 | import org.onosproject.net.device.DeviceService; |
| 53 | import org.onosproject.net.device.PortDescription; |
| 54 | import org.onosproject.net.provider.AbstractProvider; |
| 55 | import org.onosproject.net.provider.ProviderId; |
| 56 | import org.onosproject.store.trivial.impl.SimpleDeviceStore; |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 57 | |
Ray Milkey | cc53abd | 2015-02-19 12:31:33 -0800 | [diff] [blame] | 58 | import com.google.common.collect.Sets; |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 59 | |
Ray Milkey | cc53abd | 2015-02-19 12:31:33 -0800 | [diff] [blame] | 60 | import static org.junit.Assert.assertEquals; |
| 61 | import static org.junit.Assert.assertFalse; |
| 62 | import static org.junit.Assert.assertNotNull; |
| 63 | import static org.junit.Assert.assertNull; |
| 64 | import static org.junit.Assert.assertTrue; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 65 | import static org.onosproject.net.Device.Type.SWITCH; |
| 66 | import static org.onosproject.net.DeviceId.deviceId; |
Ray Milkey | cc53abd | 2015-02-19 12:31:33 -0800 | [diff] [blame] | 67 | import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_ADDED; |
| 68 | import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED; |
| 69 | import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_UPDATED; |
| 70 | import static org.onosproject.net.device.DeviceEvent.Type.PORT_ADDED; |
| 71 | import static org.onosproject.net.device.DeviceEvent.Type.PORT_REMOVED; |
| 72 | import static org.onosproject.net.device.DeviceEvent.Type.PORT_UPDATED; |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 73 | |
| 74 | /** |
| 75 | * Test codifying the device service & device provider service contracts. |
| 76 | */ |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 77 | public class DeviceManagerTest { |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 78 | |
tom | 7e02cda | 2014-09-18 12:05:46 -0700 | [diff] [blame] | 79 | private static final ProviderId PID = new ProviderId("of", "foo"); |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 80 | private static final DeviceId DID1 = deviceId("of:foo"); |
| 81 | private static final DeviceId DID2 = deviceId("of:bar"); |
| 82 | private static final String MFR = "whitebox"; |
| 83 | private static final String HW = "1.1.x"; |
| 84 | private static final String SW1 = "3.8.1"; |
| 85 | private static final String SW2 = "3.9.5"; |
| 86 | private static final String SN = "43311-12345"; |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 87 | private static final ChassisId CID = new ChassisId(); |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 88 | |
tom | 24c55cd | 2014-09-06 10:47:25 -0700 | [diff] [blame] | 89 | private static final PortNumber P1 = PortNumber.portNumber(1); |
| 90 | private static final PortNumber P2 = PortNumber.portNumber(2); |
| 91 | private static final PortNumber P3 = PortNumber.portNumber(3); |
Yuta HIGUCHI | 33faeaf | 2014-10-07 18:19:44 -0700 | [diff] [blame] | 92 | private static final NodeId NID_LOCAL = new NodeId("local"); |
Pavlin Radoslavov | 444b519 | 2014-10-28 10:45:19 -0700 | [diff] [blame] | 93 | private static final IpAddress LOCALHOST = IpAddress.valueOf("127.0.0.1"); |
tom | 24c55cd | 2014-09-06 10:47:25 -0700 | [diff] [blame] | 94 | |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 95 | private DeviceManager mgr; |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 96 | |
| 97 | protected DeviceService service; |
| 98 | protected DeviceAdminService admin; |
| 99 | protected DeviceProviderRegistry registry; |
| 100 | protected DeviceProviderService providerService; |
| 101 | protected TestProvider provider; |
| 102 | protected TestListener listener = new TestListener(); |
| 103 | |
| 104 | @Before |
| 105 | public void setUp() { |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 106 | mgr = new DeviceManager(); |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 107 | service = mgr; |
| 108 | admin = mgr; |
| 109 | registry = mgr; |
tom | 41a2c5f | 2014-09-19 09:20:35 -0700 | [diff] [blame] | 110 | mgr.store = new SimpleDeviceStore(); |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 111 | mgr.eventDispatcher = new TestEventDispatcher(); |
Yuta HIGUCHI | bcac499 | 2014-11-22 19:27:57 -0800 | [diff] [blame] | 112 | TestMastershipManager mastershipManager = new TestMastershipManager(); |
| 113 | mgr.mastershipService = mastershipManager; |
| 114 | mgr.termService = mastershipManager; |
Yuta HIGUCHI | 33faeaf | 2014-10-07 18:19:44 -0700 | [diff] [blame] | 115 | mgr.clusterService = new TestClusterService(); |
Yuta HIGUCHI | 093e83e | 2014-10-10 22:26:11 -0700 | [diff] [blame] | 116 | mgr.deviceClockProviderService = new TestClockProviderService(); |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 117 | mgr.activate(); |
| 118 | |
| 119 | service.addListener(listener); |
| 120 | |
| 121 | provider = new TestProvider(); |
| 122 | providerService = registry.register(provider); |
| 123 | assertTrue("provider should be registered", |
| 124 | registry.getProviders().contains(provider.id())); |
| 125 | } |
| 126 | |
| 127 | @After |
| 128 | public void tearDown() { |
| 129 | registry.unregister(provider); |
| 130 | assertFalse("provider should not be registered", |
| 131 | registry.getProviders().contains(provider.id())); |
| 132 | service.removeListener(listener); |
| 133 | mgr.deactivate(); |
| 134 | } |
| 135 | |
| 136 | private void connectDevice(DeviceId deviceId, String swVersion) { |
| 137 | DeviceDescription description = |
| 138 | new DefaultDeviceDescription(deviceId.uri(), SWITCH, MFR, |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame] | 139 | HW, swVersion, SN, CID); |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 140 | providerService.deviceConnected(deviceId, description); |
| 141 | assertNotNull("device should be found", service.getDevice(DID1)); |
| 142 | } |
| 143 | |
| 144 | @Test |
| 145 | public void deviceConnected() { |
| 146 | assertNull("device should not be found", service.getDevice(DID1)); |
| 147 | connectDevice(DID1, SW1); |
| 148 | validateEvents(DEVICE_ADDED); |
| 149 | |
| 150 | Iterator<Device> it = service.getDevices().iterator(); |
| 151 | assertNotNull("one device expected", it.next()); |
| 152 | assertFalse("only one device expected", it.hasNext()); |
tom | ad2d209 | 2014-09-06 23:24:20 -0700 | [diff] [blame] | 153 | assertEquals("incorrect device count", 1, service.getDeviceCount()); |
tom | ff7eb7c | 2014-09-08 12:49:03 -0700 | [diff] [blame] | 154 | assertTrue("device should be available", service.isAvailable(DID1)); |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | @Test |
| 158 | public void deviceDisconnected() { |
| 159 | connectDevice(DID1, SW1); |
| 160 | connectDevice(DID2, SW1); |
| 161 | validateEvents(DEVICE_ADDED, DEVICE_ADDED); |
tom | ff7eb7c | 2014-09-08 12:49:03 -0700 | [diff] [blame] | 162 | assertTrue("device should be available", service.isAvailable(DID1)); |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 163 | |
| 164 | // Disconnect |
| 165 | providerService.deviceDisconnected(DID1); |
| 166 | assertNotNull("device should not be found", service.getDevice(DID1)); |
tom | ff7eb7c | 2014-09-08 12:49:03 -0700 | [diff] [blame] | 167 | assertFalse("device should not be available", service.isAvailable(DID1)); |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 168 | validateEvents(DEVICE_AVAILABILITY_CHANGED); |
| 169 | |
| 170 | // Reconnect |
| 171 | connectDevice(DID1, SW1); |
| 172 | validateEvents(DEVICE_AVAILABILITY_CHANGED); |
tom | ad2d209 | 2014-09-06 23:24:20 -0700 | [diff] [blame] | 173 | |
| 174 | assertEquals("incorrect device count", 2, service.getDeviceCount()); |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | @Test |
| 178 | public void deviceUpdated() { |
| 179 | connectDevice(DID1, SW1); |
| 180 | validateEvents(DEVICE_ADDED); |
| 181 | |
| 182 | connectDevice(DID1, SW2); |
| 183 | validateEvents(DEVICE_UPDATED); |
| 184 | } |
| 185 | |
| 186 | @Test |
| 187 | public void getRole() { |
| 188 | connectDevice(DID1, SW1); |
tom | 80c0e5e | 2014-09-08 18:08:58 -0700 | [diff] [blame] | 189 | assertEquals("incorrect role", MastershipRole.MASTER, service.getRole(DID1)); |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 190 | } |
| 191 | |
tom | 24c55cd | 2014-09-06 10:47:25 -0700 | [diff] [blame] | 192 | @Test |
| 193 | public void updatePorts() { |
| 194 | connectDevice(DID1, SW1); |
| 195 | List<PortDescription> pds = new ArrayList<>(); |
| 196 | pds.add(new DefaultPortDescription(P1, true)); |
| 197 | pds.add(new DefaultPortDescription(P2, true)); |
| 198 | pds.add(new DefaultPortDescription(P3, true)); |
| 199 | providerService.updatePorts(DID1, pds); |
| 200 | validateEvents(DEVICE_ADDED, PORT_ADDED, PORT_ADDED, PORT_ADDED); |
| 201 | pds.clear(); |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 202 | |
tom | 24c55cd | 2014-09-06 10:47:25 -0700 | [diff] [blame] | 203 | pds.add(new DefaultPortDescription(P1, false)); |
| 204 | pds.add(new DefaultPortDescription(P3, true)); |
| 205 | providerService.updatePorts(DID1, pds); |
| 206 | validateEvents(PORT_UPDATED, PORT_REMOVED); |
| 207 | } |
| 208 | |
| 209 | @Test |
| 210 | public void updatePortStatus() { |
| 211 | connectDevice(DID1, SW1); |
| 212 | List<PortDescription> pds = new ArrayList<>(); |
| 213 | pds.add(new DefaultPortDescription(P1, true)); |
| 214 | pds.add(new DefaultPortDescription(P2, true)); |
| 215 | providerService.updatePorts(DID1, pds); |
| 216 | validateEvents(DEVICE_ADDED, PORT_ADDED, PORT_ADDED); |
| 217 | |
| 218 | providerService.portStatusChanged(DID1, new DefaultPortDescription(P1, false)); |
| 219 | validateEvents(PORT_UPDATED); |
| 220 | providerService.portStatusChanged(DID1, new DefaultPortDescription(P1, false)); |
| 221 | assertTrue("no events expected", listener.events.isEmpty()); |
| 222 | } |
| 223 | |
| 224 | @Test |
| 225 | public void getPorts() { |
| 226 | connectDevice(DID1, SW1); |
| 227 | List<PortDescription> pds = new ArrayList<>(); |
| 228 | pds.add(new DefaultPortDescription(P1, true)); |
| 229 | pds.add(new DefaultPortDescription(P2, true)); |
| 230 | providerService.updatePorts(DID1, pds); |
| 231 | validateEvents(DEVICE_ADDED, PORT_ADDED, PORT_ADDED); |
| 232 | assertEquals("wrong port count", 2, service.getPorts(DID1).size()); |
| 233 | |
| 234 | Port port = service.getPort(DID1, P1); |
| 235 | assertEquals("incorrect port", P1, service.getPort(DID1, P1).number()); |
| 236 | assertEquals("incorrect state", true, service.getPort(DID1, P1).isEnabled()); |
| 237 | } |
| 238 | |
| 239 | @Test |
| 240 | public void removeDevice() { |
| 241 | connectDevice(DID1, SW1); |
| 242 | connectDevice(DID2, SW2); |
tom | ad2d209 | 2014-09-06 23:24:20 -0700 | [diff] [blame] | 243 | assertEquals("incorrect device count", 2, service.getDeviceCount()); |
tom | 24c55cd | 2014-09-06 10:47:25 -0700 | [diff] [blame] | 244 | admin.removeDevice(DID1); |
| 245 | assertNull("device should not be found", service.getDevice(DID1)); |
| 246 | assertNotNull("device should be found", service.getDevice(DID2)); |
tom | ad2d209 | 2014-09-06 23:24:20 -0700 | [diff] [blame] | 247 | assertEquals("incorrect device count", 1, service.getDeviceCount()); |
| 248 | |
tom | 24c55cd | 2014-09-06 10:47:25 -0700 | [diff] [blame] | 249 | } |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 250 | |
| 251 | protected void validateEvents(Enum... types) { |
| 252 | int i = 0; |
| 253 | assertEquals("wrong events received", types.length, listener.events.size()); |
| 254 | for (Event event : listener.events) { |
| 255 | assertEquals("incorrect event type", types[i], event.type()); |
| 256 | i++; |
| 257 | } |
| 258 | listener.events.clear(); |
| 259 | } |
| 260 | |
| 261 | |
| 262 | private class TestProvider extends AbstractProvider implements DeviceProvider { |
Yuta HIGUCHI | 5481532 | 2014-10-31 23:17:08 -0700 | [diff] [blame] | 263 | private DeviceId deviceReceived; |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 264 | private MastershipRole roleReceived; |
| 265 | |
| 266 | public TestProvider() { |
| 267 | super(PID); |
| 268 | } |
| 269 | |
| 270 | @Override |
Ayaka Koshibe | 78bcbc1 | 2014-11-19 14:28:58 -0800 | [diff] [blame] | 271 | public void triggerProbe(DeviceId deviceId) { |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 272 | } |
| 273 | |
| 274 | @Override |
Yuta HIGUCHI | 5481532 | 2014-10-31 23:17:08 -0700 | [diff] [blame] | 275 | public void roleChanged(DeviceId device, MastershipRole newRole) { |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 276 | deviceReceived = device; |
| 277 | roleReceived = newRole; |
| 278 | } |
Ayaka Koshibe | e60d452 | 2014-10-28 15:07:00 -0700 | [diff] [blame] | 279 | |
| 280 | @Override |
Yuta HIGUCHI | 5481532 | 2014-10-31 23:17:08 -0700 | [diff] [blame] | 281 | public boolean isReachable(DeviceId device) { |
Ayaka Koshibe | e60d452 | 2014-10-28 15:07:00 -0700 | [diff] [blame] | 282 | return false; |
| 283 | } |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 284 | } |
| 285 | |
| 286 | private static class TestListener implements DeviceListener { |
| 287 | final List<DeviceEvent> events = new ArrayList<>(); |
| 288 | |
| 289 | @Override |
| 290 | public void event(DeviceEvent event) { |
| 291 | events.add(event); |
| 292 | } |
| 293 | } |
| 294 | |
Yuta HIGUCHI | bcac499 | 2014-11-22 19:27:57 -0800 | [diff] [blame] | 295 | private static class TestMastershipManager |
| 296 | extends MastershipServiceAdapter implements MastershipTermService { |
Ayaka Koshibe | a7f044e | 2014-09-23 16:56:20 -0700 | [diff] [blame] | 297 | @Override |
tom | b41d1ac | 2014-09-24 01:51:24 -0700 | [diff] [blame] | 298 | public MastershipRole getLocalRole(DeviceId deviceId) { |
| 299 | return MastershipRole.MASTER; |
Ayaka Koshibe | a7f044e | 2014-09-23 16:56:20 -0700 | [diff] [blame] | 300 | } |
| 301 | |
| 302 | @Override |
| 303 | public Set<DeviceId> getDevicesOf(NodeId nodeId) { |
| 304 | return Sets.newHashSet(DID1, DID2); |
| 305 | } |
| 306 | |
| 307 | @Override |
| 308 | public MastershipRole requestRoleFor(DeviceId deviceId) { |
| 309 | return MastershipRole.MASTER; |
| 310 | } |
Yuta HIGUCHI | 33faeaf | 2014-10-07 18:19:44 -0700 | [diff] [blame] | 311 | |
| 312 | @Override |
Yuta HIGUCHI | bcac499 | 2014-11-22 19:27:57 -0800 | [diff] [blame] | 313 | public MastershipTerm getMastershipTerm(DeviceId deviceId) { |
| 314 | // FIXME: just returning something not null |
| 315 | return MastershipTerm.of(NID_LOCAL, 1); |
Yuta HIGUCHI | 33faeaf | 2014-10-07 18:19:44 -0700 | [diff] [blame] | 316 | } |
Ayaka Koshibe | a7f044e | 2014-09-23 16:56:20 -0700 | [diff] [blame] | 317 | } |
| 318 | |
Yuta HIGUCHI | 33faeaf | 2014-10-07 18:19:44 -0700 | [diff] [blame] | 319 | // code clone |
Ray Milkey | cc53abd | 2015-02-19 12:31:33 -0800 | [diff] [blame] | 320 | private final class TestClusterService extends ClusterServiceAdapter { |
Yuta HIGUCHI | 33faeaf | 2014-10-07 18:19:44 -0700 | [diff] [blame] | 321 | |
| 322 | ControllerNode local = new DefaultControllerNode(NID_LOCAL, LOCALHOST); |
| 323 | |
| 324 | @Override |
| 325 | public ControllerNode getLocalNode() { |
| 326 | return local; |
| 327 | } |
| 328 | |
Yuta HIGUCHI | 33faeaf | 2014-10-07 18:19:44 -0700 | [diff] [blame] | 329 | } |
| 330 | |
| 331 | private final class TestClockProviderService implements |
Yuta HIGUCHI | 093e83e | 2014-10-10 22:26:11 -0700 | [diff] [blame] | 332 | DeviceClockProviderService { |
Yuta HIGUCHI | 33faeaf | 2014-10-07 18:19:44 -0700 | [diff] [blame] | 333 | |
Yuta HIGUCHI | 13c0b87 | 2014-10-30 18:09:22 -0700 | [diff] [blame] | 334 | private Set<DeviceId> registerdBefore = Sets.newConcurrentHashSet(); |
| 335 | |
Yuta HIGUCHI | 33faeaf | 2014-10-07 18:19:44 -0700 | [diff] [blame] | 336 | @Override |
| 337 | public void setMastershipTerm(DeviceId deviceId, MastershipTerm term) { |
Yuta HIGUCHI | 13c0b87 | 2014-10-30 18:09:22 -0700 | [diff] [blame] | 338 | registerdBefore.add(deviceId); |
| 339 | } |
| 340 | |
| 341 | @Override |
| 342 | public boolean isTimestampAvailable(DeviceId deviceId) { |
| 343 | return registerdBefore.contains(deviceId); |
Yuta HIGUCHI | 33faeaf | 2014-10-07 18:19:44 -0700 | [diff] [blame] | 344 | } |
| 345 | } |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame] | 346 | } |