Skip to content

Commit 84623af

Browse files
committed
PLUGIN-1936: Remove unused method and it's references
1 parent 3509614 commit 84623af

8 files changed

Lines changed: 0 additions & 24 deletions

File tree

src/main/java/io/cdap/plugin/servicenow/apiclient/ServiceNowTableAPIClientImpl.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,6 @@ public List<Map<String, String>> parseResponseToResultListOfMap(String responseB
181181
return GSON.fromJson(ja, type);
182182
}
183183

184-
public List<JsonObject> parseInputStreamToJsonList(InputStream in) {
185-
APIResponse apiResponse = GSON.fromJson(new JsonReader(new InputStreamReader(in, StandardCharsets.UTF_8)),
186-
APIResponse.class);
187-
return apiResponse.getResult();
188-
}
189-
190184
private String getErrorMessage(String responseBody) {
191185
try {
192186
JsonObject jo = GSON.fromJson(responseBody, JsonObject.class);

src/test/java/io/cdap/plugin/servicenow/connector/ServiceNowConnectorTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ public void testGenerateSpec() throws Exception {
145145
InputStream inputStream = new ByteArrayInputStream(body);
146146
RestAPIResponse restAPIResponse = new RestAPIResponse(headers, inputStream, null);
147147
Mockito.when(restApi.executeGetWithRetries(Mockito.any())).thenReturn(restAPIResponse);
148-
Mockito.when(restApi.parseInputStreamToJsonList(restAPIResponse.getResponseStream())).thenReturn(result);
149148
OAuthClient oAuthClient = Mockito.mock(OAuthClient.class);
150149
PowerMockito.whenNew(ServiceNowTableAPIClientImpl.class).withAnyArguments().thenReturn(restApi);
151150
OAuthJSONAccessTokenResponse accessTokenResponse = Mockito.mock(OAuthJSONAccessTokenResponse.class);

src/test/java/io/cdap/plugin/servicenow/sink/ServiceNowRecordWriterTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ public void testWriteWithUnSuccessfulApiResponse() throws Exception {
9696
RestAPIResponse restAPIResponse = new RestAPIResponse(
9797
headers, null, null);
9898
Mockito.when(restApi.executePost(Mockito.any())).thenReturn(restAPIResponse);
99-
Mockito.when(restApi.parseInputStreamToJsonList(restAPIResponse.getResponseStream())).thenReturn(result);
10099
OAuthClient oAuthClient = Mockito.mock(OAuthClient.class);
101100
PowerMockito.whenNew(ServiceNowTableAPIClientImpl.class).withAnyArguments().thenReturn(restApi);
102101
OAuthJSONAccessTokenResponse accessTokenResponse = Mockito.mock(OAuthJSONAccessTokenResponse.class);
@@ -140,7 +139,6 @@ public void testWriteWithSuccessFulApiResponse() throws Exception {
140139
Map<String, String> headers = new HashMap<>();
141140
RestAPIResponse restAPIResponse = new RestAPIResponse(headers, null, null);
142141
Mockito.when(restApi.executePost(Mockito.any(RestAPIRequest.class))).thenReturn(restAPIResponse);
143-
Mockito.when(restApi.parseInputStreamToJsonList(restAPIResponse.getResponseStream())).thenReturn(result);
144142
OAuthClient oAuthClient = Mockito.mock(OAuthClient.class);
145143
PowerMockito.whenNew(OAuthClient.class).
146144
withArguments(Mockito.any(URLConnectionClient.class)).thenReturn(oAuthClient);
@@ -188,7 +186,6 @@ public void testWriteWithUnservicedRequests() throws Exception {
188186
Map<String, String> headers = new HashMap<>();
189187
RestAPIResponse restAPIResponse = new RestAPIResponse(headers, null, null);
190188
Mockito.when(restApi.executePost(Mockito.any(RestAPIRequest.class))).thenReturn(restAPIResponse);
191-
Mockito.when(restApi.parseInputStreamToJsonList(restAPIResponse.getResponseStream())).thenReturn(result);
192189
OAuthClient oAuthClient = Mockito.mock(OAuthClient.class);
193190
PowerMockito.whenNew(OAuthClient.class).
194191
withArguments(Mockito.any(URLConnectionClient.class)).thenReturn(oAuthClient);

src/test/java/io/cdap/plugin/servicenow/sink/ServiceNowSinkTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ public void testConfigurePipeline() throws Exception {
9797
MockFailureCollector collector = new MockFailureCollector();
9898
RestAPIResponse restAPIResponse = new RestAPIResponse(headers, inputStream, null);
9999
Mockito.when(restApi.executeGetWithRetries(Mockito.any())).thenReturn(restAPIResponse);
100-
Mockito.when(restApi.parseInputStreamToJsonList(restAPIResponse.getResponseStream())).thenReturn(result);
101100
serviceNowSink.configurePipeline(mockPipelineConfigurer);
102101
Assert.assertNull(restAPIResponse.getException());
103102
Assert.assertEquals(0, collector.getValidationFailures().size());
@@ -136,7 +135,6 @@ public void testPrepareRun() throws Exception {
136135
Mockito.when(context.getInputSchema()).thenReturn(schema);
137136
RestAPIResponse restAPIResponse = new RestAPIResponse(headers, inputStream, null);
138137
Mockito.when(restApi.executeGetWithRetries(Mockito.any())).thenReturn(restAPIResponse);
139-
Mockito.when(restApi.parseInputStreamToJsonList(restAPIResponse.getResponseStream())).thenReturn(result);
140138
OAuthClient oAuthClient = Mockito.mock(OAuthClient.class);
141139
PowerMockito.whenNew(OAuthClient.class).
142140
withArguments(Mockito.any(URLConnectionClient.class)).thenReturn(oAuthClient);

src/test/java/io/cdap/plugin/servicenow/source/ServiceNowInputFormatTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ public void testFetchTableInfo() throws Exception {
150150
Schema schema = Schema.parseJson(schemaString);
151151
RestAPIResponse restAPIResponse = new RestAPIResponse(headers, inputStream, null);
152152
Mockito.when(restApi.executeGetWithRetries(Mockito.any())).thenReturn(restAPIResponse);
153-
Mockito.when(restApi.parseInputStreamToJsonList(restAPIResponse.getResponseStream())).thenReturn(result);
154153
Mockito.when(restApi.fetchTableSchema("table", SourceValueType.SHOW_ACTUAL_VALUE)).thenReturn(schema);
155154
OAuthClient oAuthClient = Mockito.mock(OAuthClient.class);
156155
PowerMockito.whenNew(OAuthClient.class).
@@ -256,7 +255,6 @@ public void testFetchTableInfoReportingMode() throws Exception {
256255
Schema schema = Schema.parseJson(schemaString);
257256
RestAPIResponse restAPIResponse = new RestAPIResponse(headers, inputStream, null);
258257
Mockito.when(restApi.executeGetWithRetries(Mockito.any())).thenReturn(restAPIResponse);
259-
Mockito.when(restApi.parseInputStreamToJsonList(restAPIResponse.getResponseStream())).thenReturn(result);
260258
Mockito.when(restApi.fetchTableSchema("proc_po", SourceValueType.SHOW_ACTUAL_VALUE)).thenReturn(schema);
261259
Mockito.when(restApi.fetchTableSchema("proc_po_item",
262260
SourceValueType.SHOW_ACTUAL_VALUE)).thenReturn(schema);
@@ -303,7 +301,6 @@ public void testFetchTableInfoWithEmptyTableName() throws Exception {
303301
InputStream inputStream = new ByteArrayInputStream(body);
304302
RestAPIResponse restAPIResponse = new RestAPIResponse(headers, inputStream, null);
305303
Mockito.when(restApi.executeGetWithRetries(Mockito.any())).thenReturn(restAPIResponse);
306-
Mockito.when(restApi.parseInputStreamToJsonList(restAPIResponse.getResponseStream())).thenReturn(result);
307304
OAuthClient oAuthClient = Mockito.mock(OAuthClient.class);
308305
PowerMockito.mockStatic(ServiceNowInputFormat.class);
309306
PowerMockito.whenNew(OAuthClient.class).

src/test/java/io/cdap/plugin/servicenow/source/ServiceNowMultiSourceConfigTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ public void testValidate() throws Exception {
187187
InputStream inputStream = new ByteArrayInputStream(body);
188188
RestAPIResponse restAPIResponse = new RestAPIResponse(headers, inputStream, null);
189189
Mockito.when(restApi.executeGetWithRetries(Mockito.any())).thenReturn(restAPIResponse);
190-
Mockito.when(restApi.parseInputStreamToJsonList(restAPIResponse.getResponseStream())).thenReturn(result);
191190
serviceNowMultiSourceConfig.validate(mockFailureCollector);
192191
Assert.assertEquals(0, mockFailureCollector.getValidationFailures().size());
193192

@@ -318,7 +317,6 @@ public void testValidateReferenceName() throws Exception {
318317
InputStream inputStream = new ByteArrayInputStream(body);
319318
RestAPIResponse restAPIResponse = new RestAPIResponse(headers, inputStream, null);
320319
Mockito.when(restApi.executeGetWithRetries(Mockito.any())).thenReturn(restAPIResponse);
321-
Mockito.when(restApi.parseInputStreamToJsonList(restAPIResponse.getResponseStream())).thenReturn(result);
322320
try {
323321
serviceNowMultiSourceConfig.validate(mockFailureCollector);
324322
Assert.fail("Exception is not thrown with valid reference name");
@@ -421,7 +419,6 @@ public void testValidateWhenTableFieldNameIsEmpty() throws Exception {
421419
InputStream inputStream = new ByteArrayInputStream(body);
422420
RestAPIResponse restAPIResponse = new RestAPIResponse(headers, inputStream, null);
423421
Mockito.when(restApi.executeGetWithRetries(Mockito.any())).thenReturn(restAPIResponse);
424-
Mockito.when(restApi.parseInputStreamToJsonList(restAPIResponse.getResponseStream())).thenReturn(result);
425422
serviceNowMultiSourceConfig.validate(mockFailureCollector);
426423
Assert.assertEquals(1, mockFailureCollector.getValidationFailures().size());
427424
Assert.assertEquals("Table name field must be specified.",

src/test/java/io/cdap/plugin/servicenow/source/ServiceNowMultiSourceTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ public void testConfigurePipeline() throws Exception {
162162
InputStream inputStream = new ByteArrayInputStream(body);
163163
RestAPIResponse restAPIResponse = new RestAPIResponse(headers, inputStream, null);
164164
Mockito.when(restApi.executeGetWithRetries(Mockito.any())).thenReturn(restAPIResponse);
165-
Mockito.when(restApi.parseInputStreamToJsonList(restAPIResponse.getResponseStream())).thenReturn(result);
166165
serviceNowMultiSource.configurePipeline(mockPipelineConfigurer);
167166
Assert.assertNull(mockPipelineConfigurer.getOutputSchema());
168167
Assert.assertEquals(0, mockFailureCollector.getValidationFailures().size());
@@ -184,7 +183,6 @@ public void testConfigurePipelineWithEmptyTable() throws Exception {
184183
InputStream inputStream = new ByteArrayInputStream(body);
185184
RestAPIResponse restAPIResponse = new RestAPIResponse(headers, inputStream, null);
186185
Mockito.when(restApi.executeGetWithRetries(Mockito.any())).thenReturn(restAPIResponse);
187-
Mockito.when(restApi.parseInputStreamToJsonList(restAPIResponse.getResponseStream())).thenReturn(result);
188186
try {
189187
serviceNowMultiSource.configurePipeline(mockPipelineConfigurer);
190188
Assert.fail("Exception is not thrown for Non-Empty Tables");
@@ -290,7 +288,6 @@ public void testPrepareRun() throws Exception {
290288
Mockito.when(ServiceNowMultiInputFormat.setInput(Mockito.any(), Mockito.any())).thenReturn((tableInfo));
291289
RestAPIResponse restAPIResponse = new RestAPIResponse(headers, inputStream, null);
292290
Mockito.when(restApi.executeGetWithRetries(Mockito.any())).thenReturn(restAPIResponse);
293-
Mockito.when(restApi.parseInputStreamToJsonList(restAPIResponse.getResponseStream())).thenReturn(result);
294291
OAuthClient oAuthClient = Mockito.mock(OAuthClient.class);
295292
PowerMockito.whenNew(OAuthClient.class).
296293
withArguments(Mockito.any(URLConnectionClient.class)).thenReturn(oAuthClient);

src/test/java/io/cdap/plugin/servicenow/source/ServiceNowSourceTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ public void testConfigurePipeline() throws Exception {
177177
Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(tableInfo);
178178
RestAPIResponse restAPIResponse = new RestAPIResponse(headers, inputStream, null);
179179
Mockito.when(restApi.executeGetWithRetries(Mockito.any())).thenReturn(restAPIResponse);
180-
Mockito.when(restApi.parseInputStreamToJsonList(restAPIResponse.getResponseStream())).thenReturn(result);
181180
OAuthClient oAuthClient = Mockito.mock(OAuthClient.class);
182181
PowerMockito.whenNew(OAuthClient.class).
183182
withArguments(Mockito.any(URLConnectionClient.class)).thenReturn(oAuthClient);
@@ -217,7 +216,6 @@ public void testConfigurePipelineWithEmptyTable() throws Exception {
217216
InputStream inputStream = new ByteArrayInputStream(body);
218217
RestAPIResponse restAPIResponse = new RestAPIResponse(headers, inputStream, null);
219218
Mockito.when(restApi.executeGetWithRetries(Mockito.any())).thenReturn(restAPIResponse);
220-
Mockito.when(restApi.parseInputStreamToJsonList(restAPIResponse.getResponseStream())).thenReturn(result);
221219
try {
222220
serviceNowSource.configurePipeline(mockPipelineConfigurer);
223221
Assert.fail("Exception is not thrown for Non-Empty Tables");
@@ -307,7 +305,6 @@ public void testPrepareRun() throws Exception {
307305
InputStream inputStream = new ByteArrayInputStream(body);
308306
RestAPIResponse restAPIResponse = new RestAPIResponse(headers, inputStream, null);
309307
PowerMockito.when(restApi.executeGetWithRetries(Mockito.any())).thenReturn(restAPIResponse);
310-
Mockito.when(restApi.parseInputStreamToJsonList(restAPIResponse.getResponseStream())).thenReturn(result);
311308
OAuthClient oAuthClient = Mockito.mock(OAuthClient.class);
312309
PowerMockito.whenNew(OAuthClient.class).
313310
withArguments(Mockito.any(URLConnectionClient.class)).thenReturn(oAuthClient);

0 commit comments

Comments
 (0)