4db835324fe741937316187f86b769fd17059b29
[nemo.git] / nemo-impl / src / test / java / org / opendaylight / nemo / intent / IntentResolverTest.java
1 /*
2  * Copyright (c) 2015 Huawei, 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.nemo.intent;
9
10 import junit.framework.TestCase;
11 import org.junit.Before;
12 import org.junit.Assert;
13 import org.junit.Test;
14 import org.opendaylight.nemo.intent.*;
15 import org.opendaylight.nemo.intent.computation.PNComputationUnit;
16 import org.opendaylight.nemo.intent.computation.VNComputationUnit;
17 import org.opendaylight.nemo.intent.computation.VNMappingUnit;
18 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
19 import java.util.Map;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.common.rev151010.UserId;
21
22 import static org.junit.Assert.*;
23 import static org.mockito.Mockito.*;
24
25 /**
26  * Created by zhangmeng on 2015/11/10.
27  */
28 public class IntentResolverTest extends TestCase {
29     private DataBroker dataBroker;
30     private NodeMapper nodeMapper;
31     private ConnectionMapper connectionMapper;
32     private FlowManager flowManager;
33     private OperationResolver operationResolver;
34     private PNComputationUnit pnComputationUnit;
35     private Map<UserId, VNComputationUnit> vnComputationUnits;
36     private VNMappingUnit vnMappingUnit;
37
38     private IntentResolver intentResolver;
39
40     @Before
41     public void setUp() throws Exception {
42         dataBroker = mock(DataBroker.class);
43         intentResolver = mock(IntentResolver.class);
44     }
45
46     @Test
47     public void testResolveIntent() throws Exception {
48         UserId userId = mock(UserId.class);
49         intentResolver.resolveIntent(userId);
50         verify(intentResolver).resolveIntent(any(UserId.class));
51         Assert.assertNotNull(intentResolver);
52     }
53
54     @Test
55     public void testClose() throws Exception {
56         intentResolver.close();
57         verify(intentResolver).close();
58         Assert.assertNotNull(intentResolver);
59     }
60 }