X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsamples%2Ftoaster-provider%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsample%2Ftoaster%2Fprovider%2FOpenDaylightToasterTest.java;h=86d2e6d19c249dad322f0f8a94d5ecbd2b546264;hb=HEAD;hp=b703a2b20bb3a19ec35948d7051f487ee6a62788;hpb=62468daa9029368b321b6e1e18fa9cfa0ae994b4;p=controller.git diff --git a/opendaylight/md-sal/samples/toaster-provider/src/test/java/org/opendaylight/controller/sample/toaster/provider/OpenDaylightToasterTest.java b/opendaylight/md-sal/samples/toaster-provider/src/test/java/org/opendaylight/controller/sample/toaster/provider/OpenDaylightToasterTest.java index b703a2b20b..86d2e6d19c 100644 --- a/opendaylight/md-sal/samples/toaster-provider/src/test/java/org/opendaylight/controller/sample/toaster/provider/OpenDaylightToasterTest.java +++ b/opendaylight/md-sal/samples/toaster-provider/src/test/java/org/opendaylight/controller/sample/toaster/provider/OpenDaylightToasterTest.java @@ -22,6 +22,7 @@ import org.junit.Test; import org.opendaylight.mdsal.binding.api.DataBroker; import org.opendaylight.mdsal.binding.api.NotificationPublishService; import org.opendaylight.mdsal.binding.api.ReadTransaction; +import org.opendaylight.mdsal.binding.api.RpcProviderService; import org.opendaylight.mdsal.binding.dom.adapter.test.AbstractConcurrentDataBrokerTest; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.DisplayString; @@ -41,13 +42,8 @@ public class OpenDaylightToasterTest extends AbstractConcurrentDataBrokerTest { @Before public void setupToaster() { - toaster = new OpendaylightToaster(); - toaster.setDataBroker(getDataBroker()); - toaster.init(); - - // We'll mock the NotificationProviderService. - NotificationPublishService mockNotification = mock(NotificationPublishService.class); - toaster.setNotificationProvider(mockNotification); + toaster = new OpendaylightToaster(getDataBroker(), mock(NotificationPublishService.class), + mock(RpcProviderService.class)); } @Test @@ -61,7 +57,7 @@ public class OpenDaylightToasterTest extends AbstractConcurrentDataBrokerTest { assertNotNull(optional); assertTrue("Operational toaster not present", optional.isPresent()); - Toaster toasterData = optional.get(); + Toaster toasterData = optional.orElseThrow(); assertEquals(Toaster.ToasterStatus.Up, toasterData.getToasterStatus()); assertEquals(new DisplayString("Opendaylight"), toasterData.getToasterManufacturer()); @@ -82,7 +78,7 @@ public class OpenDaylightToasterTest extends AbstractConcurrentDataBrokerTest { // NOTE: In a real test we would want to override the Thread.sleep() to // prevent our junit test // for sleeping for a second... - Future> makeToast = toaster.makeToast(toastInput); + Future> makeToast = toaster.invoke(toastInput); RpcResult rpcResult = makeToast.get();