Replace SchemaPath with SchemaNodeIdentifier.Absolute/QName
[mdsal.git] / dom / mdsal-dom-broker / src / test / java / org / opendaylight / mdsal / dom / broker / RoutedDOMRpcRoutingTableEntryTest.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.mdsal.dom.broker;
9
10 import static org.hamcrest.CoreMatchers.instanceOf;
11 import static org.hamcrest.MatcherAssert.assertThat;
12 import static org.junit.Assert.assertNotNull;
13 import static org.junit.Assert.assertThrows;
14 import static org.mockito.Mockito.doReturn;
15 import static org.mockito.Mockito.mock;
16
17 import com.google.common.util.concurrent.ListenableFuture;
18 import java.util.HashMap;
19 import java.util.concurrent.ExecutionException;
20 import java.util.concurrent.TimeUnit;
21 import org.junit.Test;
22 import org.opendaylight.mdsal.dom.api.DOMRpcImplementationNotAvailableException;
23 import org.opendaylight.mdsal.dom.broker.DOMRpcRouter.OperationInvocation;
24 import org.opendaylight.mdsal.dom.broker.util.TestModel;
25 import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
26
27 public class RoutedDOMRpcRoutingTableEntryTest extends TestUtils {
28     @Test
29     public void basicTest()  {
30         final RpcDefinition rpcDefinition = mock(RpcDefinition.class);
31         doReturn(TestModel.TEST2_QNAME).when(rpcDefinition).getQName();
32
33         final RoutedDOMRpcRoutingTableEntry routedDOMRpcRoutingTableEntry =
34                 new RoutedDOMRpcRoutingTableEntry(rpcDefinition, TestModel.TEST_PATH, new HashMap<>());
35         assertNotNull(routedDOMRpcRoutingTableEntry.newInstance(new HashMap<>()));
36
37         final ListenableFuture<?> future = OperationInvocation.invoke(routedDOMRpcRoutingTableEntry, TEST_CHILD);
38         final ExecutionException ex = assertThrows(ExecutionException.class, () -> future.get(5, TimeUnit.SECONDS));
39         assertThat(ex.getCause(), instanceOf(DOMRpcImplementationNotAvailableException.class));
40     }
41 }