1 package org.opendaylight.nemo.renderer.openflow;
3 import junit.framework.TestCase;
4 import org.junit.Assert;
5 import org.junit.Before;
7 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
8 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
9 import com.google.common.util.concurrent.FutureCallback;
10 import com.google.common.util.concurrent.Futures;
11 import com.google.common.util.concurrent.CheckedFuture;
12 import com.google.common.util.concurrent.ListenableFuture;
13 import static org.junit.Assert.*;
14 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
15 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
16 import org.opendaylight.nemo.renderer.openflow.OpenflowRenderer;
17 import org.opendaylight.nemo.renderer.openflow.physicalnetwork.PhyConfigLoader;
18 import org.opendaylight.nemo.renderer.openflow.physicalnetwork.PhysicalNetworkAdapter;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
22 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
23 import static org.mockito.Mockito.*;
25 * Created by zhangmeng on 2015/11/24.
27 public class OpenflowRendererTest extends TestCase {
28 private OpenflowRenderer openflowRenderer;
29 private DataBroker dataBroker;
30 private NotificationProviderService notificationProviderService;
31 private PacketProcessingService packetProcessingService;
34 public void setUp() throws Exception {
35 ReadOnlyTransaction readOnlyTransaction = mock(ReadOnlyTransaction.class);
36 CheckedFuture checkedFuture = mock(CheckedFuture.class);
38 dataBroker = mock(DataBroker.class);
39 notificationProviderService = mock(NotificationProviderService.class);
40 packetProcessingService = mock(PacketProcessingService.class);
41 when(dataBroker.newReadOnlyTransaction()).thenReturn(readOnlyTransaction);
42 when(readOnlyTransaction.read(any(LogicalDatastoreType.class),any(InstanceIdentifier.class))).thenReturn(checkedFuture);
44 openflowRenderer = new OpenflowRenderer(dataBroker,notificationProviderService,packetProcessingService);
48 public void testClose() throws Exception {
49 openflowRenderer.close();
50 Assert.assertNotNull(openflowRenderer);