Mass conversion to static methods 82/53182/4
authorRobert Varga <rovarga@cisco.com>
Sat, 11 Mar 2017 18:44:41 +0000 (19:44 +0100)
committerRobert Varga <rovarga@cisco.com>
Sat, 11 Mar 2017 22:22:07 +0000 (23:22 +0100)
This is mechanic fixup of methods which Eclipse points out as
being potentially-static.

Secondary effect is use of lambdas where the conversion can be made
automatic.

Change-Id: I33d3b81bd4737f2c2b55c5d973ed081ae58a3a0a
Signed-off-by: Robert Varga <rovarga@cisco.com>
55 files changed:
netconf/sal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/connector/netconf/NetconfConnectorModule.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/listener/NetconfDeviceCommunicator.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceTopologyAdapter.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/SchemalessNetconfDeviceRpc.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/schema/mapping/NetconfMessageTransformer.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/util/NetconfBaseOps.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/util/SchemalessRpcStructureTransformer.java
netconf/sal-netconf-connector/src/test/java/org/opendaylight/controller/config/yang/md/sal/connector/netconf/NetconfConnectorModuleTest.java
netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/LibraryModulesSchemasTest.java
netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/NetconfDeviceTest.java
netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/SchemalessNetconfDeviceTest.java
netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/listener/NetconfSessionPreferencesTest.java
netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceSalFacadeTest.java
netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/schema/mapping/NetconfMessageTransformerTest.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/md/sal/rest/schema/SchemaRetrievalServiceImpl.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonToPATCHBodyReader.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/NormalizedNodeJsonBodyWriter.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/NormalizedNodeXmlBodyWriter.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/PATCHJsonBodyWriter.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlToPATCHBodyReader.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/restconf/impl/BrokerFacade.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/restconf/impl/JSONRestconfServiceImpl.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestCodec.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/jersey/providers/JsonToPATCHBodyReader.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/jersey/providers/NormalizedNodeJsonBodyWriter.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/jersey/providers/NormalizedNodeXmlBodyWriter.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/jersey/providers/XmlToPATCHBodyReader.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/restful/services/impl/RestconfDataServiceImpl.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/restful/utils/ResponseFactory.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/rest/impl/test/providers/TestJsonBodyReader.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/rest/impl/test/providers/TestXmlBodyReader.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonBasicDataTypesTest.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/input/to/cnsn/test/RestPutListDataTest.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/nn/test/JsonToNnTest.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/nn/to/json/test/NnToJsonLeafrefType.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/nn/to/xml/test/NnInstanceIdentifierToXmlTest.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/nn/to/xml/test/NnToXmlTest.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/nn/to/xml/test/NnToXmlWithChoiceTest.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/nn/to/xml/test/NnToXmlWithDataFromSeveralModulesTest.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/BrokerFacadeTest.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/CnSnToXmlAndJsonInstanceIdentifierTest.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/CutDataToCorrectDepthTest.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/InvokeRpcMethodTest.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPostOperationTest.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPutOperationTest.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfDocumentedExceptionMapperTest.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfErrorTest.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/websockets/test/RestStream.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/streams/listeners/NotificationListenerTest.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/restconf/jersey/providers/JsonBodyReaderTest.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/restconf/jersey/providers/XmlBodyReaderTest.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/restconf/utils/mapping/RestconfMappingNodeUtilTest.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/restconf/utils/schema/context/RestconfSchemaUtilTest.java

index f2f748b3cf6ef14ffaa3dde82aea9b51bc7d4f3d..755959b64f0320e5532db2e1afd3be21f31e7a2c 100644 (file)
@@ -92,7 +92,7 @@ public final class NetconfConnectorModule extends org.opendaylight.controller.co
         }
     }
 
-    private boolean isHostAddressPresent(final Host address) {
+    private static boolean isHostAddressPresent(final Host address) {
         return address.getDomainName() != null ||
                 address.getIpAddress() != null && (address.getIpAddress().getIpv4Address() != null || address.getIpAddress().getIpv6Address() != null);
     }
index 260beaf59a3b4cc50ffbc05455cd276d38c498ca..00dd66f260f8e3e75b4316b68129f2ce56028bf1 100644 (file)
@@ -14,8 +14,6 @@ import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.SettableFuture;
 import io.netty.util.concurrent.Future;
-import io.netty.util.concurrent.FutureListener;
-import io.netty.util.concurrent.GenericFutureListener;
 import java.util.ArrayDeque;
 import java.util.Iterator;
 import java.util.List;
@@ -147,16 +145,12 @@ public class NetconfDeviceCommunicator implements NetconfClientSessionListener,
         }
 
 
-        initFuture.addListener(new GenericFutureListener<Future<Object>>(){
-
-            @Override
-            public void operationComplete(final Future<Object> future) throws Exception {
-                if (!future.isSuccess() && !future.isCancelled()) {
-                    LOG.debug("{}: Connection failed", id, future.cause());
-                    NetconfDeviceCommunicator.this.remoteDevice.onRemoteSessionFailed(future.cause());
-                    if (firstConnectionFuture.isDone()) {
-                        firstConnectionFuture.setException(future.cause());
-                    }
+        initFuture.addListener(future -> {
+            if (!future.isSuccess() && !future.isCancelled()) {
+                LOG.debug("{}: Connection failed", id, future.cause());
+                NetconfDeviceCommunicator.this.remoteDevice.onRemoteSessionFailed(future.cause());
+                if (firstConnectionFuture.isDone()) {
+                    firstConnectionFuture.setException(future.cause());
                 }
             }
         });
@@ -222,7 +216,8 @@ public class NetconfDeviceCommunicator implements NetconfClientSessionListener,
                              String.format( "The netconf session to %1$s is disconnected", id.getName() ) );
     }
 
-    private RpcResult<NetconfMessage> createErrorRpcResult(final RpcError.ErrorType errorType, final String message) {
+    private static RpcResult<NetconfMessage> createErrorRpcResult(final RpcError.ErrorType errorType,
+            final String message) {
         return RpcResultBuilder.<NetconfMessage>failed()
                 .withError(errorType, NetconfDocumentedException.ErrorTag.OPERATION_FAILED.getTagValue(), message).build();
     }
@@ -368,26 +363,23 @@ public class NetconfDeviceCommunicator implements NetconfClientSessionListener,
         final Request req = new Request(new UncancellableFuture<>(true), message);
         requests.add(req);
 
-        session.sendMessage(req.request).addListener(new FutureListener<Void>() {
-            @Override
-            public void operationComplete(final Future<Void> future) throws Exception {
-                if( !future.isSuccess() ) {
-                    // We expect that a session down will occur at this point
-                    LOG.debug("{}: Failed to send request {}", id,
-                            XmlUtil.toString(req.request.getDocument()),
-                            future.cause());
-
-                    if( future.cause() != null ) {
-                        req.future.set( createErrorRpcResult( RpcError.ErrorType.TRANSPORT,
-                                                              future.cause().getLocalizedMessage() ) );
-                    } else {
-                        req.future.set( createSessionDownRpcResult() ); // assume session is down
-                    }
-                    req.future.setException( future.cause() );
-                }
-                else {
-                    LOG.trace("Finished sending request {}", req.request);
+        session.sendMessage(req.request).addListener(future -> {
+            if( !future.isSuccess() ) {
+                // We expect that a session down will occur at this point
+                LOG.debug("{}: Failed to send request {}", id,
+                        XmlUtil.toString(req.request.getDocument()),
+                        future.cause());
+
+                if( future.cause() != null ) {
+                    req.future.set( createErrorRpcResult( RpcError.ErrorType.TRANSPORT,
+                                                          future.cause().getLocalizedMessage() ) );
+                } else {
+                    req.future.set( createSessionDownRpcResult() ); // assume session is down
                 }
+                req.future.setException( future.cause() );
+            }
+            else {
+                LOG.trace("Finished sending request {}", req.request);
             }
         });
 
index b0617cfca91f36a397530f602858a8334580e790..4d67bdd662d569729f3f57a586ffe031efaf4754 100644 (file)
@@ -57,14 +57,9 @@ import org.slf4j.LoggerFactory;
 public final class NetconfDeviceTopologyAdapter implements AutoCloseable {
 
     private static final Logger LOG = LoggerFactory.getLogger(NetconfDeviceTopologyAdapter.class);
-    public static final Function<Entry<QName, FailureReason>, UnavailableCapability> UNAVAILABLE_CAPABILITY_TRANSFORMER = new Function<Entry<QName, FailureReason>, UnavailableCapability>() {
-        @Override
-        public UnavailableCapability apply(final Entry<QName, FailureReason> input) {
-            return new UnavailableCapabilityBuilder()
-                    .setCapability(input.getKey().toString())
-                    .setFailureReason(input.getValue()).build();
-        }
-    };
+    public static final Function<Entry<QName, FailureReason>, UnavailableCapability> UNAVAILABLE_CAPABILITY_TRANSFORMER = input -> new UnavailableCapabilityBuilder()
+            .setCapability(input.getKey().toString())
+            .setFailureReason(input.getValue()).build();
 
     private final RemoteDeviceId id;
     private BindingTransactionChain txChain;
@@ -115,7 +110,7 @@ public final class NetconfDeviceTopologyAdapter implements AutoCloseable {
         commitTransaction(writeTx, "init");
     }
 
-    public void updateDeviceData(boolean up, NetconfDeviceCapabilities capabilities) {
+    public void updateDeviceData(final boolean up, final NetconfDeviceCapabilities capabilities) {
         final NetconfNode data = buildDataForNetconfNode(up, capabilities);
 
         final WriteTransaction writeTx = txChain.newWriteOnlyTransaction();
@@ -130,7 +125,7 @@ public final class NetconfDeviceTopologyAdapter implements AutoCloseable {
         commitTransaction(writeTx, "update");
     }
 
-    public void updateClusteredDeviceData(boolean up, String masterAddress, NetconfDeviceCapabilities capabilities) {
+    public void updateClusteredDeviceData(final boolean up, final String masterAddress, final NetconfDeviceCapabilities capabilities) {
         final NetconfNode data = buildDataForNetconfClusteredNode(up, masterAddress, capabilities);
 
         final WriteTransaction writeTx = txChain.newWriteOnlyTransaction();
@@ -145,7 +140,7 @@ public final class NetconfDeviceTopologyAdapter implements AutoCloseable {
         commitTransaction(writeTx, "update");
     }
 
-    public void setDeviceAsFailed(Throwable throwable) {
+    public void setDeviceAsFailed(final Throwable throwable) {
         String reason = (throwable != null && throwable.getMessage() != null) ? throwable.getMessage() : UNKNOWN_REASON;
 
         final NetconfNode data = new NetconfNodeBuilder().setConnectionStatus(ConnectionStatus.UnableToConnect).setConnectedMessage(reason).build();
@@ -162,7 +157,7 @@ public final class NetconfDeviceTopologyAdapter implements AutoCloseable {
         commitTransaction(writeTx, "update-failed-device");
     }
 
-    private NetconfNode buildDataForNetconfNode(boolean up, NetconfDeviceCapabilities capabilities) {
+    private NetconfNode buildDataForNetconfNode(final boolean up, final NetconfDeviceCapabilities capabilities) {
         List<AvailableCapability> capabilityList = new ArrayList<>();
         capabilityList.addAll(capabilities.getNonModuleBasedCapabilities());
         capabilityList.addAll(capabilities.getResolvedCapabilities());
@@ -184,7 +179,7 @@ public final class NetconfDeviceTopologyAdapter implements AutoCloseable {
         return netconfNodeBuilder.build();
     }
 
-    private NetconfNode buildDataForNetconfClusteredNode(boolean up, String masterNodeAddress, NetconfDeviceCapabilities capabilities) {
+    private NetconfNode buildDataForNetconfClusteredNode(final boolean up, final String masterNodeAddress, final NetconfDeviceCapabilities capabilities) {
         List<AvailableCapability> capabilityList = new ArrayList<>();
         capabilityList.addAll(capabilities.getNonModuleBasedCapabilities());
         capabilityList.addAll(capabilities.getResolvedCapabilities());
@@ -231,12 +226,12 @@ public final class NetconfDeviceTopologyAdapter implements AutoCloseable {
 
         final NetworkTopology networkTopology = new NetworkTopologyBuilder().build();
         LOG.trace("{}: Merging {} container to ensure its presence", id,
-                networkTopology.QNAME, writeTx.getIdentifier());
+                NetworkTopology.QNAME, writeTx.getIdentifier());
         writeTx.merge(LogicalDatastoreType.OPERATIONAL, networkTopologyPath, networkTopology);
 
         final Topology topology = new TopologyBuilder().setTopologyId(new TopologyId(TopologyNetconf.QNAME.getLocalName())).build();
         LOG.trace("{}: Merging {} container to ensure its presence", id,
-                topology.QNAME, writeTx.getIdentifier());
+                Topology.QNAME, writeTx.getIdentifier());
         writeTx.merge(LogicalDatastoreType.OPERATIONAL, topologyListPath, topology);
     }
 
@@ -278,7 +273,7 @@ public final class NetconfDeviceTopologyAdapter implements AutoCloseable {
         removeDeviceConfiguration();
     }
 
-    public void setTxChain(BindingTransactionChain txChain) {
+    public void setTxChain(final BindingTransactionChain txChain) {
         this.txChain = Preconditions.checkNotNull(txChain);
     }
 }
index f1ec789342d27eef9b91f570460c49b20bbd92ad..7448367e0ce969a9e832653fb0b13a64e52bd587 100644 (file)
@@ -42,7 +42,7 @@ public final class SchemalessNetconfDeviceRpc implements DOMRpcService {
     private final SchemalessMessageTransformer schemalessTransformer;
     private final RemoteDeviceId deviceId;
 
-    public SchemalessNetconfDeviceRpc(RemoteDeviceId deviceId, final RemoteDeviceCommunicator<NetconfMessage> listener,
+    public SchemalessNetconfDeviceRpc(final RemoteDeviceId deviceId, final RemoteDeviceCommunicator<NetconfMessage> listener,
                                       final BaseRpcSchemalessTransformer baseRpcTransformer,
                                       final SchemalessMessageTransformer messageTransformer) {
         this.deviceId = deviceId;
@@ -72,14 +72,11 @@ public final class SchemalessNetconfDeviceRpc implements DOMRpcService {
         final NetconfMessage netconfMessage = transformer.toRpcRequest(type, input);
         final ListenableFuture<RpcResult<NetconfMessage>> rpcResultListenableFuture = listener.sendRequest(netconfMessage, type.getLastComponent());
 
-        final ListenableFuture<DOMRpcResult> transformed = Futures.transform(rpcResultListenableFuture, new Function<RpcResult<NetconfMessage>, DOMRpcResult>() {
-            @Override
-            public DOMRpcResult apply(final RpcResult<NetconfMessage> input) {
-                if (input.isSuccessful()) {
-                    return transformer.toRpcResult(input.getResult(), type);
-                } else {
-                    return new DefaultDOMRpcResult(input.getErrors());
-                }
+        final ListenableFuture<DOMRpcResult> transformed = Futures.transform(rpcResultListenableFuture, (Function<RpcResult<NetconfMessage>, DOMRpcResult>) input1 -> {
+            if (input1.isSuccessful()) {
+                return transformer.toRpcResult(input1.getResult(), type);
+            } else {
+                return new DefaultDOMRpcResult(input1.getErrors());
             }
         });
 
@@ -93,7 +90,7 @@ public final class SchemalessNetconfDeviceRpc implements DOMRpcService {
     }
 
 
-    private boolean isBaseRpc(final SchemaPath type) {
+    private static boolean isBaseRpc(final SchemaPath type) {
         return NetconfMessageTransformUtil.NETCONF_URI.equals(type.getLastComponent().getNamespace());
     }
 
index f9cbef9f2d255b3a3f1d3e0452f5ac90fbaf9eac..52f707645377842f04d618be4082567c890bb7ee 100644 (file)
@@ -57,19 +57,9 @@ public class NetconfMessageTransformer implements MessageTransformer<NetconfMess
 
     private static final Logger LOG = LoggerFactory.getLogger(NetconfMessageTransformer.class);
 
-    private static final Function<SchemaNode, QName> QNAME_FUNCTION = new Function<SchemaNode, QName>() {
-        @Override
-        public QName apply(final SchemaNode rpcDefinition) {
-            return rpcDefinition.getQName();
-        }
-    };
+    private static final Function<SchemaNode, QName> QNAME_FUNCTION = rpcDefinition -> rpcDefinition.getQName();
 
-    private static final Function<SchemaNode, QName> QNAME_NOREV_FUNCTION = new Function<SchemaNode, QName>() {
-        @Override
-        public QName apply(final SchemaNode notification) {
-            return QNAME_FUNCTION.apply(notification).withoutRevision();
-        }
-    };
+    private static final Function<SchemaNode, QName> QNAME_NOREV_FUNCTION = notification -> QNAME_FUNCTION.apply(notification).withoutRevision();
 
     private final SchemaContext schemaContext;
     private final BaseSchema baseSchema;
@@ -165,7 +155,7 @@ public class NetconfMessageTransformer implements MessageTransformer<NetconfMess
         return new NetconfMessage(node);
     }
 
-    private boolean isBaseOrNotificationRpc(final QName rpc) {
+    private static boolean isBaseOrNotificationRpc(final QName rpc) {
         return rpc.getNamespace().equals(NETCONF_URI) ||
                 rpc.getNamespace().equals(IETF_NETCONF_NOTIFICATIONS.getNamespace()) ||
                 rpc.getNamespace().equals(NetconfMessageTransformUtil.CREATE_SUBSCRIPTION_RPC_QNAME.getNamespace());
index de61ee9073e467a57601d88001869a58adb3a4ad..8c51218ef96e0ec1ddd368855156d5b04c1bf335 100644 (file)
@@ -193,14 +193,11 @@ public final class NetconfBaseOps {
 
     private ListenableFuture<Optional<NormalizedNode<?, ?>>> extractData(final Optional<YangInstanceIdentifier> path,
                                                                          final ListenableFuture<DOMRpcResult> configRunning) {
-        return Futures.transform(configRunning, new Function<DOMRpcResult, Optional<NormalizedNode<?, ?>>>() {
-            @Override
-            public Optional<NormalizedNode<?, ?>> apply(final DOMRpcResult result) {
-                Preconditions.checkArgument(result.getErrors().isEmpty(), "Unable to read data: %s, errors: %s", path, result.getErrors());
-                final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataNode =
-                        ((ContainerNode) result.getResult()).getChild(NetconfMessageTransformUtil.toId(NetconfMessageTransformUtil.NETCONF_DATA_QNAME)).get();
-                return transformer.selectFromDataStructure(dataNode, path.get());
-            }
+        return Futures.transform(configRunning, (Function<DOMRpcResult, Optional<NormalizedNode<?, ?>>>) result -> {
+            Preconditions.checkArgument(result.getErrors().isEmpty(), "Unable to read data: %s, errors: %s", path, result.getErrors());
+            final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataNode =
+                    ((ContainerNode) result.getResult()).getChild(NetconfMessageTransformUtil.toId(NetconfMessageTransformUtil.NETCONF_DATA_QNAME)).get();
+            return transformer.selectFromDataStructure(dataNode, path.get());
         });
     }
 
@@ -225,7 +222,7 @@ public final class NetconfBaseOps {
         return future;
     }
 
-    private boolean isFilterPresent(final Optional<YangInstanceIdentifier> filterPath) {
+    private static boolean isFilterPresent(final Optional<YangInstanceIdentifier> filterPath) {
         return filterPath.isPresent() && !filterPath.get().isEmpty();
     }
 
@@ -261,8 +258,10 @@ public final class NetconfBaseOps {
         return Builders.choiceBuilder().withNodeIdentifier(toId(EditContent.QNAME)).withChild(configContent).build();
     }
 
-    private ContainerNode getEditConfigContent(final QName datastore, final DataContainerChild<?, ?> editStructure, final Optional<ModifyAction> defaultOperation, final boolean rollback) {
-        final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode> editBuilder = Builders.containerBuilder().withNodeIdentifier(toId(NETCONF_EDIT_CONFIG_QNAME));
+    private static ContainerNode getEditConfigContent(final QName datastore,
+            final DataContainerChild<?, ?> editStructure, final Optional<ModifyAction> defaultOperation, final boolean rollback) {
+        final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode> editBuilder =
+                Builders.containerBuilder().withNodeIdentifier(toId(NETCONF_EDIT_CONFIG_QNAME));
 
         // Target
         editBuilder.withChild(getTargetNode(datastore));
index eed36dbf266606cc6371ce6701bb69ef5fd2a17a..3342bf58737c19d5741ab6c663569629338524ab 100644 (file)
@@ -71,7 +71,7 @@ class SchemalessRpcStructureTransformer implements RpcStructureTransformer {
      */
     @Override
     public AnyXmlNode createEditConfigStructure(final Optional<NormalizedNode<?, ?>> data,
-                                                final YangInstanceIdentifier dataPath, Optional<ModifyAction> operation) {
+                                                final YangInstanceIdentifier dataPath, final Optional<ModifyAction> operation) {
         Preconditions.checkArgument(data.isPresent());
         Preconditions.checkArgument(data.get() instanceof AnyXmlNode);
 
@@ -127,7 +127,7 @@ class SchemalessRpcStructureTransformer implements RpcStructureTransformer {
                 .build();
     }
 
-    private void checkDataValidForPath(final YangInstanceIdentifier dataPath, final Element dataNode) {
+    private static void checkDataValidForPath(final YangInstanceIdentifier dataPath, final Element dataNode) {
         //if datapath is empty, consider dataNode to be a root node
         if (dataPath.equals(YangInstanceIdentifier.EMPTY)) {
             return;
@@ -146,7 +146,7 @@ class SchemalessRpcStructureTransformer implements RpcStructureTransformer {
 
     }
 
-    private void checkKeyValuesValidForPath(final XmlElement dataElement,
+    private static void checkKeyValuesValidForPath(final XmlElement dataElement,
                                             final YangInstanceIdentifier.PathArgument lastPathArgument) {
         final YangInstanceIdentifier.NodeIdentifierWithPredicates keyedId =
                 (YangInstanceIdentifier.NodeIdentifierWithPredicates) lastPathArgument;
@@ -172,7 +172,7 @@ class SchemalessRpcStructureTransformer implements RpcStructureTransformer {
         }
     }
 
-    private void setOperationAttribute(final Optional<ModifyAction> operation, final Document document,
+    private static void setOperationAttribute(final Optional<ModifyAction> operation, final Document document,
                                        final Element dataNode) {
         final QName operationQname = NetconfMessageTransformUtil.NETCONF_OPERATION_QNAME;
         final Attr operationAttribute =
@@ -203,7 +203,7 @@ class SchemalessRpcStructureTransformer implements RpcStructureTransformer {
         return parent;
     }
 
-    private List<XmlElement> selectMatchingNodes(final Element domElement, final YangInstanceIdentifier path) {
+    private static List<XmlElement> selectMatchingNodes(final Element domElement, final YangInstanceIdentifier path) {
         XmlElement element = XmlElement.fromDomElement(domElement);
         for (YangInstanceIdentifier.PathArgument pathArgument : path.getPathArguments()) {
             List<XmlElement> childElements = element.getChildElements(pathArgument.getNodeType().getLocalName());
index 8bf239602ea71ba5be7bdf561b718d196a0a41d3..9e918b6d576ea45e6bca0c9191937104ed88d566 100644 (file)
@@ -100,7 +100,7 @@ public class NetconfConnectorModuleTest {
         verify(transaction, times(2)).submit();
     }
 
-    private void verifyNode(final NodeId nodeId, final Node node) {
+    private static void verifyNode(final NodeId nodeId, final Node node) {
         Assert.assertEquals(nodeId, node.getNodeId());
         final NetconfNode netconfNode = node.getAugmentation(NetconfNode.class);
         Assert.assertEquals(HOST, netconfNode.getHost());
@@ -109,7 +109,7 @@ public class NetconfConnectorModuleTest {
         Assert.assertEquals(TCP_ONLY, netconfNode.isTcpOnly());
     }
 
-    private void setViaReflection(final Object object, final String fieldName, final Object value) {
+    private static void setViaReflection(final Object object, final String fieldName, final Object value) {
         try {
             final Field field = AbstractNetconfConnectorModule.class.getDeclaredField(fieldName);
             field.setAccessible(true);
index 32aa12870af321114159838b11f4a6ecf156970d..bf2b929a48e730439990b40b8e302d6ace5f7de0 100644 (file)
@@ -36,7 +36,7 @@ public class LibraryModulesSchemasTest {
     }
 
 
-    private void verifySchemas(final LibraryModulesSchemas libraryModulesSchemas) throws MalformedURLException {
+    private static void verifySchemas(final LibraryModulesSchemas libraryModulesSchemas) throws MalformedURLException {
         final Map<SourceIdentifier, URL> resolvedModulesSchema = libraryModulesSchemas.getAvailableModels();
         Assert.assertThat(resolvedModulesSchema.size(), is(3));
 
index 0e4c77b86aa181c631a41c45b3881e8f065aeefe..2f58669f7e629ef9361c3412766440edfee1676d 100644 (file)
@@ -39,8 +39,6 @@ import java.util.concurrent.Executors;
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
 import org.opendaylight.controller.config.util.xml.XmlUtil;
 import org.opendaylight.controller.md.sal.dom.api.DOMNotification;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
@@ -49,7 +47,6 @@ import org.opendaylight.controller.md.sal.dom.spi.DefaultDOMRpcResult;
 import org.opendaylight.netconf.api.NetconfMessage;
 import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
 import org.opendaylight.netconf.sal.connect.api.MessageTransformer;
-import org.opendaylight.netconf.sal.connect.api.NetconfDeviceSchemas;
 import org.opendaylight.netconf.sal.connect.api.NetconfDeviceSchemasResolver;
 import org.opendaylight.netconf.sal.connect.api.RemoteDeviceHandler;
 import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfDeviceCapabilities;
@@ -111,13 +108,7 @@ public class NetconfDeviceTest {
             RevisionSourceIdentifier.create(TEST_MODULE + "2", Optional.of(TEST_REVISION));
     public static final String TEST_CAPABILITY2 = TEST_NAMESPACE + "?module=" + TEST_MODULE + "2" + "&amp;revision=" + TEST_REVISION;
 
-    private static final NetconfDeviceSchemasResolver stateSchemasResolver = new NetconfDeviceSchemasResolver() {
-
-        @Override
-        public NetconfDeviceSchemas resolve(final NetconfDeviceRpc deviceRpc, final NetconfSessionPreferences remoteSessionCapabilities, final RemoteDeviceId id) {
-            return NetconfStateSchemas.EMPTY;
-        }
-    };
+    private static final NetconfDeviceSchemasResolver stateSchemasResolver = (deviceRpc, remoteSessionCapabilities, id) -> NetconfStateSchemas.EMPTY;
 
     @Test
     public void testNetconfDeviceFlawedModelFailedResolution() throws Exception {
@@ -213,26 +204,20 @@ public class NetconfDeviceTest {
         // Make fallback attempt to fail due to empty resolved sources
         final MissingSchemaSourceException schemaResolutionException = new MissingSchemaSourceException("fail first", TEST_SID);
         doReturn(Futures.immediateFailedCheckedFuture(schemaResolutionException)).when(schemaRepository).getSchemaSource(eq(TEST_SID), eq(ASTSchemaSource.class));
-        doAnswer(new Answer<Object>() {
-            @Override
-            public Object answer(final InvocationOnMock invocation) throws Throwable {
-                if (((Collection<?>) invocation.getArguments()[0]).size() == 2) {
-                    return Futures.immediateFailedCheckedFuture(schemaResolutionException);
-                } else {
-                    return Futures.immediateCheckedFuture(schema);
-                }
+        doAnswer(invocation -> {
+            if (((Collection<?>) invocation.getArguments()[0]).size() == 2) {
+                return Futures.immediateFailedCheckedFuture(schemaResolutionException);
+            } else {
+                return Futures.immediateCheckedFuture(schema);
             }
         }).when(schemaFactory).createSchemaContext(anyCollectionOf(SourceIdentifier.class));
 
-        final NetconfDeviceSchemasResolver stateSchemasResolver = new NetconfDeviceSchemasResolver() {
-            @Override
-            public NetconfDeviceSchemas resolve(final NetconfDeviceRpc deviceRpc, final NetconfSessionPreferences remoteSessionCapabilities, final RemoteDeviceId id) {
-                final Module first = Iterables.getFirst(schema.getModules(), null);
-                final QName qName = QName.create(first.getQNameModule(), first.getName());
-                final NetconfStateSchemas.RemoteYangSchema source1 = new NetconfStateSchemas.RemoteYangSchema(qName);
-                final NetconfStateSchemas.RemoteYangSchema source2 = new NetconfStateSchemas.RemoteYangSchema(QName.create(first.getQNameModule(), "test-module2"));
-                return new NetconfStateSchemas(Sets.newHashSet(source1, source2));
-            }
+        final NetconfDeviceSchemasResolver stateSchemasResolver = (deviceRpc, remoteSessionCapabilities, id) -> {
+            final Module first = Iterables.getFirst(schema.getModules(), null);
+            final QName qName = QName.create(first.getQNameModule(), first.getName());
+            final NetconfStateSchemas.RemoteYangSchema source1 = new NetconfStateSchemas.RemoteYangSchema(qName);
+            final NetconfStateSchemas.RemoteYangSchema source2 = new NetconfStateSchemas.RemoteYangSchema(QName.create(first.getQNameModule(), "test-module2"));
+            return new NetconfStateSchemas(Sets.newHashSet(source1, source2));
         };
 
         final NetconfDevice.SchemaResourcesDTO schemaResourcesDTO
@@ -253,7 +238,7 @@ public class NetconfDeviceTest {
         Mockito.verify(schemaFactory, times(1)).createSchemaContext(anyCollectionOf(SourceIdentifier.class));
     }
 
-    private SchemaSourceRegistry getSchemaRegistry() {
+    private static SchemaSourceRegistry getSchemaRegistry() {
         final SchemaSourceRegistry mock = mock(SchemaSourceRegistry.class);
         final SchemaSourceRegistration<?> mockReg = mock(SchemaSourceRegistration.class);
         doNothing().when(mockReg).close();
@@ -261,7 +246,7 @@ public class NetconfDeviceTest {
         return mock;
     }
 
-    private SchemaRepository getSchemaRepository() {
+    private static SchemaRepository getSchemaRepository() {
         final SchemaRepository mock = mock(SchemaRepository.class);
         final SchemaSourceRepresentation mockRep = mock(SchemaSourceRepresentation.class);
         doReturn(Futures.immediateCheckedFuture(mockRep)).when(mock).getSchemaSource(any(SourceIdentifier.class), eq(ASTSchemaSource.class));
@@ -367,7 +352,7 @@ public class NetconfDeviceTest {
                 moduleBasedCaps.get(QName.create(entry.getCapability())).getName(), entry.getCapabilityOrigin().getName()));
     }
 
-    private SchemaContextFactory getSchemaFactory() throws Exception {
+    private static SchemaContextFactory getSchemaFactory() throws Exception {
         final SchemaContextFactory schemaFactory = mockClass(SchemaContextFactory.class);
         doReturn(Futures.immediateCheckedFuture(getSchema())).when(schemaFactory).createSchemaContext(any(Collection.class));
         return schemaFactory;
@@ -380,7 +365,7 @@ public class NetconfDeviceTest {
         return YangParserTestUtils.parseYangStreams(modelsToParse);
     }
 
-    private RemoteDeviceHandler<NetconfSessionPreferences> getFacade() throws Exception {
+    private static RemoteDeviceHandler<NetconfSessionPreferences> getFacade() throws Exception {
         final RemoteDeviceHandler<NetconfSessionPreferences> remoteDeviceHandler = mockCloseableClass(RemoteDeviceHandler.class);
         doNothing().when(remoteDeviceHandler).onDeviceConnected(any(SchemaContext.class), any(NetconfSessionPreferences.class), any(NetconfDeviceRpc.class));
         doNothing().when(remoteDeviceHandler).onDeviceDisconnected();
@@ -388,7 +373,8 @@ public class NetconfDeviceTest {
         return remoteDeviceHandler;
     }
 
-    private <T extends AutoCloseable> T mockCloseableClass(final Class<T> remoteDeviceHandlerClass) throws Exception {
+    private static <T extends AutoCloseable> T mockCloseableClass(final Class<T> remoteDeviceHandlerClass)
+            throws Exception {
         final T mock = mockClass(remoteDeviceHandlerClass);
         doNothing().when(mock).close();
         return mock;
index fbe71266239acb72ff686544161cf326718ca18c..c336033190f8d59a13a0853760d9fd9e78dd1fd2 100644 (file)
@@ -68,7 +68,7 @@ public class SchemalessNetconfDeviceTest {
     }
 
     @SuppressWarnings("unchecked")
-    private RemoteDeviceHandler<NetconfSessionPreferences> getFacade() throws Exception {
+    private static RemoteDeviceHandler<NetconfSessionPreferences> getFacade() throws Exception {
         final RemoteDeviceHandler<NetconfSessionPreferences> remoteDeviceHandler = mockCloseableClass(RemoteDeviceHandler.class);
         doNothing().when(remoteDeviceHandler).onDeviceConnected(any(SchemaContext.class), any(NetconfSessionPreferences.class), any(NetconfDeviceRpc.class));
         doNothing().when(remoteDeviceHandler).onDeviceDisconnected();
@@ -76,7 +76,7 @@ public class SchemalessNetconfDeviceTest {
         return remoteDeviceHandler;
     }
 
-    private <T extends AutoCloseable> T mockCloseableClass(final Class<T> remoteDeviceHandlerClass) throws Exception {
+    private static <T extends AutoCloseable> T mockCloseableClass(final Class<T> remoteDeviceHandlerClass) throws Exception {
         final T mock = mockClass(remoteDeviceHandlerClass);
         doNothing().when(mock).close();
         return mock;
@@ -88,7 +88,7 @@ public class SchemalessNetconfDeviceTest {
         return mock;
     }
 
-    private NetconfSessionPreferences getSessionCaps(final boolean addMonitor, final Collection<String> additionalCapabilities) {
+    private static NetconfSessionPreferences getSessionCaps(final boolean addMonitor, final Collection<String> additionalCapabilities) {
         final ArrayList<String> capabilities = Lists.newArrayList(
                 XmlNetconfConstants.URN_IETF_PARAMS_NETCONF_BASE_1_0,
                 XmlNetconfConstants.URN_IETF_PARAMS_NETCONF_BASE_1_1);
index bd98fd191ebb44df7dcccae24703f952f3fdec4b..db07df1e86c6d978c7df6888ae038392edbf0680 100644 (file)
@@ -163,7 +163,8 @@ public class NetconfSessionPreferencesTest {
         assertCaps(sessionCaps1, 0, 4);
     }
 
-    private void assertCaps(final NetconfSessionPreferences sessionCaps1, final int nonModuleCaps, final int moduleCaps) {
+    private static void assertCaps(final NetconfSessionPreferences sessionCaps1, final int nonModuleCaps,
+            final int moduleCaps) {
         assertEquals(nonModuleCaps, sessionCaps1.getNonModuleCaps().size());
         assertEquals(moduleCaps, sessionCaps1.getModuleBasedCaps().size());
     }
index 07577ca178eb6afe340938bbfb2e8874a8ec8871..8df394c77332d01d0165d3d87c33165930d9dbc8 100644 (file)
@@ -114,7 +114,7 @@ public class NetconfDeviceSalFacadeTest {
         verify(mountInstance).publish(domNotification);
     }
 
-   private List<String> getCapabilities(){
+   private static List<String> getCapabilities() {
         return Arrays.asList(NetconfMessageTransformUtil.NETCONF_CANDIDATE_URI.toString());
     }
 }
index bdcf0274cf32c616a1c12941ad865d7e05bd5168..f0e3966718ff4d5583e2c2f15c11c0a12e0fe5c7 100644 (file)
@@ -273,7 +273,8 @@ public class NetconfMessageTransformerTest {
                 "</rpc>");
     }
 
-    private void assertSimilarXml(final NetconfMessage netconfMessage, final String xmlContent) throws SAXException, IOException {
+    private static void assertSimilarXml(final NetconfMessage netconfMessage, final String xmlContent)
+            throws SAXException, IOException {
         final Diff diff = XMLUnit.compareXML(netconfMessage.getDocument(), XmlUtil.readXmlToDocument(xmlContent));
         diff.overrideElementQualifier(new ElementNameAndAttributeQualifier());
         assertTrue(diff.toString(), diff.similar());
@@ -284,7 +285,8 @@ public class NetconfMessageTransformerTest {
 
         final QName capability = QName.create(Capabilities.QNAME, "capability");
         final DataContainerChild<?, ?> filter = toFilterStructure(
-                YangInstanceIdentifier.create(toId(NetconfState.QNAME), toId(Capabilities.QNAME), toId(capability), new YangInstanceIdentifier.NodeWithValue(capability, "a:b:c")), schema);
+                YangInstanceIdentifier.create(toId(NetconfState.QNAME), toId(Capabilities.QNAME), toId(capability),
+                    new YangInstanceIdentifier.NodeWithValue<>(capability, "a:b:c")), schema);
 
         final NetconfMessage netconfMessage = netconfMessageTransformer.toRpcRequest(toPath(NETCONF_GET_QNAME),
                 NetconfMessageTransformUtil.wrap(NETCONF_GET_QNAME, filter));
@@ -302,7 +304,7 @@ public class NetconfMessageTransformerTest {
                 "</rpc>");
     }
 
-    private NetconfMessageTransformer getTransformer(final SchemaContext schema) {
+    private static NetconfMessageTransformer getTransformer(final SchemaContext schema) {
         return new NetconfMessageTransformer(schema, true);
     }
 
@@ -316,7 +318,7 @@ public class NetconfMessageTransformerTest {
         assertNull(compositeNodeRpcResult.getResult());
     }
 
-    public SchemaContext getSchema(boolean addBase) {
+    public SchemaContext getSchema(final boolean addBase) {
         final ModuleInfoBackedContext moduleInfoBackedContext = ModuleInfoBackedContext.create();
         if(addBase) {
             moduleInfoBackedContext.addModuleInfos(Collections.singleton($YangModuleInfoImpl.getInstance()));
index f68febd1b0b0cb68a9e69fc16d4fd7ccb3b5e32c..9bada58bec55aa8d8d029d025b74aa199ad13b54 100644 (file)
@@ -69,8 +69,8 @@ public class SchemaRetrievalServiceImpl implements SchemaRetrievalService {
         return getExportUsingNameAndRevision(schemaContext, moduleName, revisionString);
     }
 
-    private SchemaExportContext getExportUsingNameAndRevision(final SchemaContext schemaContext, final String moduleName,
-            final String revisionStr) {
+    private static SchemaExportContext getExportUsingNameAndRevision(final SchemaContext schemaContext,
+            final String moduleName, final String revisionStr) {
         try {
             final Date revision = SimpleDateFormatUtil.getRevisionFormat().parse(revisionStr);
             final Module module = schemaContext.findModuleByName(moduleName, revision);
@@ -84,8 +84,5 @@ public class SchemaRetrievalServiceImpl implements SchemaRetrievalService {
         final InstanceIdentifierContext<?> mountContext = salContext.toMountPointIdentifier(identifier);
         return mountContext.getSchemaContext();
     }
-
-
-
 }
 
index ffb47bd352159540e3ca24c960d6263898977f82..014818c2d9f63ed343353a88a644c14d91a75cd1 100644 (file)
@@ -338,7 +338,7 @@ public class JsonToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider
      * @param in reader JsonReader reader
      * @return NormalizedNode representing data
      */
-    private NormalizedNode readEditData(@Nonnull final JsonReader in, @Nonnull final SchemaNode targetSchemaNode,
+    private static NormalizedNode readEditData(@Nonnull final JsonReader in, @Nonnull final SchemaNode targetSchemaNode,
                                         @Nonnull final InstanceIdentifierContext path) {
         final NormalizedNodeResult resultHolder = new NormalizedNodeResult();
         final NormalizedNodeStreamWriter writer = ImmutableNormalizedNodeStreamWriter.from(resultHolder);
@@ -352,7 +352,7 @@ public class JsonToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider
      * @param edit Instance of PatchEdit
      * @return PATCHEntity
      */
-    private PATCHEntity prepareEditOperation(@Nonnull final PatchEdit edit) {
+    private static PATCHEntity prepareEditOperation(@Nonnull final PatchEdit edit) {
         if ((edit.getOperation() != null) && (edit.getTargetSchemaNode() != null)
                 && checkDataPresence(edit.getOperation(), (edit.getData() != null))) {
             if (isPatchOperationWithValue(edit.getOperation())) {
@@ -380,19 +380,11 @@ public class JsonToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider
      * @return true if data is present when operation requires it or if there are no data when operation does not
      * allow it, false otherwise
      */
-    private boolean checkDataPresence(@Nonnull final String operation, final boolean hasData) {
+    private static boolean checkDataPresence(@Nonnull final String operation, final boolean hasData) {
         if (isPatchOperationWithValue(operation)) {
-            if (hasData) {
-                return true;
-            } else {
-                return false;
-            }
+            return hasData;
         } else  {
-            if (!hasData) {
-                return true;
-            } else {
-                return false;
-            }
+            return !hasData;
         }
     }
 
index 462c1001cd9dff2a162e5f46d9590e6099f42dd0..a41ec02afc6a7fdd5a8d53a3df7ff04a40893505 100644 (file)
@@ -92,7 +92,7 @@ public class NormalizedNodeJsonBodyWriter implements MessageBodyWriter<Normalize
         jsonWriter.flush();
     }
 
-    private void writeNormalizedNode(final JsonWriter jsonWriter, SchemaPath path,
+    private static void writeNormalizedNode(final JsonWriter jsonWriter, SchemaPath path,
             final InstanceIdentifierContext<SchemaNode> context, NormalizedNode<?, ?> data,
             final Optional<Integer> depth) throws IOException {
         final RestconfNormalizedNodeWriter nnWriter;
@@ -126,14 +126,16 @@ public class NormalizedNodeJsonBodyWriter implements MessageBodyWriter<Normalize
         nnWriter.flush();
     }
 
-    private void writeChildren(final RestconfNormalizedNodeWriter nnWriter, final ContainerNode data) throws IOException {
-        for(final DataContainerChild<? extends PathArgument, ?> child : data.getValue()) {
+    private static void writeChildren(final RestconfNormalizedNodeWriter nnWriter, final ContainerNode data)
+            throws IOException {
+        for (final DataContainerChild<? extends PathArgument, ?> child : data.getValue()) {
             nnWriter.write(child);
         }
     }
 
-    private RestconfNormalizedNodeWriter createNormalizedNodeWriter(final InstanceIdentifierContext<SchemaNode> context,
-            final SchemaPath path, final JsonWriter jsonWriter, final Optional<Integer> depth) {
+    private static RestconfNormalizedNodeWriter createNormalizedNodeWriter(
+            final InstanceIdentifierContext<SchemaNode> context, final SchemaPath path, final JsonWriter jsonWriter,
+            final Optional<Integer> depth) {
 
         final SchemaNode schema = context.getSchemaNode();
         final JSONCodecFactory codecs = getCodecFactory(context);
@@ -157,7 +159,7 @@ public class NormalizedNodeJsonBodyWriter implements MessageBodyWriter<Normalize
         }
     }
 
-    private JsonWriter createJsonWriter(final OutputStream entityStream, final boolean prettyPrint) {
+    private static JsonWriter createJsonWriter(final OutputStream entityStream, final boolean prettyPrint) {
         if (prettyPrint) {
             return JsonWriterFactory.createJsonWriter(new OutputStreamWriter(entityStream, StandardCharsets.UTF_8),
                     DEFAULT_INDENT_SPACES_NUM);
@@ -166,7 +168,7 @@ public class NormalizedNodeJsonBodyWriter implements MessageBodyWriter<Normalize
         }
     }
 
-    private JSONCodecFactory getCodecFactory(final InstanceIdentifierContext<?> context) {
+    private static JSONCodecFactory getCodecFactory(final InstanceIdentifierContext<?> context) {
         // TODO: Performance: Cache JSON Codec factory and schema context
         return JSONCodecFactory.create(context.getSchemaContext());
     }
index 633cd73c3de1df7be88f45dc8cbdab62ecee2e78..6a5d4d1c8dac754696110be60e617d310174d54e 100644 (file)
@@ -102,7 +102,7 @@ public class NormalizedNodeXmlBodyWriter implements MessageBodyWriter<Normalized
         writeNormalizedNode(xmlWriter, schemaPath, pathContext, data, Optional.fromNullable(t.getWriterParameters().getDepth()));
     }
 
-    private void writeNormalizedNode(final XMLStreamWriter xmlWriter, final SchemaPath schemaPath,
+    private static void writeNormalizedNode(final XMLStreamWriter xmlWriter, final SchemaPath schemaPath,
             final InstanceIdentifierContext<?> pathContext, NormalizedNode<?, ?> data, final Optional<Integer> depth)
             throws IOException {
         final RestconfNormalizedNodeWriter nnWriter;
@@ -126,7 +126,7 @@ public class NormalizedNodeXmlBodyWriter implements MessageBodyWriter<Normalized
         nnWriter.flush();
     }
 
-    private RestconfNormalizedNodeWriter createNormalizedNodeWriter(final XMLStreamWriter xmlWriter,
+    private static RestconfNormalizedNodeWriter createNormalizedNodeWriter(final XMLStreamWriter xmlWriter,
             final SchemaContext schemaContext, final SchemaPath schemaPath, final Optional<Integer> depth) {
         final NormalizedNodeStreamWriter xmlStreamWriter =
                 XMLStreamNormalizedNodeStreamWriter.create(xmlWriter, schemaContext, schemaPath);
@@ -137,7 +137,7 @@ public class NormalizedNodeXmlBodyWriter implements MessageBodyWriter<Normalized
         }
     }
 
-    private void writeElements(final XMLStreamWriter xmlWriter, final RestconfNormalizedNodeWriter nnWriter,
+    private static void writeElements(final XMLStreamWriter xmlWriter, final RestconfNormalizedNodeWriter nnWriter,
                                final ContainerNode data)
             throws IOException {
         try {
index 59e13927f5611edd3cccdc73b3ce06e1fe1ef37e..f172364e73fdfded35390b391b8fc45d234eb747 100644 (file)
@@ -90,7 +90,7 @@ public class PATCHJsonBodyWriter implements MessageBodyWriter<PATCHStatusContext
         jsonWriter.flush();
     }
 
-    private void reportSuccess(final JsonWriter jsonWriter) throws IOException {
+    private static void reportSuccess(final JsonWriter jsonWriter) throws IOException {
         jsonWriter.name("ok").beginArray().nullValue().endArray();
     }
 
index 8ad5d0ddc46da8e0bf1088fff167ca2d04ad51d1..fc8ad710e73ba7d2fb0d6dc5d62d26dc9dd8246a 100644 (file)
@@ -99,7 +99,7 @@ public class XmlToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider i
         }
     }
 
-    private PATCHContext parse(final InstanceIdentifierContext<?> pathContext, final Document doc) {
+    private static PATCHContext parse(final InstanceIdentifierContext<?> pathContext, final Document doc) {
         final List<PATCHEntity> resultCollection = new ArrayList<>();
         final String patchId = doc.getElementsByTagName("patch-id").item(0).getFirstChild().getNodeValue();
         final NodeList editNodes = doc.getElementsByTagName("edit");
@@ -182,7 +182,7 @@ public class XmlToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider i
      * @param operation Name of current operation
      * @return List of value elements
      */
-    private List<Element> readValueNodes(@Nonnull final Element element, @Nonnull final String operation) {
+    private static List<Element> readValueNodes(@Nonnull final Element element, @Nonnull final String operation) {
         final Node valueNode = element.getElementsByTagName("value").item(0);
 
         if (PATCHEditOperation.isPatchOperationWithValue(operation) && (valueNode == null)) {
@@ -220,9 +220,8 @@ public class XmlToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider i
      * @param revision Module revision
      * @return Non-conditional XPath
      */
-    private String prepareNonCondXpath(@Nonnull final DataSchemaNode schemaNode, @Nonnull final String target,
-                                       @Nonnull final Element value, @Nonnull final String namespace,
-                                       @Nonnull final String revision) {
+    private static String prepareNonCondXpath(@Nonnull final DataSchemaNode schemaNode, @Nonnull final String target,
+            @Nonnull final Element value, @Nonnull final String namespace, @Nonnull final String revision) {
         final Iterator<String> args = Splitter.on("/").split(target.substring(target.indexOf(':') + 1)).iterator();
 
         final StringBuilder nonCondXpath = new StringBuilder();
@@ -254,7 +253,7 @@ public class XmlToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider i
      * @param keys Iterator of list keys names
      * @return Iterator of list keys values
      */
-    private Iterator<String> readKeyValues(@Nonnull final Element value, @Nonnull final Iterator<QName> keys) {
+    private static Iterator<String> readKeyValues(@Nonnull final Element value, @Nonnull final Iterator<QName> keys) {
         final List<String> result = new ArrayList<>();
 
         while (keys.hasNext()) {
@@ -270,7 +269,7 @@ public class XmlToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider i
      * @param keyNames Iterator of list keys names
      * @param keyValues Iterator of list keys values
      */
-    private void appendKeys(@Nonnull final StringBuilder nonCondXpath, @Nonnull final Iterator<QName> keyNames,
+    private static void appendKeys(@Nonnull final StringBuilder nonCondXpath, @Nonnull final Iterator<QName> keyNames,
                             @Nonnull final Iterator<String> keyValues) {
         while (keyNames.hasNext()) {
             nonCondXpath.append("[");
index ffe1f5e42f070d4461283b8c5c12e95e643c35db..f8f4acfe470194eee7a0a4abbf5a2eedc0762397 100644 (file)
@@ -841,8 +841,7 @@ public class BrokerFacade {
         }
     }
 
-    private DataSchemaNode checkListAndOrderedType(final SchemaContext ctx,
-            final YangInstanceIdentifier path) {
+    private static DataSchemaNode checkListAndOrderedType(final SchemaContext ctx, final YangInstanceIdentifier path) {
         final YangInstanceIdentifier parent = path.getParent();
         final DataSchemaContextNode<?> node = DataSchemaContextTree.from(ctx).getChild(parent);
         final DataSchemaNode dataSchemaNode = node.getDataSchemaNode();
@@ -887,14 +886,15 @@ public class BrokerFacade {
         }
     }
 
-    private void simplePostPut(final DOMDataReadWriteTransaction rWTransaction, final LogicalDatastoreType datastore,
-            final YangInstanceIdentifier path, final NormalizedNode<?, ?> payload, final SchemaContext schemaContext) {
+    private static void simplePostPut(final DOMDataReadWriteTransaction rWTransaction,
+            final LogicalDatastoreType datastore, final YangInstanceIdentifier path, final NormalizedNode<?, ?> payload,
+            final SchemaContext schemaContext) {
         checkItemDoesNotExists(rWTransaction, datastore, path);
         ensureParentsByMerge(datastore, path, rWTransaction, schemaContext);
         rWTransaction.put(datastore, path, payload);
     }
 
-    private boolean doesItemExist(final DOMDataReadWriteTransaction rWTransaction,
+    private static boolean doesItemExist(final DOMDataReadWriteTransaction rWTransaction,
             final LogicalDatastoreType store, final YangInstanceIdentifier path) {
         try {
             return rWTransaction.exists(store, path).checkedGet();
@@ -911,8 +911,8 @@ public class BrokerFacade {
      * @param store Used datastore
      * @param path Path to item to verify its existence
      */
-    private void checkItemExists(final DOMDataReadWriteTransaction rWTransaction,
-                                 final LogicalDatastoreType store, final YangInstanceIdentifier path) {
+    private static void checkItemExists(final DOMDataReadWriteTransaction rWTransaction,
+            final LogicalDatastoreType store, final YangInstanceIdentifier path) {
         if (!doesItemExist(rWTransaction, store, path)) {
             final String errMsg = "Operation via Restconf was not executed because data does not exist";
             LOG.trace("{}:{}", errMsg, path);
@@ -928,8 +928,8 @@ public class BrokerFacade {
      * @param store Used datastore
      * @param path Path to item to verify its existence
      */
-    private void checkItemDoesNotExists(final DOMDataReadWriteTransaction rWTransaction,
-                                        final LogicalDatastoreType store, final YangInstanceIdentifier path) {
+    private static void checkItemDoesNotExists(final DOMDataReadWriteTransaction rWTransaction,
+            final LogicalDatastoreType store, final YangInstanceIdentifier path) {
         if (doesItemExist(rWTransaction, store, path)) {
             final String errMsg = "Operation via Restconf was not executed because data already exists";
             LOG.trace("{}:{}", errMsg, path);
@@ -1116,8 +1116,9 @@ public class BrokerFacade {
         }
     }
 
-    private void makePut(final DOMDataReadWriteTransaction writeTransaction, final LogicalDatastoreType datastore,
-            final YangInstanceIdentifier path, final NormalizedNode<?, ?> payload, final SchemaContext schemaContext) {
+    private static void makePut(final DOMDataReadWriteTransaction writeTransaction,
+            final LogicalDatastoreType datastore, final YangInstanceIdentifier path, final NormalizedNode<?, ?> payload,
+            final SchemaContext schemaContext) {
         if (payload instanceof MapNode) {
             final NormalizedNode<?, ?> emptySubtree = ImmutableNodes.fromInstanceId(schemaContext, path);
             writeTransaction.merge(datastore, YangInstanceIdentifier.create(emptySubtree.getIdentifier()), emptySubtree);
@@ -1131,14 +1132,14 @@ public class BrokerFacade {
         }
     }
 
-    private void simplePut(final LogicalDatastoreType datastore, final YangInstanceIdentifier path,
+    private static void simplePut(final LogicalDatastoreType datastore, final YangInstanceIdentifier path,
             final DOMDataReadWriteTransaction writeTransaction, final SchemaContext schemaContext,
             final NormalizedNode<?, ?> payload) {
         ensureParentsByMerge(datastore, path, writeTransaction, schemaContext);
         writeTransaction.put(datastore, path, payload);
     }
 
-    private CheckedFuture<Void, TransactionCommitFailedException> deleteDataViaTransaction(
+    private static CheckedFuture<Void, TransactionCommitFailedException> deleteDataViaTransaction(
             final DOMDataReadWriteTransaction readWriteTransaction, final LogicalDatastoreType datastore,
             final YangInstanceIdentifier path) {
         LOG.trace("Delete {} via Restconf: {}", datastore.name(), path);
@@ -1147,14 +1148,13 @@ public class BrokerFacade {
         return readWriteTransaction.submit();
     }
 
-    private void deleteDataWithinTransaction(
-            final DOMDataWriteTransaction writeTransaction, final LogicalDatastoreType datastore,
-            final YangInstanceIdentifier path) {
+    private static void deleteDataWithinTransaction(final DOMDataWriteTransaction writeTransaction,
+            final LogicalDatastoreType datastore, final YangInstanceIdentifier path) {
         LOG.trace("Delete {} within Restconf PATCH: {}", datastore.name(), path);
         writeTransaction.delete(datastore, path);
     }
 
-    private void mergeDataWithinTransaction(
+    private static void mergeDataWithinTransaction(
             final DOMDataReadWriteTransaction writeTransaction, final LogicalDatastoreType datastore,
             final YangInstanceIdentifier path, final NormalizedNode<?, ?> payload, final SchemaContext schemaContext) {
         LOG.trace("Merge {} within Restconf PATCH: {} with payload {}", datastore.name(), path, payload);
@@ -1198,8 +1198,9 @@ public class BrokerFacade {
         }
     }
 
-    private void ensureParentsByMerge(final LogicalDatastoreType store, final YangInstanceIdentifier normalizedPath,
-            final DOMDataReadWriteTransaction rwTx, final SchemaContext schemaContext) {
+    private static void ensureParentsByMerge(final LogicalDatastoreType store,
+            final YangInstanceIdentifier normalizedPath, final DOMDataReadWriteTransaction rwTx,
+            final SchemaContext schemaContext) {
         final List<PathArgument> normalizedPathWithoutChildArgs = new ArrayList<>();
         YangInstanceIdentifier rootNormalizedPath = null;
 
index 9c9084fc2f2cfb4cbbdd8f5b314e4b53f7c16a95..5b24d2e60d8935fbd48bb50fe87aa41d79b7c1cc 100644 (file)
@@ -157,7 +157,7 @@ public class JSONRestconfServiceImpl implements JSONRestconfService, AutoCloseab
     public void close() {
     }
 
-    private String toJson(final NormalizedNodeContext readData) throws IOException {
+    private static String toJson(final NormalizedNodeContext readData) throws IOException {
         final NormalizedNodeJsonBodyWriter writer = new NormalizedNodeJsonBodyWriter();
         final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
         writer.writeTo(readData, NormalizedNodeContext.class, null, EMPTY_ANNOTATIONS,
@@ -165,9 +165,9 @@ public class JSONRestconfServiceImpl implements JSONRestconfService, AutoCloseab
         return outputStream.toString(StandardCharsets.UTF_8.name());
     }
 
-    private boolean isDataMissing(final Exception e) {
+    private static boolean isDataMissing(final Exception e) {
         boolean dataMissing = false;
-        if(e instanceof RestconfDocumentedException) {
+        if (e instanceof RestconfDocumentedException) {
             final RestconfDocumentedException rde = (RestconfDocumentedException)e;
             if(!rde.getErrors().isEmpty()) {
                 if(rde.getErrors().get(0).getErrorTag() == ErrorTag.DATA_MISSING) {
index c6224663efacbb3e654223c0f016d3161713cbbc..42b97538f5a692f4956dc0997f1c886bce96a6f4 100644 (file)
@@ -228,7 +228,7 @@ public class RestCodec {
 
         @Override
         public YangInstanceIdentifier deserialize(final IdentityValuesDTO data) {
-            final List<PathArgument> result = new ArrayList<PathArgument>();
+            final List<PathArgument> result = new ArrayList<>();
             final IdentityValue valueWithNamespace = data.getValuesWithNamespaces().get(0);
             final Module module = getModuleByNamespace(valueWithNamespace.getNamespace(), this.mountPoint);
             if (module == null) {
@@ -301,7 +301,7 @@ public class RestCodec {
             return result.isEmpty() ? null : YangInstanceIdentifier.create(result);
         }
 
-        private List<Predicate> keyValuesToPredicateList(final Map<QName, Object> keyValues) {
+        private static List<Predicate> keyValuesToPredicateList(final Map<QName, Object> keyValues) {
             final List<Predicate> result = new ArrayList<>();
             for (final QName qName : keyValues.keySet()) {
                 final Object value = keyValues.get(qName);
@@ -310,7 +310,7 @@ public class RestCodec {
             return result;
         }
 
-        private IdentityValue qNameToIdentityValue(final QName qName) {
+        private static IdentityValue qNameToIdentityValue(final QName qName) {
             if (qName != null) {
                 return new IdentityValue(qName.getNamespace().toString(), qName.getLocalName());
             }
index ea24dbf062984911cfbd7b045ff16a5038f1b973..2c025d8e5c5c0d396d4ddf47eef2183e4a24180a 100644 (file)
@@ -350,7 +350,7 @@ public class RestconfImpl implements RestconfService {
      *            - mount point, if in use otherwise null
      * @return {@link NormalizedNodeContext}
      */
-    private NormalizedNodeContext operationsFromModulesToNormalizedContext(final Set<Module> modules,
+    private static NormalizedNodeContext operationsFromModulesToNormalizedContext(final Set<Module> modules,
             final DOMMountPoint mountPoint) {
 
         final Collection<Module> neededModules = new ArrayList<>(modules.size());
@@ -1149,7 +1149,7 @@ public class RestconfImpl implements RestconfService {
         throw new RestconfDocumentedException(msg);
     }
 
-    private Date parseDateFromQueryParam(final Entry<String, List<String>> entry) {
+    private static Date parseDateFromQueryParam(final Entry<String, List<String>> entry) {
         final DateAndTime event = new DateAndTime(entry.getValue().iterator().next());
         String numOf_ms = "";
         final String value = event.getValue();
@@ -1179,7 +1179,7 @@ public class RestconfImpl implements RestconfService {
      * @return {@link InstanceIdentifierContext} of location leaf for
      *         notification
      */
-    private InstanceIdentifierContext<?> prepareIIDSubsStreamOutput() {
+    private static InstanceIdentifierContext<?> prepareIIDSubsStreamOutput() {
         final QName qnameBase = QName.create("subscribe:to:notification", "2016-10-28", "notifi");
         final SchemaContext schemaCtx = ControllerContext.getInstance().getGlobalSchema();
         final DataSchemaNode location = ((ContainerSchemaNode) schemaCtx
@@ -1502,8 +1502,8 @@ public class RestconfImpl implements RestconfService {
      *            - contains list of qnames of notifications
      * @return - checked future object
      */
-    private CheckedFuture<DOMRpcResult, DOMRpcException>
-            invokeSalRemoteRpcNotifiStrRPC(final NormalizedNodeContext payload) {
+    private static CheckedFuture<DOMRpcResult, DOMRpcException> invokeSalRemoteRpcNotifiStrRPC(
+            final NormalizedNodeContext payload) {
         final ContainerNode data = (ContainerNode) payload.getData();
         LeafSetNode leafSet = null;
         String outputType = "XML";
index b9b38ec1439d67d7ecd28919cb9c68a79a1f4abe..0e5f5c74ec0e92b923950542539c920dbcb1cb8f 100644 (file)
@@ -333,8 +333,8 @@ public class JsonToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider
      * @param in reader JsonReader reader
      * @return NormalizedNode representing data
      */
-    private NormalizedNode readEditData(@Nonnull final JsonReader in, @Nonnull SchemaNode targetSchemaNode,
-                                        @Nonnull InstanceIdentifierContext path) {
+    private static NormalizedNode readEditData(@Nonnull final JsonReader in, @Nonnull final SchemaNode targetSchemaNode,
+                                        @Nonnull final InstanceIdentifierContext path) {
         final NormalizedNodeResult resultHolder = new NormalizedNodeResult();
         final NormalizedNodeStreamWriter writer = ImmutableNormalizedNodeStreamWriter.from(resultHolder);
         JsonParserStream.create(writer, path.getSchemaContext(), targetSchemaNode).parse(in);
@@ -347,7 +347,7 @@ public class JsonToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider
      * @param edit Instance of PatchEdit
      * @return PATCHEntity
      */
-    private PATCHEntity prepareEditOperation(@Nonnull final PatchEdit edit) {
+    private static PATCHEntity prepareEditOperation(@Nonnull final PatchEdit edit) {
         if (edit.getOperation() != null && edit.getTargetSchemaNode() != null
                 && checkDataPresence(edit.getOperation(), (edit.getData() != null))) {
             if (isPatchOperationWithValue(edit.getOperation())) {
@@ -375,19 +375,11 @@ public class JsonToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider
      * @return true if data is present when operation requires it or if there are no data when operation does not
      * allow it, false otherwise
      */
-    private boolean checkDataPresence(@Nonnull final String operation, final boolean hasData) {
+    private static boolean checkDataPresence(@Nonnull final String operation, final boolean hasData) {
         if (isPatchOperationWithValue(operation)) {
-            if (hasData) {
-                return true;
-            } else {
-                return false;
-            }
+            return hasData;
         } else  {
-            if (!hasData) {
-                return true;
-            } else {
-                return false;
-            }
+            return !hasData;
         }
     }
 
@@ -405,7 +397,7 @@ public class JsonToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider
             return id;
         }
 
-        public void setId(String id) {
+        public void setId(final String id) {
             this.id = id;
         }
 
@@ -413,7 +405,7 @@ public class JsonToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider
             return operation;
         }
 
-        public void setOperation(String operation) {
+        public void setOperation(final String operation) {
             this.operation = operation;
         }
 
@@ -421,7 +413,7 @@ public class JsonToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider
             return target;
         }
 
-        public void setTarget(YangInstanceIdentifier target) {
+        public void setTarget(final YangInstanceIdentifier target) {
             this.target = target;
         }
 
@@ -429,7 +421,7 @@ public class JsonToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider
             return targetSchemaNode;
         }
 
-        public void setTargetSchemaNode(SchemaNode targetSchemaNode) {
+        public void setTargetSchemaNode(final SchemaNode targetSchemaNode) {
             this.targetSchemaNode = targetSchemaNode;
         }
 
@@ -437,7 +429,7 @@ public class JsonToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider
             return data;
         }
 
-        public void setData(NormalizedNode data) {
+        public void setData(final NormalizedNode data) {
             this.data = data;
         }
 
index b089efe0b123299ef4d7dba5619744e75935ce80..6b10cb4d4231bd44ca0152fb7030486bbd80e6a2 100644 (file)
@@ -96,12 +96,9 @@ public class NormalizedNodeJsonBodyWriter implements MessageBodyWriter<Normalize
         jsonWriter.flush();
     }
 
-    private void writeNormalizedNode(final JsonWriter jsonWriter,
-                                     final SchemaPath path,
-                                     final InstanceIdentifierContext<SchemaNode> context,
-                                     final NormalizedNode<?, ?> data,
-                                     final Integer depth,
-                                     final List<Set<QName>> fields) throws IOException {
+    private static void writeNormalizedNode(final JsonWriter jsonWriter,
+            final SchemaPath path, final InstanceIdentifierContext<SchemaNode> context, final NormalizedNode<?, ?> data,
+            final Integer depth, final List<Set<QName>> fields) throws IOException {
         final RestconfNormalizedNodeWriter nnWriter;
 
         if (context.getSchemaNode() instanceof RpcDefinition) {
@@ -139,18 +136,16 @@ public class NormalizedNodeJsonBodyWriter implements MessageBodyWriter<Normalize
         nnWriter.flush();
     }
 
-    private void writeChildren(final RestconfNormalizedNodeWriter nnWriter,
+    private static void writeChildren(final RestconfNormalizedNodeWriter nnWriter,
                                final ContainerNode data) throws IOException {
         for (final DataContainerChild<? extends PathArgument, ?> child : data.getValue()) {
             nnWriter.write(child);
         }
     }
 
-    private RestconfNormalizedNodeWriter createNormalizedNodeWriter(final InstanceIdentifierContext<SchemaNode> context,
-                                                                    final SchemaPath path,
-                                                                    final JsonWriter jsonWriter,
-                                                                    final Integer depth,
-                                                                    final List<Set<QName>> fields) {
+    private static RestconfNormalizedNodeWriter createNormalizedNodeWriter(
+            final InstanceIdentifierContext<SchemaNode> context, final SchemaPath path, final JsonWriter jsonWriter,
+            final Integer depth, final List<Set<QName>> fields) {
 
         final SchemaNode schema = context.getSchemaNode();
         final JSONCodecFactory codecs = getCodecFactory(context);
@@ -170,7 +165,7 @@ public class NormalizedNodeJsonBodyWriter implements MessageBodyWriter<Normalize
         return ParameterAwareNormalizedNodeWriter.forStreamWriter(streamWriter, depth, fields);
     }
 
-    private JsonWriter createJsonWriter(final OutputStream entityStream, final boolean prettyPrint) {
+    private static JsonWriter createJsonWriter(final OutputStream entityStream, final boolean prettyPrint) {
         if (prettyPrint) {
             return JsonWriterFactory.createJsonWriter(
                     new OutputStreamWriter(entityStream, StandardCharsets.UTF_8), DEFAULT_INDENT_SPACES_NUM);
@@ -179,7 +174,7 @@ public class NormalizedNodeJsonBodyWriter implements MessageBodyWriter<Normalize
         }
     }
 
-    private JSONCodecFactory getCodecFactory(final InstanceIdentifierContext<?> context) {
+    private static JSONCodecFactory getCodecFactory(final InstanceIdentifierContext<?> context) {
         // TODO: Performance: Cache JSON Codec factory and schema context
         return JSONCodecFactory.create(context.getSchemaContext());
     }
index 373955a248a396a5deae4efa6b212750c6343851..86b189a0332983ad11bd9fb2a7601795ddc89107 100644 (file)
@@ -101,12 +101,9 @@ public class NormalizedNodeXmlBodyWriter implements MessageBodyWriter<Normalized
                 t.getWriterParameters().getFields());
     }
 
-    private void writeNormalizedNode(final XMLStreamWriter xmlWriter,
-                                     final SchemaPath path,
-                                     final InstanceIdentifierContext<?> pathContext,
-                                     final NormalizedNode<?, ?> data,
-                                     final Integer depth,
-                                     final List<Set<QName>> fields) throws IOException {
+    private static void writeNormalizedNode(final XMLStreamWriter xmlWriter,
+            final SchemaPath path, final InstanceIdentifierContext<?> pathContext, final NormalizedNode<?, ?> data,
+            final Integer depth, final List<Set<QName>> fields) throws IOException {
         final RestconfNormalizedNodeWriter nnWriter;
         final SchemaContext schemaCtx = pathContext.getSchemaContext();
 
@@ -141,19 +138,16 @@ public class NormalizedNodeXmlBodyWriter implements MessageBodyWriter<Normalized
         nnWriter.flush();
     }
 
-    private RestconfNormalizedNodeWriter createNormalizedNodeWriter(final XMLStreamWriter xmlWriter,
-                                                                    final SchemaContext schemaContext,
-                                                                    final SchemaPath schemaPath,
-                                                                    final Integer depth,
-                                                                    final List<Set<QName>> fields) {
+    private static RestconfNormalizedNodeWriter createNormalizedNodeWriter(final XMLStreamWriter xmlWriter,
+            final SchemaContext schemaContext, final SchemaPath schemaPath, final Integer depth,
+            final List<Set<QName>> fields) {
         final NormalizedNodeStreamWriter xmlStreamWriter = XMLStreamNormalizedNodeStreamWriter
                 .create(xmlWriter, schemaContext, schemaPath);
         return ParameterAwareNormalizedNodeWriter.forStreamWriter(xmlStreamWriter, depth, fields);
     }
 
-    private void writeElements(final XMLStreamWriter xmlWriter,
-                               final RestconfNormalizedNodeWriter nnWriter,
-                               final ContainerNode data) throws IOException {
+    private static void writeElements(final XMLStreamWriter xmlWriter, final RestconfNormalizedNodeWriter nnWriter,
+            final ContainerNode data) throws IOException {
         try {
             final QName name = data.getNodeType();
             xmlWriter.writeStartElement(XMLConstants.DEFAULT_NS_PREFIX,
index a9ded6bb1ad1e4ba3af0040d424b4917c9c2d662..40bcd23639f36527d3f224ee305f3b3118c68ac3 100644 (file)
@@ -93,7 +93,7 @@ public class XmlToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider i
         }
     }
 
-    private PATCHContext parse(final InstanceIdentifierContext<?> pathContext, final Document doc) {
+    private static PATCHContext parse(final InstanceIdentifierContext<?> pathContext, final Document doc) {
         final List<PATCHEntity> resultCollection = new ArrayList<>();
         final String patchId = doc.getElementsByTagName("patch-id").item(0).getFirstChild().getNodeValue();
         final NodeList editNodes = doc.getElementsByTagName("edit");
@@ -176,7 +176,7 @@ public class XmlToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider i
      * @param operation Name of current operation
      * @return List of value elements
      */
-    private List<Element> readValueNodes(@Nonnull final Element element, @Nonnull final String operation) {
+    private static List<Element> readValueNodes(@Nonnull final Element element, @Nonnull final String operation) {
         final Node valueNode = element.getElementsByTagName("value").item(0);
 
         if (PATCHEditOperation.isPatchOperationWithValue(operation) && valueNode == null) {
@@ -214,9 +214,8 @@ public class XmlToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider i
      * @param revision Module revision
      * @return Non-conditional XPath
      */
-    private String prepareNonCondXpath(@Nonnull final DataSchemaNode schemaNode, @Nonnull final String target,
-                                       @Nonnull final Element value, @Nonnull final String namespace,
-                                       @Nonnull final String revision) {
+    private static String prepareNonCondXpath(@Nonnull final DataSchemaNode schemaNode, @Nonnull final String target,
+            @Nonnull final Element value, @Nonnull final String namespace, @Nonnull final String revision) {
         final Iterator<String> args = Splitter.on("/").split(target.substring(target.indexOf(':') + 1)).iterator();
 
         final StringBuilder nonCondXpath = new StringBuilder();
@@ -248,7 +247,7 @@ public class XmlToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider i
      * @param keys Iterator of list keys names
      * @return Iterator of list keys values
      */
-    private Iterator<String> readKeyValues(@Nonnull final Element value, @Nonnull final Iterator<QName> keys) {
+    private static Iterator<String> readKeyValues(@Nonnull final Element value, @Nonnull final Iterator<QName> keys) {
         final List<String> result = new ArrayList<>();
 
         while (keys.hasNext()) {
@@ -264,7 +263,7 @@ public class XmlToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider i
      * @param keyNames Iterator of list keys names
      * @param keyValues Iterator of list keys values
      */
-    private void appendKeys(@Nonnull final StringBuilder nonCondXpath, @Nonnull final Iterator<QName> keyNames,
+    private static void appendKeys(@Nonnull final StringBuilder nonCondXpath, @Nonnull final Iterator<QName> keyNames,
                             @Nonnull final Iterator<String> keyValues) {
         while (keyNames.hasNext()) {
             nonCondXpath.append("[");
index 33fc7baf1b6cc26b8c2b7342b6286537892b5ba7..4a25fcb35eef45ba8a5684300222255d80da46a1 100644 (file)
@@ -222,7 +222,7 @@ public class RestconfDataServiceImpl implements RestconfDataService {
         return PutDataTransactionUtil.putData(payload, ref, transactionNode, insert, point);
     }
 
-    private void checkQueryParams(final boolean insert_used, final boolean point_used, final String insert) {
+    private static void checkQueryParams(final boolean insert_used, final boolean point_used, final String insert) {
         if (point_used && !insert_used) {
             throw new RestconfDocumentedException("Point parameter can't be used without Insert parameter.");
         }
index b4137ac989eb1df02e2154714606cc5b700ad845..851226629cb21fa41cc4ee2255917d486d846e76 100644 (file)
@@ -40,7 +40,7 @@ final class ResponseFactory extends FutureDataFactory<Void> implements Builder<R
         return this.responseBuilder.build();
     }
 
-    private Status prepareStatus(final NormalizedNode<?, ?> readData) {
+    private static Status prepareStatus(final NormalizedNode<?, ?> readData) {
         return readData != null ? Status.OK : Status.CREATED;
     }
 }
index a15cf3e09f3196032331d43d7dc605a22de26488..8c8138578029e2ff23efe05157226c099fe079ce 100644 (file)
@@ -206,15 +206,13 @@ public class TestJsonBodyReader extends AbstractBodyReaderTest {
                 .toString()));
     }
 
-    private void checkExpectValueNormalizeNodeContext(
-            final DataSchemaNode dataSchemaNode,
+    private static void checkExpectValueNormalizeNodeContext(final DataSchemaNode dataSchemaNode,
             final NormalizedNodeContext nnContext) {
         checkExpectValueNormalizeNodeContext(dataSchemaNode, nnContext, null);
     }
 
-    private void checkExpectValueNormalizeNodeContext(final DataSchemaNode dataSchemaNode,
-                                                      final NormalizedNodeContext nnContext,
-                                                      final YangInstanceIdentifier dataNodeIdent) {
+    private static void checkExpectValueNormalizeNodeContext(final DataSchemaNode dataSchemaNode,
+            final NormalizedNodeContext nnContext, final YangInstanceIdentifier dataNodeIdent) {
         assertEquals(dataSchemaNode, nnContext.getInstanceIdentifierContext().getSchemaNode());
         assertEquals(dataNodeIdent, nnContext.getInstanceIdentifierContext().getInstanceIdentifier());
         assertNotNull(NormalizedNodes.findNode(nnContext.getData(), dataNodeIdent));
index 01cd84bbd297bfa20eed8ffe805c80dd9ef1c98f..6e32f8d276d441ff21e263845756ff70128db6f8 100644 (file)
@@ -197,14 +197,13 @@ public class TestXmlBodyReader extends AbstractBodyReaderTest {
         assertTrue("lf-test".equalsIgnoreCase(leafDataNode.get().getValue().toString()));
     }
 
-    private void checkExpectValueNormalizeNodeContext(final DataSchemaNode dataSchemaNode,
+    private static void checkExpectValueNormalizeNodeContext(final DataSchemaNode dataSchemaNode,
             final NormalizedNodeContext nnContext) {
         checkExpectValueNormalizeNodeContext(dataSchemaNode, nnContext, null);
     }
 
-    private void checkExpectValueNormalizeNodeContext(final DataSchemaNode dataSchemaNode,
-                                                      final NormalizedNodeContext nnContext,
-                                                      final YangInstanceIdentifier dataNodeIdent) {
+    private static void checkExpectValueNormalizeNodeContext(final DataSchemaNode dataSchemaNode,
+            final NormalizedNodeContext nnContext, final YangInstanceIdentifier dataNodeIdent) {
         assertEquals(dataSchemaNode, nnContext.getInstanceIdentifierContext().getSchemaNode());
         assertEquals(dataNodeIdent, nnContext.getInstanceIdentifierContext().getInstanceIdentifier());
         assertNotNull(NormalizedNodes.findNode(nnContext.getData(), dataNodeIdent));
index 1727f4334ea2adb10eb24c1d55874584708ff8c2..3abe9f91cad928ed0f58a67fc49000212a482e90 100644 (file)
@@ -181,7 +181,7 @@ public class CnSnToJsonBasicDataTypesTest extends YangAndXmlAndDataSchemaLoader
         dataLoad("/cnsn-to-json/simple-data-types");
     }
 
-    private void verifyJsonOutput(final String jsonOutput) {
+    private static void verifyJsonOutput(final String jsonOutput) {
         final StringReader strReader = new StringReader(jsonOutput);
         final JsonReader jReader = new JsonReader(strReader);
 
@@ -195,7 +195,7 @@ public class CnSnToJsonBasicDataTypesTest extends YangAndXmlAndDataSchemaLoader
         assertNull("Error during reading Json output: " + exception, exception);
     }
 
-    private void jsonReadCont(final JsonReader jReader) throws IOException {
+    private static void jsonReadCont(final JsonReader jReader) throws IOException {
         jReader.beginObject();
         assertNotNull("cont1 is missing.", jReader.hasNext());
 
@@ -208,7 +208,7 @@ public class CnSnToJsonBasicDataTypesTest extends YangAndXmlAndDataSchemaLoader
         // return dataFromJson;
     }
 
-    private void jsonReadContElements(final JsonReader jReader) throws IOException {
+    private static void jsonReadContElements(final JsonReader jReader) throws IOException {
         jReader.beginObject();
 
         final Map<String, LeafVerifier> expectedMap = Maps.newHashMap();
index 110d78cab982f660a51aab6da88c2f91027acf1c..c77ce658d677e73cce9a5c1bf6c913e9274ed717 100644 (file)
@@ -157,7 +157,8 @@ public class RestPutListDataTest {
         }
     }
 
-    private void verifyException(final RestconfDocumentedException e, final ErrorType errorType, final ErrorTag errorTag) {
+    private static void verifyException(final RestconfDocumentedException e, final ErrorType errorType,
+            final ErrorTag errorTag) {
         final List<RestconfError> errors = e.getErrors();
         assertEquals("getErrors() size", 1, errors.size());
         assertEquals("RestconfError getErrorType()", errorType, errors.get(0).getErrorType());
@@ -212,7 +213,7 @@ public class RestPutListDataTest {
         putListDataTest(uriKey1, uriKey2, payloadKey1, payloadKey2);
     }
 
-    private String toUri(final String uriKey1, final String uriKey2) {
+    private static String toUri(final String uriKey1, final String uriKey2) {
         final StringBuilder uriBuilder = new StringBuilder("/test-module:lst-with-composite-key/");
         uriBuilder.append(uriKey1);
         if (uriKey2 != null) {
index e68c7abaa32ef8c672974c7b7facf7159b49f677..be83cc31767bd92c6157ffbf7b0d9aad29cf8479 100644 (file)
@@ -295,8 +295,7 @@ public class JsonToNnTest extends AbstractBodyReaderTest {
         return normalizedNodeContext;
     }
 
-    private void verifyNormaluizedNodeContext(
-            final NormalizedNodeContext normalizedNodeContext,
+    private static void verifyNormaluizedNodeContext(final NormalizedNodeContext normalizedNodeContext,
             final String topLevelElementName) {
         assertEquals(topLevelElementName, normalizedNodeContext.getData()
                 .getNodeType().getLocalName());
@@ -311,8 +310,7 @@ public class JsonToNnTest extends AbstractBodyReaderTest {
         assertTrue(dataTree.contains("lf1"));
     }
 
-    private void verityMultipleItemsInList(
-            final NormalizedNodeContext normalizedNodeContext) {
+    private static void verityMultipleItemsInList(final NormalizedNodeContext normalizedNodeContext) {
 
         final String dataTree = NormalizedNodes.toStringTree(normalizedNodeContext
                 .getData());
index a2c40fee9b5b3c7a1bef6aeec4714afddf2a92c4..8df3cb8ee756db27788083b0a65c8f6cd5a33999 100644 (file)
@@ -84,7 +84,7 @@ public class NnToJsonLeafrefType extends AbstractBodyReaderTest {
                 json);
     }
 
-    private void validateJson(final String regex, final String value) {
+    private static void validateJson(final String regex, final String value) {
         assertNotNull(value);
         final Pattern ptrn = Pattern.compile(regex, Pattern.DOTALL);
         final Matcher mtch = ptrn.matcher(value);
index 113b50ec19aa9eef5fec44fb9c6644ef9dc01e53..8abd413e5855b8e2e32766a1c273b58b46d7ca8c 100644 (file)
@@ -99,8 +99,7 @@ public class NnInstanceIdentifierToXmlTest extends AbstractBodyReaderTest {
         assertTrue(outputJson.contains("</cont>"));
     }
 
-    private NormalizedNodeContext prepareNNCLeafList()
-            throws URISyntaxException {
+    private static NormalizedNodeContext prepareNNCLeafList() throws URISyntaxException {
         final QName cont = QName.create("instance:identifier:module", "2014-01-17",
                 "cont");
         final QName cont1 = QName.create("instance:identifier:module", "2014-01-17",
@@ -145,7 +144,7 @@ public class NnInstanceIdentifierToXmlTest extends AbstractBodyReaderTest {
         dataCont.withChild(dataCont1.build());
 
         final NormalizedNodeContext testNormalizedNodeContext = new NormalizedNodeContext(
-                new InstanceIdentifierContext<DataSchemaNode>(null, schemaCont,
+                new InstanceIdentifierContext<>(null, schemaCont,
                         null, schemaContext), dataCont.build());
 
         return testNormalizedNodeContext;
@@ -194,7 +193,7 @@ public class NnInstanceIdentifierToXmlTest extends AbstractBodyReaderTest {
         assertTrue(outputJson.contains("</lst11></cont1></cont>"));
     }
 
-    private NormalizedNodeContext preparNNC() {
+    private static NormalizedNodeContext preparNNC() {
         final QName cont = QName.create("instance:identifier:module", "2014-01-17",
                 "cont");
         final QName cont1 = QName.create("instance:identifier:module", "2014-01-17",
@@ -249,14 +248,13 @@ public class NnInstanceIdentifierToXmlTest extends AbstractBodyReaderTest {
         dataCont.withChild(dataCont1.build());
 
         final NormalizedNodeContext testNormalizedNodeContext = new NormalizedNodeContext(
-                new InstanceIdentifierContext<DataSchemaNode>(null, schemaCont,
+                new InstanceIdentifierContext<>(null, schemaCont,
                         null, schemaContext), dataCont.build());
 
         return testNormalizedNodeContext;
     }
 
-    private DataContainerChild<?, ?> buildLeaf(final DataSchemaNode lst11Schema,
-            final QName qname,
+    private static DataContainerChild<?, ?> buildLeaf(final DataSchemaNode lst11Schema, final QName qname,
             final CollectionNodeBuilder<MapEntryNode, MapNode> dataLst11, final Object value) {
 
         final List<DataSchemaNode> instanceLf = ControllerContext
index 1c77de09b86186e0df039f88940a6c93aa6ca962..7664de37a8830886c5400ce03ef195113296221e 100644 (file)
@@ -278,7 +278,7 @@ public class NnToXmlTest extends AbstractBodyReaderTest {
         nnToXml(normalizedNodeContext, "<" + elName + ">true</" + elName + ">");
     }
 
-    private NormalizedNodeContext prepareNNC(final Object object, final String name) {
+    private static NormalizedNodeContext prepareNNC(final Object object, final String name) {
         final QName cont = QName.create("basic:module", "2013-12-2", "cont");
         final QName lf = QName.create("basic:module", "2013-12-2", name);
 
@@ -294,7 +294,7 @@ public class NnToXmlTest extends AbstractBodyReaderTest {
         contData.withChild(Builders.leafBuilder((LeafSchemaNode) schemaLf).withValue(object).build());
 
         final NormalizedNodeContext testNormalizedNodeContext = new NormalizedNodeContext(
-                new InstanceIdentifierContext<DataSchemaNode>(null, contSchema, null, schemaContext), contData.build());
+                new InstanceIdentifierContext<>(null, contSchema, null, schemaContext), contData.build());
 
         return testNormalizedNodeContext;
     }
@@ -304,12 +304,12 @@ public class NnToXmlTest extends AbstractBodyReaderTest {
         final OutputStream output = new ByteArrayOutputStream();
         this.xmlBodyWriter.writeTo(normalizedNodeContext, null, null, null, this.mediaType, null, output);
 
-        for (int i = 0; i < xmlRepresentation.length; i++) {
-            assertTrue(output.toString().contains(xmlRepresentation[i]));
+        for (String element : xmlRepresentation) {
+            assertTrue(output.toString().contains(element));
         }
     }
 
-    private NormalizedNodeContext prepareLeafrefData() {
+    private static NormalizedNodeContext prepareLeafrefData() {
         final QName cont = QName.create("basic:module", "2013-12-2", "cont");
         final QName lfBoolean = QName.create("basic:module", "2013-12-2", "lfBoolean");
         final QName lfLfref = QName.create("basic:module", "2013-12-2", "lfLfref");
@@ -332,12 +332,12 @@ public class NnToXmlTest extends AbstractBodyReaderTest {
         contData.withChild(Builders.leafBuilder((LeafSchemaNode) schemaLf).withValue("true").build());
 
         final NormalizedNodeContext testNormalizedNodeContext = new NormalizedNodeContext(
-                new InstanceIdentifierContext<DataSchemaNode>(null, contSchema, null, schemaContext), contData.build());
+                new InstanceIdentifierContext<>(null, contSchema, null, schemaContext), contData.build());
 
         return testNormalizedNodeContext;
     }
 
-    private NormalizedNodeContext prepareLeafrefNegativeData() {
+    private static NormalizedNodeContext prepareLeafrefNegativeData() {
         final QName cont = QName.create("basic:module", "2013-12-2", "cont");
         final QName lfLfref = QName.create("basic:module", "2013-12-2", "lfLfrefNegative");
 
@@ -355,7 +355,7 @@ public class NnToXmlTest extends AbstractBodyReaderTest {
                 new InstanceIdentifierContext<>(null, contSchema, null, schemaContext), contData.build());
     }
 
-    private NormalizedNodeContext prepareIdrefData(final String prefix, final boolean valueAsQName) {
+    private static NormalizedNodeContext prepareIdrefData(final String prefix, final boolean valueAsQName) {
         final QName cont = QName.create("basic:module", "2013-12-2", "cont");
         final QName cont1 = QName.create("basic:module", "2013-12-2", "cont1");
         final QName lf11 = QName.create("basic:module", "2013-12-2", "lf11");
@@ -386,7 +386,7 @@ public class NnToXmlTest extends AbstractBodyReaderTest {
         contData.withChild(cont1Data.build());
 
         final NormalizedNodeContext testNormalizedNodeContext = new NormalizedNodeContext(
-                new InstanceIdentifierContext<DataSchemaNode>(null, contSchema, null, schemaContext), contData.build());
+                new InstanceIdentifierContext<>(null, contSchema, null, schemaContext), contData.build());
         return testNormalizedNodeContext;
     }
 
index d0f0ee0782078a8d52b472246829113f3ef317f7..dc77462eed40b1d917610157cba20eb39b79bf2a 100644 (file)
@@ -69,8 +69,7 @@ public class NnToXmlWithChoiceTest extends AbstractBodyReaderTest {
         assertTrue(output.toString().contains("<lf2>String data2</lf2>"));
     }
 
-    private NormalizedNodeContext prepareNNC(final String name,
-            final Object value) {
+    private static NormalizedNodeContext prepareNNC(final String name, final Object value) {
 
         final QName contQname = QName.create("module:with:choice", "2013-12-18",
                 "cont");
@@ -100,7 +99,7 @@ public class NnToXmlWithChoiceTest extends AbstractBodyReaderTest {
         dataContainerNodeAttrBuilder.withChild(dataChoice.build());
 
         final NormalizedNodeContext testNormalizedNodeContext = new NormalizedNodeContext(
-                new InstanceIdentifierContext<DataSchemaNode>(null,
+                new InstanceIdentifierContext<>(null,
                         contSchemaNode, null, schemaContext),
                 dataContainerNodeAttrBuilder.build());
 
index cc3d3d1997607f101f12223ee1cbfba2e2176bae..dacd492af89a72fd90aa0dffa162ee47821c2b1a 100644 (file)
@@ -94,7 +94,7 @@ public class NnToXmlWithDataFromSeveralModulesTest extends
         return null;
     }
 
-    private NormalizedNodeContext prepareNormalizedNodeContext() {
+    private static NormalizedNodeContext prepareNormalizedNodeContext() {
         final String rev = "2014-01-17";
 
         final DataSchemaNode schemaContNode = schemaContext;
@@ -115,14 +115,14 @@ public class NnToXmlWithDataFromSeveralModulesTest extends
         dataContSchemaContNode.withChild(modul2.build());
 
         final NormalizedNodeContext testNormalizedNodeContext = new NormalizedNodeContext(
-                new InstanceIdentifierContext<DataSchemaNode>(null,
+                new InstanceIdentifierContext<>(null,
                         schemaContNode, null, schemaContext),
                 dataContSchemaContNode.build());
 
         return testNormalizedNodeContext;
     }
 
-    private DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> buildContBuilderMod1(
+    private static DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> buildContBuilderMod1(
             final String uri, final String rev, final String cont, final String contB, final String lf1,
             final String lf1_value) {
         final QName contQname = QName.create(uri, rev, cont);
index a8442af3b4b9c470ef35060a095b71b988877040..41afee3ace410efed3c6a26d510fa34cfa840abe 100644 (file)
@@ -124,19 +124,20 @@ public class BrokerFacadeTest {
         ControllerContext.getInstance().setSchemas(TestUtils.loadSchemaContext("/full-versions/test-module"));
     }
 
-    private CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> wrapDummyNode(
+    private static CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> wrapDummyNode(
             final NormalizedNode<?, ?> dummyNode) {
         return Futures.immediateCheckedFuture(Optional.<NormalizedNode<?, ?>> of(dummyNode));
     }
 
-    private CheckedFuture<Boolean, ReadFailedException> wrapExistence(final Boolean exists) {
+    private static CheckedFuture<Boolean, ReadFailedException> wrapExistence(final Boolean exists) {
         return Futures.immediateCheckedFuture(exists);
     }
 
     /**
      * Value of this node shouldn't be important for testing purposes
      */
-    private NormalizedNode<?, ?> createDummyNode(final String namespace, final String date, final String localName) {
+    private static NormalizedNode<?, ?> createDummyNode(final String namespace, final String date,
+            final String localName) {
         return Builders.containerBuilder()
                 .withNodeIdentifier(new NodeIdentifier(QName.create(namespace, date, localName))).build();
     }
index 8f26109ad6507c3086d1f11886a25a434c6157fd..6fd84fb687703cc97469551db243eb90b1e18cdd 100644 (file)
@@ -41,7 +41,7 @@ public class CnSnToXmlAndJsonInstanceIdentifierTest extends YangAndXmlAndDataSch
     }
 
 
-    private void validateXmlOutput(final String xml) throws XMLStreamException {
+    private static void validateXmlOutput(final String xml) throws XMLStreamException {
         final XMLInputFactory xmlInFactory = XMLInputFactory.newInstance();
         XMLEventReader eventReader;
 
@@ -82,7 +82,7 @@ public class CnSnToXmlAndJsonInstanceIdentifierTest extends YangAndXmlAndDataSch
 
     }
 
-    private void validateXmlOutputWithLeafList(final String xml) throws XMLStreamException {
+    private static void validateXmlOutputWithLeafList(final String xml) throws XMLStreamException {
         final XMLInputFactory xmlInFactory = XMLInputFactory.newInstance();
         XMLEventReader eventReader;
 
@@ -118,7 +118,7 @@ public class CnSnToXmlAndJsonInstanceIdentifierTest extends YangAndXmlAndDataSch
 
     }
 
-    private YangInstanceIdentifier createInstanceIdentifier() throws URISyntaxException {
+    private static YangInstanceIdentifier createInstanceIdentifier() throws URISyntaxException {
         final List<PathArgument> pathArguments = new ArrayList<>();
         pathArguments.add(new NodeIdentifier(new QName(new URI("instance:identifier:module"), "cont")));
         pathArguments.add(new NodeIdentifier(new QName(new URI("instance:identifier:module"), "cont1")));
@@ -135,7 +135,7 @@ public class CnSnToXmlAndJsonInstanceIdentifierTest extends YangAndXmlAndDataSch
         return YangInstanceIdentifier.create(pathArguments);
     }
 
-    private YangInstanceIdentifier createInstanceIdentifierWithLeafList() throws URISyntaxException {
+    private static YangInstanceIdentifier createInstanceIdentifierWithLeafList() throws URISyntaxException {
         final List<PathArgument> pathArguments = new ArrayList<>();
         pathArguments.add(new NodeIdentifier(new QName(new URI("instance:identifier:module"), "cont")));
         pathArguments.add(new NodeIdentifier(new QName(new URI("instance:identifier:module"), "cont1")));
index 026403c26e0d318123eaac04513d03d9564e35aa..ecec06cd6b6709cc1331184dab80b9f96a08e4b9 100644 (file)
@@ -306,15 +306,13 @@ public class CutDataToCorrectDepthTest extends JerseyTest {
         return new NodeWithValue(QName.create("urn:nested:module", "2014-06-3", localName), value);
     }
 
-
-
-    private UnkeyedListEntryNode nodeDataDepth3Operational() {
+    private static UnkeyedListEntryNode nodeDataDepth3Operational() {
         return unkeyedEntry("depth2-cont1",
                 container("depth3-cont1", container("depth4-cont1"), leaf("depth4-leaf1", "depth4-leaf1-value")),
                 leaf("depth3-leaf1", "depth3-leaf1-value"));
     }
 
-    private ContainerNode nodeDataDepth5() {
+    private static ContainerNode nodeDataDepth5() {
         return container(
                 "depth1-cont",
                 unkeyedList(
@@ -336,7 +334,7 @@ public class CutDataToCorrectDepthTest extends JerseyTest {
                 leaf("depth2-leaf1", "depth2-leaf1-value"));
     }
 
-    private ContainerNode nodeDataDepth4() {
+    private static ContainerNode nodeDataDepth4() {
         return container(
                 "depth1-cont",
                 unkeyedList("depth2-cont1", nodeDataDepth3Operational()),
@@ -350,7 +348,7 @@ public class CutDataToCorrectDepthTest extends JerseyTest {
                         leaf("depth3-leaf2", "depth3-leaf2-value")), leaf("depth2-leaf1", "depth2-leaf1-value"));
     }
 
-    private ContainerNode nodeDataDepth3() {
+    private static ContainerNode nodeDataDepth3() {
         return container(
                 "depth1-cont",
                 unkeyedList("depth2-cont1",
@@ -363,7 +361,7 @@ public class CutDataToCorrectDepthTest extends JerseyTest {
                 leaf("depth2-leaf1", "depth2-leaf1-value"));
     }
 
-    private ContainerNode nodeDataDepth2() {
+    private static ContainerNode nodeDataDepth2() {
         return container(
                 "depth1-cont",
                 unkeyedList("depth2-cont1", unkeyedEntry("depth2-cont1")),
@@ -374,7 +372,7 @@ public class CutDataToCorrectDepthTest extends JerseyTest {
                 leaf("depth2-leaf1", "depth2-leaf1-value"));
     }
 
-    private ContainerNode nodeDataDepth1() {
+    private static ContainerNode nodeDataDepth1() {
         return container("depth1-cont");
     }
 }
index fea433254a89b8e255cda6eb6b5656daeafa54b1..c88c0aca53152592294f0b90709baa736c8ec26f 100644 (file)
@@ -126,7 +126,7 @@ public class InvokeRpcMethodTest {
 
     }
 
-    private NormalizedNodeContext prepareDomPayload() {
+    private static NormalizedNodeContext prepareDomPayload() {
         final SchemaContext schema = controllerContext.getGlobalSchema();
         final Module rpcModule = schema.findModuleByName("invoke-rpc-module", null);
         assertNotNull(rpcModule);
index a7b315199e09307e73266f0f9c2e14ea993b1f55..ec1642e55ff9ef313528a558ddde5300da964103 100644 (file)
@@ -48,8 +48,6 @@ import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
 import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
 import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
 import org.opendaylight.netconf.sal.rest.impl.JsonNormalizedNodeBodyReader;
@@ -134,7 +132,7 @@ public class RestGetOperationTest extends JerseyTest {
         return resourceConfig;
     }
 
-    private void setControllerContext(final SchemaContext schemaContext) {
+    private static void setControllerContext(final SchemaContext schemaContext) {
         final ControllerContext controllerContext = ControllerContext.getInstance();
         controllerContext.setSchemas(schemaContext);
         restconfImpl.setControllerContext(controllerContext);
@@ -218,7 +216,7 @@ public class RestGetOperationTest extends JerseyTest {
         assertEquals(200, get(uri, MediaType.APPLICATION_XML));
     }
 
-    private YangInstanceIdentifier prepareInstanceIdentifierForList() throws Exception {
+    private static YangInstanceIdentifier prepareInstanceIdentifierForList() throws Exception {
         final List<PathArgument> parameters = new ArrayList<>();
 
         final QName qNameCont = newTestModuleQName("cont");
@@ -232,7 +230,7 @@ public class RestGetOperationTest extends JerseyTest {
         return YangInstanceIdentifier.create(parameters);
     }
 
-    private QName newTestModuleQName(final String localPart) throws Exception {
+    private static QName newTestModuleQName(final String localPart) throws Exception {
         final Date revision = new SimpleDateFormat("yyyy-MM-dd").parse("2014-01-09");
         final URI uri = new URI("test:module");
         return QName.create(uri, revision, localPart);
@@ -375,7 +373,7 @@ public class RestGetOperationTest extends JerseyTest {
 
     }
 
-    private void validateOperationsResponseXml(final Document responseDoc, final SchemaContext schemaContext) {
+    private static void validateOperationsResponseXml(final Document responseDoc, final SchemaContext schemaContext) {
 
         final Element operationsElem = responseDoc.getDocumentElement();
         assertEquals(RESTCONF_NS, operationsElem.getNamespaceURI());
@@ -425,7 +423,8 @@ public class RestGetOperationTest extends JerseyTest {
 
     }
 
-    private Matcher validateOperationsResponseJson(final String searchIn, final String rpcName, final String moduleName) {
+    private static Matcher validateOperationsResponseJson(final String searchIn, final String rpcName,
+            final String moduleName) {
         final StringBuilder regex = new StringBuilder();
         regex.append(".*\"" + rpcName + "\"");
         final Pattern ptrn = Pattern.compile(regex.toString(), Pattern.DOTALL);
@@ -433,7 +432,8 @@ public class RestGetOperationTest extends JerseyTest {
 
     }
 
-    private Matcher validateOperationsResponseXml(final String searchIn, final String rpcName, final String namespace) {
+    private static Matcher validateOperationsResponseXml(final String searchIn, final String rpcName,
+            final String namespace) {
         final StringBuilder regex = new StringBuilder();
 
         regex.append("^");
@@ -528,7 +528,7 @@ public class RestGetOperationTest extends JerseyTest {
 
     }
 
-    private void validateModulesResponseXml(final Response response, final SchemaContext schemaContext) {
+    private static void validateModulesResponseXml(final Response response, final SchemaContext schemaContext) {
         assertEquals(200, response.getStatus());
         final Document responseBody = response.readEntity(Document.class);
         final NodeList moduleNodes = responseBody.getDocumentElement().getElementsByTagNameNS(RESTCONF_NS, "module");
@@ -547,7 +547,7 @@ public class RestGetOperationTest extends JerseyTest {
         assertAllModules(foundModules,schemaContext);
     }
 
-    private void assertAllModules(final Set<QName> foundModules, final SchemaContext schemaContext) {
+    private static void assertAllModules(final Set<QName> foundModules, final SchemaContext schemaContext) {
         for(final Module module : schemaContext.getModules()) {
             final QName current = QName.create(module.getQNameModule(),module.getName());
             assertTrue("Module not found in response.",foundModules.contains(current));
@@ -555,7 +555,7 @@ public class RestGetOperationTest extends JerseyTest {
 
     }
 
-    private QName assertedModuleXmlToModuleQName(final org.w3c.dom.Node module) {
+    private static QName assertedModuleXmlToModuleQName(final org.w3c.dom.Node module) {
         assertEquals("module", module.getLocalName());
         assertEquals(RESTCONF_NS, module.getNamespaceURI());
         String revision = null;
@@ -596,7 +596,7 @@ public class RestGetOperationTest extends JerseyTest {
         return QName.create(namespace,revision,name);
     }
 
-    private void validateModulesResponseJson(final Response response) {
+    private static void validateModulesResponseJson(final Response response) {
         assertEquals(200, response.getStatus());
         final String responseBody = response.readEntity(String.class);
 
@@ -608,7 +608,7 @@ public class RestGetOperationTest extends JerseyTest {
                 .find());
     }
 
-    private Matcher prepareJsonRegex(final String module, final String revision, final String namespace,
+    private static Matcher prepareJsonRegex(final String module, final String revision, final String namespace,
             final String searchIn) {
         final StringBuilder regex = new StringBuilder();
         regex.append("^");
@@ -648,7 +648,8 @@ public class RestGetOperationTest extends JerseyTest {
             }
     */
     @SuppressWarnings("rawtypes")
-    private NormalizedNode prepareCnDataForMountPointTest(final boolean wrapToCont) throws URISyntaxException, ParseException {
+    private static NormalizedNode prepareCnDataForMountPointTest(final boolean wrapToCont)
+            throws URISyntaxException, ParseException {
         final String testModuleDate = "2014-01-09";
         final ContainerNode contChild = Builders
                 .containerBuilder()
@@ -668,18 +669,18 @@ public class RestGetOperationTest extends JerseyTest {
     }
 
     @SuppressWarnings("unchecked")
-    private void mockReadOperationalDataMethod() {
+    private static void mockReadOperationalDataMethod() {
         when(brokerFacade.readOperationalData(any(YangInstanceIdentifier.class))).thenReturn(answerFromGet);
     }
 
     @SuppressWarnings("unchecked")
-    private void mockReadConfigurationDataMethod() {
+    private static void mockReadConfigurationDataMethod() {
         when(brokerFacade.readConfigurationData(any(YangInstanceIdentifier.class), Mockito.anyString()))
                 .thenReturn(answerFromGet);
     }
 
     @SuppressWarnings("rawtypes")
-    private NormalizedNode prepareCnDataForSlashesBehindMountPointTest() throws ParseException {
+    private static NormalizedNode prepareCnDataForSlashesBehindMountPointTest() throws ParseException {
         return ImmutableMapEntryNodeBuilder
                 .create()
                 .withNodeIdentifier(
@@ -736,12 +737,7 @@ public class RestGetOperationTest extends JerseyTest {
         final MultivaluedMap<String, String> paramMap = new MultivaluedHashMap<>();
         paramMap.putSingle("depth", "1o");
         final UriInfo mockInfo = mock(UriInfo.class);
-        when(mockInfo.getQueryParameters(false)).thenAnswer(new Answer<MultivaluedMap<String, String>>() {
-            @Override
-            public MultivaluedMap<String, String> answer(final InvocationOnMock invocation) {
-                return paramMap;
-            }
-        });
+        when(mockInfo.getQueryParameters(false)).thenAnswer(invocation -> paramMap);
 
         getDataWithInvalidDepthParameterTest(mockInfo);
 
@@ -753,7 +749,7 @@ public class RestGetOperationTest extends JerseyTest {
     }
 
     @SuppressWarnings({"rawtypes", "unchecked"})
-    private void getDataWithInvalidDepthParameterTest(final UriInfo uriInfo) {
+    private static void getDataWithInvalidDepthParameterTest(final UriInfo uriInfo) {
         try {
             final QName qNameDepth1Cont = QName.create("urn:nested:module", "2014-06-3", "depth1-cont");
             final YangInstanceIdentifier ii = YangInstanceIdentifier.builder().node(qNameDepth1Cont).build();
index cccf61e955584dbce880fc0a4480a2b07e12c3b1..5832d680e6b04dc656e9bd00fb64e0cb706c1c23 100644 (file)
@@ -101,7 +101,7 @@ public class RestPostOperationTest extends JerseyTest {
         return resourceConfig;
     }
 
-    private void setSchemaControllerContext(final SchemaContext schema) {
+    private static void setSchemaControllerContext(final SchemaContext schema) {
         final ControllerContext context = ControllerContext.getInstance();
         context.setSchemas(schema);
         restconfImpl.setControllerContext(context);
index eefdc9ced0b3701a8248fb874fb54dcbf883dd0b..2d6c8e16a8a0aff7de8a4aceaaaf1ec0bfe37565 100644 (file)
@@ -205,7 +205,7 @@ public class RestPutOperationTest extends JerseyTest {
         return target(uri).request(mediaType).put(Entity.entity(data, mediaType)).getStatus();
     }
 
-    private void mockCommitConfigurationDataPutMethod(final boolean noErrors) {
+    private static void mockCommitConfigurationDataPutMethod(final boolean noErrors) {
         final PutResult putResMock = mock(PutResult.class);
         if (noErrors) {
             doReturn(putResMock).when(brokerFacade).commitConfigurationDataPut(
index a443ad6e3792a7e975827e09922dfb61fd5016af..b3e556fb88b67fd8eb6d7809956aa21ab11bc17f 100644 (file)
@@ -669,7 +669,7 @@ public class RestconfDocumentedExceptionMapperTest extends JerseyTest {
                 errorInfoVerifier);
     }
 
-    private JsonArray parseJsonErrorArrayElement(final InputStream stream) throws IOException {
+    private static JsonArray parseJsonErrorArrayElement(final InputStream stream) throws IOException {
         final ByteArrayOutputStream bos = new ByteArrayOutputStream();
         ByteStreams.copy(stream, bos);
 
index 17049890b5499db7c44545d1af93d0f6ddff8596..5a56aaaef5280746d7c2e5128a81f12c7fea352f 100644 (file)
@@ -37,17 +37,17 @@ public class RestconfErrorTest {
 
         private final String text;
 
-        public Contains(String text) {
+        public Contains(final String text) {
             this.text = text;
         }
 
         @Override
-        public void describeTo(Description desc) {
+        public void describeTo(final Description desc) {
             desc.appendText("contains ").appendValue(text);
         }
 
         @Override
-        public boolean matches(Object arg) {
+        public boolean matches(final Object arg) {
             return arg != null && arg.toString().contains(text);
         }
     }
@@ -74,7 +74,7 @@ public class RestconfErrorTest {
 
     @Test
     public void testErrorTagStatusCodes() {
-        Map<String, Integer> lookUpMap = new HashMap<String, Integer>();
+        Map<String, Integer> lookUpMap = new HashMap<>();
 
         lookUpMap.put("in-use", 409);
         lookUpMap.put("invalid-value", 400);
@@ -183,15 +183,17 @@ public class RestconfErrorTest {
                                null, "<severity>error</severity>", new RestconfError( rpcError ) );
     }
 
-    private void validateRestConfError(String expectedMessage, ErrorType expectedErrorType, ErrorTag expectedErrorTag,
-            String expectedErrorAppTag, String errorInfo, RestconfError e) {
+    private static void validateRestConfError(final String expectedMessage, final ErrorType expectedErrorType,
+            final ErrorTag expectedErrorTag, final String expectedErrorAppTag, final String errorInfo,
+            final RestconfError e) {
 
         validateRestConfError(expectedMessage, expectedErrorType, expectedErrorTag, expectedErrorAppTag,
                 equalTo(errorInfo), e);
     }
 
-    private void validateRestConfError(String expectedMessage, ErrorType expectedErrorType, ErrorTag expectedErrorTag,
-            String expectedErrorAppTag, Matcher<String> errorInfoMatcher, RestconfError e) {
+    private static void validateRestConfError(final String expectedMessage, final ErrorType expectedErrorType,
+            final ErrorTag expectedErrorTag, final String expectedErrorAppTag, final Matcher<String> errorInfoMatcher,
+            final RestconfError e) {
 
         assertEquals("getErrorMessage", expectedMessage, e.getErrorMessage());
         assertEquals("getErrorType", expectedErrorType, e.getErrorType());
index 4bb99597f9eb108cd32c96cc15741458f0fc19df..8f6082b4d37160eba4add8a56f4bec5d4b27a613 100644 (file)
@@ -99,7 +99,7 @@ public class RestStream extends JerseyTest {
         return target(uri).request(mediaType).get();
     }
 
-    private String getRpcInput() {
+    private static String getRpcInput() {
         final StringBuilder sb = new StringBuilder();
         sb.append("<input xmlns=\"urn:opendaylight:params:xml:ns:yang:controller:md:sal:remote\">");
         sb.append("<path xmlns:int=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\">/int:interfaces/int:interface[int:name='eth0']</path>");
index a2d794aa14609dcecd348b2e00fe487cfacf6fdf..16d8778e9e2c2edbf051a30f0a76e83855f06baf 100644 (file)
@@ -180,7 +180,7 @@ public class NotificationListenerTest {
         assertTrue(result.contains("lf-augm" + '"' + ":" + '"' + "value"));
     }
 
-    private AugmentationNode mockAugm(final LeafNode leaf) {
+    private static AugmentationNode mockAugm(final LeafNode leaf) {
         final AugmentationNode augm = mock(AugmentationNode.class);
         final AugmentationIdentifier augmId = new AugmentationIdentifier(SingletonSet.of(leaf.getNodeType()));
         when(augm.getIdentifier()).thenReturn(augmId);
@@ -192,7 +192,7 @@ public class NotificationListenerTest {
         return augm;
     }
 
-    private MapEntryNode mockMapEntry(final QName entryQName, final LeafNode leaf) {
+    private static MapEntryNode mockMapEntry(final QName entryQName, final LeafNode leaf) {
         final MapEntryNode entry = mock(MapEntryNode.class);
         final Map<QName, Object> keyValues = new HashMap<>();
         keyValues.put(leaf.getNodeType(), "value");
@@ -207,7 +207,7 @@ public class NotificationListenerTest {
         return entry;
     }
 
-    private MapNode mockList(final QName listQName, final MapEntryNode... entries) {
+    private static MapNode mockList(final QName listQName, final MapEntryNode... entries) {
         final MapNode list = mock(MapNode.class);
         when(list.getIdentifier()).thenReturn(NodeIdentifier.create(listQName));
         when(list.getNodeType()).thenReturn(listQName);
@@ -215,7 +215,7 @@ public class NotificationListenerTest {
         return list;
     }
 
-    private ContainerNode mockCont(final QName contQName, final DataContainerChild<? extends PathArgument, ?> child) {
+    private static ContainerNode mockCont(final QName contQName, final DataContainerChild<? extends PathArgument, ?> child) {
         final ContainerNode cont = mock(ContainerNode.class);
         when(cont.getIdentifier()).thenReturn(NodeIdentifier.create(contQName));
         when(cont.getNodeType()).thenReturn(contQName);
@@ -226,7 +226,7 @@ public class NotificationListenerTest {
         return cont;
     }
 
-    private LeafNode mockLeaf(final QName leafQName) {
+    private static LeafNode mockLeaf(final QName leafQName) {
         final LeafNode child = mock(LeafNode.class);
         when(child.getNodeType()).thenReturn(leafQName);
         when(child.getIdentifier()).thenReturn(NodeIdentifier.create(leafQName));
index 2b691e530163dca9b365bc114401dbf9373992f6..43c4d1ac8eb8de466e808ec41af8ecea791584c7 100644 (file)
@@ -168,7 +168,7 @@ public class JsonBodyReaderTest extends AbstractBodyReaderTest {
         checkExpectValueNormalizeNodeContext(dataSchemaNode, returnValue, dataII);
     }
 
-    private void checkExpectValueNormalizeNodeContext(final DataSchemaNode dataSchemaNode,
+    private static void checkExpectValueNormalizeNodeContext(final DataSchemaNode dataSchemaNode,
             final NormalizedNodeContext nnContext, final YangInstanceIdentifier dataNodeIdent) {
         assertEquals(dataSchemaNode, nnContext.getInstanceIdentifierContext().getSchemaNode());
         assertEquals(dataNodeIdent, nnContext.getInstanceIdentifierContext().getInstanceIdentifier());
index 375886c2cc47ea5c1d5b0d406cabb8ebe01df855..ffd3036361741d8959b94a0f04b2ae3972ec7cb6 100644 (file)
@@ -162,7 +162,7 @@ public class XmlBodyReaderTest extends AbstractBodyReaderTest {
         checkExpectValueNormalizeNodeContext(dataSchemaNode, returnValue, dataII);
     }
 
-    private void checkExpectValueNormalizeNodeContext(final DataSchemaNode dataSchemaNode,
+    private static void checkExpectValueNormalizeNodeContext(final DataSchemaNode dataSchemaNode,
             final NormalizedNodeContext nnContext, final YangInstanceIdentifier dataNodeIdent) {
         assertEquals(dataSchemaNode, nnContext.getInstanceIdentifierContext().getSchemaNode());
         assertEquals(dataNodeIdent, nnContext.getInstanceIdentifierContext().getInstanceIdentifier());
index 01076f26d604663deea01da264d796f9fc6da858..599184bdcd047a7888fd2d17946d2d5530f2f17f 100644 (file)
@@ -178,7 +178,8 @@ public class RestconfMappingNodeUtilTest {
         testData(map, mappedData);
     }
 
-    private Map<QName, Object> prepareMap(final String name, final URI uri, final Date start, final String outputType) {
+    private static Map<QName, Object> prepareMap(final String name, final URI uri, final Date start,
+            final String outputType) {
         final Map<QName, Object> map = new HashMap<>();
         map.put(MonitoringModule.LEAF_NAME_STREAM_QNAME, name);
         map.put(MonitoringModule.LEAF_LOCATION_ACCESS_QNAME, uri.toString());
@@ -189,7 +190,7 @@ public class RestconfMappingNodeUtilTest {
         return map;
     }
 
-    private void testData(final Map<QName, Object> map, final NormalizedNode mappedData) {
+    private static void testData(final Map<QName, Object> map, final NormalizedNode mappedData) {
         for (final DataContainerChild<? extends PathArgument, ?> child : ((MapEntryNode) mappedData).getValue()) {
             if (child instanceof LeafNode) {
                 final LeafNode leaf = ((LeafNode) child);
@@ -205,7 +206,7 @@ public class RestconfMappingNodeUtilTest {
      * @param containerNode
      *            - modules
      */
-    private void verifyLoadedModules(final ContainerNode containerNode) {
+    private static void verifyLoadedModules(final ContainerNode containerNode) {
 
         final Map<String, String> loadedModules = new HashMap<>();
 
@@ -243,8 +244,8 @@ public class RestconfMappingNodeUtilTest {
      * @param expectedModules Modules from <code>SchemaContext</code>
      * @param loadedModules Loaded modules into Restconf module
      */
-    private final void verifyLoadedModules(final Set<Module> expectedModules,
-                                           final Map<String, String> loadedModules) {
+    private static void verifyLoadedModules(final Set<Module> expectedModules,
+            final Map<String, String> loadedModules) {
         assertEquals("Number of loaded modules is not as expected", expectedModules.size(), loadedModules.size());
         for (final Module m : expectedModules) {
             final String name = m.getName();
index c572bb67ce9bfb3fdb1f88053d2e87dbf32285ee..d19c0ab565a46af01919dc437b80c615076e0a5d 100644 (file)
@@ -37,15 +37,15 @@ public class RestconfSchemaUtilTest {
         findSchemaNodeInCollection("bad_key", origSchNode);
     }
 
-    private SchemaNode findSchemaNodeInCollection(final String key, final SchemaNode... origSchNode) {
+    private static SchemaNode findSchemaNodeInCollection(final String key, final SchemaNode... origSchNode) {
         final List<SchemaNode> collection = new ArrayList<>();
-        for (int i = 0; i < origSchNode.length; i++) {
-            collection.add(origSchNode[i]);
+        for (SchemaNode element : origSchNode) {
+            collection.add(element);
         }
         return RestconfSchemaUtil.findSchemaNodeInCollection(collection, key);
     }
 
-    private SchemaNode mockSchemaNode(final String origKey) {
+    private static SchemaNode mockSchemaNode(final String origKey) {
         final SchemaNode mockSchNode = Mockito.mock(SchemaNode.class);
         Mockito.when(mockSchNode.getQName())
                 .thenReturn(QName.create("ns", new SimpleDateFormat("yyyy-MM-dd").format(new Date()), origKey));