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.dom.broker;
10 import static org.junit.Assert.assertNotNull;
11 import static org.junit.Assert.assertTrue;
12 import static org.junit.Assert.fail;
13 import static org.mockito.Mockito.doReturn;
14 import static org.mockito.Mockito.mock;
16 import java.util.HashMap;
17 import org.junit.Test;
18 import org.opendaylight.mdsal.dom.api.DOMRpcImplementationNotAvailableException;
19 import org.opendaylight.mdsal.dom.broker.util.TestModel;
20 import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
21 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
23 public class RoutedDOMRpcRoutingTableEntryTest extends TestUtils {
26 public void basicTest() throws Exception {
27 final RpcDefinition rpcDefinition = mock(RpcDefinition.class);
28 doReturn(SchemaPath.ROOT).when(rpcDefinition).getPath();
30 final RoutedDOMRpcRoutingTableEntry routedDOMRpcRoutingTableEntry =
31 new RoutedDOMRpcRoutingTableEntry(rpcDefinition, TestModel.TEST_PATH, new HashMap<>());
32 assertNotNull(routedDOMRpcRoutingTableEntry.newInstance(new HashMap<>()));
35 routedDOMRpcRoutingTableEntry.invokeRpc(TEST_CHILD).checkedGet();
36 fail("Expected DOMRpcImplementationNotAvailableException");
37 } catch (final Exception e) {
38 assertTrue(e instanceof DOMRpcImplementationNotAvailableException);