2 * Copyright (c) 2014, 2015 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.mdsal.binding.dom.adapter;
10 import static org.junit.Assert.assertTrue;
12 import com.google.common.collect.ImmutableMap;
13 import com.google.common.collect.ImmutableSet;
14 import com.google.common.collect.ImmutableSetMultimap;
15 import com.google.common.collect.SetMultimap;
16 import java.lang.reflect.Method;
19 import org.junit.Test;
20 import org.opendaylight.mdsal.binding.dom.adapter.test.AbstractSchemaAwareTest;
21 import org.opendaylight.mdsal.binding.dom.codec.impl.BindingCodecContext;
22 import org.opendaylight.mdsal.binding.runtime.api.BindingRuntimeContext;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.bi.ba.rpcservice.rev140701.OpendaylightTestRpcServiceService;
24 import org.opendaylight.yangtools.yang.common.QNameModule;
25 import org.opendaylight.yangtools.yang.common.XMLNamespace;
26 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
27 import org.opendaylight.yangtools.yang.model.api.Module;
28 import org.opendaylight.yangtools.yang.model.api.stmt.ModuleEffectiveStatement;
29 import org.opendaylight.yangtools.yang.model.spi.AbstractSchemaContext;
31 public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
33 private CurrentAdapterSerializer serializer;
36 protected void setupWithRuntimeContext(final BindingRuntimeContext runtimeContext) {
37 serializer = new CurrentAdapterSerializer(new BindingCodecContext(runtimeContext));
41 public void testGetRpcMethodToQName() {
42 assertTrue(serializer.createQNameToMethod(OpendaylightTestRpcServiceService.class)
45 .anyMatch("rockTheHouse"::equals));
48 static class EmptyEffectiveModelContext extends AbstractSchemaContext implements EffectiveModelContext {
50 public Set<Module> getModules() {
51 return ImmutableSet.of();
55 protected Map<QNameModule, Module> getModuleMap() {
56 return ImmutableMap.of();
60 protected SetMultimap<XMLNamespace, Module> getNamespaceToModules() {
61 return ImmutableSetMultimap.of();
65 protected SetMultimap<String, Module> getNameToModules() {
66 return ImmutableSetMultimap.of();
70 public Map<QNameModule, ModuleEffectiveStatement> getModuleStatements() {
71 return ImmutableMap.of();