Remove redundant exception declarations
[openflowplugin.git] / applications / bulk-o-matic / src / test / java / org / opendaylight / openflowplugin / applications / bulk / o / matic / BulkOMaticUtilsTest.java
1 /*
2  * Copyright (c) 2016 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.applications.bulk.o.matic;
10
11 import org.junit.Assert;
12 import org.junit.Test;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
17
18 /**
19  * Test for {@link BulkOMaticUtils}.
20  */
21 public class BulkOMaticUtilsTest {
22
23     private static final Logger LOG = LoggerFactory.getLogger(BulkOMaticUtilsTest.class);
24     private static final String FLOW_ID = "1";
25
26     @Test
27     public void testIpIntToStr() {
28         Assert.assertEquals("255.255.255.255/32", BulkOMaticUtils.ipIntToStr(0xffffffff));
29         Assert.assertEquals("255.255.255.255/32", BulkOMaticUtils.ipIntToStr(-1));
30         Assert.assertEquals("0.0.0.0/32", BulkOMaticUtils.ipIntToStr(0));
31         Assert.assertEquals("1.2.3.4/32", BulkOMaticUtils.ipIntToStr(0x01020304));
32     }
33
34     @Test
35     public void testGetMatch() {
36         final Match match = BulkOMaticUtils.getMatch(0xffffffff);
37         Assert.assertNotNull(match);
38     }
39
40     @Test
41     public void testBuildFlow() {
42         final Match match = BulkOMaticUtils.getMatch(0xffffffff);
43         final Flow flow = BulkOMaticUtils.buildFlow((short)1, FLOW_ID, match);
44         Assert.assertEquals(FLOW_ID,flow.getId().getValue());
45         Assert.assertEquals((short) 1 ,flow.getTableId().shortValue());
46     }
47
48     @Test
49     public void testGetFlowInstanceIdentifier() {
50         Assert.assertNotNull(BulkOMaticUtils.getFlowInstanceIdentifier((short)1, "1", "1"));
51     }
52
53     @Test
54     public void testGetFlowCapableNodeId() {
55         Assert.assertNotNull(BulkOMaticUtils.getFlowCapableNodeId("1"));
56     }
57
58     @Test
59     public void testGetTableId() {
60         Assert.assertNotNull(BulkOMaticUtils.getTableId((short)1, "1"));
61     }
62
63     @Test
64     public void testGetFlowId() {
65         Assert.assertNotNull(BulkOMaticUtils.getFlowId(BulkOMaticUtils.getTableId((short)1, "1"), "1"));
66     }
67
68 }