OPNFLWPLUG-1032: Neon-MRI: Bump odlparent, yangtools, mdsal
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / statistics / services / OpendaylightFlowStatisticsServiceImpl1Test.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.openflowplugin.impl.statistics.services;
10
11 import java.util.concurrent.Future;
12 import org.junit.Test;
13 import org.mockito.ArgumentCaptor;
14 import org.mockito.Captor;
15 import org.opendaylight.openflowplugin.impl.rpc.AbstractRequestContext;
16 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
17 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInputBuilder;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInputBuilder;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInputBuilder;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutput;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId;
25 import org.opendaylight.yangtools.yang.common.RpcResult;
26
27 /**
28  * Test for {@link OpendaylightFlowStatisticsServiceImpl} - only delegated methods (failing).
29  */
30 public class OpendaylightFlowStatisticsServiceImpl1Test extends AbstractStatsServiceTest {
31
32     @Captor
33     private ArgumentCaptor<MultipartRequestInput> requestInput;
34
35     private OpendaylightFlowStatisticsServiceImpl flowStatisticsService;
36
37     public void setUp() {
38         final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
39         flowStatisticsService =
40                 OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, deviceContext, convertorManager);
41
42         AbstractRequestContext<Object> rqContext = new AbstractRequestContext<Object>(42L) {
43             @Override
44             public void close() {
45                 //NOOP
46             }
47         };
48         //Mockito.when(rqContextStack.<Object>createRequestContext()).thenReturn(rqContext);
49     }
50
51     @Test(expected = IllegalAccessError.class)
52     public void testGetAggregateFlowStatisticsFromFlowTableForAllFlows() throws Exception {
53         GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder input =
54                 new GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder()
55                 .setNode(createNodeRef("unitProt:123"))
56                 .setTableId(new TableId((short) 1));
57
58         flowStatisticsService.getAggregateFlowStatisticsFromFlowTableForAllFlows(input.build());
59     }
60
61     @Test(expected = IllegalAccessError.class)
62     public void testGetAllFlowStatisticsFromFlowTable() throws Exception {
63         GetAllFlowStatisticsFromFlowTableInputBuilder input = new GetAllFlowStatisticsFromFlowTableInputBuilder()
64                 .setNode(createNodeRef("unitProt:123"))
65                 .setTableId(new TableId((short) 1));
66
67         flowStatisticsService.getAllFlowStatisticsFromFlowTable(input.build());
68     }
69
70     @Test(expected = IllegalAccessError.class)
71     public void testGetAllFlowsStatisticsFromAllFlowTables() throws Exception {
72         GetAllFlowsStatisticsFromAllFlowTablesInputBuilder input =
73                 new GetAllFlowsStatisticsFromAllFlowTablesInputBuilder()
74                 .setNode(createNodeRef("unitProt:123"));
75
76         flowStatisticsService.getAllFlowsStatisticsFromAllFlowTables(input.build());
77     }
78
79     @Test(expected = IllegalAccessError.class)
80     public void testGetFlowStatisticsFromFlowTable() throws Exception {
81         GetFlowStatisticsFromFlowTableInputBuilder input = new GetFlowStatisticsFromFlowTableInputBuilder()
82                 .setNode(createNodeRef("unitProt:123"))
83                 .setPriority(5);
84
85         final Future<RpcResult<GetFlowStatisticsFromFlowTableOutput>> resultFuture
86                 = flowStatisticsService.getFlowStatisticsFromFlowTable(input.build());
87     }
88 }