-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathComponentsApiTests.java
More file actions
161 lines (127 loc) · 7.52 KB
/
Copy pathComponentsApiTests.java
File metadata and controls
161 lines (127 loc) · 7.52 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
package Api;
import org.junit.Assert;
import org.junit.Test;
import factset.analyticsapi.engines.*;
import factset.analyticsapi.engines.api.*;
import factset.analyticsapi.engines.models.*;
public class ComponentsApiTests {
private static ApiClient apiClient;
private ComponentsApi apiInstance;
/*************************************************************************/
/********************* PA Components Test Cases ***********************/
/*************************************************************************/
@Test
public void getAllPAComponentsSuccess() throws ApiException {
ApiResponse<ComponentSummaryRoot> getAllComponentsResponse = null;
apiClient = CommonFunctions.buildApiClient(CommonParameters.DefaultUsername, CommonParameters.DefaultPassword);
apiInstance = new ComponentsApi(apiClient);
try {
getAllComponentsResponse = apiInstance.getPAComponentsWithHttpInfo(CommonParameters.PA_DEFAULT_DOCUMENT);
Assert.assertTrue("Response should be 200 - Success", getAllComponentsResponse.getStatusCode() == 200);
Assert.assertTrue("Response data should not be null.", getAllComponentsResponse.getData().getData().size() != 0);
} catch (ApiException e) {
CommonFunctions.handleException("ComponentsApi#getPAComponentsWithHttpInfo", e);
}
}
@Test
public void getPAComponentByIdSuccess() throws ApiException {
ApiResponse<ComponentSummaryRoot> getAllComponentsResponse = null;
apiClient = CommonFunctions.buildApiClient(CommonParameters.DefaultUsername, CommonParameters.DefaultPassword);
apiInstance = new ComponentsApi(apiClient);
try {
getAllComponentsResponse = apiInstance.getPAComponentsWithHttpInfo(CommonParameters.PA_DEFAULT_DOCUMENT);
Assert.assertTrue("Response should be 200 - Success", getAllComponentsResponse.getStatusCode() == 200);
Assert.assertTrue("Response data should not be null.", getAllComponentsResponse.getData().getData().size() != 0);
} catch (ApiException e) {
CommonFunctions.handleException("ComponentsApi#getPAComponentsWithHttpInfo", e);
}
ApiResponse<PAComponentRoot> getByIdResponse = null;
try {
getByIdResponse = apiInstance
.getPAComponentByIdWithHttpInfo(getAllComponentsResponse.getData().getData().entrySet().iterator().next().getKey());
Assert.assertTrue("Response should be 200 - Success", getByIdResponse.getStatusCode() == 200);
Assert.assertTrue("Response data should not be null.", getByIdResponse.getData() != null);
} catch (ApiException e) {
CommonFunctions.handleException("ComponentsApi#getPAComponentByIdWithHttpInfo", e);
}
}
/*************************************************************************/
/********************* Vault Components Test Cases ***********************/
/*************************************************************************/
@Test
public void getAllVaultComponentsSuccess() throws ApiException {
ApiResponse<ComponentSummaryRoot> getVaultComponentsResponse = null;
apiClient = CommonFunctions.buildApiClient(CommonParameters.DefaultUsername, CommonParameters.DefaultPassword);
apiInstance = new ComponentsApi(apiClient);
try {
getVaultComponentsResponse = apiInstance
.getVaultComponentsWithHttpInfo(CommonParameters.VAULT_DEFAULT_DOCUMENT);
Assert.assertTrue("Response should be 200 - Success", getVaultComponentsResponse.getStatusCode() == 200);
Assert.assertTrue("Response data should not be null.", getVaultComponentsResponse.getData().getData().size() != 0);
} catch (ApiException e) {
CommonFunctions.handleException("ComponentsApi#getVaultComponentsWithHttpInfo", e);
}
}
@Test
public void getByVaultComponentIdSuccess() throws ApiException {
ApiResponse<ComponentSummaryRoot> getVaultComponentsResponse = null;
apiClient = CommonFunctions.buildApiClient(CommonParameters.DefaultUsername, CommonParameters.DefaultPassword);
apiInstance = new ComponentsApi(apiClient);
try {
getVaultComponentsResponse = apiInstance
.getVaultComponentsWithHttpInfo(CommonParameters.VAULT_DEFAULT_DOCUMENT);
Assert.assertTrue("Response should be 200 - Success", getVaultComponentsResponse.getStatusCode() == 200);
Assert.assertTrue("Response data should not be null.", getVaultComponentsResponse.getData().getData().size() != 0);
} catch (ApiException e) {
CommonFunctions.handleException("ComponentsApi#getVaultComponentsWithHttpInfo", e);
}
ApiResponse<VaultComponentRoot> getVaultByIdResponse = null;
try {
getVaultByIdResponse = apiInstance.getVaultComponentByIdWithHttpInfo(
getVaultComponentsResponse.getData().getData().entrySet().iterator().next().getKey());
Assert.assertTrue("Response should be 200 - Success", getVaultByIdResponse.getStatusCode() == 200);
Assert.assertTrue("Response data should not be null.", getVaultByIdResponse.getData() != null);
} catch (ApiException e) {
CommonFunctions.handleException("ComponentsApi#getVaultComponentByIdWithHttpInfo", e);
}
}
/*************************************************************************/
/********************* SPAR Components Test Cases ***********************/
/*************************************************************************/
@Test
public void getAllSPARComponentsSuccess() throws ApiException {
ApiResponse<ComponentSummaryRoot> getSPARComponentsResponse = null;
apiClient = CommonFunctions.buildApiClient(CommonParameters.DefaultUsername, CommonParameters.DefaultPassword);
apiInstance = new ComponentsApi(apiClient);
try {
getSPARComponentsResponse = apiInstance.getSPARComponentsWithHttpInfo(CommonParameters.SPAR_DEFAULT_DOCUMENT);
Assert.assertTrue("Response should be 200 - Success", getSPARComponentsResponse.getStatusCode() == 200);
Assert.assertTrue("Response data should not be null.", getSPARComponentsResponse.getData().getData().size() != 0);
} catch (ApiException e) {
CommonFunctions.handleException("ComponentsApi#getSPARComponentsWithHttpInfo", e);
}
}
@Test
public void getBySPARComponentIdSuccess() throws ApiException {
ApiResponse<ComponentSummaryRoot> getSPARComponentsResponse = null;
apiClient = CommonFunctions.buildApiClient(CommonParameters.DefaultUsername, CommonParameters.DefaultPassword);
apiInstance = new ComponentsApi(apiClient);
try {
getSPARComponentsResponse = apiInstance.getSPARComponentsWithHttpInfo(CommonParameters.SPARAccount);
Assert.assertTrue("Response should be 200 - Success", getSPARComponentsResponse.getStatusCode() == 200);
Assert.assertTrue("Response data should not be null.", getSPARComponentsResponse.getData().getData().size() != 0);
} catch (ApiException e) {
CommonFunctions.handleException("ComponentsApi#getSPARComponentsWithHttpInfo", e);
}
ApiResponse<SPARComponentRoot> getSPARByIdResponse = null;
try {
getSPARByIdResponse = apiInstance.getSPARComponentByIdWithHttpInfo(
getSPARComponentsResponse.getData().getData().entrySet().iterator().next().getKey());
Assert.assertTrue("Response should be 200 - Success", getSPARByIdResponse.getStatusCode() == 200);
Assert.assertTrue("Response data should not be null.", getSPARByIdResponse.getData() != null);
Assert.assertEquals("Response result should be of SPARComponent type.", getSPARByIdResponse.getData().getData().getClass(), SPARComponent.class);
} catch (ApiException e) {
CommonFunctions.handleException("ComponentsApi#getVaultComponentByIdWithHttpInfo", e);
}
}
}