Merge "Reorder modifiers"
[so.git] / adapters / mso-vnf-adapter / src / test / java / org / openecomp / mso / adapters / vnf / VnfAdapterRestV2ExceptionTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * OPENECOMP - SO
4  * ================================================================================
5  * Copyright (C) 2018 Huawei Intellectual Property. 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.openecomp.mso.adapters.vnf;
21
22 import org.junit.Test;
23 import org.openecomp.mso.adapters.vnfrest.CreateVfModuleRequest;
24 import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleRequest;
25 import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleRequest;
26 import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleRequest;
27
28 public class VnfAdapterRestV2ExceptionTest {
29
30  
31
32         VnfAdapterRestV2 vnfAdapterRestV2 = new VnfAdapterRestV2();
33
34         //TODO THESE ARE RAINY DAY TESTS, NEED TO WRITE THE SUNNY DAY ONES 
35         // @Test(expected = ClassFormatError.class)
36         public void testHealthcheckFailForInvalidCase() throws Exception {
37                 try{
38                         vnfAdapterRestV2.healthcheck();
39                 }
40                 catch(Exception ex){
41                         // EXCEPTION EXPECTED
42                         assert(true);
43                 }
44         }
45
46
47         //  @Test(expected = ClassFormatError.class)
48         public void deleteVfModuleClassFormatError() throws Exception {
49                 try{
50                         DeleteVfModuleRequest deleteVfModuleRequest = new DeleteVfModuleRequest();
51                         deleteVfModuleRequest.setVnfId("vnfid");
52                         deleteVfModuleRequest.setVfModuleId("moduleid");
53                         vnfAdapterRestV2.deleteVfModule("vnfid", "moduleid", "mode", deleteVfModuleRequest);
54                 }
55                 catch(Exception ex)
56                 {                       // EXCEPTION EXPECTED
57                         assert(true);
58                 }
59
60         }
61
62         // @Test(expected = NullPointerException.class)
63         public void queryVfModuleNullPointerException() throws Exception {
64                 try{
65                         vnfAdapterRestV2.queryVfModule("vnfid", "moduleid", "cloudid", "teanantid", "vfmodulename", true, "requestid", "serviceinstanceid", "mode");
66                 }
67                 catch(Exception ex)
68                 {                       // EXCEPTION EXPECTED
69                         assert(true);
70                 }
71         }
72
73         //  @Test(expected = ClassFormatError.class)
74         public void createVfModuleClassFormatError() throws Exception {
75                 try{
76                         vnfAdapterRestV2.createVfModule("vnfid", "create", new CreateVfModuleRequest());
77                 }
78                 catch(Exception ex)
79                 {                       // EXCEPTION EXPECTED
80                         assert(true);
81                 }
82         }
83
84         //   @Test(expected = ClassFormatError.class)
85         public void updateVfModulClassFormatErrore() throws Exception {
86                 try{
87                         vnfAdapterRestV2.updateVfModule("vnfid", "moduleid", "mode", new UpdateVfModuleRequest());
88                 }
89                 catch(Exception ex)
90                 {                       // EXCEPTION EXPECTED
91                         assert(true);
92                 }
93         }
94
95         //   @Test(expected = NullPointerException.class)
96         public void rollbackVfModuleNullPointerException() throws Exception {
97                 try{
98
99                         vnfAdapterRestV2.rollbackVfModule("vnfid", "moduleid", new RollbackVfModuleRequest());
100                 }
101                 catch(Exception ex)
102                 {
103                         // EXCEPTION EXPECTED
104                         assert(true);
105                 }
106         }
107
108
109 }