/** * Send segment json using default settings. * * @param uri URI * @param jsonString Segment json string * @return Response * @throws IOException * @throws HttpErrorStatusException */ public SimpleHttpResponse sendSegmentJson(URI uri, String jsonString) throws IOException, HttpErrorStatusException { return sendSegmentJson(uri, jsonString, null, null, DEFAULT_SOCKET_TIMEOUT_MS); }
@Test public void testSendFileWithJson() throws Exception { ObjectNode segmentJson = JsonUtils.newObjectNode(); segmentJson.put(CommonConstants.Segment.Offline.DOWNLOAD_URL, TEST_URI); String jsonString = segmentJson.toString(); try (FileUploadDownloadClient fileUploadDownloadClient = new FileUploadDownloadClient()) { SimpleHttpResponse response = fileUploadDownloadClient .sendSegmentJson(FileUploadDownloadClient.getUploadSegmentHttpURI(TEST_HOST, TEST_PORT), jsonString); Assert.assertEquals(response.getStatusCode(), HttpStatus.SC_OK); Assert.assertEquals(response.getResponse(), "OK"); } }