Remove DeviceContextImpl.XidGenerator
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / rpc / RequestContextImplTest.java
1 /*
2  * Copyright (c) 2015 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
9 package org.opendaylight.openflowplugin.impl.rpc;
10
11 import static org.junit.Assert.assertNotNull;
12 import static org.mockito.Mockito.verify;
13
14 import com.google.common.util.concurrent.SettableFuture;
15 import org.junit.Before;
16 import org.junit.Test;
17 import org.junit.runner.RunWith;
18 import org.mockito.Matchers;
19 import org.mockito.Mock;
20 import org.mockito.runners.MockitoJUnitRunner;
21 import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
22 import org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext;
23
24 @RunWith(MockitoJUnitRunner.class)
25 public class RequestContextImplTest {
26
27     @Mock
28     RpcContext rpcContext;
29
30     RequestContext requestContext;
31
32     @Before
33     public void setup() {
34         requestContext = new RequestContextImpl<>(rpcContext);
35     }
36
37     @Test
38     public void testCreateRequestFuture() throws Exception {
39         SettableFuture future = requestContext.getFuture();
40         assertNotNull(future);
41     }
42
43     @Test
44     public void testClose() throws Exception {
45         requestContext.close();
46         verify(rpcContext).forgetRequestContext(Matchers.any(RequestContext.class));
47     }
48
49 }