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