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