X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflowplugin-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fimpl%2Fdevice%2FTransactionChainManagerTest.java;h=b7b50facb87d57f6f6d52283d23ee0f7fe3fad32;hb=refs%2Fchanges%2F14%2F57814%2F38;hp=cd3a89bc3836509af4441a2a8788753d7c51576b;hpb=52f1d136aff5568e9d9607e6a61e4ec128c962aa;p=openflowplugin.git diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/TransactionChainManagerTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/TransactionChainManagerTest.java index cd3a89bc38..b7b50facb8 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/TransactionChainManagerTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/TransactionChainManagerTest.java @@ -14,7 +14,6 @@ import com.google.common.util.concurrent.Futures; import io.netty.util.HashedWheelTimer; import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Matchers; @@ -32,8 +31,9 @@ import org.opendaylight.controller.md.sal.common.api.data.TransactionChain; import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener; import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext; +import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo; import org.opendaylight.openflowplugin.api.openflow.device.DeviceState; -import org.opendaylight.openflowplugin.api.openflow.lifecycle.LifecycleConductor; +import org.opendaylight.openflowplugin.api.openflow.lifecycle.LifecycleService; import org.opendaylight.openflowplugin.impl.util.DeviceStateUtil; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; @@ -67,7 +67,9 @@ public class TransactionChainManagerTest { @Mock DeviceState deviceState; @Mock - LifecycleConductor conductor; + DeviceInfo deviceInfo; + @Mock + LifecycleService lifecycleService; @Mock private KeyedInstanceIdentifier nodeKeyIdent; @@ -86,9 +88,9 @@ public class TransactionChainManagerTest { .thenReturn(txChain); nodeId = new NodeId("h2g2:42"); nodeKeyIdent = DeviceStateUtil.createNodeInstanceIdentifier(nodeId); - Mockito.when(deviceState.getNodeInstanceIdentifier()).thenReturn(nodeKeyIdent); - Mockito.when(deviceState.getNodeId()).thenReturn(nodeId); - txChainManager = new TransactionChainManager(dataBroker, deviceState, conductor); + Mockito.when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeKeyIdent); + Mockito.when(deviceInfo.getNodeId()).thenReturn(nodeId); + txChainManager = new TransactionChainManager(dataBroker, deviceInfo); Mockito.when(txChain.newWriteOnlyTransaction()).thenReturn(writeTx); path = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(nodeId)); @@ -218,7 +220,8 @@ public class TransactionChainManagerTest { Mockito.verify(txChain).newWriteOnlyTransaction(); Mockito.verify(writeTx).put(LogicalDatastoreType.CONFIGURATION, path, data, false); - Mockito.verify(writeTx).submit(); + Mockito.verify(writeTx, Mockito.never()).submit(); + Mockito.verify(writeTx).cancel(); Mockito.verify(txChain).close(); } @@ -226,7 +229,7 @@ public class TransactionChainManagerTest { public void testShuttingDown() throws Exception{ final Node data = new NodeBuilder().setId(nodeId).build(); txChainManager.writeToTransaction(LogicalDatastoreType.CONFIGURATION, path, data, false); - + txChainManager.enableSubmit(); txChainManager.shuttingDown(); Mockito.verify(txChain).newWriteOnlyTransaction();