Showing
2 changed files
with
14 additions
and
3 deletions
1 | package org.onlab.onos.net.device.impl; | 1 | package org.onlab.onos.net.device.impl; |
2 | 2 | ||
3 | +import com.hazelcast.core.HazelcastInstance; | ||
3 | import org.junit.After; | 4 | import org.junit.After; |
4 | import org.junit.Before; | 5 | import org.junit.Before; |
5 | import org.junit.Test; | 6 | import org.junit.Test; |
... | @@ -23,6 +24,7 @@ import org.onlab.onos.net.device.PortDescription; | ... | @@ -23,6 +24,7 @@ import org.onlab.onos.net.device.PortDescription; |
23 | import org.onlab.onos.net.provider.AbstractProvider; | 24 | import org.onlab.onos.net.provider.AbstractProvider; |
24 | import org.onlab.onos.net.provider.ProviderId; | 25 | import org.onlab.onos.net.provider.ProviderId; |
25 | import org.onlab.onos.event.impl.TestEventDispatcher; | 26 | import org.onlab.onos.event.impl.TestEventDispatcher; |
27 | +import org.onlab.onos.store.StoreService; | ||
26 | import org.onlab.onos.store.device.impl.DistributedDeviceStore; | 28 | import org.onlab.onos.store.device.impl.DistributedDeviceStore; |
27 | 29 | ||
28 | import com.google.common.collect.Iterables; | 30 | import com.google.common.collect.Iterables; |
... | @@ -76,7 +78,6 @@ public class DistributedDeviceManagerTest { | ... | @@ -76,7 +78,6 @@ public class DistributedDeviceManagerTest { |
76 | service = mgr; | 78 | service = mgr; |
77 | admin = mgr; | 79 | admin = mgr; |
78 | registry = mgr; | 80 | registry = mgr; |
79 | - dstore = new DistributedDeviceStore(); | ||
80 | // FIXME should be reading the hazelcast.xml | 81 | // FIXME should be reading the hazelcast.xml |
81 | Config config = new Config(); | 82 | Config config = new Config(); |
82 | // avoid accidentally joining other cluster | 83 | // avoid accidentally joining other cluster |
... | @@ -88,7 +89,7 @@ public class DistributedDeviceManagerTest { | ... | @@ -88,7 +89,7 @@ public class DistributedDeviceManagerTest { |
88 | config.getNetworkConfig().getJoin() | 89 | config.getNetworkConfig().getJoin() |
89 | .getMulticastConfig() | 90 | .getMulticastConfig() |
90 | .setEnabled(false); | 91 | .setEnabled(false); |
91 | - dstore.theInstance = Hazelcast.newHazelcastInstance(config); | 92 | + dstore = new TestDistributedDeviceStore(Hazelcast.newHazelcastInstance(config)); |
92 | dstore.activate(); | 93 | dstore.activate(); |
93 | mgr.store = dstore; | 94 | mgr.store = dstore; |
94 | mgr.eventDispatcher = new TestEventDispatcher(); | 95 | mgr.eventDispatcher = new TestEventDispatcher(); |
... | @@ -280,4 +281,14 @@ public class DistributedDeviceManagerTest { | ... | @@ -280,4 +281,14 @@ public class DistributedDeviceManagerTest { |
280 | } | 281 | } |
281 | } | 282 | } |
282 | 283 | ||
284 | + private class TestDistributedDeviceStore extends DistributedDeviceStore { | ||
285 | + public TestDistributedDeviceStore(final HazelcastInstance hazelcastInstance) { | ||
286 | + storeService = new StoreService() { | ||
287 | + @Override | ||
288 | + public HazelcastInstance getHazelcastInstance() { | ||
289 | + return hazelcastInstance; | ||
290 | + } | ||
291 | + }; | ||
292 | + } | ||
293 | + } | ||
283 | } | 294 | } | ... | ... |
... | @@ -19,7 +19,7 @@ public class StoreManager implements StoreService { | ... | @@ -19,7 +19,7 @@ public class StoreManager implements StoreService { |
19 | 19 | ||
20 | private final Logger log = LoggerFactory.getLogger(getClass()); | 20 | private final Logger log = LoggerFactory.getLogger(getClass()); |
21 | 21 | ||
22 | - private HazelcastInstance instance; | 22 | + protected HazelcastInstance instance; |
23 | 23 | ||
24 | @Activate | 24 | @Activate |
25 | public void activate() { | 25 | public void activate() { | ... | ... |
-
Please register or login to post a comment