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
8 package org.opendaylight.mdsal.singleton.dom.impl;
10 import static org.junit.Assert.assertFalse;
11 import static org.junit.Assert.assertNotNull;
12 import static org.junit.Assert.assertNull;
13 import static org.junit.Assert.assertTrue;
14 import static org.mockito.Mockito.doNothing;
15 import static org.mockito.Mockito.doReturn;
16 import static org.mockito.Mockito.never;
17 import static org.mockito.Mockito.verify;
18 import static org.opendaylight.mdsal.singleton.dom.impl.AbstractClusterSingletonServiceProviderImpl.CLOSE_SERVICE_ENTITY_TYPE;
19 import static org.opendaylight.mdsal.singleton.dom.impl.AbstractClusterSingletonServiceProviderImpl.SERVICE_ENTITY_TYPE;
21 import com.google.common.util.concurrent.Futures;
22 import com.google.common.util.concurrent.ListenableFuture;
23 import java.util.concurrent.ExecutionException;
24 import org.junit.Before;
25 import org.junit.Test;
26 import org.junit.runner.RunWith;
27 import org.mockito.Mock;
28 import org.mockito.junit.MockitoJUnitRunner;
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 @RunWith(MockitoJUnitRunner.StrictStubs.class)
45 public class ClusterSingletonServiceGroupImplTest {
46 public static final String SERVICE_IDENTIFIER = "TestServiceIdent";
47 public static final ServiceGroupIdentifier SERVICE_GROUP_IDENT = ServiceGroupIdentifier.create(SERVICE_IDENTIFIER);
49 public static final TestEntity MAIN_ENTITY = new TestEntity(SERVICE_ENTITY_TYPE, SERVICE_IDENTIFIER);
50 public static final TestEntity CLOSE_ENTITY = new TestEntity(CLOSE_SERVICE_ENTITY_TYPE, SERVICE_IDENTIFIER);
53 public ClusterSingletonService mockClusterSingletonService;
55 public ClusterSingletonService mockClusterSingletonServiceSecond;
57 public GenericEntityOwnershipCandidateRegistration<?, ?> mockEntityCandReg;
59 public GenericEntityOwnershipCandidateRegistration<?, ?> mockCloseEntityCandReg;
61 public GenericEntityOwnershipListener<TestInstanceIdentifier,
62 GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity>> mockEosListener;
65 public GenericEntityOwnershipService<TestInstanceIdentifier,TestEntity,
66 GenericEntityOwnershipListener<TestInstanceIdentifier,
67 GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity>>> mockEosService;
69 public ClusterSingletonServiceGroupImpl<TestInstanceIdentifier,TestEntity,
70 GenericEntityOwnershipChange<TestInstanceIdentifier,TestEntity>,
71 GenericEntityOwnershipListener<TestInstanceIdentifier,
72 GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity>>,
73 GenericEntityOwnershipService<TestInstanceIdentifier, TestEntity,
74 GenericEntityOwnershipListener<TestInstanceIdentifier,
75 GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity>>>> singletonServiceGroup;
77 public ClusterSingletonServiceRegistration firstReg;
78 public ClusterSingletonServiceRegistration secondReg;
81 * Initialization functionality for every Tests in this suite.
83 * @throws CandidateAlreadyRegisteredException unexpected exception.
86 public void setup() throws CandidateAlreadyRegisteredException {
87 doReturn(mockEntityCandReg).when(mockEosService).registerCandidate(MAIN_ENTITY);
88 doReturn(mockCloseEntityCandReg).when(mockEosService).registerCandidate(CLOSE_ENTITY);
89 doNothing().when(mockEntityCandReg).close();
90 doNothing().when(mockCloseEntityCandReg).close();
91 doNothing().when(mockClusterSingletonService).instantiateServiceInstance();
92 doReturn(Futures.immediateFuture(null)).when(mockClusterSingletonService).closeServiceInstance();
94 doReturn(SERVICE_GROUP_IDENT).when(mockClusterSingletonService).getIdentifier();
95 doReturn(SERVICE_GROUP_IDENT).when(mockClusterSingletonServiceSecond).getIdentifier();
97 firstReg = new AbstractClusterSingletonServiceRegistration(mockClusterSingletonService) {
99 protected void removeRegistration() {
103 secondReg = new AbstractClusterSingletonServiceRegistration(mockClusterSingletonServiceSecond) {
105 protected void removeRegistration() {
110 singletonServiceGroup = new ClusterSingletonServiceGroupImpl<>(SERVICE_IDENTIFIER, MAIN_ENTITY, CLOSE_ENTITY,
115 * Test NULL ServiceIdent input for new ServiceGroup instance.
117 @Test(expected = NullPointerException.class)
118 public void instantiationClusterSingletonServiceGroupNullIdentTest() {
119 new ClusterSingletonServiceGroupImpl<>(null, MAIN_ENTITY, CLOSE_ENTITY, mockEosService);
123 * Test empty ServiceIdent input for new ServiceGroup instance.
125 @Test(expected = IllegalArgumentException.class)
126 public void instantiationClusterSingletonServiceGroupEmptyIdentTest() {
127 new ClusterSingletonServiceGroupImpl<>("", MAIN_ENTITY, CLOSE_ENTITY, mockEosService);
131 * Test NULL MainEntity input for new ServiceGroup instance.
133 @Test(expected = NullPointerException.class)
134 public void instantiationClusterSingletonServiceGroupNullMainEntityTest() {
135 new ClusterSingletonServiceGroupImpl<>(SERVICE_IDENTIFIER, null, CLOSE_ENTITY, mockEosService);
139 * Test NULL CloseEntity input for new ServiceGroup instance.
141 @Test(expected = NullPointerException.class)
142 public void instantiationClusterSingletonServiceGroupNullCloseEntityTest() {
143 new ClusterSingletonServiceGroupImpl<>(SERVICE_IDENTIFIER, MAIN_ENTITY, null, mockEosService);
147 * Test NULL EntityOwnershipService input for new ServiceGroup instance.
149 @Test(expected = NullPointerException.class)
150 public void instantiationClusterSingletonServiceGroupNullEOS_Test() {
151 new ClusterSingletonServiceGroupImpl<>(SERVICE_IDENTIFIER, MAIN_ENTITY, CLOSE_ENTITY, null);
155 * Test GoldPath for initialization ServiceGroup.
158 public void initializationClusterSingletonServiceGroupTest() throws CandidateAlreadyRegisteredException {
159 singletonServiceGroup.initialize();
160 verify(mockEosService).registerCandidate(MAIN_ENTITY);
164 * Test GoldPath for NO-TO-SLAVE entity Candidate role change.
166 * @throws CandidateAlreadyRegisteredException - unexpected exception
169 public void initializationSlaveTest() throws CandidateAlreadyRegisteredException {
170 singletonServiceGroup.initialize();
171 verify(mockEosService).registerCandidate(MAIN_ENTITY);
172 singletonServiceGroup.registerService(firstReg);
173 singletonServiceGroup.ownershipChanged(getEntityToSlave());
174 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
175 verify(mockEosService, never()).registerCandidate(CLOSE_ENTITY);
179 * Test GoldPath for NO-TO-SLAVE but without MASTER entity Candidate role change.
181 * @throws CandidateAlreadyRegisteredException - unexpected exception
184 public void initializationNoMasterTest() throws CandidateAlreadyRegisteredException {
185 singletonServiceGroup.initialize();
186 verify(mockEosService).registerCandidate(MAIN_ENTITY);
187 singletonServiceGroup.registerService(firstReg);
188 singletonServiceGroup.ownershipChanged(getEntityToSlaveNoMaster());
189 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
190 verify(mockEosService, never()).registerCandidate(CLOSE_ENTITY);
194 * Test GoldPath for InJeopardy entity Candidate role change.
196 * @throws CandidateAlreadyRegisteredException - unexpected exception
199 public void initializationInJeopardyTest() throws CandidateAlreadyRegisteredException {
200 singletonServiceGroup.initialize();
201 verify(mockEosService).registerCandidate(MAIN_ENTITY);
202 singletonServiceGroup.registerService(firstReg);
203 singletonServiceGroup.ownershipChanged(getEntityToJeopardy());
204 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
205 verify(mockEosService, never()).registerCandidate(CLOSE_ENTITY);
209 * Test GoldPath for registration SingletonService.
211 * @throws CandidateAlreadyRegisteredException - unexpected exception
214 public void serviceRegistrationClusterSingletonServiceGroupTest() throws CandidateAlreadyRegisteredException {
215 singletonServiceGroup.initialize();
216 verify(mockEosService).registerCandidate(MAIN_ENTITY);
217 singletonServiceGroup.registerService(firstReg);
221 * Test GoldPath for registration SingletonService.
223 * @throws CandidateAlreadyRegisteredException - unexpected exception
226 public void serviceRegistrationClusterSingletonServiceGroupTwoServiceTest()
227 throws CandidateAlreadyRegisteredException {
228 singletonServiceGroup.initialize();
229 verify(mockEosService).registerCandidate(MAIN_ENTITY);
230 singletonServiceGroup.registerService(firstReg);
231 singletonServiceGroup.registerService(secondReg);
235 * Test GoldPath for unregistration SingletonService don't call closeServiceInstance
236 * without mastership and don't remove ServiceGroup from map.
238 * @throws CandidateAlreadyRegisteredException - unexpected exception
241 public void serviceUnregistrationClusterSingletonServiceGroupTest() throws CandidateAlreadyRegisteredException {
242 singletonServiceGroup.initialize();
243 verify(mockEosService).registerCandidate(MAIN_ENTITY);
244 singletonServiceGroup.registerService(firstReg);
245 assertNotNull(singletonServiceGroup.unregisterService(firstReg));
246 verify(mockClusterSingletonService, never()).closeServiceInstance();
250 * Test GoldPath for unregistration SingletonService don't call closeServiceInstance
251 * without mastership and don't remove ServiceGroup from map.
253 * @throws CandidateAlreadyRegisteredException - unexpected exception
256 public void serviceUnregistrationClusterSingletonServiceGroupTwoServicesTest()
257 throws CandidateAlreadyRegisteredException {
258 singletonServiceGroup.initialize();
259 verify(mockEosService).registerCandidate(MAIN_ENTITY);
260 singletonServiceGroup.registerService(firstReg);
261 singletonServiceGroup.registerService(secondReg);
262 assertNull(singletonServiceGroup.unregisterService(firstReg));
263 verify(mockClusterSingletonService, never()).closeServiceInstance();
267 * Test GoldPath get Slave role for registered main entity.
269 * @throws CandidateAlreadyRegisteredException - unexpected exception
272 public void getSlaveClusterSingletonServiceGroupTest() throws CandidateAlreadyRegisteredException {
273 singletonServiceGroup.initialize();
274 verify(mockEosService).registerCandidate(MAIN_ENTITY);
275 singletonServiceGroup.registerService(firstReg);
276 singletonServiceGroup.ownershipChanged(getEntityToSlave());
277 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
281 * Test GoldPath get Master role for registered main entity.
283 * @throws CandidateAlreadyRegisteredException - unexpected exception
286 public void tryToTakeLeaderClusterSingletonServiceGroupTest() throws CandidateAlreadyRegisteredException {
287 singletonServiceGroup.initialize();
288 verify(mockEosService).registerCandidate(MAIN_ENTITY);
289 singletonServiceGroup.registerService(firstReg);
290 singletonServiceGroup.ownershipChanged(getEntityToMaster());
291 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
292 verify(mockEosService).registerCandidate(CLOSE_ENTITY);
296 * Test GoldPath get Master role for registered close entity.
298 * @throws CandidateAlreadyRegisteredException - unexpected exception
301 public void takeMasterClusterSingletonServiceGroupTest() throws CandidateAlreadyRegisteredException {
302 singletonServiceGroup.initialize();
303 verify(mockEosService).registerCandidate(MAIN_ENTITY);
304 singletonServiceGroup.registerService(firstReg);
305 singletonServiceGroup.ownershipChanged(getEntityToMaster());
306 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
307 verify(mockEosService).registerCandidate(CLOSE_ENTITY);
308 singletonServiceGroup.ownershipChanged(getDoubleEntityToMaster());
309 verify(mockClusterSingletonService).instantiateServiceInstance();
313 * Test GoldPath get Master role for registered entity but initial Slave
314 * role for closeEntity.
316 * @throws CandidateAlreadyRegisteredException - unexpected exception
319 public void waitToTakeMasterClusterSingletonServiceGroupTest() throws CandidateAlreadyRegisteredException {
320 singletonServiceGroup.initialize();
321 verify(mockEosService).registerCandidate(MAIN_ENTITY);
322 singletonServiceGroup.registerService(firstReg);
323 singletonServiceGroup.ownershipChanged(getEntityToMaster());
324 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
325 verify(mockEosService).registerCandidate(CLOSE_ENTITY);
326 singletonServiceGroup.ownershipChanged(getInitDoubleEntityToSlave());
327 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
328 verify(mockClusterSingletonService, never()).closeServiceInstance();
332 * Test inJeopardy validation during wait phase for Master role for closeEntity.
334 * @throws CandidateAlreadyRegisteredException - unexpected exception
337 public void inJeopardyInWaitPhaseClusterSingletonServiceGroupTest() throws CandidateAlreadyRegisteredException {
338 singletonServiceGroup.initialize();
339 verify(mockEosService).registerCandidate(MAIN_ENTITY);
340 singletonServiceGroup.registerService(firstReg);
341 singletonServiceGroup.ownershipChanged(getEntityToMaster());
342 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
343 verify(mockEosService).registerCandidate(CLOSE_ENTITY);
344 singletonServiceGroup.ownershipChanged(getEntityToJeopardy());
345 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
346 verify(mockClusterSingletonService, never()).closeServiceInstance();
350 * Test inJeopardy validation during wait phase for Master role for closeEntity.
352 * @throws CandidateAlreadyRegisteredException - unexpected exception
355 public void inJeopardyInWaitPhaseClusterSingletonServiceGroupTwoServiceTest()
356 throws CandidateAlreadyRegisteredException {
357 singletonServiceGroup.initialize();
358 verify(mockEosService).registerCandidate(MAIN_ENTITY);
359 singletonServiceGroup.registerService(firstReg);
360 singletonServiceGroup.registerService(secondReg);
361 singletonServiceGroup.ownershipChanged(getEntityToMaster());
362 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
363 verify(mockEosService).registerCandidate(CLOSE_ENTITY);
364 singletonServiceGroup.ownershipChanged(getEntityToJeopardy());
365 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
366 verify(mockClusterSingletonService, never()).closeServiceInstance();
370 * Test inJeopardy validation for holding leadership.
372 * @throws CandidateAlreadyRegisteredException - unexpected exception
375 public void inJeopardyLeaderClusterSingletonServiceGroupTest() throws CandidateAlreadyRegisteredException {
376 singletonServiceGroup.initialize();
377 verify(mockEosService).registerCandidate(MAIN_ENTITY);
378 singletonServiceGroup.registerService(firstReg);
379 singletonServiceGroup.ownershipChanged(getEntityToMaster());
380 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
381 verify(mockEosService).registerCandidate(CLOSE_ENTITY);
382 singletonServiceGroup.ownershipChanged(getDoubleEntityToMaster());
383 verify(mockClusterSingletonService).instantiateServiceInstance();
385 // Base entity in jeopardy should not matter...
386 singletonServiceGroup.ownershipChanged(getEntityToMasterJeopardy());
387 verify(mockClusterSingletonService, never()).closeServiceInstance();
389 // ... application state is actually guarded by cleanup
390 singletonServiceGroup.ownershipChanged(getDoubleEntityToJeopardy());
391 verify(mockClusterSingletonService).closeServiceInstance();
395 * Test GoldPath for SLAVE-TO-MASTER entity Candidate role change.
397 * @throws CandidateAlreadyRegisteredException - unexpected exception
400 public void lostLeaderClusterSingletonServiceGroupTest() throws CandidateAlreadyRegisteredException {
401 singletonServiceGroup.initialize();
402 verify(mockEosService).registerCandidate(MAIN_ENTITY);
403 singletonServiceGroup.registerService(firstReg);
404 singletonServiceGroup.ownershipChanged(getEntityToMaster());
405 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
406 verify(mockEosService).registerCandidate(CLOSE_ENTITY);
407 singletonServiceGroup.ownershipChanged(getDoubleEntityToMaster());
408 verify(mockClusterSingletonService).instantiateServiceInstance();
409 singletonServiceGroup.ownershipChanged(getEntityToSlave());
410 verify(mockClusterSingletonService).closeServiceInstance();
414 * Test checks validation Error processing for SLAVE-TO-MASTER entity Candidate role change.
415 * Not initialized provider has to close and remove all singletonServices from Group and
416 * Group itself remove too.
418 @Test(expected = IllegalStateException.class)
419 public void tryToTakeLeaderForNotInitializedGroupTest() {
420 singletonServiceGroup.registerService(firstReg);
424 * Test checks closing processing for close {@link ClusterSingletonServiceRegistration}.
426 * @throws CandidateAlreadyRegisteredException - unexpected exception
429 public void checkClosingRegistrationTest() throws CandidateAlreadyRegisteredException {
430 singletonServiceGroup.initialize();
431 verify(mockEosService).registerCandidate(MAIN_ENTITY);
432 singletonServiceGroup.registerService(firstReg);
433 singletonServiceGroup.ownershipChanged(getEntityToMaster());
434 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
435 verify(mockEosService).registerCandidate(CLOSE_ENTITY);
436 singletonServiceGroup.ownershipChanged(getDoubleEntityToMaster());
437 verify(mockClusterSingletonService).instantiateServiceInstance();
438 assertNotNull(singletonServiceGroup.unregisterService(firstReg));
439 verify(mockClusterSingletonService, never()).closeServiceInstance();
440 singletonServiceGroup.ownershipChanged(getEntityToSlaveNoMaster());
441 verify(mockClusterSingletonService).closeServiceInstance();
445 * Test checks validation Error processing for MASTER-TO-SLAVE closeEntity Candidate role change.
447 * @throws CandidateAlreadyRegisteredException - unexpected exception
450 public void checkClosingUnexpectedDoubleEntityForMasterOwnershipChangeRegistrationTest()
451 throws CandidateAlreadyRegisteredException {
452 singletonServiceGroup.initialize();
453 verify(mockEosService).registerCandidate(MAIN_ENTITY);
454 singletonServiceGroup.registerService(firstReg);
455 singletonServiceGroup.ownershipChanged(getEntityToMaster());
456 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
457 verify(mockEosService).registerCandidate(CLOSE_ENTITY);
458 singletonServiceGroup.ownershipChanged(getDoubleEntityToMaster());
459 verify(mockClusterSingletonService).instantiateServiceInstance();
460 singletonServiceGroup.ownershipChanged(getDoubleEntityToSlave());
461 verify(mockClusterSingletonService).closeServiceInstance();
465 * Test checks validation Error processing for MASTER-TO-SLAVE closeEntity Candidate role change
466 * without closeEntity registration.
468 * @throws CandidateAlreadyRegisteredException - unexpected exception
471 public void checkClosingUnexpectedDoubleEntityForSlaveOwnershipChangeRegistrationTest()
472 throws CandidateAlreadyRegisteredException {
473 singletonServiceGroup.initialize();
474 verify(mockEosService).registerCandidate(MAIN_ENTITY);
475 singletonServiceGroup.registerService(firstReg);
476 singletonServiceGroup.ownershipChanged(getEntityToSlave());
477 verify(mockClusterSingletonService, never()).instantiateServiceInstance();
478 verify(mockEosService, never()).registerCandidate(CLOSE_ENTITY);
479 singletonServiceGroup.ownershipChanged(getDoubleEntityToSlave());
480 verify(mockClusterSingletonService, never()).closeServiceInstance();
484 public void testRegisterCloseShutdown() throws CandidateAlreadyRegisteredException, InterruptedException,
486 initializeGroupAndStartService();
488 assertNotNull(singletonServiceGroup.unregisterService(firstReg));
489 verify(mockClusterSingletonService, never()).closeServiceInstance();
490 verify(mockEntityCandReg).close();
492 final ListenableFuture<?> future = singletonServiceGroup.closeClusterSingletonGroup();
493 assertNotNull(future);
494 assertFalse(future.isDone());
495 verify(mockClusterSingletonService).closeServiceInstance();
497 singletonServiceGroup.ownershipChanged(getEntityToSlave());
498 verify(mockCloseEntityCandReg).close();
500 singletonServiceGroup.ownershipChanged(getDoubleEntityToSlave());
501 assertTrue(future.isDone());
502 assertNull(future.get());
505 private void initialize() throws CandidateAlreadyRegisteredException {
506 singletonServiceGroup.initialize();
507 verify(mockEosService).registerCandidate(MAIN_ENTITY);
510 private void initializeGroupAndStartService() throws CandidateAlreadyRegisteredException {
512 singletonServiceGroup.registerService(firstReg);
513 singletonServiceGroup.ownershipChanged(getEntityToMaster());
514 verify(mockEosService).registerCandidate(CLOSE_ENTITY);
515 singletonServiceGroup.ownershipChanged(getDoubleEntityToMaster());
516 verify(mockClusterSingletonService).instantiateServiceInstance();
519 private static GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity> getEntityToMaster() {
520 return new GenericEntityOwnershipChange<>(MAIN_ENTITY, EntityOwnershipChangeState.LOCAL_OWNERSHIP_GRANTED);
523 private static GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity> getEntityToSlave() {
524 return new GenericEntityOwnershipChange<>(MAIN_ENTITY,
525 EntityOwnershipChangeState.LOCAL_OWNERSHIP_LOST_NEW_OWNER);
528 private static GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity> getEntityToSlaveNoMaster() {
529 return new GenericEntityOwnershipChange<>(MAIN_ENTITY,
530 EntityOwnershipChangeState.LOCAL_OWNERSHIP_LOST_NO_OWNER);
533 private static GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity> getEntityToMasterJeopardy() {
534 return new GenericEntityOwnershipChange<>(MAIN_ENTITY,
535 EntityOwnershipChangeState.LOCAL_OWNERSHIP_GRANTED, true);
538 private static GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity> getEntityToJeopardy() {
539 return new GenericEntityOwnershipChange<>(MAIN_ENTITY,
540 EntityOwnershipChangeState.REMOTE_OWNERSHIP_LOST_NO_OWNER, true);
543 private static GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity> getDoubleEntityToMaster() {
544 return new GenericEntityOwnershipChange<>(CLOSE_ENTITY, EntityOwnershipChangeState.LOCAL_OWNERSHIP_GRANTED);
547 private static GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity> getDoubleEntityToSlave() {
548 return new GenericEntityOwnershipChange<>(CLOSE_ENTITY,
549 EntityOwnershipChangeState.LOCAL_OWNERSHIP_LOST_NEW_OWNER);
552 private static GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity> getInitDoubleEntityToSlave() {
553 return new GenericEntityOwnershipChange<>(CLOSE_ENTITY, EntityOwnershipChangeState.REMOTE_OWNERSHIP_CHANGED);
556 private static GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity> getDoubleEntityToJeopardy() {
557 return new GenericEntityOwnershipChange<>(CLOSE_ENTITY,
558 EntityOwnershipChangeState.REMOTE_OWNERSHIP_LOST_NO_OWNER, true);