BUG-980: stop emiting copyright
[controller.git] / opendaylight / config / yang-jmx-generator-plugin / src / test / java / org / opendaylight / controller / config / yangjmxgenerator / plugin / RuntimeRegistratorFtlFileTest.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.yangjmxgenerator.plugin;
9
10 import org.junit.Test;
11 import org.opendaylight.controller.config.yangjmxgenerator.RuntimeBeanEntry;
12 import org.opendaylight.controller.config.yangjmxgenerator.RuntimeRegistratorTest;
13 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.FtlTemplate;
14 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.RuntimeRegistratorFtlTemplate;
15
16 import java.util.Arrays;
17 import java.util.Collections;
18 import java.util.Map;
19
20 import static org.hamcrest.CoreMatchers.is;
21 import static org.junit.Assert.assertNotNull;
22 import static org.junit.Assert.assertThat;
23
24 public class RuntimeRegistratorFtlFileTest extends RuntimeRegistratorTest {
25
26     @Test
27     public void testRootWithoutAnything() {
28         RuntimeBeanEntry rootRB = prepareRootRB(Collections
29                 .<RuntimeBeanEntry> emptyList());
30         Map<String, FtlTemplate> createdFtls = RuntimeRegistratorFtlTemplate
31                 .create(rootRB);
32         assertThat(createdFtls.size(), is(2));
33         String rootRegistratorName = RuntimeRegistratorFtlTemplate
34                 .getJavaNameOfRuntimeRegistration(rootRB.getJavaNamePrefix());
35         FtlTemplate rootFtlFile = createdFtls.get(rootRegistratorName);
36         assertNotNull(rootFtlFile);
37
38         assertThat(createdFtls.values().size(), is(2));
39     }
40
41     @Test
42     public void testHierarchy2() {
43         RuntimeBeanEntry grandChildRB = prepareChildRB(
44                 Collections.<RuntimeBeanEntry> emptyList(), "grand");
45         RuntimeBeanEntry childRB = prepareChildRB(Arrays.asList(grandChildRB),
46                 "");
47         RuntimeBeanEntry rootRB = prepareRootRB(Arrays.asList(childRB));
48
49         Map<String, FtlTemplate> createdFtls = RuntimeRegistratorFtlTemplate
50                 .create(rootRB);
51         assertThat(createdFtls.values().size(), is(4));
52     }
53 }