Move adsal into its own subdirectory.
[controller.git] / opendaylight / adsal / 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
22 public class PropertyTest {
23     @Test
24     public void testBandWidthStr() {
25         Property b;
26
27         b = new Bandwidth(Bandwidth.BWUNK);
28         System.out.println("b = " + b);
29         Assert.assertTrue(b.toString().equals("BandWidth[UnKnown]"));
30
31         b = new Bandwidth(100L);
32         System.out.println("b = " + b);
33         Assert.assertTrue(b.toString().equals("BandWidth[100bps]"));
34
35         b = new Bandwidth(Bandwidth.BW10Mbps);
36         System.out.println("b = " + b);
37         Assert.assertTrue(b.toString().equals("BandWidth[10Mbps]"));
38
39         b = new Bandwidth(Bandwidth.BW100Mbps);
40         System.out.println("b = " + b);
41         Assert.assertTrue(b.toString().equals("BandWidth[100Mbps]"));
42
43         b = new Bandwidth(Bandwidth.BW100Mbps);
44         System.out.println("b = " + b);
45         Assert.assertTrue(b.toString().equals("BandWidth[100Mbps]"));
46
47         b = new Bandwidth(Bandwidth.BW1Gbps);
48         System.out.println("b = " + b);
49         Assert.assertTrue(b.toString().equals("BandWidth[1Gbps]"));
50
51         b = new Bandwidth(Bandwidth.BW10Gbps);
52         System.out.println("b = " + b);
53         Assert.assertTrue(b.toString().equals("BandWidth[10Gbps]"));
54
55         b = new Bandwidth(Bandwidth.BW40Gbps);
56         System.out.println("b = " + b);
57         Assert.assertTrue(b.toString().equals("BandWidth[40Gbps]"));
58
59         b = new Bandwidth(Bandwidth.BW100Gbps);
60         System.out.println("b = " + b);
61         Assert.assertTrue(b.toString().equals("BandWidth[100Gbps]"));
62
63         b = new Bandwidth(Bandwidth.BW100Gbps + 15L);
64         System.out.println("b = " + b);
65         Assert.assertTrue(b.toString().equals("BandWidth[100Gbps]"));
66
67         b = new Bandwidth(Bandwidth.BW1Tbps);
68         System.out.println("b = " + b);
69         Assert.assertTrue(b.toString().equals("BandWidth[1Tbps]"));
70     }
71
72     @Test
73     public void testLatencyStr() {
74         Property l;
75
76         l = new Latency(Latency.LATENCYUNK);
77         System.out.println("l = " + l);
78         Assert.assertTrue(l.toString().equals("Latency[UnKnown]"));
79
80         l = new Latency(Latency.LATENCY1ns);
81         System.out.println("l = " + l);
82         Assert.assertTrue(l.toString().equals("Latency[1nsec]"));
83
84         l = new Latency(Latency.LATENCY1us);
85         System.out.println("l = " + l);
86         Assert.assertTrue(l.toString().equals("Latency[1usec]"));
87
88         l = new Latency(Latency.LATENCY1ms);
89         System.out.println("l = " + l);
90         Assert.assertTrue(l.toString().equals("Latency[1msec]"));
91     }
92 }