8a55177f1e27600a6ef75ac857b8650211e50fea
[so.git] / adapters / mso-openstack-adapters / src / test / java / org / onap / so / adapters / tenant / MsoTenantAdapterImplTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20 package org.onap.so.adapters.tenant;
21
22 import java.util.HashMap;
23
24 import javax.xml.ws.Holder;
25
26 import org.junit.Test;
27 import org.junit.runner.RunWith;
28 import org.mockito.InjectMocks;
29 import org.mockito.Mock;
30 import org.mockito.Spy;
31 import org.mockito.runners.MockitoJUnitRunner;
32 import org.onap.so.adapters.tenantrest.TenantRollback;
33 import org.onap.so.cloud.CloudConfig;
34 import org.onap.so.entity.MsoRequest;
35
36 @RunWith(MockitoJUnitRunner.class)
37 public class MsoTenantAdapterImplTest {
38         
39     @Mock
40         private CloudConfig cloudConfig;
41     
42     @Spy
43     @InjectMocks
44     private MsoTenantAdapterImpl msoTenantAdapter;
45
46     @Test
47     public void healthCheck() throws Exception {
48         msoTenantAdapter.healthCheck();
49     }
50
51     @Test(expected = NullPointerException.class)
52     public void createTenant() throws Exception {
53         msoTenantAdapter.createTenant("site", "tenant", new HashMap<>(),
54                 true, true, new MsoRequest(), new Holder<String>(), new Holder<TenantRollback>());
55     }
56
57     @Test(expected = NullPointerException.class)
58     public void queryTenant() throws Exception {
59         msoTenantAdapter.queryTenant("site", "tenant", new MsoRequest(),
60                 new Holder<>(), new Holder<>(), new Holder<>());
61     }
62
63     @Test(expected = NullPointerException.class)
64     public void deleteTenant() throws Exception {
65         msoTenantAdapter.deleteTenant("cloud", "tenant", new MsoRequest(), new Holder<Boolean>());
66     }
67
68     @Test
69     public void rollbackTenant() throws Exception {
70         msoTenantAdapter.rollbackTenant(new TenantRollback());
71     }
72
73 }