Eliminate sal.connect.netconf.sal.tx package 18/105818/1
authorRobert Varga <[email protected]>
Wed, 3 May 2023 16:49:13 +0000 (18:49 +0200)
committerRobert Varga <[email protected]>
Wed, 3 May 2023 16:50:19 +0000 (18:50 +0200)
Transactions in this package are an implementation detail of the
sal.connect.netconf.sal package. Move them and their tests, hiding
them from outside view.

JIRA: NETCONF-1006
Change-Id: I3f3cc23ca54bc1a0e3b25fb4a29f5c75a3d8bd5e
Signed-off-by: Robert Varga <[email protected]>
26 files changed:
plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/AbstractReadOnlyTx.java [moved from plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/AbstractReadOnlyTx.java with 93% similarity]
plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/AbstractTxChain.java [moved from plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/AbstractTxChain.java with 98% similarity]
plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/AbstractWriteTx.java [moved from plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/AbstractWriteTx.java with 90% similarity]
plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/FieldsAwareReadOnlyTx.java [moved from plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/FieldsAwareReadOnlyTx.java with 81% similarity]
plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/FieldsAwareReadWriteTx.java [moved from plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/FieldsAwareReadWriteTx.java with 78% similarity]
plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/FieldsAwareTxChain.java [moved from plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/FieldsAwareTxChain.java with 90% similarity]
plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceDataBroker.java
plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/ReadOnlyTx.java [moved from plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/ReadOnlyTx.java with 70% similarity]
plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/ReadWriteTx.java [moved from plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/ReadWriteTx.java with 89% similarity]
plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/TxChain.java [moved from plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/TxChain.java with 84% similarity]
plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/TxListener.java [moved from plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/TxListener.java with 94% similarity]
plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/WriteCandidateRunningTx.java [moved from plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/WriteCandidateRunningTx.java with 79% similarity]
plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/WriteCandidateTx.java [moved from plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/WriteCandidateTx.java with 92% similarity]
plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/WriteRunningTx.java [moved from plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/WriteRunningTx.java with 90% similarity]
plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/FieldsAwareReadOnlyTxTest.java [moved from plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/FieldsAwareReadOnlyTxTest.java with 97% similarity]
plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/FieldsAwareReadWriteTxTest.java [moved from plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/FieldsAwareReadWriteTxTest.java with 95% similarity]
plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDataTreeServiceImplTest.java
plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceDataBrokerTest.java
plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceWriteOnlyTxTest.java [moved from plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/NetconfDeviceWriteOnlyTxTest.java with 99% similarity]
plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/ReadOnlyTxTest.java [moved from plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/ReadOnlyTxTest.java with 98% similarity]
plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/ReadWriteTxTest.java [moved from plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/ReadWriteTxTest.java with 98% similarity]
plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/TxChainTest.java [moved from plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/TxChainTest.java with 98% similarity]
plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/TxTestUtils.java [moved from plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/TxTestUtils.java with 55% similarity]
plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/WriteCandidateRunningTxTest.java [moved from plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/WriteCandidateRunningTxTest.java with 98% similarity]
plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/WriteCandidateTxTest.java [moved from plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/WriteCandidateTxTest.java with 97% similarity]
plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/WriteRunningTxTest.java [moved from plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/WriteRunningTxTest.java with 97% similarity]

@@ -5,7 +5,7 @@
  * 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.netconf.sal.connect.netconf.sal.tx;
+package org.opendaylight.netconf.sal.connect.netconf.sal;
 
 import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.FutureCallback;
@@ -75,16 +75,15 @@ abstract class AbstractReadOnlyTx implements DOMDataTreeReadTransaction {
     @Override
     public final FluentFuture<Optional<NormalizedNode>> read(final LogicalDatastoreType store,
             final YangInstanceIdentifier path) {
-        switch (store) {
-            case CONFIGURATION:
-                return readConfigurationData(path);
-            case OPERATIONAL:
-                return readOperationalData(path);
-            default:
+        return switch (store) {
+            case CONFIGURATION -> readConfigurationData(path);
+            case OPERATIONAL -> readOperationalData(path);
+            default -> {
                 LOG.info("Unknown datastore type: {}.", store);
                 throw new IllegalArgumentException(String.format(
                     "%s, Cannot read data %s for %s datastore, unknown datastore type", id, path, store));
-        }
+            }
+        };
     }
 
     @Override
@@ -5,7 +5,7 @@
  * 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.netconf.sal.connect.netconf.sal.tx;
+package org.opendaylight.netconf.sal.connect.netconf.sal;
 
 import static com.google.common.base.Preconditions.checkState;
 
@@ -5,7 +5,7 @@
  * 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.netconf.sal.connect.netconf.sal.tx;
+package org.opendaylight.netconf.sal.connect.netconf.sal;
 
 import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkState;
@@ -43,18 +43,17 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public abstract class AbstractWriteTx implements DOMDataTreeWriteTransaction {
-
+abstract class AbstractWriteTx implements DOMDataTreeWriteTransaction {
     private static final Logger LOG  = LoggerFactory.getLogger(AbstractWriteTx.class);
 
-    protected final RemoteDeviceId id;
-    protected final NetconfBaseOps netOps;
-    protected final boolean rollbackSupport;
-    protected final List<ListenableFuture<? extends DOMRpcResult>> resultsFutures = new ArrayList<>();
+    final RemoteDeviceId id;
+    final NetconfBaseOps netOps;
+    final boolean rollbackSupport;
+    final List<ListenableFuture<? extends DOMRpcResult>> resultsFutures = new ArrayList<>();
     private final List<TxListener> listeners = new CopyOnWriteArrayList<>();
     // Allow commit to be called only once
-    protected volatile boolean finished = false;
-    protected final boolean isLockAllowed;
+    volatile boolean finished = false;
+    final boolean isLockAllowed;
 
     @SuppressFBWarnings(value = "MC_OVERRIDABLE_METHOD_CALL_IN_CONSTRUCTOR", justification = "Behavior-only subclasses")
     AbstractWriteTx(final RemoteDeviceId id, final NetconfBaseOps netconfOps, final boolean rollbackSupport,
@@ -66,15 +65,15 @@ public abstract class AbstractWriteTx implements DOMDataTreeWriteTransaction {
         init();
     }
 
-    protected static boolean isSuccess(final DOMRpcResult result) {
+    static boolean isSuccess(final DOMRpcResult result) {
         return result.errors().isEmpty();
     }
 
-    protected void checkNotFinished() {
+    void checkNotFinished() {
         checkState(!isFinished(), "%s: Transaction %s already finished", id, getIdentifier());
     }
 
-    protected boolean isFinished() {
+    boolean isFinished() {
         return finished;
     }
 
@@ -90,9 +89,9 @@ public abstract class AbstractWriteTx implements DOMDataTreeWriteTransaction {
     }
 
     // FIXME: only called from ctor which needs @SuppressDBWarnings. Refactor class hierarchy without this method (here)
-    protected abstract void init();
+    abstract void init();
 
-    protected abstract void cleanup();
+    abstract void cleanup();
 
     @Override
     public Object getIdentifier() {
@@ -176,7 +175,7 @@ public abstract class AbstractWriteTx implements DOMDataTreeWriteTransaction {
         return FluentFuture.from(resultFuture);
     }
 
-    protected final ListenableFuture<RpcResult<Void>> commitConfiguration() {
+    final ListenableFuture<RpcResult<Void>> commitConfiguration() {
         listeners.forEach(listener -> listener.onTransactionSubmitted(this));
         checkNotFinished();
         finished = true;
@@ -202,7 +201,7 @@ public abstract class AbstractWriteTx implements DOMDataTreeWriteTransaction {
         return result;
     }
 
-    protected abstract ListenableFuture<RpcResult<Void>> performCommit();
+    abstract ListenableFuture<RpcResult<Void>> performCommit();
 
     private void checkEditable(final LogicalDatastoreType store) {
         checkNotFinished();
@@ -210,11 +209,11 @@ public abstract class AbstractWriteTx implements DOMDataTreeWriteTransaction {
                 "Can edit only configuration data, not %s", store);
     }
 
-    protected abstract void editConfig(YangInstanceIdentifier path, Optional<NormalizedNode> data,
-                                       DataContainerChild editStructure,
-                                       Optional<EffectiveOperation> defaultOperation, String operation);
+    abstract void editConfig(YangInstanceIdentifier path, Optional<NormalizedNode> data,
+                             DataContainerChild editStructure, Optional<EffectiveOperation> defaultOperation,
+                             String operation);
 
-    protected ListenableFuture<RpcResult<Void>> resultsToTxStatus() {
+    ListenableFuture<RpcResult<Void>> resultsToTxStatus() {
         final SettableFuture<RpcResult<Void>> transformed = SettableFuture.create();
 
         Futures.addCallback(Futures.allAsList(resultsFutures), new FutureCallback<List<DOMRpcResult>>() {
@@ -5,7 +5,7 @@
  * 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.netconf.sal.connect.netconf.sal.tx;
+package org.opendaylight.netconf.sal.connect.netconf.sal;
 
 import com.google.common.util.concurrent.FluentFuture;
 import java.util.List;
@@ -21,27 +21,26 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public final class FieldsAwareReadOnlyTx extends AbstractReadOnlyTx implements NetconfDOMFieldsReadTransaction {
+final class FieldsAwareReadOnlyTx extends AbstractReadOnlyTx implements NetconfDOMFieldsReadTransaction {
     private static final Logger LOG = LoggerFactory.getLogger(FieldsAwareReadOnlyTx.class);
 
-    public FieldsAwareReadOnlyTx(final NetconfBaseOps netconfOps, final RemoteDeviceId id) {
+    FieldsAwareReadOnlyTx(final NetconfBaseOps netconfOps, final RemoteDeviceId id) {
         super(netconfOps, id);
     }
 
     @Override
     public FluentFuture<Optional<NormalizedNode>> read(final LogicalDatastoreType store,
             final YangInstanceIdentifier path, final List<YangInstanceIdentifier> fields) {
-        switch (store) {
-            case CONFIGURATION:
-                return readConfigurationData(path, fields);
-            case OPERATIONAL:
-                return readOperationalData(path, fields);
-            default:
+        return switch (store) {
+            case CONFIGURATION -> readConfigurationData(path, fields);
+            case OPERATIONAL -> readOperationalData(path, fields);
+            default -> {
                 LOG.warn("Unknown datastore type: {}.", store);
                 throw new IllegalArgumentException(String.format(
                         "%s, Cannot read data %s with fields %s for %s datastore, unknown datastore type",
                         id, path, fields, store));
-        }
+            }
+        };
     }
 
     private @NonNull FluentFuture<Optional<NormalizedNode>> readConfigurationData(
@@ -5,7 +5,7 @@
  * 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.netconf.sal.connect.netconf.sal.tx;
+package org.opendaylight.netconf.sal.connect.netconf.sal;
 
 import com.google.common.util.concurrent.FluentFuture;
 import java.util.List;
@@ -17,11 +17,10 @@ import org.opendaylight.netconf.dom.api.tx.NetconfDOMFieldsReadWriteTransaction;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
-public final class FieldsAwareReadWriteTx extends ReadWriteTx<NetconfDOMFieldsReadTransaction>
+final class FieldsAwareReadWriteTx extends ReadWriteTx<NetconfDOMFieldsReadTransaction>
         implements NetconfDOMFieldsReadWriteTransaction {
-
-    public FieldsAwareReadWriteTx(final NetconfDOMFieldsReadTransaction readTransaction,
-                                  final DOMDataTreeWriteTransaction writeTransaction) {
+    FieldsAwareReadWriteTx(final NetconfDOMFieldsReadTransaction readTransaction,
+            final DOMDataTreeWriteTransaction writeTransaction) {
         super(readTransaction, writeTransaction);
     }
 
@@ -5,7 +5,7 @@
  * 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.netconf.sal.connect.netconf.sal.tx;
+package org.opendaylight.netconf.sal.connect.netconf.sal;
 
 import static java.util.Objects.requireNonNull;
 
@@ -19,7 +19,7 @@ import org.opendaylight.netconf.dom.api.tx.NetconfDOMFieldsTransactionChain;
 public final class FieldsAwareTxChain extends AbstractTxChain implements NetconfDOMFieldsTransactionChain {
     private final NetconfDOMDataBrokerFieldsExtension dataBrokerFieldsExtension;
 
-    public FieldsAwareTxChain(final DOMDataBroker dataBroker, final DOMTransactionChainListener listener,
+    FieldsAwareTxChain(final DOMDataBroker dataBroker, final DOMTransactionChainListener listener,
                               final NetconfDOMDataBrokerFieldsExtension dataBrokerFieldsExtension) {
         super(dataBroker, listener);
         this.dataBrokerFieldsExtension = requireNonNull(dataBrokerFieldsExtension);
index e365567ab0464a41dec3e3d6c0a9fae21562febf..61971f86e897fbed8553b69dea68112a0fb934da 100644 (file)
@@ -25,15 +25,6 @@ import org.opendaylight.netconf.dom.api.tx.NetconfDOMFieldsReadTransaction;
 import org.opendaylight.netconf.dom.api.tx.NetconfDOMFieldsReadWriteTransaction;
 import org.opendaylight.netconf.dom.api.tx.NetconfDOMFieldsTransactionChain;
 import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfSessionPreferences;
-import org.opendaylight.netconf.sal.connect.netconf.sal.tx.FieldsAwareReadOnlyTx;
-import org.opendaylight.netconf.sal.connect.netconf.sal.tx.FieldsAwareReadWriteTx;
-import org.opendaylight.netconf.sal.connect.netconf.sal.tx.FieldsAwareTxChain;
-import org.opendaylight.netconf.sal.connect.netconf.sal.tx.ReadOnlyTx;
-import org.opendaylight.netconf.sal.connect.netconf.sal.tx.ReadWriteTx;
-import org.opendaylight.netconf.sal.connect.netconf.sal.tx.TxChain;
-import org.opendaylight.netconf.sal.connect.netconf.sal.tx.WriteCandidateRunningTx;
-import org.opendaylight.netconf.sal.connect.netconf.sal.tx.WriteCandidateTx;
-import org.opendaylight.netconf.sal.connect.netconf.sal.tx.WriteRunningTx;
 import org.opendaylight.netconf.sal.connect.netconf.util.NetconfBaseOps;
 import org.opendaylight.yangtools.rfc8528.data.api.MountPointContext;
 
similarity index 70%
rename from plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/ReadOnlyTx.java
rename to plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/ReadOnlyTx.java
index 2c1c659cd5c687a5afa4978fd41f935111f6a50d..2c5bb7224d73e67d0744314db7005c8ebd7cc965 100644 (file)
@@ -5,13 +5,13 @@
  * 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.netconf.sal.connect.netconf.sal.tx;
+package org.opendaylight.netconf.sal.connect.netconf.sal;
 
 import org.opendaylight.netconf.client.mdsal.api.RemoteDeviceId;
 import org.opendaylight.netconf.sal.connect.netconf.util.NetconfBaseOps;
 
-public final class ReadOnlyTx extends AbstractReadOnlyTx {
-    public ReadOnlyTx(final NetconfBaseOps netconfOps, final RemoteDeviceId id) {
+final class ReadOnlyTx extends AbstractReadOnlyTx {
+    ReadOnlyTx(final NetconfBaseOps netconfOps, final RemoteDeviceId id) {
         super(netconfOps, id);
     }
 }
similarity index 89%
rename from plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/ReadWriteTx.java
rename to plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/ReadWriteTx.java
index 9397c8671f867d92dd2401a620845e70d2ff87b6..bb36b6778349da7b2953e761cd240ec44649ad0b 100644 (file)
@@ -5,8 +5,7 @@
  * 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.netconf.sal.connect.netconf.sal.tx;
+package org.opendaylight.netconf.sal.connect.netconf.sal;
 
 import com.google.common.util.concurrent.FluentFuture;
 import java.util.Optional;
@@ -19,11 +18,11 @@ import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
-public class ReadWriteTx<T extends DOMDataTreeReadTransaction> implements DOMDataTreeReadWriteTransaction {
+class ReadWriteTx<T extends DOMDataTreeReadTransaction> implements DOMDataTreeReadWriteTransaction {
     private final DOMDataTreeWriteTransaction delegateWriteTx;
     final T delegateReadTx;
 
-    public ReadWriteTx(final T delegateReadTx, final DOMDataTreeWriteTransaction delegateWriteTx) {
+    ReadWriteTx(final T delegateReadTx, final DOMDataTreeWriteTransaction delegateWriteTx) {
         this.delegateReadTx = delegateReadTx;
         this.delegateWriteTx = delegateWriteTx;
     }
similarity index 84%
rename from plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/TxChain.java
rename to plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/TxChain.java
index c634a6154eefd1dd138b0806df052332d5de978c..a8a87861cd1023bbf7a66dee5588438b25d9b90a 100644 (file)
@@ -5,7 +5,7 @@
  * 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.netconf.sal.connect.netconf.sal.tx;
+package org.opendaylight.netconf.sal.connect.netconf.sal;
 
 import org.opendaylight.mdsal.dom.api.DOMDataBroker;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeReadTransaction;
@@ -16,8 +16,8 @@ import org.opendaylight.mdsal.dom.api.DOMTransactionChainListener;
 /**
  * {@link DOMTransactionChain} implementation for Netconf connector.
  */
-public final class TxChain extends AbstractTxChain {
-    public TxChain(final DOMDataBroker dataBroker, final DOMTransactionChainListener listener) {
+final class TxChain extends AbstractTxChain {
+    TxChain(final DOMDataBroker dataBroker, final DOMTransactionChainListener listener) {
         super(dataBroker, listener);
     }
 
similarity index 94%
rename from plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/TxListener.java
rename to plugins/netconf-client-mdsal/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/TxListener.java
index 1c97cabe370d9bce95d2081b33a921d11d8c9e9e..9e1d3db44ee63de169ab8044b7050ce02bb840a0 100644 (file)
@@ -5,11 +5,9 @@
  * 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.netconf.sal.connect.netconf.sal.tx;
+package org.opendaylight.netconf.sal.connect.netconf.sal;
 
 interface TxListener {
-
     /**
      * Invoked, when transaction completes successfully.
      * @param transaction transaction
@@ -35,6 +33,4 @@ interface TxListener {
      * @param transaction transaction
      */
     void onTransactionSubmitted(AbstractWriteTx transaction);
-
-
 }
@@ -5,7 +5,7 @@
  * 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.netconf.sal.connect.netconf.sal.tx;
+package org.opendaylight.netconf.sal.connect.netconf.sal;
 
 import org.opendaylight.netconf.client.mdsal.api.RemoteDeviceId;
 import org.opendaylight.netconf.sal.connect.netconf.util.NetconfBaseOps;
@@ -20,27 +20,26 @@ import org.slf4j.LoggerFactory;
  *     <li>Running datastore is locked as the first thing and this lock has to succeed</li>
  * </ul>
  */
-public class WriteCandidateRunningTx extends WriteCandidateTx {
+class WriteCandidateRunningTx extends WriteCandidateTx {
     private static final Logger LOG  = LoggerFactory.getLogger(WriteCandidateRunningTx.class);
 
-    public WriteCandidateRunningTx(final RemoteDeviceId id, final NetconfBaseOps netOps,
-            final boolean rollbackSupport) {
+    WriteCandidateRunningTx(final RemoteDeviceId id, final NetconfBaseOps netOps, final boolean rollbackSupport) {
         this(id, netOps, rollbackSupport, true);
     }
 
-    public WriteCandidateRunningTx(final RemoteDeviceId id, final NetconfBaseOps netconfOps,
-            final boolean rollbackSupport, final boolean isLockAllowed) {
+    WriteCandidateRunningTx(final RemoteDeviceId id, final NetconfBaseOps netconfOps, final boolean rollbackSupport,
+            final boolean isLockAllowed) {
         super(id, netconfOps, rollbackSupport, isLockAllowed);
     }
 
     @Override
-    protected synchronized void init() {
+    synchronized void init() {
         lockRunning();
         super.init();
     }
 
     @Override
-    protected void cleanupOnSuccess() {
+    void cleanupOnSuccess() {
         super.cleanupOnSuccess();
         unlockRunning();
     }
@@ -5,7 +5,7 @@
  * 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.netconf.sal.connect.netconf.sal.tx;
+package org.opendaylight.netconf.sal.connect.netconf.sal;
 
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
@@ -45,20 +45,20 @@ import org.slf4j.LoggerFactory;
  *   <li>Commit and Unlock candidate datastore async</li>
  * </ol>
  */
-public class WriteCandidateTx extends AbstractWriteTx {
+class WriteCandidateTx extends AbstractWriteTx {
     private static final Logger LOG  = LoggerFactory.getLogger(WriteCandidateTx.class);
 
-    public WriteCandidateTx(final RemoteDeviceId id, final NetconfBaseOps netconfOps, final boolean rollbackSupport) {
+    WriteCandidateTx(final RemoteDeviceId id, final NetconfBaseOps netconfOps, final boolean rollbackSupport) {
         this(id, netconfOps, rollbackSupport, true);
     }
 
-    public WriteCandidateTx(final RemoteDeviceId id, final NetconfBaseOps netconfOps, final boolean rollbackSupport,
+    WriteCandidateTx(final RemoteDeviceId id, final NetconfBaseOps netconfOps, final boolean rollbackSupport,
             final boolean isLockAllowed) {
         super(id, netconfOps, rollbackSupport, isLockAllowed);
     }
 
     @Override
-    protected synchronized void init() {
+    synchronized void init() {
         LOG.trace("{}: Initializing {} transaction", id, getClass().getSimpleName());
         lock();
     }
@@ -90,7 +90,7 @@ public class WriteCandidateTx extends AbstractWriteTx {
     }
 
     @Override
-    protected void cleanup() {
+    void cleanup() {
         discardChanges();
         cleanupOnSuccess();
     }
@@ -125,7 +125,7 @@ public class WriteCandidateTx extends AbstractWriteTx {
         return txResult;
     }
 
-    protected void cleanupOnSuccess() {
+    void cleanupOnSuccess() {
         unlock();
     }
 
@@ -5,7 +5,7 @@
  * 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.netconf.sal.connect.netconf.sal.tx;
+package org.opendaylight.netconf.sal.connect.netconf.sal;
 
 import com.google.common.util.concurrent.ListenableFuture;
 import java.util.ArrayList;
@@ -40,23 +40,22 @@ import org.slf4j.LoggerFactory;
  *   <li>Unlock running datastore on tx commit</li>
  * </ol>
  */
-public class WriteRunningTx extends AbstractWriteTx {
-
+class WriteRunningTx extends AbstractWriteTx {
     private static final Logger LOG  = LoggerFactory.getLogger(WriteRunningTx.class);
+
     private final List<Change> changes = new ArrayList<>();
 
-    public WriteRunningTx(final RemoteDeviceId id, final NetconfBaseOps netOps,
-                          final boolean rollbackSupport) {
+    WriteRunningTx(final RemoteDeviceId id, final NetconfBaseOps netOps, final boolean rollbackSupport) {
         this(id, netOps, rollbackSupport, true);
     }
 
-    public WriteRunningTx(final RemoteDeviceId id, final NetconfBaseOps netconfOps, final boolean rollbackSupport,
+    WriteRunningTx(final RemoteDeviceId id, final NetconfBaseOps netconfOps, final boolean rollbackSupport,
             final boolean isLockAllowed) {
         super(id, netconfOps, rollbackSupport, isLockAllowed);
     }
 
     @Override
-    protected synchronized void init() {
+    synchronized void init() {
         lock();
     }
 
@@ -69,7 +68,7 @@ public class WriteRunningTx extends AbstractWriteTx {
     }
 
     @Override
-    protected void cleanup() {
+    void cleanup() {
         unlock();
     }
 
@@ -99,7 +98,6 @@ public class WriteRunningTx extends AbstractWriteTx {
     }
 
     private static final class Change {
-
         private final DataContainerChild editStructure;
         private final Optional<EffectiveOperation> defaultOperation;
 
@@ -5,7 +5,7 @@
  * 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.netconf.sal.connect.netconf.sal.tx;
+package org.opendaylight.netconf.sal.connect.netconf.sal;
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.eq;
@@ -5,7 +5,7 @@
  * 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.netconf.sal.connect.netconf.sal.tx;
+package org.opendaylight.netconf.sal.connect.netconf.sal;
 
 import static org.mockito.Mockito.verify;
 
index f34814f5f7031fbcf38544c1e8a21037adda5b67..962c6e1c0bfa188be7fb68cc2e927afb09286b7b 100644 (file)
@@ -41,7 +41,6 @@ import org.opendaylight.netconf.client.mdsal.api.RemoteDeviceId;
 import org.opendaylight.netconf.client.mdsal.api.RemoteDeviceServices.Rpcs;
 import org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformer;
 import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfSessionPreferences;
-import org.opendaylight.netconf.sal.connect.netconf.sal.tx.TxTestUtils;
 import org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.base._1._0.rev110601.IetfNetconfService;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.NetconfState;
index 0831843a130df705a84fa8ff9d37b4b344d62234..c009d957790df646018d9f5ec2e47f35d955f080 100644 (file)
@@ -39,10 +39,6 @@ import org.opendaylight.netconf.dom.api.tx.NetconfDOMDataBrokerFieldsExtension;
 import org.opendaylight.netconf.dom.api.tx.NetconfDOMFieldsReadTransaction;
 import org.opendaylight.netconf.dom.api.tx.NetconfDOMFieldsReadWriteTransaction;
 import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfSessionPreferences;
-import org.opendaylight.netconf.sal.connect.netconf.sal.tx.AbstractWriteTx;
-import org.opendaylight.netconf.sal.connect.netconf.sal.tx.WriteCandidateRunningTx;
-import org.opendaylight.netconf.sal.connect.netconf.sal.tx.WriteCandidateTx;
-import org.opendaylight.netconf.sal.connect.netconf.sal.tx.WriteRunningTx;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.base._1._0.rev110601.IetfNetconfService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.monitoring.rev220718.NetconfTcp;
 import org.opendaylight.yangtools.rfc8528.data.util.EmptyMountPointContext;
@@ -5,7 +5,7 @@
  * 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.netconf.sal.connect.netconf.sal.tx;
+package org.opendaylight.netconf.sal.connect.netconf.sal;
 
 import static org.junit.Assert.assertThrows;
 import static org.mockito.ArgumentMatchers.any;
@@ -53,7 +53,6 @@ import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 
 @RunWith(MockitoJUnitRunner.StrictStubs.class)
 public class NetconfDeviceWriteOnlyTxTest extends AbstractBaseSchemasTest {
-
     private final RemoteDeviceId id = new RemoteDeviceId("test-mount", new InetSocketAddress(99));
 
     @Mock
@@ -5,7 +5,7 @@
  * 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.netconf.sal.connect.netconf.sal.tx;
+package org.opendaylight.netconf.sal.connect.netconf.sal;
 
 import static org.junit.Assert.assertNotEquals;
 import static org.mockito.ArgumentMatchers.any;
@@ -5,7 +5,7 @@
  * 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.netconf.sal.connect.netconf.sal.tx;
+package org.opendaylight.netconf.sal.connect.netconf.sal;
 
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertTrue;
similarity index 98%
rename from plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/TxChainTest.java
rename to plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/TxChainTest.java
index e47e3ba6216d7c0e3bb202a5c066127a910a5c55..a6d8ebee0f246f3b6960de9d18a9e564716154ab 100644 (file)
@@ -5,8 +5,7 @@
  * 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.netconf.sal.connect.netconf.sal.tx;
+package org.opendaylight.netconf.sal.connect.netconf.sal;
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.never;
@@ -17,6 +16,7 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.ArgumentCaptor;
+import org.mockito.Captor;
 import org.mockito.Mock;
 import org.mockito.junit.MockitoJUnitRunner;
 import org.opendaylight.mdsal.common.api.TransactionCommitFailedException;
@@ -27,7 +27,6 @@ import org.opendaylight.mdsal.dom.api.DOMTransactionChainListener;
 
 @RunWith(MockitoJUnitRunner.StrictStubs.class)
 public class TxChainTest {
-
     @Mock
     private DOMDataBroker broker;
     @Mock
@@ -46,7 +45,8 @@ public class TxChainTest {
     private AutoCloseable registration2;
     @Mock
     private AutoCloseable registration3;
-    private final ArgumentCaptor<TxListener> captor = ArgumentCaptor.forClass(TxListener.class);
+    @Captor
+    private ArgumentCaptor<TxListener> captor;
     private TxChain chain;
 
     @Before
similarity index 55%
rename from plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/TxTestUtils.java
rename to plugins/netconf-client-mdsal/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/TxTestUtils.java
index 498812a46a7735fef217c4305a7d792a3e49bfc0..9159f4da52981ddf533679a9a7a40c1af686388e 100644 (file)
@@ -5,47 +5,35 @@
  * 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.netconf.sal.connect.netconf.sal.tx;
+package org.opendaylight.netconf.sal.connect.netconf.sal;
 
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
+import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 
 public final class TxTestUtils {
-
     private static final QName Q_NAME_1 = QName.create("test:namespace", "2013-07-22", "c");
     private static final QName Q_NAME_2 = QName.create(Q_NAME_1, "a");
 
     private TxTestUtils() {
-
+        // Hidden on purpose
     }
 
     static YangInstanceIdentifier getContainerId() {
-        return YangInstanceIdentifier.builder()
-                .node(Q_NAME_1)
-                .build();
+        return YangInstanceIdentifier.builder().node(Q_NAME_1).build();
     }
 
-    public static YangInstanceIdentifier getLeafId() {
-        return YangInstanceIdentifier.builder()
-                .node(Q_NAME_1)
-                .node(Q_NAME_2)
-                .build();
+    static YangInstanceIdentifier getLeafId() {
+        return YangInstanceIdentifier.builder().node(Q_NAME_1).node(Q_NAME_2).build();
     }
 
     static ContainerNode getContainerNode() {
-        return Builders.containerBuilder()
-                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(Q_NAME_1))
-                .build();
+        return ImmutableNodes.containerNode(Q_NAME_1);
     }
 
     public static LeafNode<String> getLeafNode() {
-        return Builders.<String>leafBuilder()
-                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(Q_NAME_2))
-                .withValue("data")
-                .build();
+        return ImmutableNodes.leafNode(Q_NAME_2, "data");
     }
 }
@@ -5,7 +5,7 @@
  * 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.netconf.sal.connect.netconf.sal.tx;
+package org.opendaylight.netconf.sal.connect.netconf.sal;
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.eq;
@@ -5,7 +5,7 @@
  * 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.netconf.sal.connect.netconf.sal.tx;
+package org.opendaylight.netconf.sal.connect.netconf.sal;
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.eq;
@@ -5,7 +5,7 @@
  * 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.netconf.sal.connect.netconf.sal.tx;
+package org.opendaylight.netconf.sal.connect.netconf.sal;
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.eq;