2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.config.yangjmxgenerator.plugin;
10 import static org.hamcrest.CoreMatchers.is;
11 import static org.junit.Assert.assertNotNull;
12 import static org.junit.Assert.assertThat;
14 import java.util.Arrays;
15 import java.util.Collections;
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;
23 public class RuntimeRegistratorFtlFileTest extends RuntimeRegistratorTest {
26 public void testRootWithoutAnything() {
27 RuntimeBeanEntry rootRB = prepareRootRB(Collections
28 .<RuntimeBeanEntry> emptyList());
29 Map<String, FtlTemplate> createdFtls = RuntimeRegistratorFtlTemplate
31 assertThat(createdFtls.size(), is(2));
32 String rootRegistratorName = RuntimeRegistratorFtlTemplate
33 .getJavaNameOfRuntimeRegistration(rootRB.getJavaNamePrefix());
34 FtlTemplate rootFtlFile = createdFtls.get(rootRegistratorName);
35 assertNotNull(rootFtlFile);
37 assertThat(createdFtls.values().size(), is(2));
41 public void testHierarchy2() {
42 RuntimeBeanEntry grandChildRB = prepareChildRB(
43 Collections.<RuntimeBeanEntry> emptyList(), "grand");
44 RuntimeBeanEntry childRB = prepareChildRB(Arrays.asList(grandChildRB),
46 RuntimeBeanEntry rootRB = prepareRootRB(Arrays.asList(childRB));
48 Map<String, FtlTemplate> createdFtls = RuntimeRegistratorFtlTemplate
50 assertThat(createdFtls.values().size(), is(4));