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.junit.Assert.assertNotNull;
11 import static org.junit.Assert.assertThat;
12 import static org.junit.Assert.assertTrue;
13 import static org.junit.Assert.fail;
14 import static org.junit.matchers.JUnitMatchers.containsString;
16 import org.junit.Test;
17 import org.opendaylight.controller.config.yangjmxgenerator.ConfigConstants;
18 import org.opendaylight.controller.config.yangjmxgenerator.PackageTranslatorTest;
20 import com.google.common.collect.Sets;
22 public class JMXGeneratorFileNamesValidationTest extends JMXGeneratorTest {
27 map.put(JMXGenerator.NAMESPACE_TO_PACKAGE_PREFIX + "1",
28 ConfigConstants.CONFIG_NAMESPACE + ":test:files1"
29 + JMXGenerator.NAMESPACE_TO_PACKAGE_DIVIDER
30 + PackageTranslatorTest.EXPECTED_PACKAGE_PREFIX);
31 map.put(JMXGenerator.NAMESPACE_TO_PACKAGE_PREFIX + "2",
32 ConfigConstants.CONFIG_NAMESPACE + ":test:files"
33 + JMXGenerator.NAMESPACE_TO_PACKAGE_DIVIDER
34 + PackageTranslatorTest.EXPECTED_PACKAGE_PREFIX);
36 map.put(JMXGenerator.MODULE_FACTORY_FILE_BOOLEAN, "randomValue");
37 jmxGenerator.setAdditionalConfig(map);
39 jmxGenerator.generateSources(context, outputBaseDir,
40 Sets.newHashSet(testFilesModule, testFiles1Module));
42 } catch (RuntimeException e) {
43 final Throwable cause = e.getCause();
45 assertTrue(cause instanceof IllegalStateException);
46 assertThat(cause.getMessage(),
47 containsString("Name conflict in generated files"));
48 assertThat(cause.getMessage(), containsString("DtoA.java"));