2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.openflowplugin.impl.statistics.services;
11 import java.util.concurrent.Future;
12 import org.junit.Test;
13 import org.mockito.ArgumentCaptor;
14 import org.mockito.Captor;
15 import org.mockito.Mockito;
16 import org.opendaylight.openflowplugin.impl.rpc.AbstractRequestContext;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInputBuilder;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInputBuilder;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInputBuilder;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutput;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId;
24 import org.opendaylight.yangtools.yang.common.RpcResult;
27 * Test for {@link OpendaylightFlowStatisticsServiceImpl} - only delegated methods (failing)
29 public class OpendaylightFlowStatisticsServiceImpl1Test extends AbstractStatsServiceTest {
32 private ArgumentCaptor<MultipartRequestInput> requestInput;
34 private AbstractRequestContext<Object> rqContext;
36 private OpendaylightFlowStatisticsServiceImpl flowStatisticsService;
39 flowStatisticsService = new OpendaylightFlowStatisticsServiceImpl(rqContextStack, deviceContext);
41 rqContext = new AbstractRequestContext<Object>(42L) {
47 Mockito.when(rqContextStack.<Object>createRequestContext()).thenReturn(rqContext);
50 @Test(expected = IllegalAccessError.class)
51 public void testGetAggregateFlowStatisticsFromFlowTableForAllFlows() throws Exception {
52 GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder input = new GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder()
53 .setNode(createNodeRef("unitProt:123"))
54 .setTableId(new TableId((short) 1));
56 flowStatisticsService.getAggregateFlowStatisticsFromFlowTableForAllFlows(input.build());
59 @Test(expected = IllegalAccessError.class)
60 public void testGetAllFlowStatisticsFromFlowTable() throws Exception {
61 GetAllFlowStatisticsFromFlowTableInputBuilder input = new GetAllFlowStatisticsFromFlowTableInputBuilder()
62 .setNode(createNodeRef("unitProt:123"))
63 .setTableId(new TableId((short) 1));
65 flowStatisticsService.getAllFlowStatisticsFromFlowTable(input.build());
68 @Test(expected = IllegalAccessError.class)
69 public void testGetAllFlowsStatisticsFromAllFlowTables() throws Exception {
70 GetAllFlowsStatisticsFromAllFlowTablesInputBuilder input = new GetAllFlowsStatisticsFromAllFlowTablesInputBuilder()
71 .setNode(createNodeRef("unitProt:123"));
73 flowStatisticsService.getAllFlowsStatisticsFromAllFlowTables(input.build());
76 @Test(expected = IllegalAccessError.class)
77 public void testGetFlowStatisticsFromFlowTable() throws Exception {
78 GetFlowStatisticsFromFlowTableInputBuilder input = new GetFlowStatisticsFromFlowTableInputBuilder()
79 .setNode(createNodeRef("unitProt:123"))
82 final Future<RpcResult<GetFlowStatisticsFromFlowTableOutput>> resultFuture
83 = flowStatisticsService.getFlowStatisticsFromFlowTable(input.build());