Initial code drop of yang model driven configuration system
[controller.git] / opendaylight / config / config-manager / src / test / java / org / opendaylight / controller / config / manager / impl / util / InterfacesHelperTest.java
1 /*
2  * Copyright (c) 2013 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 package org.opendaylight.controller.config.manager.impl.util;
9
10 import static org.junit.Assert.assertEquals;
11
12 import java.util.Set;
13
14 import javax.management.MXBean;
15
16 import org.junit.Test;
17 import org.opendaylight.controller.config.spi.Module;
18
19 import com.google.common.collect.Sets;
20
21 public class InterfacesHelperTest {
22
23     interface SuperA {
24
25     }
26
27     interface SuperBMXBean {
28
29     }
30
31     interface SuperC extends SuperA, SuperBMXBean {
32
33     }
34
35     class SuperClass implements SuperC {
36
37     }
38
39     @MXBean
40     interface SubA {
41
42     }
43
44     abstract class SubClass extends SuperClass implements SubA, Module {
45
46     }
47
48     @Test
49     public void testGetAllInterfaces() {
50         Set<Class<?>> expected = Sets.<Class<?>> newHashSet(SuperA.class, SuperBMXBean.class, SuperC.class,
51                 SubA.class, Module.class, org.opendaylight.protocol.concepts.NamedObject.class);
52         assertEquals(expected,
53                 InterfacesHelper.getAllInterfaces(SubClass.class));
54     }
55
56     @Test
57     public void testGetMXInterfaces() {
58         Set<Class<?>> expected = Sets.<Class<?>> newHashSet(SuperBMXBean.class, SubA.class);
59         assertEquals(expected, InterfacesHelper.getMXInterfaces(SubClass.class));
60     }
61
62 }