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.sal.binding.generator.impl;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertTrue;
13 import org.junit.Test;
14 import org.opendaylight.controller.binding.generator.util.Types;
15 import org.opendaylight.controller.sal.binding.generator.spi.TypeProvider;
16 import org.opendaylight.controller.sal.binding.model.api.ConcreteType;
17 import org.opendaylight.controller.sal.binding.model.api.ParameterizedType;
18 import org.opendaylight.controller.sal.binding.model.api.Type;
19 import org.opendaylight.controller.sal.binding.yang.types.BaseYangTypes;
21 public class BaseTypeProvider {
25 TypeProvider provider = BaseYangTypes.BASE_YANG_TYPES_PROVIDER;
27 Type stringType = provider.javaTypeForYangType("string");
28 assertEquals("java.lang", stringType.getPackageName());
29 assertEquals("String", stringType.getName());
30 assertTrue(stringType instanceof ConcreteType);
31 ParameterizedType stringBooleanMap = Types.mapTypeFor(
32 provider.javaTypeForYangType("string"),
33 provider.javaTypeForYangType("boolean"));
34 assertTrue(!(stringBooleanMap instanceof ConcreteType));
35 assertEquals("java.util", stringBooleanMap.getPackageName());
36 assertEquals("Map", stringBooleanMap.getName());
37 assertEquals(2, stringBooleanMap.getActualTypeArguments().length);