Further changes for cnf-adpter in bpmn infra
[so.git] / adapters / mso-cnf-adapter / src / test / java / org / onap / so / adapters / cnf / service / CnfAdapterServiceTest.java
1 // TODO
2 /*
3  * package org.onap.so.adapters.cnf.service;
4  * 
5  * import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks;
6  * import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import
7  * org.onap.so.adapters.cnf.model.BpmnInstanceRequest; import org.onap.so.adapters.cnf.model.InstanceMiniResponseList;
8  * import org.onap.so.adapters.cnf.model.InstanceResponse; import org.onap.so.adapters.cnf.model.InstanceStatusResponse;
9  * import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; import
10  * org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import
11  * org.springframework.test.context.junit4.SpringRunner; import org.springframework.web.client.RestTemplate;
12  * 
13  * @RunWith(SpringRunner.class) public class CnfAdapterServiceTest {
14  * 
15  * @InjectMocks CnfAdapterService cnfAdapterService;
16  * 
17  * @Mock ResponseEntity<InstanceResponse> createInstanceResponse;
18  * 
19  * @Mock ResponseEntity<InstanceMiniResponseList> instacneMiniResponseList;
20  * 
21  * @Mock ResponseEntity<InstanceStatusResponse> instanceStatusResponse;
22  * 
23  * @Mock private RestTemplate restTemplate;
24  * 
25  * @Test public void healthCheckTest() throws Exception {
26  * 
27  * ResponseEntity<String> response = new ResponseEntity<String>(HttpStatus.OK);
28  * 
29  * Mockito.when(restTemplate.exchange(Matchers.anyString(), Matchers.any(HttpMethod.class),
30  * Matchers.<HttpEntity<?>>any(), Matchers.<Class<String>>any())).thenReturn(response);
31  * 
32  * ResponseEntity<String> actualResponse = cnfAdapterService.healthCheck(); Assert.assertNotNull(actualResponse);
33  * Assert.assertEquals(HttpStatus.OK, actualResponse.getStatusCode());
34  * 
35  * }
36  * 
37  * @Test public void createInstanceTest() throws Exception {
38  * 
39  * ResponseEntity<InstanceResponse> response = new ResponseEntity<InstanceResponse>(HttpStatus.OK); BpmnInstanceRequest
40  * bpmnInstanceRequest = new BpmnInstanceRequest(); bpmnInstanceRequest.setK8sRBProfileName("k8sRBProfileName");
41  * Mockito.when(restTemplate.exchange(Matchers.anyString(), Matchers.any(HttpMethod.class),
42  * Matchers.<HttpEntity<?>>any(), Matchers.<Class<InstanceResponse>>any())).thenReturn(response);
43  * 
44  * ResponseEntity<InstanceResponse> actualResponse = cnfAdapterService.createInstance(bpmnInstanceRequest);
45  * Assert.assertNotNull(response); Assert.assertEquals(actualResponse.getStatusCode(), response.getStatusCode());
46  * 
47  * }
48  * 
49  * @Test public void createInstanceExceptionTest() throws Exception {
50  * 
51  * BpmnInstanceRequest bpmnInstanceRequest = new BpmnInstanceRequest(); ResponseEntity<InstanceResponse> response =
52  * cnfAdapterService.createInstance(bpmnInstanceRequest); Assert.assertNull(response);
53  * 
54  * }
55  * 
56  * @Test public void getInstanceByInstanceIdTest() throws Exception {
57  * 
58  * ResponseEntity<InstanceResponse> response = new ResponseEntity<InstanceResponse>(HttpStatus.OK); String instanceId =
59  * "123"; Mockito.when(restTemplate.exchange(Matchers.anyString(), Matchers.any(HttpMethod.class),
60  * Matchers.<HttpEntity<?>>any(), Matchers.<Class<InstanceResponse>>any())).thenReturn(response);
61  * 
62  * ResponseEntity<InstanceResponse> actualResponse = cnfAdapterService.getInstanceByInstanceId(instanceId);
63  * Assert.assertNotNull(actualResponse); Assert.assertEquals(HttpStatus.OK, actualResponse.getStatusCode());
64  * 
65  * }
66  * 
67  * @Test public void getInstanceStatusByInstanceIdTest() throws Exception {
68  * 
69  * ResponseEntity<InstanceStatusResponse> response = new ResponseEntity<InstanceStatusResponse>(HttpStatus.OK); String
70  * instanceId = "123"; Mockito.when(restTemplate.exchange(Matchers.anyString(), Matchers.any(HttpMethod.class),
71  * Matchers.<HttpEntity<?>>any(), Matchers.<Class<InstanceStatusResponse>>any())).thenReturn(response);
72  * 
73  * ResponseEntity<InstanceStatusResponse> actualResponse = cnfAdapterService .getInstanceStatusByInstanceId(instanceId);
74  * Assert.assertNotNull(actualResponse); Assert.assertEquals(HttpStatus.OK, response.getStatusCode());
75  * 
76  * }
77  * 
78  * @Test public void getInstanceByRBNameOrRBVersionOrProfileNameTest() throws Exception {
79  * 
80  * ResponseEntity<InstanceMiniResponseList> response = new ResponseEntity<InstanceMiniResponseList>(HttpStatus.OK);
81  * String rbName = "xyz"; String rbVersion = "v1"; String profileName = "p1";
82  * 
83  * Mockito.when(restTemplate.exchange(Matchers.anyString(), Matchers.any(HttpMethod.class),
84  * Matchers.<HttpEntity<?>>any(), Matchers.<Class<InstanceMiniResponseList>>any())).thenReturn(response);
85  * 
86  * ResponseEntity<InstanceMiniResponseList> actualResponse = cnfAdapterService
87  * .getInstanceByRBNameOrRBVersionOrProfileName(rbName, rbVersion, profileName); Assert.assertNotNull(actualResponse);
88  * Assert.assertEquals(HttpStatus.OK, actualResponse.getStatusCode());
89  * 
90  * }
91  * 
92  * @Test public void deleteInstanceByInstanceIdTest() throws Exception {
93  * 
94  * ResponseEntity<String> response = new ResponseEntity<String>(HttpStatus.OK); String instanceId = "123";
95  * Mockito.when(restTemplate.exchange(Matchers.anyString(), Matchers.any(HttpMethod.class),
96  * Matchers.<HttpEntity<?>>any(), Matchers.<Class<String>>any())).thenReturn(response);
97  * 
98  * ResponseEntity<String> actualResponse = cnfAdapterService.deleteInstanceByInstanceId(instanceId);
99  * Assert.assertNotNull(response); Assert.assertEquals(HttpStatus.OK, response.getStatusCode());
100  * 
101  * }
102  * 
103  * }
104  */