2 * Copyright (c) 2016 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.invoke;
10 import static org.junit.Assert.assertNotNull;
11 import static org.junit.Assert.fail;
13 import com.google.common.collect.ImmutableMap;
14 import java.lang.reflect.Method;
15 import org.junit.Test;
16 import org.opendaylight.yangtools.yang.binding.RpcService;
17 import org.opendaylight.yangtools.yang.common.QName;
18 import org.opendaylight.yangtools.yang.common.QNameModule;
19 import org.opendaylight.yangtools.yang.common.Revision;
20 import org.opendaylight.yangtools.yang.common.XMLNamespace;
22 public class RpcServiceInvokerTest {
25 public void fromTest() throws Exception {
26 final Method method = this.getClass().getDeclaredMethod("testMethod");
27 method.setAccessible(true);
28 assertNotNull(RpcServiceInvoker.from(ImmutableMap.of(
29 QName.create(QNameModule.create(XMLNamespace.of("testURI"), Revision.of("2017-10-26")),"test"), method,
30 QName.create(QNameModule.create(XMLNamespace.of("testURI2"), Revision.of("2017-10-26")),"test"), method)));
31 assertNotNull(RpcServiceInvoker.from(ImmutableMap.of(
32 QName.create(QNameModule.create(XMLNamespace.of("testURI"), Revision.of("2017-10-26")), "test"), method)));
35 @Deprecated(forRemoval = true)
36 @Test(expected = IllegalArgumentException.class)
37 public void fromWithExceptionTest() {
38 RpcServiceInvoker.from(RpcService.class);
39 fail("Expected IllegalArgumentException");
42 private void testMethod() {