import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.Collections;
import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
@Before
public void setUp() throws Exception {
- when(mockedDeviceContext.reservedXidForDeviceMessage()).thenReturn(TEST_XID);
+ when(mockedDeviceContext.reserveXidForDeviceMessage()).thenReturn(TEST_XID);
+ when(mockConductor.getDeviceContext(Mockito.<NodeId>any())).thenReturn(mockedDeviceContext);
initStatisticsContext();
}
private void initStatisticsContext() {
- statisticsContext = new StatisticsContextImpl(mockedDeviceContext, false);
+ statisticsContext = new StatisticsContextImpl(mockedDeviceContext.getDeviceState().getNodeId(), false, mockConductor);
statisticsContext.setStatisticsGatheringService(mockedStatisticsGatheringService);
statisticsContext.setStatisticsGatheringOnTheFlyService(mockedStatisticsOnFlyGatheringService);
}
*/
@Test
public void testClose() throws Exception {
- final StatisticsContextImpl statisticsContext = new StatisticsContextImpl(mockedDeviceContext, false);
+ final StatisticsContextImpl statisticsContext = new StatisticsContextImpl(mockedDeviceContext.getDeviceState().getNodeId(), false, mockConductor);
final RequestContext<Object> requestContext = statisticsContext.createRequestContext();
statisticsContext.close();
try {
@Test
public void testGatherDynamicData_all() throws Exception {
Mockito.reset(mockedDeviceState);
- when(mockedDeviceState.isTableStatisticsAvailable()).thenReturn(true);
- when(mockedDeviceState.isFlowStatisticsAvailable()).thenReturn(true);
- when(mockedDeviceState.isGroupAvailable()).thenReturn(true);
- when(mockedDeviceState.isMetersAvailable()).thenReturn(true);
- when(mockedDeviceState.isPortStatisticsAvailable()).thenReturn(true);
- when(mockedDeviceState.isQueueStatisticsAvailable()).thenReturn(true);
+ when(mockedDeviceState.getFeatures()).thenReturn(mock(GetFeaturesOutput.class));
+ when(mockedDeviceState.isTableStatisticsAvailable()).thenReturn(Boolean.TRUE);
+ when(mockedDeviceState.isFlowStatisticsAvailable()).thenReturn(Boolean.TRUE);
+ when(mockedDeviceState.isGroupAvailable()).thenReturn(Boolean.TRUE);
+ when(mockedDeviceState.isMetersAvailable()).thenReturn(Boolean.TRUE);
+ when(mockedDeviceState.isPortStatisticsAvailable()).thenReturn(Boolean.TRUE);
+ when(mockedDeviceState.isQueueStatisticsAvailable()).thenReturn(Boolean.TRUE);
when(mockedDeviceState.getNodeInstanceIdentifier()).thenReturn(dummyNodeII);
initStatisticsContext();