From: janab Date: Mon, 8 Aug 2016 19:32:14 +0000 (-0700) Subject: Fixed Checkstyle violation errors in mdsal-dom-api module X-Git-Tag: release/carbon~228 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=39c0d06b2987b65ba978c4d85f4448895d3490bd;p=mdsal.git Fixed Checkstyle violation errors in mdsal-dom-api module Implemented code review comment. 2nd round code review comments are implemented. Change-Id: Iaa93e0786c54d80aa8cba8289570dc281442a055 Signed-off-by: Brinda Jana Signed-off-by: Robert Varga --- diff --git a/dom/mdsal-dom-api/pom.xml b/dom/mdsal-dom-api/pom.xml index e3a3847d42..f6f085556f 100644 --- a/dom/mdsal-dom-api/pom.xml +++ b/dom/mdsal-dom-api/pom.xml @@ -48,6 +48,13 @@ maven-bundle-plugin true + + org.apache.maven.plugins + maven-checkstyle-plugin + + checkstyle.violationSeverity=warning + + diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataBroker.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataBroker.java index 2c406983c2..23c6efcf8c 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataBroker.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataBroker.java @@ -5,44 +5,30 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.mdsal.dom.api; import org.opendaylight.mdsal.common.api.AsyncDataBroker; import org.opendaylight.mdsal.common.api.TransactionChainFactory; import org.opendaylight.mdsal.common.api.TransactionChainListener; - import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; /** * Data Broker which provides data transaction and data change listener functionality - * using {@link NormalizedNode} data format. - * - * This interface is type capture of generic interfaces and returns type captures - * of results for client-code convenience. - * + * using {@link NormalizedNode} data format. This interface is type capture of generic + * interfaces and returns type captures of results for client-code convenience. */ public interface DOMDataBroker extends AsyncDataBroker>, TransactionChainFactory>, DOMExtensibleService { - /** - * {@inheritDoc} - */ @Override DOMDataTreeReadTransaction newReadOnlyTransaction(); - /** - * {@inheritDoc} - */ @Override DOMDataTreeWriteTransaction newWriteOnlyTransaction(); - /** - * {@inheritDoc} - */ @Override DOMTransactionChain createTransactionChain(TransactionChainListener listener); } diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeChangeListener.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeChangeListener.java index 1e0812b158..efe66b4b4a 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeChangeListener.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeChangeListener.java @@ -31,7 +31,6 @@ public interface DOMDataTreeChangeListener extends EventListener { * and after compare as equal. Implementations of this interface are expected * to recover from such events. Event producers are expected to exert reasonable * effort to suppress such events. - * * In other words, it is completely acceptable to observe * a {@link org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode}, * which reports a {@link org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType} diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeChangeService.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeChangeService.java index bbe4da3cfa..e08892f1fb 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeChangeService.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeChangeService.java @@ -18,13 +18,15 @@ public interface DOMDataTreeChangeService extends DOMDataBrokerExtension { /** * Registers a {@link DOMDataTreeChangeListener} to receive notifications when data changes * under a given path in the conceptual data tree. + * *

* You are able to register for notifications for any node or subtree which can be represented * using {@link DOMDataTreeIdentifier}. - *

* + *

* You are able to register for data change notifications for a subtree or leaf even if it does * not exist. You will receive notification once that node is created. + * *

* If there is any pre-existing data in the data tree for the path for which you are * registering, you will receive an initial data change event, which will contain all @@ -33,6 +35,7 @@ public interface DOMDataTreeChangeService extends DOMDataBrokerExtension { *

* This method returns a {@link ListenerRegistration} object. To "unregister" your listener for * changes call the {@link ListenerRegistration#close()} method on the returned object. + * *

* You MUST explicitly unregister your listener when you no longer want to receive * notifications. This is especially true in OSGi environments, where failure to do so during @@ -44,5 +47,6 @@ public interface DOMDataTreeChangeService extends DOMDataBrokerExtension { * @return Listener registration object, which may be used to unregister your listener using * {@link ListenerRegistration#close()} to stop delivery of change events. */ - @Nonnull ListenerRegistration registerDataTreeChangeListener(@Nonnull DOMDataTreeIdentifier treeId, @Nonnull L listener); + @Nonnull ListenerRegistration + registerDataTreeChangeListener(@Nonnull DOMDataTreeIdentifier treeId, @Nonnull L listener); } diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeCommitCohort.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeCommitCohort.java index 8bf594db4e..251061d9f6 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeCommitCohort.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeCommitCohort.java @@ -15,82 +15,61 @@ import org.opendaylight.mdsal.common.api.PostCanCommitStep; import org.opendaylight.yangtools.yang.model.api.SchemaContext; /** - * * Commit cohort participating in commit of data modification, which can validate data tree * modifications, with option to reject supplied modification, and with callbacks describing state * of commit. * *

Performance implications

- * * {@link DOMDataTreeCommitCohort}s are hooked up into commit of data tree changes and MAY * negatively affect performance of data broker / store. - * * Implementations of this interface are discouraged, unless you really need ability to veto data * tree changes, or to provide external state change in sync with visibility of commited data. * - * *

Implementation requirements

- * *

Correctness assumptions

Implementation SHOULD use only {@link DOMDataTreeCandidate} and * provided {@link SchemaContext} for validation purposes. - * * Use of any other external mutable state is discouraged, implementation MUST NOT use any * transaction related APIs on same data broker / data store instance during invocation of * callbacks, except ones provided as argument. Note that this MAY BE enforced by some * implementations of {@link DOMDataBroker} or DOMDataCommitCoordinator - * * Note that this may be enforced by some implementations of {@link DOMDataTreeCommitCohortRegistry} * and such calls may fail. - * *

Correct model usage

If implementation is performing YANG-model driven validation * implementation SHOULD use provided schema context. - * * Any other instance of {@link SchemaContext} obtained by other means, may not be valid for * associated DOMDataTreeCandidate and it may lead to incorrect validation or processing of provided * data. - * *

DataTreeCandidate assumptions

Implementation SHOULD NOT make any assumptions on * {@link DOMDataTreeCandidate} being successfully committed until associated * {@link PostCanCommitStep#preCommit()} and * {@link org.opendaylight.mdsal.common.api.PostPreCommitStep#commit()} callback was invoked. - * - * *

Usage patterns

- * *

Data Tree Validator

- * * Validator is implementation, which only validates {@link DOMDataTreeCandidate} and does not * retain any state derived from edited data - does not care if {@link DOMDataTreeCandidate} was * rejected afterwards or transaction was cancelled. - * * Implementation may opt-out from receiving {@code preCommit()}, {@code commit()}, {@code abort()} * callbacks by returning {@link PostCanCommitStep#NOOP}. * - * TODO: Provide example and describe more usage patterns - * - * @author Tony Tkacik <ttkacik@cisco.com> - * + *

+ * @author Tony Tkacik */ +// TODO: Provide example and describe more usage patterns @Beta public interface DOMDataTreeCommitCohort { /** * Validates supplied data tree candidate and associates cohort-specific steps with data broker * transaction. - * * If {@link DataValidationFailedException} is thrown by implementation, commit of supplied data * will be prevented, with the DataBroker transaction providing the thrown exception as the * cause of failure. - * * Note the implementations are expected to do validation and processing asynchronous. - * * Implementations SHOULD do processing fast, and are discouraged SHOULD NOT block on any * external resources. - * * Implementation MUST NOT access any data transaction related APIs during invocation of * callback. Note that this may be enforced by some implementations of * {@link DOMDataTreeCommitCohortRegistry} and such calls may fail. - * * Implementation MAY opt-out from implementing other steps by returning * {@link PostCanCommitStep#NOOP}. Otherwise implementation MUST return instance of * {@link PostCanCommitStep}, which will be used to invoke diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeCommitCohortRegistry.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeCommitCohortRegistry.java index 63cba172b7..402376a561 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeCommitCohortRegistry.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeCommitCohortRegistry.java @@ -9,9 +9,7 @@ package org.opendaylight.mdsal.dom.api; /** - * * Commit Cohort registry for {@link DOMDataTreeWriteTransaction}. - * * See {@link DOMDataTreeCommitCohort} for more details. * * @author Tony Tkacik <ttkacik@cisco.com> diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeCursorAwareTransaction.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeCursorAwareTransaction.java index b4abfb2001..351dd7394e 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeCursorAwareTransaction.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeCursorAwareTransaction.java @@ -5,7 +5,6 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.mdsal.dom.api; import com.google.common.util.concurrent.CheckedFuture; @@ -27,18 +26,14 @@ public interface DOMDataTreeCursorAwareTransaction extends DOMDataTreeCursorProv * @return write cursor at the desired location. * @throws IllegalStateException when there's an open cursor, or this transaction is closed already. */ - @Nullable @Override - DOMDataTreeWriteCursor createCursor(@Nonnull DOMDataTreeIdentifier path); + @Nullable DOMDataTreeWriteCursor createCursor(@Nonnull DOMDataTreeIdentifier path); /** * Cancels the transaction. - * * Transactions can only be cancelled if it was not yet submited. - * * Invoking cancel() on failed or already canceled will have no effect, and transaction is * considered cancelled. - * * Invoking cancel() on finished transaction (future returned by {@link #submit()} already * successfully completed) will always fail (return false). * @@ -51,20 +46,18 @@ public interface DOMDataTreeCursorAwareTransaction extends DOMDataTreeCursorProv /** * Submits this transaction to be asynchronously applied to update the logical data tree. The * returned CheckedFuture conveys the result of applying the data changes. + * *

* Note: It is strongly recommended to process the CheckedFuture result in an * asynchronous manner rather than using the blocking get() method. - * * This call logically seals the transaction, which prevents the client from further changing * data tree using this transaction's cursor. Any subsequent calls to * createCursorCursor(DOMDataTreeIdentifier * or any of the cursor's methods will fail with {@link IllegalStateException}. - * * The transaction is marked as submitted and enqueued into the shard back-end for * processing. * * @return Checked future informing of success/failure */ - CheckedFuture submit(); - + CheckedFuture submit(); } diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeIdentifier.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeIdentifier.java index c61722c5b4..d21eece43e 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeIdentifier.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeIdentifier.java @@ -5,16 +5,14 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.mdsal.dom.api; -import org.opendaylight.mdsal.common.api.LogicalDatastoreType; - import com.google.common.base.MoreObjects; import com.google.common.base.Preconditions; import java.io.Serializable; import java.util.Iterator; import javax.annotation.Nonnull; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.yangtools.concepts.Immutable; import org.opendaylight.yangtools.concepts.Path; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; @@ -24,12 +22,14 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgum * A unique identifier for a particular subtree. It is composed of the logical * data store type and the instance identifier of the root node. */ -public final class DOMDataTreeIdentifier implements Immutable, Path, Serializable, Comparable { +public final class DOMDataTreeIdentifier implements Immutable, + Path, Serializable, Comparable { private static final long serialVersionUID = 1L; private final YangInstanceIdentifier rootIdentifier; private final LogicalDatastoreType datastoreType; - public DOMDataTreeIdentifier(final LogicalDatastoreType datastoreType, final YangInstanceIdentifier rootIdentifier) { + public DOMDataTreeIdentifier(final LogicalDatastoreType datastoreType, + final YangInstanceIdentifier rootIdentifier) { this.datastoreType = Preconditions.checkNotNull(datastoreType); this.rootIdentifier = Preconditions.checkNotNull(rootIdentifier); } @@ -82,29 +82,29 @@ public final class DOMDataTreeIdentifier implements Immutable, Path mi = rootIdentifier.getPathArguments().iterator(); - final Iterator oi = o.rootIdentifier.getPathArguments().iterator(); + final Iterator myIter = rootIdentifier.getPathArguments().iterator(); + final Iterator otherIter = domDataTreeIdentifier.rootIdentifier.getPathArguments().iterator(); - while (mi.hasNext()) { - if (!oi.hasNext()) { + while (myIter.hasNext()) { + if (!otherIter.hasNext()) { return 1; } - final PathArgument ma = mi.next(); - final PathArgument oa = oi.next(); - i = ma.compareTo(oa); - if (i != 0) { - return i; + final PathArgument myPathArg = myIter.next(); + final PathArgument otherPathArg = otherIter.next(); + cmp = myPathArg.compareTo(otherPathArg); + if (cmp != 0) { + return cmp; } } - return oi.hasNext() ? -1 : 0; + return otherIter.hasNext() ? -1 : 0; } @Override diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeInaccessibleException.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeInaccessibleException.java index 6dd250663c..85d8252146 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeInaccessibleException.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeInaccessibleException.java @@ -22,7 +22,8 @@ public class DOMDataTreeInaccessibleException extends DOMDataTreeListeningExcept this.treeIdentifier = Preconditions.checkNotNull(treeIdentifier); } - public DOMDataTreeInaccessibleException(final DOMDataTreeIdentifier treeIdentifier, final String message, final Throwable cause) { + public DOMDataTreeInaccessibleException(final DOMDataTreeIdentifier treeIdentifier, + final String message, final Throwable cause) { super(message); this.treeIdentifier = Preconditions.checkNotNull(treeIdentifier); } diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeListener.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeListener.java index 22de496972..3c8edc1e3a 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeListener.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeListener.java @@ -29,7 +29,8 @@ public interface DOMDataTreeListener extends EventListener { * This includes all the subtrees this listener is subscribed to, even those * which have not changed. */ - void onDataTreeChanged(@Nonnull Collection changes, @Nonnull Map> subtrees); + void onDataTreeChanged(@Nonnull Collection changes, + @Nonnull Map> subtrees); /** * Invoked when a subtree listening failure occurs. This can be triggered, for example, when a diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeProducer.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeProducer.java index 7ff7d96487..f6aae1d1db 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeProducer.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeProducer.java @@ -16,21 +16,26 @@ import javax.annotation.Nonnull; * open. It needs to be either submitted or cancelled before another one can be open. * Once a transaction is submitted, it will proceed to be committed asynchronously. * - * Each instance has an upper bound on the number of transactions which can be in-flight, + *

+ * Each instance has an upper bound on the number of transactions which can be in-flight, * once that capacity is exceeded, an attempt to create a new transaction will block * until some transactions complete. * + *

* Each {@link DOMDataTreeProducer} can be in two logical states, bound and unbound, * which define the lifecycle rules for when is it legal to create and submit transactions * in relationship with {@link DOMDataTreeListener} callbacks. * + *

* When a producer is first created, it is unbound. In this state the producer can be * accessed by any application thread to allocate or submit transactions, as long as * the 'single open transaction' rule is maintained. The producer and any transaction * object MUST NOT be accessed, directly or indirectly, from a {@link DOMDataTreeListener} * callback. * - * When a producer is referenced in a call to {@link DOMDataTreeService#registerListener(DOMDataTreeListener, java.util.Collection, boolean, java.util.Collection)}, + *

+ * When a producer is referenced in a call to {@link DOMDataTreeService#registerListener(DOMDataTreeListener, + * Collection, boolean, Collection)}, * an attempt will be made to bind the producer to the specified {@link DOMDataTreeListener}. * Such an attempt will fail the producer is already bound, or it has an open transaction. * Once bound, the producer can only be accessed from within the {@link DOMDataTreeListener} @@ -57,17 +62,18 @@ public interface DOMDataTreeProducer extends DOMDataTreeProducerFactory, AutoClo @Nonnull DOMDataTreeCursorAwareTransaction createTransaction(boolean isolated); /** - * {@inheritDoc} + * {@inheritDoc}. * + *

* When invoked on a {@link DOMDataTreeProducer}, this method has additional restrictions. There * may not be an open transaction from this producer. The method needs to be invoked in * appropriate context, e.g. bound or unbound. * + *

* Specified subtrees must be accessible by this producer. Accessible means they are a subset of * the subtrees specified when the producer is instantiated. The set is further reduced as child * producers are instantiated -- if you create a producer for /a and then a child for /a/b, /a/b * is not accessible from the first producer. - * * Once this method returns successfully, this (parent) producer loses the ability to access the * specified paths until the resulting (child) producer is shut down. * @@ -83,7 +89,7 @@ public interface DOMDataTreeProducer extends DOMDataTreeProducerFactory, AutoClo @Nonnull DOMDataTreeProducer createProducer(@Nonnull Collection subtrees); /** - * {@inheritDoc} + * {@inheritDoc}. * * @throws DOMDataTreeProducerBusyException when there is an open transaction. */ diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeReadCursor.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeReadCursor.java index 0664838588..b675f71917 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeReadCursor.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeReadCursor.java @@ -27,8 +27,8 @@ public interface DOMDataTreeReadCursor extends DOMDataTreeCursor { /** * Checks if data is available in the logical data store located at provided path. - *

* + *

* Note: a successful result from this method makes no guarantee that a subsequent call to * {@link #readNode(PathArgument)} will succeed. It is possible that the data resides in a data store on a remote * node and, if that node goes down or a network failure occurs, a subsequent read would fail. diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeReadTransaction.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeReadTransaction.java index bdd6629b3f..1840f2113c 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeReadTransaction.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeReadTransaction.java @@ -17,6 +17,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; /** * A transaction that provides read access to a logical data store. + * *

* For more information on usage and examples, please see the documentation in {@link AsyncReadTransaction}. */ @@ -24,6 +25,7 @@ public interface DOMDataTreeReadTransaction extends AsyncReadTransaction * If the target is a subtree, then the whole subtree is read (and will be * accessible from the returned data object). @@ -49,8 +51,8 @@ public interface DOMDataTreeReadTransaction extends AsyncReadTransaction * + *

* Note: a successful result from this method makes no guarantee that a subsequent call to {@link #read} * will succeed. It is possible that the data resides in a data store on a remote node and, if that * node goes down or a network failure occurs, a subsequent read would fail. Another scenario is if diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeService.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeService.java index 1a7ae4c0f7..1934f870dd 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeService.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeService.java @@ -16,10 +16,12 @@ import org.opendaylight.yangtools.concepts.ListenerRegistration; * with the data tree are split into data producers and consumers (listeners). Each * of them operate on a set of subtrees, which need to be declared at instantiation time. * + *

* Returned instances are not thread-safe and expected to be used by a single thread * at a time. Furthermore, producers may not be accessed from consumer callbacks * unless they were specified when the listener is registered. * + *

* The service maintains a loop-free topology of producers and consumers. What this means * is that a consumer is not allowed to access a producer, which affects any of the * subtrees it is subscribed to. This restriction is in place to ensure the system does @@ -35,12 +37,14 @@ public interface DOMDataTreeService extends DOMDataTreeProducerFactory, DOMServi * is free to merge the changes, so that a smaller number of them will be reported, * possibly hiding some data transitions (like flaps). * + *

* If the listener wants to write into any producer, that producer has to be mentioned * in the call to this method. Those producers will be bound exclusively to the * registration, so that accessing them outside of this listener's callback will trigger * an error. Any producers mentioned must be idle, e.g. they may not have an open * transaction at the time this method is invoked. * + *

* Each listener instance can be registered at most once. Implementations of this * interface have to guarantee that the listener's methods will not be invoked * concurrently from multiple threads. diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeShardingService.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeShardingService.java index 116561cb2f..4a4255c4f2 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeShardingService.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeShardingService.java @@ -16,11 +16,13 @@ import org.opendaylight.yangtools.concepts.ListenerRegistration; * single {@link DOMDataTreeIdentifier}. Based on those data tree identifiers, the * shards are organized in a tree, where there is a logical parent/child relationship. * + *

* It is not allowed to attach two shards to the same data tree identifier, which means * the mapping of each piece of information has an unambiguous home. When accessing * the information, the shard with the longest matching data tree identifier is used, * which is why this interface treats it is a prefix. * + *

* Whenever a parent/child relationship is changed, the parent is notified, so it can * understand that a logical child has been attached. */ @@ -35,5 +37,6 @@ public interface DOMDataTreeShardingService extends DOMService { * @throws DOMDataTreeShardingConflictException if the prefix is already bound */ @Nonnull ListenerRegistration registerDataTreeShard( - @Nonnull DOMDataTreeIdentifier prefix, @Nonnull T shard, @Nonnull DOMDataTreeProducer producer) throws DOMDataTreeShardingConflictException; + @Nonnull DOMDataTreeIdentifier prefix, @Nonnull T shard, + @Nonnull DOMDataTreeProducer producer) throws DOMDataTreeShardingConflictException; } diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeWriteTransaction.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeWriteTransaction.java index 67a12dc6b7..d500782b19 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeWriteTransaction.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeWriteTransaction.java @@ -9,22 +9,25 @@ package org.opendaylight.mdsal.dom.api; import org.opendaylight.mdsal.common.api.AsyncWriteTransaction; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; - import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; /** * A transaction that provides mutation capabilities on a data tree. + * *

* For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}. */ -public interface DOMDataTreeWriteTransaction extends AsyncWriteTransaction> { +public interface DOMDataTreeWriteTransaction extends + AsyncWriteTransaction> { /** * Stores a piece of data at the specified path. This acts as an add / replace * operation, which is to say that whole subtree will be replaced by the specified data. + * *

* For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}. + * *

* If you need to make sure that a parent object exists but you do not want modify * its pre-existing state by using put, consider using {@link #merge} instead. @@ -44,8 +47,10 @@ public interface DOMDataTreeWriteTransaction extends AsyncWriteTransaction * For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}. + * *

* If you require an explicit replace operation, use {@link #put} instead. * @@ -60,9 +65,7 @@ public interface DOMDataTreeWriteTransaction extends AsyncWriteTransaction data); - /** - * {@inheritDoc} - */ + @Override - public void delete(LogicalDatastoreType store, YangInstanceIdentifier path); + void delete(LogicalDatastoreType store, YangInstanceIdentifier path); } diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMEvent.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMEvent.java index 33eb4aa8ee..285000a87a 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMEvent.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMEvent.java @@ -11,12 +11,12 @@ package org.opendaylight.mdsal.dom.api; import java.util.Date; /** - * Generic event interface + * Generic event interface. */ public interface DOMEvent { /** - * Get the time of the event occurrence + * Get the time of the event occurrence. * * @return the event time */ diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMExtensibleService.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMExtensibleService.java index 289e1b935a..cc52a5844a 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMExtensibleService.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMExtensibleService.java @@ -19,7 +19,8 @@ import javax.annotation.Nonnull; * @param Extension type */ @Beta -public interface DOMExtensibleService, E extends DOMServiceExtension> extends DOMService { +public interface DOMExtensibleService, + E extends DOMServiceExtension> extends DOMService { /** * Return a map of currently-supported extensions, along with accessor services * which provide access to the specific functionality bound to this service. diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMMountPoint.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMMountPoint.java index 08801c3b2d..d9af3d5758 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMMountPoint.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMMountPoint.java @@ -5,13 +5,11 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.mdsal.dom.api; +import com.google.common.base.Optional; import org.opendaylight.yangtools.concepts.Identifiable; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; - -import com.google.common.base.Optional; import org.opendaylight.yangtools.yang.model.api.SchemaContext; public interface DOMMountPoint extends Identifiable { diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMNotificationPublishService.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMNotificationPublishService.java index 03332d4837..a55edb3db4 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMNotificationPublishService.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMNotificationPublishService.java @@ -28,32 +28,29 @@ public interface DOMNotificationPublishService extends DOMService { * Well-known value indicating that the implementation is currently not * able to accept a notification. */ - ListenableFuture REJECTED = Futures.immediateFailedFuture(new DOMNotificationRejectedException("Unacceptable blocking conditions encountered")); + ListenableFuture REJECTED = Futures.immediateFailedFuture( + new DOMNotificationRejectedException("Unacceptable blocking conditions encountered")); /** * Publish a notification. The result of this method is a {@link ListenableFuture} which will * complete once the notification has been delivered to all immediate registrants. The type of * the object resulting from the future is not defined and implementations may use it to convey * additional information related to the publishing process. - * * Abstract subclasses can refine the return type as returning a promise of a more specific * type, e.g.: - * * public interface DeliveryStatus { int getListenerCount(); } ListenableFuture<? extends * DeliveryStatus>[ putNotification(DOMNotification notification); - * * Once the Future succeeds, the resulting object can be queried for traits using instanceof, * e.g: - * * // Can block when (for example) the implemention's ThreadPool queue is full Object o = * service.putNotification(notif).get(); if (o instanceof DeliveryStatus) { DeliveryStatus ds = * (DeliveryStatus)o; LOG.debug("Notification was received by {} listeners", * ds.getListenerCount();); } } - * * In case an implementation is running out of resources, it can block the calling thread until * enough resources become available to accept the notification for processing, or it is * interrupted. * + *

* Caution: completion here means that the implementation has completed processing of the * notification. This does not mean that all existing registrants have seen the notification. * Most importantly, the delivery process at other cluster nodes may have not begun yet. @@ -64,7 +61,8 @@ public interface DOMNotificationPublishService extends DOMService { * @throws InterruptedException if interrupted while waiting * @throws NullPointerException if notification is null. */ - @Nonnull ListenableFuture putNotification(@Nonnull DOMNotification notification) throws InterruptedException; + @Nonnull ListenableFuture putNotification(@Nonnull DOMNotification notification) + throws InterruptedException; /** * Attempt to publish a notification. The result of this method is a {@link ListenableFuture} diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMNotificationService.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMNotificationService.java index 9677211000..4160d90c65 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMNotificationService.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMNotificationService.java @@ -31,7 +31,8 @@ public interface DOMNotificationService extends DOMService { * null or a SchemaPath which does not represent a valid {@link DOMNotification} type. * @throws NullPointerException if either of the arguments is null */ - ListenerRegistration registerNotificationListener(@Nonnull T listener, @Nonnull Collection types); + ListenerRegistration + registerNotificationListener(@Nonnull T listener, @Nonnull Collection types); /** * Register a {@link DOMNotificationListener} to receive a set of notifications. As with other @@ -48,5 +49,6 @@ public interface DOMNotificationService extends DOMService { * @throws NullPointerException if listener is null */ // FIXME: Java 8: provide a default implementation of this method. - ListenerRegistration registerNotificationListener(@Nonnull T listener, SchemaPath... types); + ListenerRegistration + registerNotificationListener(@Nonnull T listener, SchemaPath... types); } diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMRpcIdentifier.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMRpcIdentifier.java index 2c948e66bd..c5e4fce87c 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMRpcIdentifier.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMRpcIdentifier.java @@ -9,12 +9,10 @@ package org.opendaylight.mdsal.dom.api; import com.google.common.base.MoreObjects; import com.google.common.base.Preconditions; -import java.util.Collections; import java.util.Objects; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; -import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument; import org.opendaylight.yangtools.yang.model.api.SchemaPath; /** @@ -24,9 +22,6 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath; * contexts concurrently. */ public abstract class DOMRpcIdentifier { - - private static final YangInstanceIdentifier GLOBAL_CONTEXT = YangInstanceIdentifier.create(Collections.emptySet()); - private static final class Global extends DOMRpcIdentifier { private Global(final @Nonnull SchemaPath type) { super(type); @@ -34,7 +29,7 @@ public abstract class DOMRpcIdentifier { @Override public YangInstanceIdentifier getContextReference() { - return GLOBAL_CONTEXT; + return YangInstanceIdentifier.EMPTY; } } @@ -75,8 +70,9 @@ public abstract class DOMRpcIdentifier { * @param contextReference Context reference, null means a global RPC identifier. * @return A global RPC identifier, guaranteed to be non-null. */ - public static @Nonnull DOMRpcIdentifier create(final @Nonnull SchemaPath type, final @Nullable YangInstanceIdentifier contextReference) { - if (contextReference == null || GLOBAL_CONTEXT.equals(contextReference)) { + public static @Nonnull DOMRpcIdentifier create(final @Nonnull SchemaPath type, + final @Nullable YangInstanceIdentifier contextReference) { + if (contextReference == null || contextReference.isEmpty()) { return new Global(type); } else { return new Local(type, contextReference); @@ -125,6 +121,7 @@ public abstract class DOMRpcIdentifier { @Override public final String toString() { - return MoreObjects.toStringHelper(this).omitNullValues().add("type", type).add("contextReference", getContextReference()).toString(); + return MoreObjects.toStringHelper(this).omitNullValues().add("type", type).add("contextReference", + getContextReference()).toString(); } } diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMRpcImplementation.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMRpcImplementation.java index 2710f59f4d..9bb5150467 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMRpcImplementation.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMRpcImplementation.java @@ -27,5 +27,6 @@ public interface DOMRpcImplementation { * or report a subclass of {@link DOMRpcException} reporting a transport * error. */ - @Nonnull CheckedFuture invokeRpc(@Nonnull DOMRpcIdentifier rpc, @Nullable NormalizedNode input); + @Nonnull CheckedFuture + invokeRpc(@Nonnull DOMRpcIdentifier rpc, @Nullable NormalizedNode input); } diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMRpcImplementationNotAvailableException.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMRpcImplementationNotAvailableException.java index 5fa076284b..22f5116687 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMRpcImplementationNotAvailableException.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMRpcImplementationNotAvailableException.java @@ -20,7 +20,8 @@ public class DOMRpcImplementationNotAvailableException extends DOMRpcException { super(String.format(format, args)); } - public DOMRpcImplementationNotAvailableException(@Nonnull final Throwable cause, @Nonnull final String format, final Object... args) { + public DOMRpcImplementationNotAvailableException(@Nonnull final Throwable cause, + @Nonnull final String format, final Object... args) { super(String.format(format, args), Preconditions.checkNotNull(cause)); } } diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMRpcProviderService.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMRpcProviderService.java index cac1879145..9edc47f9f1 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMRpcProviderService.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMRpcProviderService.java @@ -25,7 +25,8 @@ public interface DOMRpcProviderService extends DOMService { * @throws NullPointerException if implementation or types is null * @throws IllegalArgumentException if types is empty or contains a null element. */ - @Nonnull DOMRpcImplementationRegistration registerRpcImplementation(@Nonnull T implementation, @Nonnull DOMRpcIdentifier... rpcs); + @Nonnull DOMRpcImplementationRegistration + registerRpcImplementation(@Nonnull T implementation, @Nonnull DOMRpcIdentifier... rpcs); /** * Register an {@link DOMRpcImplementation} object with this service. @@ -36,5 +37,6 @@ public interface DOMRpcProviderService extends DOMService { * @throws NullPointerException if implementation or types is null * @throws IllegalArgumentException if types is empty or contains a null element. */ - @Nonnull DOMRpcImplementationRegistration registerRpcImplementation(@Nonnull T implementation, @Nonnull Set rpcs); + @Nonnull DOMRpcImplementationRegistration + registerRpcImplementation(@Nonnull T implementation, @Nonnull Set rpcs); } diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMRpcService.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMRpcService.java index 935c23b32c..a977ece8e2 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMRpcService.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMRpcService.java @@ -31,13 +31,13 @@ public interface DOMRpcService extends DOMService { * or report a subclass of {@link DOMRpcException} reporting a transport * error. */ - @Nonnull CheckedFuture invokeRpc(@Nonnull SchemaPath type, @Nullable NormalizedNode input); + @Nonnull CheckedFuture + invokeRpc(@Nonnull SchemaPath type, @Nullable NormalizedNode input); /** * Register a {@link DOMRpcAvailabilityListener} with this service to receive notifications * about RPC implementations becoming (un)available. The listener will be invoked with the * current implementations reported and will be kept uptodate as implementations come and go. - * * Users should note that using a listener does not necessarily mean that * {@link #invokeRpc(SchemaPath, NormalizedNode)} will not report a failure due to * {@link DOMRpcImplementationNotAvailableException} and need to be ready to handle it. diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMSchemaService.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMSchemaService.java index b6946c9552..6e733bc7ec 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMSchemaService.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMSchemaService.java @@ -14,15 +14,16 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContextListener; public interface DOMSchemaService extends DOMService { /** - * Returns session specific YANG schema context - * @return + * Returns session specific YANG schema context. + * + * @return schemaContext */ SchemaContext getSessionContext(); /** - * Returns global schema context + * Returns global schema context. * - * @return + * @return schemaContext */ SchemaContext getGlobalContext(); diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMTransactionChain.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMTransactionChain.java index c26f0cac5e..14d7929b95 100644 --- a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMTransactionChain.java +++ b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMTransactionChain.java @@ -8,13 +8,11 @@ package org.opendaylight.mdsal.dom.api; import org.opendaylight.mdsal.common.api.TransactionChain; - import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; /** * A chain of DOM Data transactions. - * * Transactions in a chain need to be committed in sequence and each * transaction should see the effects of previous transactions as if they happened. A chain * makes no guarantees of atomicity, in fact transactions are committed as soon as possible. diff --git a/dom/mdsal-dom-api/src/test/java/org/opendaylight/controller/md/sal/dom/api/AbstractDOMDataTreeServiceTestSuite.java b/dom/mdsal-dom-api/src/test/java/org/opendaylight/controller/md/sal/dom/api/AbstractDOMDataTreeServiceTestSuite.java index 979cc533b0..a6df9c00fb 100644 --- a/dom/mdsal-dom-api/src/test/java/org/opendaylight/controller/md/sal/dom/api/AbstractDOMDataTreeServiceTestSuite.java +++ b/dom/mdsal-dom-api/src/test/java/org/opendaylight/controller/md/sal/dom/api/AbstractDOMDataTreeServiceTestSuite.java @@ -9,22 +9,19 @@ package org.opendaylight.controller.md.sal.dom.api; import static org.junit.Assert.assertNotNull; +import com.google.common.util.concurrent.CheckedFuture; +import java.net.URI; +import java.util.Collections; +import javax.annotation.Nonnull; +import org.junit.Test; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.mdsal.common.api.TransactionCommitFailedException; - -import org.opendaylight.mdsal.dom.api.DOMDataTreeCursor; import org.opendaylight.mdsal.dom.api.DOMDataTreeCursorAwareTransaction; import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier; import org.opendaylight.mdsal.dom.api.DOMDataTreeProducer; import org.opendaylight.mdsal.dom.api.DOMDataTreeProducerException; import org.opendaylight.mdsal.dom.api.DOMDataTreeService; import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteCursor; -import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction; -import com.google.common.util.concurrent.CheckedFuture; -import java.net.URI; -import java.util.Collections; -import javax.annotation.Nonnull; -import org.junit.Test; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.QNameModule; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; @@ -36,12 +33,14 @@ import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableCo * can be used. */ public abstract class AbstractDOMDataTreeServiceTestSuite { - protected static final QNameModule TEST_MODULE = QNameModule.create(URI.create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:test:store"), null); + protected static final QNameModule TEST_MODULE = + QNameModule.create(URI.create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:test:store"), null); protected static final YangInstanceIdentifier UNORDERED_CONTAINER_IID = YangInstanceIdentifier.create( new NodeIdentifier(QName.create(TEST_MODULE, "lists")), new NodeIdentifier(QName.create(TEST_MODULE, "unordered-container"))); - protected static final DOMDataTreeIdentifier UNORDERED_CONTAINER_TREE = new DOMDataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, UNORDERED_CONTAINER_IID); + protected static final DOMDataTreeIdentifier UNORDERED_CONTAINER_TREE + = new DOMDataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, UNORDERED_CONTAINER_IID); /** * Return a reference to the service used in this test. The instance @@ -55,20 +54,23 @@ public abstract class AbstractDOMDataTreeServiceTestSuite { /** * A simple unbound producer. It write some basic things into the data store based on the * test model. - * @throws DOMDataTreeProducerException - * @throws TransactionCommitFailedException + * + * @throws DOMDataTreeProducerException when this exceptional condition happens + * @throws TransactionCommitFailedException when transaction commit fails */ - @Test public final void testBasicProducer() throws DOMDataTreeProducerException, TransactionCommitFailedException { // Create a producer. It is an AutoCloseable resource, hence the try-with pattern - try (final DOMDataTreeProducer prod = service().createProducer(Collections.singleton(UNORDERED_CONTAINER_TREE))) { + try (final DOMDataTreeProducer prod = + service().createProducer(Collections.singleton(UNORDERED_CONTAINER_TREE))) { assertNotNull(prod); final DOMDataTreeCursorAwareTransaction tx = prod.createTransaction(true); assertNotNull(tx); - final DOMDataTreeWriteCursor cursor = tx.createCursor(new DOMDataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, UNORDERED_CONTAINER_IID)); + final DOMDataTreeWriteCursor cursor = + tx.createCursor(new DOMDataTreeIdentifier( + LogicalDatastoreType.OPERATIONAL, UNORDERED_CONTAINER_IID)); assertNotNull(cursor); cursor.write(UNORDERED_CONTAINER_IID.getLastPathArgument(), ImmutableContainerNodeBuilder.create().build()); cursor.close(); diff --git a/dom/mdsal-dom-api/src/test/java/org/opendaylight/mdsal/dom/api/DOMDataTreeIdentifierTest.java b/dom/mdsal-dom-api/src/test/java/org/opendaylight/mdsal/dom/api/DOMDataTreeIdentifierTest.java index c2b28e4fa6..70e3dc2107 100644 --- a/dom/mdsal-dom-api/src/test/java/org/opendaylight/mdsal/dom/api/DOMDataTreeIdentifierTest.java +++ b/dom/mdsal-dom-api/src/test/java/org/opendaylight/mdsal/dom/api/DOMDataTreeIdentifierTest.java @@ -33,8 +33,8 @@ public class DOMDataTreeIdentifierTest { new YangInstanceIdentifier.NodeIdentifier(QName.create(TEST_MODULE, TEST_LISTS))); private static final DOMDataTreeIdentifier REF_TREE = new DOMDataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, REF_YII_IID); - private static final DOMDataTreeIdentifier TEST_DIFF_TREE = new DOMDataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, - TEST_YII_IID); + private static final DOMDataTreeIdentifier + TEST_DIFF_TREE = new DOMDataTreeIdentifier(LogicalDatastoreType.OPERATIONAL,TEST_YII_IID); @Test public void constructTest() { @@ -62,7 +62,8 @@ public class DOMDataTreeIdentifierTest { public void equalsTest() { assertTrue("Equals same", REF_TREE.equals(new DOMDataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, REF_YII_IID))); - assertFalse("Different DataStoreType", REF_TREE.equals(new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, + assertFalse("Different DataStoreType", REF_TREE.equals( + new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, REF_YII_IID))); assertTrue("Equals same instance", REF_TREE.equals(REF_TREE)); assertFalse("Different object", REF_TREE.equals(new Object())); @@ -76,7 +77,8 @@ public class DOMDataTreeIdentifierTest { final YangInstanceIdentifier compareSecondIid = YangInstanceIdentifier.create( new YangInstanceIdentifier.NodeIdentifier(QName.create(TEST_MODULE, COMPARE_SECOND_LISTS))); - assertEquals("Compare same to same", REF_TREE.compareTo(new DOMDataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, + assertEquals("Compare same to same", REF_TREE.compareTo( + new DOMDataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, REF_YII_IID)), 0); assertNotEquals("Compare same to same with different datastore", REF_TREE.compareTo(new DOMDataTreeIdentifier( LogicalDatastoreType.CONFIGURATION, REF_YII_IID)), 0); @@ -107,4 +109,4 @@ public class DOMDataTreeIdentifierTest { assertTrue("ToString", REF_TREE.toString().contains(REF_TREE.getRootIdentifier().toString()) && REF_TREE .toString().contains(REF_TREE.getDatastoreType().toString())); } -} \ No newline at end of file +} diff --git a/dom/mdsal-dom-api/src/test/java/org/opendaylight/mdsal/dom/api/DOMExceptionsTest.java b/dom/mdsal-dom-api/src/test/java/org/opendaylight/mdsal/dom/api/DOMExceptionsTest.java index 3c8bd7533e..f220e583c2 100644 --- a/dom/mdsal-dom-api/src/test/java/org/opendaylight/mdsal/dom/api/DOMExceptionsTest.java +++ b/dom/mdsal-dom-api/src/test/java/org/opendaylight/mdsal/dom/api/DOMExceptionsTest.java @@ -29,7 +29,7 @@ public class DOMExceptionsTest { TEST_YI_ID); @Test(expected = DOMDataTreeInaccessibleException.class) - public void DOMDataTreeInaccessibleExceptionTest() throws Exception { + public void testDomDataTreeInaccessibleException() throws Exception { final DOMDataTreeInaccessibleException testExc = new DOMDataTreeInaccessibleException(TEST_TREE, TEST_MESSAGE); assertTrue(testExc.getMessage().contains(TEST_MESSAGE)); assertNotNull(testExc.getTreeIdentifier()); @@ -39,7 +39,7 @@ public class DOMExceptionsTest { } @Test(expected = DOMDataTreeListeningException.class) - public void DOMDataTreeListeningExceptionTest() throws Exception { + public void testDomDataTreeListeningException() throws Exception { final DOMDataTreeListeningException testExc = new DOMDataTreeListeningException(TEST_MESSAGE); assertTrue(testExc.getMessage().contains(TEST_MESSAGE)); @@ -47,7 +47,7 @@ public class DOMExceptionsTest { } @Test(expected = DOMDataTreeLoopException.class) - public void DOMDataTreeLoopExceptionTest() throws Exception { + public void testDomDataTreeLoopException() throws Exception { final DOMDataTreeLoopException testExc = new DOMDataTreeLoopException(TEST_MESSAGE); assertTrue(testExc.getMessage().contains(TEST_MESSAGE)); @@ -55,7 +55,7 @@ public class DOMExceptionsTest { } @Test(expected = DOMDataTreeProducerBusyException.class) - public void DOMDataTreeProducerBusyExceptionTest() throws Exception { + public void testDomDataTreeProducerBusyException() throws Exception { final DOMDataTreeProducerBusyException testExc = new DOMDataTreeProducerBusyException(TEST_MESSAGE); assertTrue(testExc.getMessage().contains(TEST_MESSAGE)); @@ -63,7 +63,7 @@ public class DOMExceptionsTest { } @Test(expected = DOMDataTreeProducerException.class) - public void DOMDataTreeProducerExceptionTest() throws Exception { + public void testDOMDataTreeProducerException() throws Exception { final DOMDataTreeProducerException testExc = new DOMDataTreeProducerException(TEST_MESSAGE); assertTrue(testExc.getMessage().contains(TEST_MESSAGE)); @@ -71,7 +71,7 @@ public class DOMExceptionsTest { } @Test(expected = DOMDataTreeShardingConflictException.class) - public void DOMDataTreeShardingConflictExceptionTest() throws Exception { + public void testDOMDataTreeShardingConflictException() throws Exception { final DOMDataTreeShardingConflictException testExc = new DOMDataTreeShardingConflictException(TEST_MESSAGE); assertTrue(testExc.getMessage().contains(TEST_MESSAGE)); @@ -79,7 +79,7 @@ public class DOMExceptionsTest { } @Test(expected = DOMNotificationRejectedException.class) - public void DOMNotificationRejectedExceptionTest() throws Exception { + public void testDomNotificationRejectedException() throws Exception { final DOMNotificationRejectedException testExc = new DOMNotificationRejectedException(TEST_MESSAGE); assertTrue(testExc.getMessage().contains(TEST_MESSAGE)); @@ -87,9 +87,10 @@ public class DOMExceptionsTest { } @Test(expected = DOMRpcImplementationNotAvailableException.class) - public void DOMRpcImplementationNotAvailableExceptionTest() throws Exception { - final DOMRpcImplementationNotAvailableException testExc = new DOMRpcImplementationNotAvailableException(TEST_MESSAGE); - assertTrue(testExc.getMessage().contains(TEST_MESSAGE)); + public void testDomRpcImplementationNotAvailableException() throws Exception { + final DOMRpcImplementationNotAvailableException dompcImplementationNotAvailableException + = new DOMRpcImplementationNotAvailableException(TEST_MESSAGE); + assertTrue(dompcImplementationNotAvailableException.getMessage().contains(TEST_MESSAGE)); throw new DOMRpcImplementationNotAvailableException(new Throwable(), TEST_MESSAGE, new Object()); }