Initial opendaylight infrastructure commit!!
[controller.git] / opendaylight / sal / api / src / test / java / org / opendaylight / controller / sal / core / PropertyTest.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  * and is available at http://www.eclipse.org/legal/epl-v10.html
8  */
9
10 /**
11  * @file   PropertyTest.java
12  *
13  * @brief  Test for properties
14  *
15  */
16
17 package org.opendaylight.controller.sal.core;
18
19 import org.junit.Assert;
20 import org.junit.Test;
21 import org.opendaylight.controller.sal.core.Bandwidth;
22 import org.opendaylight.controller.sal.core.Latency;
23 import org.opendaylight.controller.sal.core.Property;
24
25 public class PropertyTest {
26     @Test
27     public void testBandWidthStr() {
28         Property b;
29
30         b = new Bandwidth(Bandwidth.BWUNK);
31         System.out.println("b = " + b);
32         Assert.assertTrue(b.toString().equals("BandWidth[UnKnown]"));
33
34         b = new Bandwidth(100L);
35         System.out.println("b = " + b);
36         Assert.assertTrue(b.toString().equals("BandWidth[100bps]"));
37
38         b = new Bandwidth(Bandwidth.BW10Mbps);
39         System.out.println("b = " + b);
40         Assert.assertTrue(b.toString().equals("BandWidth[10Mbps]"));
41
42         b = new Bandwidth(Bandwidth.BW100Mbps);
43         System.out.println("b = " + b);
44         Assert.assertTrue(b.toString().equals("BandWidth[100Mbps]"));
45
46         b = new Bandwidth(Bandwidth.BW100Mbps);
47         System.out.println("b = " + b);
48         Assert.assertTrue(b.toString().equals("BandWidth[100Mbps]"));
49
50         b = new Bandwidth(Bandwidth.BW1Gbps);
51         System.out.println("b = " + b);
52         Assert.assertTrue(b.toString().equals("BandWidth[1Gbps]"));
53
54         b = new Bandwidth(Bandwidth.BW10Gbps);
55         System.out.println("b = " + b);
56         Assert.assertTrue(b.toString().equals("BandWidth[10Gbps]"));
57
58         b = new Bandwidth(Bandwidth.BW40Gbps);
59         System.out.println("b = " + b);
60         Assert.assertTrue(b.toString().equals("BandWidth[40Gbps]"));
61
62         b = new Bandwidth(Bandwidth.BW100Gbps);
63         System.out.println("b = " + b);
64         Assert.assertTrue(b.toString().equals("BandWidth[100Gbps]"));
65
66         b = new Bandwidth(Bandwidth.BW100Gbps + 15L);
67         System.out.println("b = " + b);
68         Assert.assertTrue(b.toString().equals("BandWidth[100Gbps]"));
69
70         b = new Bandwidth(Bandwidth.BW1Tbps);
71         System.out.println("b = " + b);
72         Assert.assertTrue(b.toString().equals("BandWidth[1Tbps]"));
73     }
74
75     @Test
76     public void testLatencyStr() {
77         Property l;
78
79         l = new Latency(Latency.LATENCYUNK);
80         System.out.println("l = " + l);
81         Assert.assertTrue(l.toString().equals("Latency[UnKnown]"));
82
83         l = new Latency(Latency.LATENCY1ns);
84         System.out.println("l = " + l);
85         Assert.assertTrue(l.toString().equals("Latency[1nsec]"));
86
87         l = new Latency(Latency.LATENCY1us);
88         System.out.println("l = " + l);
89         Assert.assertTrue(l.toString().equals("Latency[1usec]"));
90
91         l = new Latency(Latency.LATENCY1ms);
92         System.out.println("l = " + l);
93         Assert.assertTrue(l.toString().equals("Latency[1msec]"));
94     }
95 }