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 java.util.concurrent.ExecutionException;
18 import java.util.concurrent.TimeoutException;
19 import org.junit.Test;
20 import org.opendaylight.mdsal.dom.api.DOMRpcImplementationNotAvailableException;
21 import org.opendaylight.mdsal.dom.broker.util.TestModel;
22 import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
23 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
25 public class RoutedDOMRpcRoutingTableEntryTest extends TestUtils {
27 @SuppressWarnings("checkstyle:IllegalCatch")
29 public void basicTest() throws InterruptedException, TimeoutException {
30 final RpcDefinition rpcDefinition = mock(RpcDefinition.class);
31 doReturn(SchemaPath.ROOT).when(rpcDefinition).getPath();
33 final RoutedDOMRpcRoutingTableEntry routedDOMRpcRoutingTableEntry =
34 new RoutedDOMRpcRoutingTableEntry(rpcDefinition, TestModel.TEST_PATH, new HashMap<>());
35 assertNotNull(routedDOMRpcRoutingTableEntry.newInstance(new HashMap<>()));
38 routedDOMRpcRoutingTableEntry.invokeRpc(TEST_CHILD).get();
39 fail("Expected DOMRpcImplementationNotAvailableException");
40 } catch (ExecutionException e) {
41 assertTrue(e.getCause() instanceof DOMRpcImplementationNotAvailableException);