<scope>test</scope>
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
<scm>
<connection>scm:git:http://git.opendaylight.org/gerrit/mdsal.git</connection>
public class ServiceGroupIdentifier extends AbstractStringIdentifier<ServiceGroupIdentifier> {
/**
- * Method create immutable instance of {@link ServiceGroupIdentifier}
+ * Method to create immutable instances of {@link ServiceGroupIdentifier}.
*
- * @param serviceGroupIdentifier
- * @return {@link ServiceGroupIdentifier} instance
+ * @param serviceGroupIdentifier the String identifier for the ServiceGroupIdentifier instance
+ * @return {@link ServiceGroupIdentifier} new instance
*/
public static ServiceGroupIdentifier create(final String serviceGroupIdentifier) {
return new ServiceGroupIdentifier(serviceGroupIdentifier);
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+ </configuration>
+ </plugin>
</plugins>
</build>
<scm>
import org.opendaylight.mdsal.eos.common.api.GenericEntityOwnershipListenerRegistration;
import org.opendaylight.mdsal.eos.common.api.GenericEntityOwnershipService;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
+import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
import org.opendaylight.yangtools.concepts.Path;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* @param <R> the GenericEntityOwnershipListenerRegistration type
*/
public abstract class AbstractClusterSingletonServiceProviderImpl<P extends Path<P>, E extends GenericEntity<P>,
- C extends GenericEntityOwnershipChange<P, E>,
- G extends GenericEntityOwnershipListener<P, C>,
- S extends GenericEntityOwnershipService<P, E, G>,
- R extends GenericEntityOwnershipListenerRegistration<P, G>>
+ C extends GenericEntityOwnershipChange<P, E>,
+ G extends GenericEntityOwnershipListener<P, C>,
+ S extends GenericEntityOwnershipService<P, E, G>,
+ R extends GenericEntityOwnershipListenerRegistration<P, G>>
implements ClusterSingletonServiceProvider, GenericEntityOwnershipListener<P, C> {
private static final Logger LOG = LoggerFactory
private static final String CLOSE_SERVICE_ENTITY_TYPE = "org.opendaylight.mdsal.AsyncServiceCloseEntityType";
private final S entityOwnershipService;
- private final ConcurrentMap<String, ClusterSingletonServiceGroup<P, E, C>> serviceGroupMap = new ConcurrentHashMap<>();
+ private final ConcurrentMap<String, ClusterSingletonServiceGroup<P, E, C>> serviceGroupMap =
+ new ConcurrentHashMap<>();
/* EOS Entity Listeners Registration */
private R serviceEntityListenerReg;
private R asyncCloseEntityListenerReg;
/**
- * Class constructor
+ * Class constructor.
*
* @param entityOwnershipService relevant EOS
*/
}
@Override
- public void onFailure(final Throwable t) {
- cleaningProvider(t);
+ public void onFailure(final Throwable throwable) {
+ cleaningProvider(throwable);
}
});
}
/**
* Method is responsible for parsing ServiceGroupIdentifier from E entity.
*
- * @param entity
+ * @param entity instance of GenericEntity type
* @return ServiceGroupIdentifier parsed from entity key value.
*/
protected abstract String getServiceIdentifierFromEntity(final E entity);
/**
* Method is called async. from close method in end of Provider lifecycle.
*
- * @param t Throwable (needs for log)
+ * @param throwable Throwable (needs for log)
*/
- protected final void cleaningProvider(@Nullable final Throwable t) {
+ protected final void cleaningProvider(@Nullable final Throwable throwable) {
LOG.debug("Final cleaning ClusterSingletonServiceProvider {}", this.getClass().getName());
- if (t != null) {
- LOG.warn("Unexpected problem by closing ClusterSingletonServiceProvider {}", this.getClass().getName(), t);
+ if (throwable != null) {
+ LOG.warn("Unexpected problem by closing ClusterSingletonServiceProvider {}",
+ this.getClass().getName(), throwable);
}
if (asyncCloseEntityListenerReg != null) {
asyncCloseEntityListenerReg.close();
import org.slf4j.LoggerFactory;
/**
- * Implementation of {@link ClusterSingletonServiceGroup}
+ * Implementation of {@link ClusterSingletonServiceGroup}.
*
* @param <P> the instance identifier path type
* @param <E> the GenericEntity type
private GenericEntityOwnershipCandidateRegistration<P, E> asyncCloseEntityCandidateReg;
/**
- * Class constructor
+ * Class constructor.
*
* @param clusterSingletonServiceGroupIdentifier not empty string as identifier
- * @param mainEntity
- * @param closeEntity
- * @param entityOwnershipService
+ * @param mainEntity as Entity instance
+ * @param closeEntity as Entity instance
+ * @param entityOwnershipService GenericEntityOwnershipService instance
+ * @param allServiceGroups concurrentMap of String and ClusterSingletonServiceGroup type
*/
ClusterSingletonServiceGroupImpl(final String clusterSingletonServiceGroupIdentifier, final E mainEntity,
final E closeEntity, final S entityOwnershipService,
this.allServiceGroups = Preconditions.checkNotNull(allServiceGroups);
}
+ @SuppressWarnings("checkstyle:IllegalCatch")
@Override
- public final ListenableFuture<List<Void>> closeClusterSingletonGroup() {
+ public ListenableFuture<List<Void>> closeClusterSingletonGroup() {
LOG.debug("Close method for service Provider {}", clusterSingletonGroupIdentifier);
boolean needReleaseLock = false;
final ListenableFuture<List<Void>> destroyFuture;
try {
needReleaseLock = clusterLock.tryAcquire(10, TimeUnit.SECONDS);
} catch (final Exception e) {
- LOG.warn("Unexpected Exception for service Provider {} in closing phase.", clusterSingletonGroupIdentifier, e);
+ LOG.warn("Unexpected Exception for service Provider {} in closing phase.",
+ clusterSingletonGroupIdentifier, e);
} finally {
if (serviceEntityCandidateReg != null) {
serviceEntityCandidateReg.close();
return destroyFuture;
}
+ @SuppressWarnings("checkstyle:IllegalCatch")
@Override
- public final void initializationClusterSingletonGroup() {
+ public void initializationClusterSingletonGroup() {
LOG.debug("Initialization ClusterSingletonGroup {}", clusterSingletonGroupIdentifier);
boolean needReleaseLock = false;
boolean needCloseProviderInstance = false;
}
}
+ @SuppressWarnings("checkstyle:IllegalCatch")
@Override
- public final ClusterSingletonServiceRegistration registerService(final ClusterSingletonService service) {
+ public ClusterSingletonServiceRegistration registerService(final ClusterSingletonService service) {
LOG.debug("RegisterService method call for ClusterSingletonServiceGroup {}", clusterSingletonGroupIdentifier);
Verify.verify(clusterSingletonGroupIdentifier.equals(service.getIdentifier().getValue()));
boolean needReleaseLock = false;
return reg;
}
+ @SuppressWarnings("checkstyle:IllegalCatch")
@Override
- public final void unregisterService(final ClusterSingletonService service) {
+ public void unregisterService(final ClusterSingletonService service) {
LOG.debug("UnregisterService method call for ClusterSingletonServiceGroup {}", clusterSingletonGroupIdentifier);
Verify.verify(clusterSingletonGroupIdentifier.equals(service.getIdentifier().getValue()));
boolean needReleaseLock = false;
}
}
+ @SuppressWarnings("checkstyle:IllegalCatch")
@Override
- public final void ownershipChanged(final C ownershipChange) {
+ public void ownershipChanged(final C ownershipChange) {
LOG.debug("Ownership change {} for ClusterSingletonServiceGrou {}", ownershipChange,
clusterSingletonGroupIdentifier);
try {
} else {
LOG.warn("Unexpected EntityOwnershipChangeEvent for entity {}", ownershipChange);
}
- } catch (final Exception e) {
+ } catch (Exception e) {
LOG.error("Unexpected Exception for service Provider {}", clusterSingletonGroupIdentifier, e);
// TODO : think about close ... is it necessary?
}
* Help method to registered DoubleCandidateEntity. It is first step
* before the actual instance take Leadership.
*/
+ @SuppressWarnings("checkstyle:IllegalCatch")
private void tryToTakeOwnership() {
LOG.debug("TryToTakeLeadership method for service Provider {}", clusterSingletonGroupIdentifier);
boolean needReleaseLock = false;
Verify.verify(serviceEntityCandidateReg != null);
Verify.verify(asyncCloseEntityCandidateReg == null);
asyncCloseEntityCandidateReg = entityOwnershipService.registerCandidate(doubleCandidateEntity);
- } catch (final Exception e) {
+ } catch (Exception e) {
LOG.error("Unexpected exception state for service Provider {} in TryToTakeLeadership",
clusterSingletonGroupIdentifier, e);
needCloseProviderInstance = true;
/*
* Help method calls setupService method for create single cluster-wide service instance.
*/
+ @SuppressWarnings("checkstyle:IllegalCatch")
private void takeOwnership() {
LOG.debug("TakeLeadership method for service Provider {}", clusterSingletonGroupIdentifier);
boolean needReleaseLock = false;
* The last async. step has to close DoubleCandidateRegistration reference what should initialize
* new election for DoubleCandidateEntity.
*/
+ @SuppressWarnings("checkstyle:IllegalCatch")
private void lostOwnership() {
LOG.debug("LostLeadership method for service Provider {}", clusterSingletonGroupIdentifier);
boolean needReleaseLock = false;
}
@Override
- public void onFailure(final Throwable t) {
- removeThisGroupFromProvider(t);
+ public void onFailure(final Throwable throwable) {
+ removeThisGroupFromProvider(throwable);
}
});
}
/*
* Help method for final ClusterSingletonGroup removing
*/
- protected final void removeThisGroupFromProvider(@Nullable final Throwable t) {
+ protected void removeThisGroupFromProvider(@Nullable final Throwable throwable) {
LOG.debug("Removing ClusterSingletonServiceGroup {}", clusterSingletonGroupIdentifier);
- if (t != null) {
+ if (throwable != null) {
LOG.warn("Unexpected problem by closingResources ClusterSingletonServiceGroup {}",
clusterSingletonGroupIdentifier);
}
* Help method creates FutureCallback for suspend Future
*/
private FutureCallback<List<Void>> newAsyncCloseCallback(@Nullable final Semaphore semaphore) {
- final Consumer<Throwable> closeEntityCandidateRegistration = (@Nullable final Throwable t) -> {
- if (t != null) {
- LOG.warn("Unexpected error closing service instance {}", clusterSingletonGroupIdentifier, t);
+ final Consumer<Throwable> closeEntityCandidateRegistration = (@Nullable final Throwable throwable) -> {
+ if (throwable != null) {
+ LOG.warn("Unexpected error closing service instance {}", clusterSingletonGroupIdentifier, throwable);
} else {
LOG.debug("Destroy service Instance {} is success", clusterSingletonGroupIdentifier);
}
}
@Override
- public void onFailure(final Throwable t) {
- closeEntityCandidateRegistration.accept(t);
+ public void onFailure(final Throwable throwable) {
+ closeEntityCandidateRegistration.accept(throwable);
}
};
}
* Close registration means remove {@link ClusterSingletonService} instance from internal
* ClusterSingletonServiceGroup list reference.
*
+ *<p>
* Close {@link ClusterSingletonServiceRegistration} is prepared for a possible restart
* service or application in osgi container. Any another services from group can not be
* stopped.
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
/**
- * Binding version of {@link AbstractClusterSingletonServiceProviderImpl}
+ * Binding version of {@link AbstractClusterSingletonServiceProviderImpl}.
*/
public final class DOMClusterSingletonServiceProviderImpl extends
AbstractClusterSingletonServiceProviderImpl<YangInstanceIdentifier, DOMEntity,
implements DOMEntityOwnershipListener {
/**
- * Initialization all needed class internal property for {@link DOMClusterSingletonServiceProviderImpl}
+ * Initialization all needed class internal property for {@link DOMClusterSingletonServiceProviderImpl}.
*
* @param entityOwnershipService - we need only {@link GenericEntityOwnershipService}
*/
}
@Override
- protected final DOMEntity createEntity(final String type, final String ident) {
+ protected DOMEntity createEntity(final String type, final String ident) {
return new DOMEntity(type, ident);
}
@Override
- protected final DOMEntityOwnershipListenerRegistration registerListener(final String type,
+ protected DOMEntityOwnershipListenerRegistration registerListener(final String type,
final DOMEntityOwnershipService eos) {
return eos.registerListener(type, this);
}
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
+
import com.google.common.util.concurrent.Futures;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
-import org.opendaylight.mdsal.singleton.dom.impl.ClusterSingletonServiceGroup;
-import org.opendaylight.mdsal.singleton.dom.impl.ClusterSingletonServiceGroupImpl;
import org.opendaylight.mdsal.singleton.dom.impl.util.TestEntity;
import org.opendaylight.mdsal.singleton.dom.impl.util.TestInstanceIdentifier;
/**
- * Testing {@link ClusterSingletonServiceGroupImpl}
+ * Testing {@link ClusterSingletonServiceGroupImpl}.
*/
public class ClusterSingletonServiceGroupImplTest {
@Mock
private GenericEntityOwnershipCandidateRegistration<?, ?> mockCloseEntityCandReg;
@Mock
- private GenericEntityOwnershipListener<TestInstanceIdentifier,GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity>> mockEosListener;
+ private GenericEntityOwnershipListener<TestInstanceIdentifier,
+ GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity>> mockEosListener;
@Mock
- private GenericEntityOwnershipService<TestInstanceIdentifier,TestEntity, GenericEntityOwnershipListener<TestInstanceIdentifier,GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity>>> mockEosService;
-
- private ClusterSingletonServiceGroupImpl<TestInstanceIdentifier,TestEntity,GenericEntityOwnershipChange<TestInstanceIdentifier,TestEntity>,
- GenericEntityOwnershipListener<TestInstanceIdentifier, GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity>>,
- GenericEntityOwnershipService<TestInstanceIdentifier, TestEntity, GenericEntityOwnershipListener<TestInstanceIdentifier,
- GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity>>>> singletonServiceGroup;
+ private GenericEntityOwnershipService<TestInstanceIdentifier,TestEntity,
+ GenericEntityOwnershipListener<TestInstanceIdentifier,
+ GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity>>> mockEosService;
+
+ private ClusterSingletonServiceGroupImpl<TestInstanceIdentifier,TestEntity,
+ GenericEntityOwnershipChange<TestInstanceIdentifier,TestEntity>,
+ GenericEntityOwnershipListener<TestInstanceIdentifier,
+ GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity>>,
+ GenericEntityOwnershipService<TestInstanceIdentifier, TestEntity,
+ GenericEntityOwnershipListener<TestInstanceIdentifier,
+ GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity>>>> singletonServiceGroup;
private final TestEntity mainEntity = new TestEntity(SERVICE_ENTITY_TYPE, SERVICE_IDENTIFIER);
private final TestEntity closeEntity = new TestEntity(CLOSE_SERVICE_ENTITY_TYPE, SERVICE_IDENTIFIER);
private final ConcurrentMap<String, ClusterSingletonServiceGroup<?, ?, ?>> map = new ConcurrentHashMap<>();
/**
- * Initialization functionality for every Tests in this suite
+ * Initialization functionality for every Tests in this suite.
*
* @throws Exception - unexpected exception
*/
- @Before
- public void setup() throws Exception {
- MockitoAnnotations.initMocks(this);
+ @Before
+ public void setup() throws Exception {
+ MockitoAnnotations.initMocks(this);
- doReturn(mockEntityCandReg).when(mockEosService).registerCandidate(mainEntity);
- doReturn(mockCloseEntityCandReg).when(mockEosService).registerCandidate(closeEntity);
- doNothing().when(mockEntityCandReg).close();
- doNothing().when(mockCloseEntityCandReg).close();
- doNothing().when(mockClusterSingletonService).instantiateServiceInstance();
- doReturn(Futures.immediateFuture(null)).when(mockClusterSingletonService).closeServiceInstance();
+ doReturn(mockEntityCandReg).when(mockEosService).registerCandidate(mainEntity);
+ doReturn(mockCloseEntityCandReg).when(mockEosService).registerCandidate(closeEntity);
+ doNothing().when(mockEntityCandReg).close();
+ doNothing().when(mockCloseEntityCandReg).close();
+ doNothing().when(mockClusterSingletonService).instantiateServiceInstance();
+ doReturn(Futures.immediateFuture(null)).when(mockClusterSingletonService).closeServiceInstance();
doReturn(SERVICE_GROUP_IDENT).when(mockClusterSingletonService).getIdentifier();
doReturn(SERVICE_GROUP_IDENT).when(mockClusterSingletonServiceSecond).getIdentifier();
- singletonServiceGroup = new ClusterSingletonServiceGroupImpl(SERVICE_IDENTIFIER, mainEntity, closeEntity, mockEosService, map);
+ singletonServiceGroup = new ClusterSingletonServiceGroupImpl(
+ SERVICE_IDENTIFIER, mainEntity, closeEntity, mockEosService, map);
}
/**
- * Test NULL ServiceIdent input for new ServiceGroup instance
+ * Test NULL ServiceIdent input for new ServiceGroup instance.
*
* @throws Exception - unexpected exception
*/
@Test(expected = IllegalArgumentException.class)
public void instantiationClusterSingletonServiceGroupNullIdentTest() throws Exception {
- singletonServiceGroup = new ClusterSingletonServiceGroupImpl(null, mainEntity, closeEntity, mockEosService, map);
+ singletonServiceGroup = new ClusterSingletonServiceGroupImpl(
+ null, mainEntity, closeEntity, mockEosService, map);
}
/**
- * Test empty ServiceIdent input for new ServiceGroup instance
+ * Test empty ServiceIdent input for new ServiceGroup instance.
*
* @throws Exception - unexpected exception
*/
}
/**
- * Test NULL MainEntity input for new ServiceGroup instance
+ * Test NULL MainEntity input for new ServiceGroup instance.
*
* @throws Exception - unexpected exception
*/
@Test(expected = NullPointerException.class)
public void instantiationClusterSingletonServiceGroupNullMainEntityTest() throws Exception {
- singletonServiceGroup = new ClusterSingletonServiceGroupImpl(SERVICE_IDENTIFIER, null, closeEntity, mockEosService, map);
+ singletonServiceGroup = new ClusterSingletonServiceGroupImpl(
+ SERVICE_IDENTIFIER, null, closeEntity, mockEosService, map);
}
/**
- * Test NULL MainEntity input for new ServiceGroup instance
+ * Test NULL MainEntity input for new ServiceGroup instance.
*
* @throws Exception - unexpected exception
*/
@Test(expected = NullPointerException.class)
public void instantiationClusterSingletonServiceGroupNullCloseEntityTest() throws Exception {
- singletonServiceGroup = new ClusterSingletonServiceGroupImpl(SERVICE_IDENTIFIER, mainEntity, null, mockEosService, map);
+ singletonServiceGroup = new ClusterSingletonServiceGroupImpl(
+ SERVICE_IDENTIFIER, mainEntity, null, mockEosService, map);
}
/**
- * Test NULL MainEntity input for new ServiceGroup instance
+ * Test NULL MainEntity input for new ServiceGroup instance.
*
* @throws Exception - unexpected exception
*/
@Test(expected = NullPointerException.class)
public void instantiationClusterSingletonServiceGroupNullEOS_Test() throws Exception {
- singletonServiceGroup = new ClusterSingletonServiceGroupImpl(SERVICE_IDENTIFIER, mainEntity, closeEntity, null, map);
+ singletonServiceGroup = new ClusterSingletonServiceGroupImpl(
+ SERVICE_IDENTIFIER, mainEntity, closeEntity, null, map);
}
/**
- * Test NULL MainEntity input for new ServiceGroup instance
+ * Test NULL MainEntity input for new ServiceGroup instance.
*
* @throws Exception - unexpected exception
*/
@Test(expected = NullPointerException.class)
public void instantiationClusterSingletonServiceGroupNullMapRefTest() throws Exception {
- singletonServiceGroup = new ClusterSingletonServiceGroupImpl(SERVICE_IDENTIFIER, mainEntity, closeEntity, mockEosService, null);
+ singletonServiceGroup = new ClusterSingletonServiceGroupImpl(
+ SERVICE_IDENTIFIER, mainEntity, closeEntity, mockEosService, null);
}
/**
- * Test GoldPath for initialization ServiceGroup
+ * Test GoldPath for initialization ServiceGroup.
*
* @throws Exception - unexpected exception
*/
}
/**
- * Test GoldPath for NO-TO-SLAVE entity Candidate role change
+ * Test GoldPath for NO-TO-SLAVE entity Candidate role change.
*
* @throws Exception - unexpected exception
*/
}
/**
- * Test GoldPath for NO-TO-SLAVE but without MASTER entity Candidate role change
+ * Test GoldPath for NO-TO-SLAVE but without MASTER entity Candidate role change.
*
* @throws Exception - unexpected exception
*/
}
/**
- * Test GoldPath for InJeopardy entity Candidate role change
+ * Test GoldPath for InJeopardy entity Candidate role change.
*
* @throws Exception - unexpected exception
*/
}
/**
- * Test GoldPath for registration SingletonService
+ * Test GoldPath for registration SingletonService.
*
* @throws Exception - unexpected exception
*/
}
/**
- * Test GoldPath for registration SingletonService
+ * Test GoldPath for registration SingletonService.
*
* @throws Exception - unexpected exception
*/
/**
* Test GoldPath for unregistration SingletonService don't call closeServiceInstance
- * without mastership and don't remove ServiceGroup from map
+ * without mastership and don't remove ServiceGroup from map.
*
* @throws Exception - unexpected exception
*/
/**
* Test GoldPath for unregistration SingletonService don't call closeServiceInstance
- * without mastership and don't remove ServiceGroup from map
+ * without mastership and don't remove ServiceGroup from map.
*
* @throws Exception - unexpected exception
*/
}
/**
- * Test GoldPath get Slave role for registered main entity
+ * Test GoldPath get Slave role for registered main entity.
*
* @throws Exception - unexpected exception
*/
}
/**
- * Test GoldPath get Master role for registered main entity
+ * Test GoldPath get Master role for registered main entity.
*
* @throws Exception - unexpected exception
*/
}
/**
- * Test GoldPath get Master role for registered close entity
+ * Test GoldPath get Master role for registered close entity.
*
* @throws Exception - unexpected exception
*/
/**
* Test GoldPath get Master role for registered entity but initial Slave
- * role for closeEntity
+ * role for closeEntity.
*
* @throws Exception - unexpected exception
*/
}
/**
- * Test inJeopardy validation during wait phase for Master role for closeEntity
+ * Test inJeopardy validation during wait phase for Master role for closeEntity.
*
* @throws Exception - unexpected exception
*/
}
/**
- * Test inJeopardy validation during wait phase for Master role for closeEntity
+ * Test inJeopardy validation during wait phase for Master role for closeEntity.
*
* @throws Exception - unexpected exception
*/
}
/**
- * Test inJeopardy validation for holding leadership
+ * Test inJeopardy validation for holding leadership.
*
* @throws Exception - unexpected exception
*/
}
/**
- * Test GoldPath for SLAVE-TO-MASTER entity Candidate role change
+ * Test GoldPath for SLAVE-TO-MASTER entity Candidate role change.
*
* @throws Exception - unexpected exception
*/
/**
* Test checks validation Error processing for SLAVE-TO-MASTER entity Candidate role change.
- * Not initialized provider has to close and remove all singletonServices from Group and
- * Group itself remove too.
+ * Not initialized provider has to close and remove all singletonServices from Group and
+ * Group itself remove too.
*
* @throws Exception - unexpected exception
*/
}
/**
- * Test checks closing procesing for close {@link ClusterSingletonServiceRegistration}
+ * Test checks closing procesing for close {@link ClusterSingletonServiceRegistration}.
*
* @throws Exception - unexpected exception
*/
}
/**
- * Test checks validation Error processing for MASTER-TO-SLAVE closeEntity Candidate role change
+ * Test checks validation Error processing for MASTER-TO-SLAVE closeEntity Candidate role change.
*
* @throws Exception - unexpected exception
*/
/**
* Test checks validation Error processing for MASTER-TO-SLAVE closeEntity Candidate role change
- * without closeEntity registration
+ * without closeEntity registration.
*
* @throws Exception - unexpected exception
*/
}
private GenericEntityOwnershipChange<TestInstanceIdentifier, TestEntity> getEntityToJeopardy() {
- return new GenericEntityOwnershipChange<>(mainEntity, EntityOwnershipChangeState.from(false, false, false), true);
+ return new GenericEntityOwnershipChange<>(mainEntity,
+ EntityOwnershipChangeState.from(false, false, false), true);
}
}
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.verify;
+
import com.google.common.util.concurrent.Futures;
import org.junit.Assert;
import org.junit.Before;
import org.mockito.MockitoAnnotations;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
-import org.opendaylight.mdsal.singleton.dom.impl.ClusterSingletonServiceGroup;
-import org.opendaylight.mdsal.singleton.dom.impl.ClusterSingletonServiceGroupImpl;
-import org.opendaylight.mdsal.singleton.dom.impl.ClusterSingletonServiceRegistrationDelegator;
/**
- * Testing {@link ClusterSingletonServiceRegistrationDelegator}
+ * Testing {@link ClusterSingletonServiceRegistrationDelegator}.
*/
public class ClusterSingletonServiceRegistrationDelegatorTest {
private ClusterSingletonServiceRegistrationDelegator delegator;
/**
- * Initialization functionality for every Tests in this suite
+ * Initialization functionality for every Tests in this suite.
*
* @throws Exception - unexpected setup exception
*/
}
/**
- * Test create input with {@link ClusterSingletonService} as null
+ * Test create input with {@link ClusterSingletonService} as null.
*/
@Test(expected = NullPointerException.class)
public void testSetupNullService() {
}
/**
- * Test create input with {@link ClusterSingletonServiceGroupImpl} as null
+ * Test create input with {@link ClusterSingletonServiceGroupImpl} as null.
*/
@Test(expected = NullPointerException.class)
public void testSetupNullGroup() {
}
/**
- * Test a method delegation {@link ClusterSingletonService#instantiateServiceInstance()}
+ * Test a method delegation {@link ClusterSingletonService#instantiateServiceInstance()}.
*/
@Test
public void testInstatiateServiceDelegMethod() {
}
/**
- * Test a method delegation {@link ClusterSingletonService#instantiateServiceInstance()}
+ * Test a method delegation {@link ClusterSingletonService#instantiateServiceInstance()}.
*/
@Test
public void testCloseServiceDelegMethod() {
}
/**
- * Test a method delegation {@link ClusterSingletonService#getIdentifier()}
+ * Test a method delegation {@link ClusterSingletonService#getIdentifier()}.
*/
@Test
public void testGetServiceIdentifierDelegMethod() {
}
/**
- * Test a close method delegation to {@link ClusterSingletonServiceGroupImpl#unregisterService(ClusterSingletonService)}
+ * Test a close method delegation to
+ * {@link ClusterSingletonServiceGroupImpl#unregisterService(ClusterSingletonService)}.
*
* @throws Exception is from AutoclosableInterface
*/
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
+
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import org.junit.Assert;
import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
/**
- * Testing {@link DOMClusterSingletonServiceProviderImpl} implementation
+ * Testing {@link DOMClusterSingletonServiceProviderImpl} implementation.
*/
public class DOMClusterSingletonServiceProviderImplTest {
private final DOMEntity doubleEntity = new DOMEntity(CLOSE_SERVICE_ENTITY_TYPE, SERVICE_NAME);
/**
- * Initialization functionality for every Tests in this suite
+ * Initialization functionality for every Tests in this suite.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Before
public void setup() throws Exception {
}
/**
- * Test checks NullPointer for null {@link DOMEntityOwnershipService} input value
+ * Test checks NullPointer for null {@link DOMEntityOwnershipService} input value.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test(expected = NullPointerException.class)
public void initializationClusterSingletonServiceProviderNullInputTest() throws Exception {
}
/**
- * Test GoldPath for close {@link DOMClusterSingletonServiceProviderImpl}
+ * Test GoldPath for close {@link DOMClusterSingletonServiceProviderImpl}.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void closeClusterSingletonServiceProviderTest() throws Exception {
}
/**
- * Test parser ServiceIdentifier from Entity
+ * Test parser ServiceIdentifier from Entity.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void makeEntityClusterSingletonServiceProviderTest() throws Exception {
}
/**
- * Test parser ServiceIdentifier from Entity
+ * Test parser ServiceIdentifier from Entity.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void getIdentifierClusterSingletonServiceProviderTest() throws Exception {
}
/**
- * Test GoldPath for initialization {@link ClusterSingletonService}
+ * Test GoldPath for initialization {@link ClusterSingletonService}.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void initializationClusterSingletonServiceTest() throws Exception {
}
/**
- * Test GoldPath for initialization with init ownership result SLAVE {@link ClusterSingletonService}
+ * Test GoldPath for initialization with init ownership result SLAVE {@link ClusterSingletonService}.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void slaveInitClusterSingletonServiceTest() throws Exception {
}
/**
- * Test GoldPath for initialization with init ownership result SLAVE, but NO-MASTER {@link ClusterSingletonService}
+ * Test GoldPath for initialization with init ownership result SLAVE, but NO-MASTER {@link ClusterSingletonService}.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void slaveInitNoMasterClusterSingletonServiceTest() throws Exception {
}
/**
- * Test GoldPath for initialization with init ownership result MASTER {@link ClusterSingletonService}
+ * Test GoldPath for initialization with init ownership result MASTER {@link ClusterSingletonService}.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void masterInitClusterSingletonServiceTest() throws Exception {
}
/**
- * Test GoldPath for initialization with init ownership result MASTER {@link ClusterSingletonService}
+ * Test GoldPath for initialization with init ownership result MASTER {@link ClusterSingletonService}.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void masterInitSlaveDoubleCandidateClusterSingletonServiceTest() throws Exception {
}
/**
- * Test GoldPath for takeLeadership with ownership result MASTER {@link ClusterSingletonService}
+ * Test GoldPath for takeLeadership with ownership result MASTER {@link ClusterSingletonService}.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void takeLeadershipClusterSingletonServiceTest() throws Exception {
}
/**
- * Test GoldPath for initialization with init ownership result MASTER {@link ClusterSingletonService}
+ * Test GoldPath for initialization with init ownership result MASTER {@link ClusterSingletonService}.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void masterInitClusterSingletonServiceTwoServicesTest() throws Exception {
}
/**
- * Test GoldPath for takeLeadership with ownership result MASTER {@link ClusterSingletonService}
+ * Test GoldPath for takeLeadership with ownership result MASTER {@link ClusterSingletonService}.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void takeLeadershipClusterSingletonServiceTwoAddDuringWaitPhaseServicesTest() throws Exception {
}
/**
- * Test GoldPath for takeLeadership with ownership result MASTER {@link ClusterSingletonService}
+ * Test GoldPath for takeLeadership with ownership result MASTER {@link ClusterSingletonService}.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void takeLeadershipClusterSingletonServiceTowServicesTest() throws Exception {
}
/**
- * Test checks CandidateAlreadyRegisteredException processing in initialization phase
+ * Test checks CandidateAlreadyRegisteredException processing in initialization phase.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void initializationClusterSingletonServiceCandidateAlreadyRegistredTest() throws Exception {
/**
* Test GoldPath for lostLeadership during tryToTakeLeadership with ownership result MASTER
- * {@link ClusterSingletonService}
+ * {@link ClusterSingletonService}.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void lostLeadershipDuringTryToTakeLeadershipClusterSingletonServiceTest() throws Exception {
}
/**
- * Test GoldPath for lostLeadership with ownership result MASTER-TO-SLAVE {@link ClusterSingletonService}
+ * Test GoldPath for lostLeadership with ownership result MASTER-TO-SLAVE {@link ClusterSingletonService}.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void lostLeadershipClusterSingletonServiceTest() throws Exception {
}
/**
- * Test checks umexpected change for MASTER-TO-SLAVE double Candidate role change
+ * Test checks umexpected change for MASTER-TO-SLAVE double Candidate role change.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void unexpectedLostLeadershipDoubleCandidateTest() throws Exception {
}
/**
- * Test checks inJeopardy Cluster Node state for Master Instance
+ * Test checks inJeopardy Cluster Node state for Master Instance.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void inJeopardyMasterTest() throws Exception {
}
/**
- * Test checks inJeopardy Cluster Node state for Slave Instance
+ * Test checks inJeopardy Cluster Node state for Slave Instance.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void inJeopardySlaveTest() throws Exception {
}
/**
- * Test checks close procesing for {@link ClusterSingletonServiceRegistration}
+ * Test checks close processing for {@link ClusterSingletonServiceRegistration}.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void closeClusterSingletonServiceRegistrationNoRoleTest() throws Exception {
}
/**
- * Test checks close procesing for {@link ClusterSingletonServiceRegistration}
+ * Test checks close procesing for {@link ClusterSingletonServiceRegistration}.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void closeClusterSingletonServiceRegistrationNoRoleTwoServicesTest() throws Exception {
}
/**
- * Test checks close procesing for {@link ClusterSingletonServiceRegistration}
+ * Test checks close procesing for {@link ClusterSingletonServiceRegistration}.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void closeClusterSingletonServiceRegistrationSlaveTest() throws Exception {
}
/**
- * Test checks close procesing for {@link ClusterSingletonServiceRegistration}
+ * Test checks close procesing for {@link ClusterSingletonServiceRegistration}.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void closeClusterSingletonServiceRegistrationSlaveTwoServicesTest() throws Exception {
}
/**
- * Test checks close procesing for {@link ClusterSingletonServiceRegistration}
+ * Test checks close procesing for {@link ClusterSingletonServiceRegistration}.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void closeClusterSingletonServiceRegistrationMasterTest() throws Exception {
}
/**
- * Test checks close procesing for {@link ClusterSingletonServiceRegistration}
+ * Test checks close procesing for {@link ClusterSingletonServiceRegistration}.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void closeClusterSingletonServiceRegistrationMasterTwoServicesTest() throws Exception {
}
/**
- * Test checks validation Error processing for SLAVE-TO-MASTER entity Candidate role change
+ * Test checks validation Error processing for SLAVE-TO-MASTER entity Candidate role change.
*
- * @throws Exception
+ * @throws Exception if the condition does not meet
*/
@Test
public void tryToTakeLeaderForClosedServiceRegistrationTest() throws Exception {
}
/**
- * Base states for AbstractClusterProjectProvider
+ * Base states for AbstractClusterProjectProvider.
*/
- static enum TestClusterSingletonServiceState {
+ enum TestClusterSingletonServiceState {
/**
- * State represents a correct Instantiated process
+ * State represents a correct Instantiated process.
*/
STARTED,
/**
- * State represents a correct call abstract method instantiatingProject
+ * State represents a correct call abstract method instantiatingProject.
*/
INITIALIZED,
/**
- * State represents a correct call abstract method destryingProject
+ * State represents a correct call abstract method destryingProject.
*/
DESTROYED;
}
/**
- * Test implementation of {@link ClusterSingletonService}
+ * Test implementation of {@link ClusterSingletonService}.
*/
class TestClusterSingletonServiceInstance implements ClusterSingletonService {
- private final ServiceGroupIdentifier SERVICE_IDENT = ServiceGroupIdentifier.create(SERVICE_NAME);
+ private final ServiceGroupIdentifier serviceIndent = ServiceGroupIdentifier.create(SERVICE_NAME);
private TestClusterSingletonServiceState serviceState;
- public TestClusterSingletonServiceInstance() {
+ TestClusterSingletonServiceInstance() {
this.serviceState = TestClusterSingletonServiceState.INITIALIZED;
}
@Override
public ServiceGroupIdentifier getIdentifier() {
- return SERVICE_IDENT;
+ return serviceIndent;
}
}
}
private final ImmutableList<String> path;
- /**
- * {@link TestInstanceIdentifier} constructor
- *
- * @param path - path
- */
public TestInstanceIdentifier(final Iterable<? extends TestInstanceIdentifier> path) {
Preconditions.checkArgument(path != null);
final List<String> tiis = new LinkedList<>();