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%2Factors%2Fdds%2FSingleClientHistoryTest.java;h=1d68e979dbd5b25bc681de38555e34c1e194e0ef;hb=refs%2Fchanges%2F61%2F96761%2F2;hp=72e434ad519fd9c4a21c4b108324527fff528679;hpb=ca5129914385dd43bf4c2af2757374878e785979;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/SingleClientHistoryTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/SingleClientHistoryTest.java index 72e434ad51..1d68e979db 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/SingleClientHistoryTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/SingleClientHistoryTest.java @@ -7,23 +7,28 @@ */ package org.opendaylight.controller.cluster.databroker.actors.dds; -import static org.opendaylight.controller.cluster.databroker.actors.dds.TestUtils.CLIENT_ID; +import static org.hamcrest.CoreMatchers.startsWith; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; +import static org.junit.Assert.assertTrue; import akka.actor.ActorSystem; -import akka.testkit.JavaTestKit; import akka.testkit.TestProbe; +import akka.testkit.javadsl.TestKit; import org.junit.After; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.MockitoAnnotations; +import org.mockito.junit.MockitoJUnitRunner; import org.opendaylight.controller.cluster.access.client.AbstractClientConnection; import org.opendaylight.controller.cluster.access.client.AccessClientUtil; import org.opendaylight.controller.cluster.access.client.ClientActorContext; import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier; -import org.opendaylight.controller.cluster.datastore.utils.ActorContext; +import org.opendaylight.controller.cluster.datastore.utils.ActorUtils; +@RunWith(MockitoJUnitRunner.StrictStubs.class) public class SingleClientHistoryTest extends AbstractClientHistoryTest { private ActorSystem system; private AbstractDataStoreClientBehavior behavior; @@ -34,24 +39,22 @@ public class SingleClientHistoryTest extends AbstractClientHistoryTest clientConnection = behavior.getConnection(0L); final ProxyHistory historyProxy = object().createHistoryProxy(HISTORY_ID, clientConnection); - Assert.assertEquals(object().getIdentifier(), historyProxy.getIdentifier()); + assertEquals(object().getIdentifier(), historyProxy.getIdentifier()); } @Override @Test - public void testDoCreateSnapshot() throws Exception { + public void testDoCreateSnapshot() { final ClientSnapshot clientSnapshot = object().doCreateSnapshot(); - Assert.assertEquals(new TransactionIdentifier(object().getIdentifier(), object().nextTx()).getHistoryId(), + assertEquals(new TransactionIdentifier(object().getIdentifier(), object().nextTx()).getHistoryId(), clientSnapshot.getIdentifier().getHistoryId()); } @Override @Test - public void testOnTransactionComplete() throws Exception { + public void testOnTransactionComplete() { final ClientTransaction transaction = object().createTransaction(); // make transaction ready object().onTransactionReady(transaction, cohort); @@ -97,29 +100,31 @@ public class SingleClientHistoryTest extends AbstractClientHistoryTest object().onTransactionReady(transaction, cohort)); + assertThat(ise.getMessage(), startsWith("Duplicate cohort ")); } } \ No newline at end of file