Adjust for yangtools normalizing module names
[controller.git] / opendaylight / config / yang-jmx-generator / src / test / java / org / opendaylight / controller / config / yangjmxgenerator / PackageTranslatorTest.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;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.mockito.Mockito.doReturn;
12 import static org.mockito.Mockito.mock;
13
14 import com.google.common.collect.Maps;
15 import java.net.URI;
16 import java.util.Map;
17 import org.junit.Test;
18 import org.opendaylight.yangtools.yang.model.api.Module;
19
20 public class PackageTranslatorTest {
21     public static final String EXPECTED_PACKAGE_PREFIX = "org.opendaylight.controller.config";
22
23     @Test
24     public void test() throws Exception {
25         Map<String, String> map = Maps.newHashMap();
26         map.put(ConfigConstants.CONFIG_NAMESPACE, EXPECTED_PACKAGE_PREFIX);
27         PackageTranslator tested = new PackageTranslator(map);
28         Module module = mock(Module.class);
29         doReturn(new URI(ConfigConstants.CONFIG_NAMESPACE + ":threads:api"))
30                 .when(module).getNamespace();
31         assertEquals(EXPECTED_PACKAGE_PREFIX + ".threads.api",
32                 tested.getPackageName(module));
33     }
34
35 }