Added range type to subject-feature-definition/parameter
[groupbasedpolicy.git] / renderers / opflex / src / test / java / org / opendaylight / groupbasedpolicy / renderer / opflex / mit / PolicyClassInfoTest.java
1 /*
2  * Copyright (C) 2014 Cisco Systems, Inc.
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  *  Authors : tbachman
9  */
10 package org.opendaylight.groupbasedpolicy.renderer.opflex.mit;
11
12 import static org.junit.Assert.assertTrue;
13
14
15
16 import java.util.ArrayList;
17 import java.util.List;
18
19 import org.junit.Before;
20 import org.junit.Test;
21 import org.opendaylight.groupbasedpolicy.renderer.opflex.mit.PolicyClassInfo.PolicyClassInfoBuilder;
22 import org.opendaylight.groupbasedpolicy.renderer.opflex.mit.PolicyPropertyInfo.PolicyPropertyId;
23 import org.opendaylight.groupbasedpolicy.renderer.opflex.mit.PolicyPropertyInfo.PolicyPropertyInfoBuilder;
24
25 public class PolicyClassInfoTest {
26
27         List<PolicyPropertyId> testKeyList;
28         List<PolicyPropertyInfo> testPropertyInfoList;
29         PolicyPropertyInfo testPpi;
30
31         private static final int TEST_PROP_ID = 200;
32         private static final int TEST_CLASS_ID = 100;
33         private static final String TEST_CLASS_NAME = "foobar";
34         private static final PolicyClassInfo.PolicyClassType TEST_CLASS_TYPE =
35                         PolicyClassInfo.PolicyClassType.POLICY;
36
37     @Before
38     public void setUp() throws Exception {
39         PolicyPropertyInfoBuilder ppib = new PolicyPropertyInfoBuilder();
40         testPpi = ppib.build();
41         testKeyList = new ArrayList<PolicyPropertyId>();
42         testKeyList.add(new PolicyPropertyId(TEST_PROP_ID));
43         testPropertyInfoList = new ArrayList<PolicyPropertyInfo>();
44         testPropertyInfoList.add(testPpi);
45     }
46
47     @Test
48     public void testBuilder() throws Exception {
49         PolicyClassInfoBuilder pcib = new PolicyClassInfoBuilder();
50         PolicyClassInfo pci = null;
51         pcib.setClassId(TEST_CLASS_ID);
52         pcib.setClassName(TEST_CLASS_NAME);
53         pcib.setKey(testKeyList);
54         pcib.setPolicyType(TEST_CLASS_TYPE);
55         pcib.setProperty(testPropertyInfoList);
56         pci = pcib.build();
57
58         assertTrue(pci.getClassId() == TEST_CLASS_ID);
59         assertTrue(pci.getClassName().equals(TEST_CLASS_NAME));
60         assertTrue(pci.getKeys().get(0) == testKeyList.get(0));
61         assertTrue(pci.getPolicyType() == TEST_CLASS_TYPE);
62         assertTrue(pci.getProperties().get(0) == testPropertyInfoList.get(0));
63
64     }
65
66 }