3 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
11 * @file PropertyTest.java
13 * @brief Test for properties
17 package org.opendaylight.controller.sal.core;
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;
25 public class PropertyTest {
27 public void testBandWidthStr() {
30 b = new Bandwidth(Bandwidth.BWUNK);
31 System.out.println("b = " + b);
32 Assert.assertTrue(b.toString().equals("BandWidth[UnKnown]"));
34 b = new Bandwidth(100L);
35 System.out.println("b = " + b);
36 Assert.assertTrue(b.toString().equals("BandWidth[100bps]"));
38 b = new Bandwidth(Bandwidth.BW10Mbps);
39 System.out.println("b = " + b);
40 Assert.assertTrue(b.toString().equals("BandWidth[10Mbps]"));
42 b = new Bandwidth(Bandwidth.BW100Mbps);
43 System.out.println("b = " + b);
44 Assert.assertTrue(b.toString().equals("BandWidth[100Mbps]"));
46 b = new Bandwidth(Bandwidth.BW100Mbps);
47 System.out.println("b = " + b);
48 Assert.assertTrue(b.toString().equals("BandWidth[100Mbps]"));
50 b = new Bandwidth(Bandwidth.BW1Gbps);
51 System.out.println("b = " + b);
52 Assert.assertTrue(b.toString().equals("BandWidth[1Gbps]"));
54 b = new Bandwidth(Bandwidth.BW10Gbps);
55 System.out.println("b = " + b);
56 Assert.assertTrue(b.toString().equals("BandWidth[10Gbps]"));
58 b = new Bandwidth(Bandwidth.BW40Gbps);
59 System.out.println("b = " + b);
60 Assert.assertTrue(b.toString().equals("BandWidth[40Gbps]"));
62 b = new Bandwidth(Bandwidth.BW100Gbps);
63 System.out.println("b = " + b);
64 Assert.assertTrue(b.toString().equals("BandWidth[100Gbps]"));
66 b = new Bandwidth(Bandwidth.BW100Gbps + 15L);
67 System.out.println("b = " + b);
68 Assert.assertTrue(b.toString().equals("BandWidth[100Gbps]"));
70 b = new Bandwidth(Bandwidth.BW1Tbps);
71 System.out.println("b = " + b);
72 Assert.assertTrue(b.toString().equals("BandWidth[1Tbps]"));
76 public void testLatencyStr() {
79 l = new Latency(Latency.LATENCYUNK);
80 System.out.println("l = " + l);
81 Assert.assertTrue(l.toString().equals("Latency[UnKnown]"));
83 l = new Latency(Latency.LATENCY1ns);
84 System.out.println("l = " + l);
85 Assert.assertTrue(l.toString().equals("Latency[1nsec]"));
87 l = new Latency(Latency.LATENCY1us);
88 System.out.println("l = " + l);
89 Assert.assertTrue(l.toString().equals("Latency[1usec]"));
91 l = new Latency(Latency.LATENCY1ms);
92 System.out.println("l = " + l);
93 Assert.assertTrue(l.toString().equals("Latency[1msec]"));