X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatabroker%2FAbstractDOMBrokerWriteTransactionTest.java;h=1680a79444df2c13a8fae2174fccef11ef3134a8;hb=514df5b3d350482fee8ee8f1f5b257c229f7e61a;hp=69265ddc773046e1835cceaf681b5f28bcb0763f;hpb=7ab6f974861e01daa16ff56658eeb1be163cbfec;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/AbstractDOMBrokerWriteTransactionTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/AbstractDOMBrokerWriteTransactionTest.java index 69265ddc77..1680a79444 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/AbstractDOMBrokerWriteTransactionTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/AbstractDOMBrokerWriteTransactionTest.java @@ -7,20 +7,22 @@ package org.opendaylight.controller.cluster.databroker; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; -import com.google.common.util.concurrent.CheckedFuture; +import com.google.common.util.concurrent.FluentFuture; import java.util.Collection; import java.util.Collections; +import java.util.concurrent.ExecutionException; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; -import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; -import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction; +import org.opendaylight.mdsal.common.api.CommitInfo; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; +import org.opendaylight.mdsal.common.api.TransactionCommitFailedException; +import org.opendaylight.mdsal.dom.spi.store.DOMStoreWriteTransaction; public class AbstractDOMBrokerWriteTransactionTest { @@ -54,38 +56,38 @@ public class AbstractDOMBrokerWriteTransactionTest { } @Test - public void readyRuntimeExceptionAndCancel() { + public void readyRuntimeExceptionAndCancel() throws InterruptedException { RuntimeException thrown = new RuntimeException(); doThrow(thrown).when(domStoreWriteTransaction).ready(); AbstractDOMBrokerWriteTransactionTestImpl abstractDOMBrokerWriteTransactionTestImpl = new AbstractDOMBrokerWriteTransactionTestImpl(); - CheckedFuture submitFuture = - abstractDOMBrokerWriteTransactionTestImpl.submit(); + FluentFuture submitFuture = abstractDOMBrokerWriteTransactionTestImpl.commit(); try { - submitFuture.checkedGet(); + submitFuture.get(); Assert.fail("TransactionCommitFailedException expected"); - } catch (TransactionCommitFailedException e) { - assertTrue(e.getCause() == thrown); + } catch (ExecutionException e) { + assertTrue(e.getCause() instanceof TransactionCommitFailedException); + assertTrue(e.getCause().getCause() == thrown); abstractDOMBrokerWriteTransactionTestImpl.cancel(); } } @Test - public void submitRuntimeExceptionAndCancel() { + public void submitRuntimeExceptionAndCancel() throws InterruptedException { RuntimeException thrown = new RuntimeException(); - doThrow(thrown).when(abstractDOMTransactionFactory).submit(any(), any()); + doThrow(thrown).when(abstractDOMTransactionFactory).commit(any(), any()); AbstractDOMBrokerWriteTransactionTestImpl abstractDOMBrokerWriteTransactionTestImpl = new AbstractDOMBrokerWriteTransactionTestImpl(); - CheckedFuture submitFuture = - abstractDOMBrokerWriteTransactionTestImpl.submit(); + FluentFuture submitFuture = abstractDOMBrokerWriteTransactionTestImpl.commit(); try { - submitFuture.checkedGet(); + submitFuture.get(); Assert.fail("TransactionCommitFailedException expected"); - } catch (TransactionCommitFailedException e) { - assertTrue(e.getCause() == thrown); + } catch (ExecutionException e) { + assertTrue(e.getCause() instanceof TransactionCommitFailedException); + assertTrue(e.getCause().getCause() == thrown); abstractDOMBrokerWriteTransactionTestImpl.cancel(); } } -} \ No newline at end of file +}