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;
@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
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());
// NOTE: In a real test we would want to override the Thread.sleep() to
// prevent our junit test
// for sleeping for a second...
- Future<RpcResult<MakeToastOutput>> makeToast = toaster.makeToast(toastInput);
+ Future<RpcResult<MakeToastOutput>> makeToast = toaster.invoke(toastInput);
RpcResult<MakeToastOutput> rpcResult = makeToast.get();