Fix/Ignore raw type warnings after Phosphorus bump
[transportpce.git] / renderer / src / test / java / org / opendaylight / transportpce / renderer / utils / TransactionUtils.java
index 23349e3cb468310db9a6041a34d33aabe7d59c93..9ba7c51f9cfabca3745e99ff2f028815c7826c4d 100644 (file)
@@ -11,7 +11,7 @@ package org.opendaylight.transportpce.renderer.utils;
 import java.util.Optional;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.transportpce.common.Timeouts;
 import org.opendaylight.transportpce.common.device.DeviceTransaction;
 import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
@@ -24,6 +24,11 @@ public final class TransactionUtils {
 
     }
 
+    @SuppressWarnings({ "unchecked", "deprecation", "rawtypes" })
+    // deviceTx.put needs the "true" boolean parameter at the end in order to not compromise the Junit test suite
+    // FIXME check if the InstanceIdentifier raw type can be avoided
+    // Raw types use are discouraged since they lack type safety.
+    // Resulting Problems are observed at run time and not at compile time
     public static boolean writeTransaction(DeviceTransactionManager deviceTransactionManager,
                                     String nodeId,
                                     LogicalDatastoreType logicalDatastoreType,
@@ -36,7 +41,7 @@ public final class TransactionUtils {
             return false;
         }
         DeviceTransaction deviceTx = deviceTxFuture.get().get();
-        deviceTx.put(logicalDatastoreType, instanceIdentifier, object, true);
+        deviceTx.merge(logicalDatastoreType, instanceIdentifier, object);
         deviceTx.commit(Timeouts.DEVICE_WRITE_TIMEOUT, Timeouts.DEVICE_WRITE_TIMEOUT_UNIT).get();
         return true;
     }
@@ -52,7 +57,7 @@ public final class TransactionUtils {
             return null;
         }
         DeviceTransaction deviceTx = deviceTxFuture.get().get();
-        com.google.common.base.Optional<? extends DataObject> readOpt
+        Optional<? extends DataObject> readOpt
                 = deviceTx.read(logicalDatastoreType, instanceIdentifier).get();
         if (!readOpt.isPresent()) {
             return null;