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 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;
16 import java.util.Arrays;
17 import java.util.Collections;
20 import static org.hamcrest.CoreMatchers.is;
21 import static org.junit.Assert.assertNotNull;
22 import static org.junit.Assert.assertThat;
24 public class RuntimeRegistratorFtlFileTest extends RuntimeRegistratorTest {
27 public void testRootWithoutAnything() {
28 RuntimeBeanEntry rootRB = prepareRootRB(Collections
29 .<RuntimeBeanEntry> emptyList());
30 Map<String, FtlTemplate> createdFtls = RuntimeRegistratorFtlTemplate
32 assertThat(createdFtls.size(), is(2));
33 String rootRegistratorName = RuntimeRegistratorFtlTemplate
34 .getJavaNameOfRuntimeRegistration(rootRB.getJavaNamePrefix());
35 FtlTemplate rootFtlFile = createdFtls.get(rootRegistratorName);
36 assertNotNull(rootFtlFile);
38 assertThat(createdFtls.values().size(), is(2));
42 public void testHierarchy2() {
43 RuntimeBeanEntry grandChildRB = prepareChildRB(
44 Collections.<RuntimeBeanEntry> emptyList(), "grand");
45 RuntimeBeanEntry childRB = prepareChildRB(Arrays.asList(grandChildRB),
47 RuntimeBeanEntry rootRB = prepareRootRB(Arrays.asList(childRB));
49 Map<String, FtlTemplate> createdFtls = RuntimeRegistratorFtlTemplate
51 assertThat(createdFtls.values().size(), is(4));