c54ac0613ff510b714165d3989eef719a08c73fb
[controller.git] / opendaylight / sal / yang-prototype / code-generator / binding-generator-impl / src / test / java / org / opendaylight / controller / sal / binding / generator / impl / BaseTypeProvider.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.sal.binding.generator.impl;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertTrue;
12
13 import org.junit.Ignore;
14 import org.junit.Test;
15 import org.opendaylight.controller.binding.generator.util.Types;
16 import org.opendaylight.controller.sal.binding.generator.spi.TypeProvider;
17 import org.opendaylight.controller.sal.binding.model.api.ConcreteType;
18 import org.opendaylight.controller.sal.binding.model.api.ParameterizedType;
19 import org.opendaylight.controller.sal.binding.model.api.Type;
20 import org.opendaylight.controller.sal.binding.yang.types.BaseYangTypes;
21
22 public class BaseTypeProvider {
23
24     @Test
25     public void test() {
26         TypeProvider provider = BaseYangTypes.BASE_YANG_TYPES_PROVIDER;
27
28         Type stringType = provider.javaTypeForYangType("string");
29         assertEquals("java.lang", stringType.getPackageName());
30         assertEquals("String", stringType.getName());
31         assertTrue(stringType instanceof ConcreteType);
32         ParameterizedType stringBooleanMap = Types.mapTypeFor(
33                 provider.javaTypeForYangType("string"),
34                 provider.javaTypeForYangType("boolean"));
35         assertTrue(!(stringBooleanMap instanceof ConcreteType));
36         assertEquals("java.util", stringBooleanMap.getPackageName());
37         assertEquals("Map", stringBooleanMap.getName());
38         assertEquals(2, stringBooleanMap.getActualTypeArguments().length);
39     }
40 }