2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.mdsal.singleton.dom.impl;
11 import static org.junit.Assert.assertFalse;
12 import static org.junit.Assert.assertNotNull;
13 import static org.junit.Assert.assertNull;
14 import static org.junit.Assert.assertTrue;
15 import static org.mockito.Mockito.doNothing;
16 import static org.mockito.Mockito.doReturn;
17 import static org.mockito.Mockito.never;
18 import static org.mockito.Mockito.verify;
19 import static org.opendaylight.mdsal.singleton.dom.impl.AbstractClusterSingletonServiceProviderImpl.CLOSE_SERVICE_ENTITY_TYPE;
20 import static org.opendaylight.mdsal.singleton.dom.impl.AbstractClusterSingletonServiceProviderImpl.SERVICE_ENTITY_TYPE;
22 import com.google.common.util.concurrent.Futures;
23 import com.google.common.util.concurrent.ListenableFuture;
24 import java.util.concurrent.ExecutionException;
25 import org.junit.Before;
26 import org.junit.Test;
27 import org.mockito.Mock;
28 import org.mockito.MockitoAnnotations;
29 import org.opendaylight.mdsal.eos.common.api.CandidateAlreadyRegisteredException;
30 import org.opendaylight.mdsal.eos.common.api.EntityOwnershipChangeState;
31 import org.opendaylight.mdsal.eos.common.api.GenericEntityOwnershipCandidateRegistration;
32 import org.opendaylight.mdsal.eos.common.api.GenericEntityOwnershipChange;
33 import org.opendaylight.mdsal.eos.common.api.GenericEntityOwnershipListener;
34 import org.opendaylight.mdsal.eos.common.api.GenericEntityOwnershipService;
35 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
36 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
37 import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
38 import org.opendaylight.mdsal.singleton.dom.impl.util.TestEntity;
39 import org.opendaylight.mdsal.singleton.dom.impl.util.TestInstanceIdentifier;
42 * Testing {@link ClusterSingletonServiceGroupImpl}.
44 public class ClusterSingletonServiceGroupImplTest {
45 private static final String SERVICE_IDENTIFIER = "TestServiceIdent";
46 private static final ServiceGroupIdentifier SERVICE_GROUP_IDENT = ServiceGroupIdentifier.create(SERVICE_IDENTIFIER);
48 private static final TestEntity MAIN_ENTITY = new TestEntity(SERVICE_ENTITY_TYPE, SERVICE_IDENTIFIER);
49 private static final TestEntity CLOSE_ENTITY = new TestEntity(CLOSE_SERVICE_ENTITY_TYPE, SERVICE_IDENTIFIER);
52 private ClusterSingletonService mockClusterSingletonService;
54 private ClusterSingletonService mockClusterSingletonServiceSecond;
56 private GenericEntityOwnershipCandidateRegistration<?, ?> mockEntityCandReg;
58 private GenericEntityOwnershipCandidateRegistration<?, ?> mockCloseEntityCandReg;
60 private GenericEntityOwnershipListener<TestInstanceIdentifier,
61 GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity>> mockEosListener;
64 private GenericEntityOwnershipService<TestInstanceIdentifier,TestEntity,
65 GenericEntityOwnershipListener<TestInstanceIdentifier,
66 GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity>>> mockEosService;
68 private ClusterSingletonServiceGroupImpl<TestInstanceIdentifier,TestEntity,
69 GenericEntityOwnershipChange<TestInstanceIdentifier,TestEntity>,
70 GenericEntityOwnershipListener<TestInstanceIdentifier,
71 GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity>>,
72 GenericEntityOwnershipService<TestInstanceIdentifier, TestEntity,
73 GenericEntityOwnershipListener<TestInstanceIdentifier,
74 GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity>>>> singletonServiceGroup;
76 private ClusterSingletonServiceRegistration firstReg;
77 private ClusterSingletonServiceRegistration secondReg;
80 * Initialization functionality for every Tests in this suite.
82 * @throws CandidateAlreadyRegisteredException unexpected exception.
85 public void setup() throws CandidateAlreadyRegisteredException {
86 MockitoAnnotations.initMocks(this);
88 doReturn(mockEntityCandReg).when(mockEosService).registerCandidate(MAIN_ENTITY);
89 doReturn(mockCloseEntityCandReg).when(mockEosService).registerCandidate(CLOSE_ENTITY);
90 doNothing().when(mockEntityCandReg).close();
91 doNothing().when(mockCloseEntityCandReg).close();
92 doNothing().when(mockClusterSingletonService).instantiateServiceInstance();
93 doReturn(Futures.immediateFuture(null)).when(mockClusterSingletonService).closeServiceInstance();
95 doReturn(SERVICE_GROUP_IDENT).when(mockClusterSingletonService).getIdentifier();
96 doReturn(SERVICE_GROUP_IDENT).when(mockClusterSingletonServiceSecond).getIdentifier();
98 firstReg = new AbstractClusterSingletonServiceRegistration(mockClusterSingletonService) {
100 protected void removeRegistration() {
104 secondReg = new AbstractClusterSingletonServiceRegistration(mockClusterSingletonServiceSecond) {
106 protected void removeRegistration() {
111 singletonServiceGroup = new ClusterSingletonServiceGroupImpl<>(SERVICE_IDENTIFIER, MAIN_ENTITY, CLOSE_ENTITY,
116 * Test NULL ServiceIdent input for new ServiceGroup instance.
118 @Test(expected = NullPointerException.class)
119 public void instantiationClusterSingletonServiceGroupNullIdentTest() {
120 new ClusterSingletonServiceGroupImpl<>(null, MAIN_ENTITY, CLOSE_ENTITY, mockEosService);
124 * Test empty ServiceIdent input for new ServiceGroup instance.
126 @Test(expected = IllegalArgumentException.class)
127 public void instantiationClusterSingletonServiceGroupEmptyIdentTest() {
128 new ClusterSingletonServiceGroupImpl<>("", MAIN_ENTITY, CLOSE_ENTITY, mockEosService);
132 * Test NULL MainEntity input for new ServiceGroup instance.
134 @Test(expected = NullPointerException.class)
135 public void instantiationClusterSingletonServiceGroupNullMainEntityTest() {
136 new ClusterSingletonServiceGroupImpl<>(SERVICE_IDENTIFIER, null, CLOSE_ENTITY, mockEosService);
140 * Test NULL CloseEntity input for new ServiceGroup instance.
142 @Test(expected = NullPointerException.class)
143 public void instantiationClusterSingletonServiceGroupNullCloseEntityTest() {
144 new ClusterSingletonServiceGroupImpl<>(SERVICE_IDENTIFIER, MAIN_ENTITY, null, mockEosService);
148 * Test NULL EntityOwnershipService input for new ServiceGroup instance.
150 @Test(expected = NullPointerException.class)
151 public void instantiationClusterSingletonServiceGroupNullEOS_Test() {
152 new ClusterSingletonServiceGroupImpl<>(SERVICE_IDENTIFIER, MAIN_ENTITY, CLOSE_ENTITY, null);
156 * Test GoldPath for initialization ServiceGroup.
159 public void initializationClusterSingletonServiceGroupTest() throws CandidateAlreadyRegisteredException {
160 singletonServiceGroup.initialize();
161 verify(mockEosService).registerCandidate(MAIN_ENTITY);
165 * Test GoldPath for NO-TO-SLAVE entity Candidate role change.
167 * @throws CandidateAlreadyRegisteredException - unexpected exception
170 public void initializationSlaveTest() throws CandidateAlreadyRegisteredException {
171 singletonServiceGroup.initialize();
172 verify(mockEosService).registerCandidate(MAIN_ENTITY);
173 singletonServiceGroup.registerService(firstReg);
174 singletonServiceGroup.ownershipChanged(getEntityToSlave());
175 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
176 verify(mockEosService, never()).registerCandidate(CLOSE_ENTITY);
180 * Test GoldPath for NO-TO-SLAVE but without MASTER entity Candidate role change.
182 * @throws CandidateAlreadyRegisteredException - unexpected exception
185 public void initializationNoMasterTest() throws CandidateAlreadyRegisteredException {
186 singletonServiceGroup.initialize();
187 verify(mockEosService).registerCandidate(MAIN_ENTITY);
188 singletonServiceGroup.registerService(firstReg);
189 singletonServiceGroup.ownershipChanged(getEntityToSlaveNoMaster());
190 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
191 verify(mockEosService, never()).registerCandidate(CLOSE_ENTITY);
195 * Test GoldPath for InJeopardy entity Candidate role change.
197 * @throws CandidateAlreadyRegisteredException - unexpected exception
200 public void initializationInJeopardyTest() throws CandidateAlreadyRegisteredException {
201 singletonServiceGroup.initialize();
202 verify(mockEosService).registerCandidate(MAIN_ENTITY);
203 singletonServiceGroup.registerService(firstReg);
204 singletonServiceGroup.ownershipChanged(getEntityToJeopardy());
205 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
206 verify(mockEosService, never()).registerCandidate(CLOSE_ENTITY);
210 * Test GoldPath for registration SingletonService.
212 * @throws CandidateAlreadyRegisteredException - unexpected exception
215 public void serviceRegistrationClusterSingletonServiceGroupTest() throws CandidateAlreadyRegisteredException {
216 singletonServiceGroup.initialize();
217 verify(mockEosService).registerCandidate(MAIN_ENTITY);
218 singletonServiceGroup.registerService(firstReg);
222 * Test GoldPath for registration SingletonService.
224 * @throws CandidateAlreadyRegisteredException - unexpected exception
227 public void serviceRegistrationClusterSingletonServiceGroupTwoServiceTest()
228 throws CandidateAlreadyRegisteredException {
229 singletonServiceGroup.initialize();
230 verify(mockEosService).registerCandidate(MAIN_ENTITY);
231 singletonServiceGroup.registerService(firstReg);
232 singletonServiceGroup.registerService(secondReg);
236 * Test GoldPath for unregistration SingletonService don't call closeServiceInstance
237 * without mastership and don't remove ServiceGroup from map.
239 * @throws CandidateAlreadyRegisteredException - unexpected exception
242 public void serviceUnregistrationClusterSingletonServiceGroupTest() throws CandidateAlreadyRegisteredException {
243 singletonServiceGroup.initialize();
244 verify(mockEosService).registerCandidate(MAIN_ENTITY);
245 singletonServiceGroup.registerService(firstReg);
246 assertTrue(singletonServiceGroup.unregisterService(firstReg));
247 verify(mockClusterSingletonService, never()).closeServiceInstance();
251 * Test GoldPath for unregistration SingletonService don't call closeServiceInstance
252 * without mastership and don't remove ServiceGroup from map.
254 * @throws CandidateAlreadyRegisteredException - unexpected exception
257 public void serviceUnregistrationClusterSingletonServiceGroupTwoServicesTest()
258 throws CandidateAlreadyRegisteredException {
259 singletonServiceGroup.initialize();
260 verify(mockEosService).registerCandidate(MAIN_ENTITY);
261 singletonServiceGroup.registerService(firstReg);
262 singletonServiceGroup.registerService(secondReg);
263 assertFalse(singletonServiceGroup.unregisterService(firstReg));
264 verify(mockClusterSingletonService, never()).closeServiceInstance();
268 * Test GoldPath get Slave role for registered main entity.
270 * @throws CandidateAlreadyRegisteredException - unexpected exception
273 public void getSlaveClusterSingletonServiceGroupTest() throws CandidateAlreadyRegisteredException {
274 singletonServiceGroup.initialize();
275 verify(mockEosService).registerCandidate(MAIN_ENTITY);
276 singletonServiceGroup.registerService(firstReg);
277 singletonServiceGroup.ownershipChanged(getEntityToSlave());
278 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
282 * Test GoldPath get Master role for registered main entity.
284 * @throws CandidateAlreadyRegisteredException - unexpected exception
287 public void tryToTakeLeaderClusterSingletonServiceGroupTest() throws CandidateAlreadyRegisteredException {
288 singletonServiceGroup.initialize();
289 verify(mockEosService).registerCandidate(MAIN_ENTITY);
290 singletonServiceGroup.registerService(firstReg);
291 singletonServiceGroup.ownershipChanged(getEntityToMaster());
292 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
293 verify(mockEosService).registerCandidate(CLOSE_ENTITY);
297 * Test GoldPath get Master role for registered close entity.
299 * @throws CandidateAlreadyRegisteredException - unexpected exception
302 public void takeMasterClusterSingletonServiceGroupTest() throws CandidateAlreadyRegisteredException {
303 singletonServiceGroup.initialize();
304 verify(mockEosService).registerCandidate(MAIN_ENTITY);
305 singletonServiceGroup.registerService(firstReg);
306 singletonServiceGroup.ownershipChanged(getEntityToMaster());
307 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
308 verify(mockEosService).registerCandidate(CLOSE_ENTITY);
309 singletonServiceGroup.ownershipChanged(getDoubleEntityToMaster());
310 verify(mockClusterSingletonService).instantiateServiceInstance();
314 * Test GoldPath get Master role for registered entity but initial Slave
315 * role for closeEntity.
317 * @throws CandidateAlreadyRegisteredException - unexpected exception
320 public void waitToTakeMasterClusterSingletonServiceGroupTest() throws CandidateAlreadyRegisteredException {
321 singletonServiceGroup.initialize();
322 verify(mockEosService).registerCandidate(MAIN_ENTITY);
323 singletonServiceGroup.registerService(firstReg);
324 singletonServiceGroup.ownershipChanged(getEntityToMaster());
325 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
326 verify(mockEosService).registerCandidate(CLOSE_ENTITY);
327 singletonServiceGroup.ownershipChanged(getInitDoubleEntityToSlave());
328 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
329 verify(mockClusterSingletonService, never()).closeServiceInstance();
333 * Test inJeopardy validation during wait phase for Master role for closeEntity.
335 * @throws CandidateAlreadyRegisteredException - unexpected exception
338 public void inJeopardyInWaitPhaseClusterSingletonServiceGroupTest() throws CandidateAlreadyRegisteredException {
339 singletonServiceGroup.initialize();
340 verify(mockEosService).registerCandidate(MAIN_ENTITY);
341 singletonServiceGroup.registerService(firstReg);
342 singletonServiceGroup.ownershipChanged(getEntityToMaster());
343 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
344 verify(mockEosService).registerCandidate(CLOSE_ENTITY);
345 singletonServiceGroup.ownershipChanged(getEntityToJeopardy());
346 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
347 verify(mockClusterSingletonService, never()).closeServiceInstance();
351 * Test inJeopardy validation during wait phase for Master role for closeEntity.
353 * @throws CandidateAlreadyRegisteredException - unexpected exception
356 public void inJeopardyInWaitPhaseClusterSingletonServiceGroupTwoServiceTest()
357 throws CandidateAlreadyRegisteredException {
358 singletonServiceGroup.initialize();
359 verify(mockEosService).registerCandidate(MAIN_ENTITY);
360 singletonServiceGroup.registerService(firstReg);
361 singletonServiceGroup.registerService(secondReg);
362 singletonServiceGroup.ownershipChanged(getEntityToMaster());
363 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
364 verify(mockEosService).registerCandidate(CLOSE_ENTITY);
365 singletonServiceGroup.ownershipChanged(getEntityToJeopardy());
366 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
367 verify(mockClusterSingletonService, never()).closeServiceInstance();
371 * Test inJeopardy validation for holding leadership.
373 * @throws CandidateAlreadyRegisteredException - unexpected exception
376 public void inJeopardyLeaderClusterSingletonServiceGroupTest() throws CandidateAlreadyRegisteredException {
377 singletonServiceGroup.initialize();
378 verify(mockEosService).registerCandidate(MAIN_ENTITY);
379 singletonServiceGroup.registerService(firstReg);
380 singletonServiceGroup.ownershipChanged(getEntityToMaster());
381 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
382 verify(mockEosService).registerCandidate(CLOSE_ENTITY);
383 singletonServiceGroup.ownershipChanged(getDoubleEntityToMaster());
384 verify(mockClusterSingletonService).instantiateServiceInstance();
386 // Base entity in jeopardy should not matter...
387 singletonServiceGroup.ownershipChanged(getEntityToJeopardy());
388 verify(mockClusterSingletonService, never()).closeServiceInstance();
390 // ... application state is actually guarded by cleanup
391 singletonServiceGroup.ownershipChanged(getDoubleEntityToJeopardy());
392 verify(mockClusterSingletonService).closeServiceInstance();
396 * Test GoldPath for SLAVE-TO-MASTER entity Candidate role change.
398 * @throws CandidateAlreadyRegisteredException - unexpected exception
401 public void lostLeaderClusterSingletonServiceGroupTest() throws CandidateAlreadyRegisteredException {
402 singletonServiceGroup.initialize();
403 verify(mockEosService).registerCandidate(MAIN_ENTITY);
404 singletonServiceGroup.registerService(firstReg);
405 singletonServiceGroup.ownershipChanged(getEntityToMaster());
406 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
407 verify(mockEosService).registerCandidate(CLOSE_ENTITY);
408 singletonServiceGroup.ownershipChanged(getDoubleEntityToMaster());
409 verify(mockClusterSingletonService).instantiateServiceInstance();
410 singletonServiceGroup.ownershipChanged(getEntityToSlave());
411 verify(mockClusterSingletonService).closeServiceInstance();
415 * Test checks validation Error processing for SLAVE-TO-MASTER entity Candidate role change.
416 * Not initialized provider has to close and remove all singletonServices from Group and
417 * Group itself remove too.
419 @Test(expected = RuntimeException.class)
420 public void tryToTakeLeaderForNotInitializedGroupTest() {
421 singletonServiceGroup.registerService(firstReg);
425 * Test checks closing processing for close {@link ClusterSingletonServiceRegistration}.
427 * @throws CandidateAlreadyRegisteredException - unexpected exception
430 public void checkClosingRegistrationTest() throws CandidateAlreadyRegisteredException {
431 singletonServiceGroup.initialize();
432 verify(mockEosService).registerCandidate(MAIN_ENTITY);
433 singletonServiceGroup.registerService(firstReg);
434 singletonServiceGroup.ownershipChanged(getEntityToMaster());
435 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
436 verify(mockEosService).registerCandidate(CLOSE_ENTITY);
437 singletonServiceGroup.ownershipChanged(getDoubleEntityToMaster());
438 verify(mockClusterSingletonService).instantiateServiceInstance();
439 assertTrue(singletonServiceGroup.unregisterService(firstReg));
440 verify(mockClusterSingletonService, never()).closeServiceInstance();
441 singletonServiceGroup.ownershipChanged(getEntityToSlaveNoMaster());
442 verify(mockClusterSingletonService).closeServiceInstance();
446 * Test checks validation Error processing for MASTER-TO-SLAVE closeEntity Candidate role change.
448 * @throws CandidateAlreadyRegisteredException - unexpected exception
451 public void checkClosingUnexpectedDoubleEntityForMasterOwnershipChangeRegistrationTest()
452 throws CandidateAlreadyRegisteredException {
453 singletonServiceGroup.initialize();
454 verify(mockEosService).registerCandidate(MAIN_ENTITY);
455 singletonServiceGroup.registerService(firstReg);
456 singletonServiceGroup.ownershipChanged(getEntityToMaster());
457 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
458 verify(mockEosService).registerCandidate(CLOSE_ENTITY);
459 singletonServiceGroup.ownershipChanged(getDoubleEntityToMaster());
460 verify(mockClusterSingletonService).instantiateServiceInstance();
461 singletonServiceGroup.ownershipChanged(getDoubleEntityToSlave());
462 verify(mockClusterSingletonService).closeServiceInstance();
466 * Test checks validation Error processing for MASTER-TO-SLAVE closeEntity Candidate role change
467 * without closeEntity registration.
469 * @throws CandidateAlreadyRegisteredException - unexpected exception
472 public void checkClosingUnexpectedDoubleEntityForSlaveOwnershipChangeRegistrationTest()
473 throws CandidateAlreadyRegisteredException {
474 singletonServiceGroup.initialize();
475 verify(mockEosService).registerCandidate(MAIN_ENTITY);
476 singletonServiceGroup.registerService(firstReg);
477 singletonServiceGroup.ownershipChanged(getEntityToSlave());
478 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
479 verify(mockEosService, never()).registerCandidate(CLOSE_ENTITY);
480 singletonServiceGroup.ownershipChanged(getDoubleEntityToSlave());
481 verify(mockClusterSingletonService, never()).closeServiceInstance();
485 public void testRegisterCloseShutdown() throws CandidateAlreadyRegisteredException, InterruptedException,
487 initializeGroupAndStartService();
489 assertTrue(singletonServiceGroup.unregisterService(firstReg));
490 verify(mockClusterSingletonService, never()).closeServiceInstance();
491 verify(mockEntityCandReg, never()).close();
493 final ListenableFuture<?> future = singletonServiceGroup.closeClusterSingletonGroup();
494 assertNotNull(future);
495 assertFalse(future.isDone());
496 verify(mockClusterSingletonService, never()).closeServiceInstance();
497 verify(mockEntityCandReg).close();
499 singletonServiceGroup.ownershipChanged(getEntityToSlave());
500 verify(mockClusterSingletonService).closeServiceInstance();
501 verify(mockCloseEntityCandReg).close();
503 singletonServiceGroup.ownershipChanged(getDoubleEntityToSlave());
504 assertTrue(future.isDone());
505 assertNull(future.get());
508 private void initialize() throws CandidateAlreadyRegisteredException {
509 singletonServiceGroup.initialize();
510 verify(mockEosService).registerCandidate(MAIN_ENTITY);
513 private void initializeGroupAndStartService() throws CandidateAlreadyRegisteredException {
515 singletonServiceGroup.registerService(firstReg);
516 singletonServiceGroup.ownershipChanged(getEntityToMaster());
517 verify(mockEosService).registerCandidate(CLOSE_ENTITY);
518 singletonServiceGroup.ownershipChanged(getDoubleEntityToMaster());
519 verify(mockClusterSingletonService).instantiateServiceInstance();
522 private static GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity> getEntityToMaster() {
523 return new GenericEntityOwnershipChange<>(MAIN_ENTITY, EntityOwnershipChangeState.LOCAL_OWNERSHIP_GRANTED);
526 private static GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity> getEntityToSlave() {
527 return new GenericEntityOwnershipChange<>(MAIN_ENTITY,
528 EntityOwnershipChangeState.LOCAL_OWNERSHIP_LOST_NEW_OWNER);
531 private static GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity> getEntityToSlaveNoMaster() {
532 return new GenericEntityOwnershipChange<>(MAIN_ENTITY,
533 EntityOwnershipChangeState.LOCAL_OWNERSHIP_LOST_NO_OWNER);
536 private static GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity> getEntityToJeopardy() {
537 return new GenericEntityOwnershipChange<>(MAIN_ENTITY,
538 EntityOwnershipChangeState.REMOTE_OWNERSHIP_LOST_NO_OWNER, true);
541 private static GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity> getDoubleEntityToMaster() {
542 return new GenericEntityOwnershipChange<>(CLOSE_ENTITY, EntityOwnershipChangeState.LOCAL_OWNERSHIP_GRANTED);
545 private static GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity> getDoubleEntityToSlave() {
546 return new GenericEntityOwnershipChange<>(CLOSE_ENTITY,
547 EntityOwnershipChangeState.LOCAL_OWNERSHIP_LOST_NEW_OWNER);
550 private static GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity> getInitDoubleEntityToSlave() {
551 return new GenericEntityOwnershipChange<>(CLOSE_ENTITY, EntityOwnershipChangeState.REMOTE_OWNERSHIP_CHANGED);
554 private static GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity> getDoubleEntityToJeopardy() {
555 return new GenericEntityOwnershipChange<>(CLOSE_ENTITY,
556 EntityOwnershipChangeState.REMOTE_OWNERSHIP_LOST_NO_OWNER, true);