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