@Test public void testGetFileNames() throws IOException { String fileUrl = "/" + HttpEndpointConstants.FILE_URL + "?" + HttpEndpointConstants.STAGE_PARAM + "=" + stageName + "&" + HttpEndpointConstants.DOCID_PARAM + "=" + URLEncoder.encode(doc.getID().toJSON(), "UTF-8"); stubFor(get(urlEqualTo(fileUrl)).willReturn(aResponse().withBody("[\"file1\", \"file2\"]"))); List<String> expected = Arrays.asList("file1", "file2"); List<String> actual = rp.getFileNames(doc.getID()); assertEquals(expected, actual); }
@SuppressWarnings("unchecked") public List<String> getFileNames(DocumentID<?> docid) { try { HttpResponse response = core.get(fileUrl + "&" + HttpEndpointConstants.DOCID_PARAM + "=" + URLEncoder.encode(docid.toJSON(), "UTF-8")); if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { try { return (List<String>) SerializationUtils.toObject(EntityUtils.toString(response.getEntity())); } catch (JsonException e) { throw new IOException(e); } } else { logUnexpected("getFileNames()", response); return null; } } catch (IOException e) { throw new RuntimeException(e); } }
HttpRemotePipeline implements RemotePipeline { @SuppressWarnings("unchecked") public List<String> getFileNames(DocumentID<?> docid) { try { HttpResponse response = core.get(fileUrl + "&" + HttpEndpointConstants.DOCID_PARAM + "=" + URLEncoder.encode(docid.toJSON(), "UTF-8")); if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { try { return (List<String>) SerializationUtils.toObject(EntityUtils.toString(response.getEntity())); } catch (JsonException e) { throw new IOException(e); } } else { logUnexpected("getFileNames()", response); return null; } } catch (IOException e) { throw new RuntimeException(e); } } }
HttpRemotePipeline implements RemotePipeline { @SuppressWarnings("unchecked") public List<String> getFileNames(DocumentID<?> docid) { try { HttpResponse response = core.get(fileUrl + "&" + HttpEndpointConstants.DOCID_PARAM + "=" + URLEncoder.encode(docid.toJSON(), "UTF-8")); if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { try { return (List<String>) SerializationUtils.toObject(EntityUtils.toString(response.getEntity())); } catch (JsonException e) { throw new IOException(e); } } else { logUnexpected("getFileNames()", response); return null; } } catch (IOException e) { throw new RuntimeException(e); } } HttpRemotePipeline(String stageName);  HttpRemotePipeline(String hostName, int port, String stageName);  HttpRemotePipeline(String hostName, int port, String stageName, boolean performanceLogging); }
HttpRemotePipeline implements RemotePipeline { @SuppressWarnings("unchecked") public List<String> getFileNames(DocumentID<?> docid) { try { HttpResponse response = core.get(fileUrl + "&" + HttpEndpointConstants.DOCID_PARAM + "=" + URLEncoder.encode(docid.toJSON(), "UTF-8")); if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { try { return (List<String>) SerializationUtils.toObject(EntityUtils.toString(response.getEntity())); } catch (JsonException e) { throw new IOException(e); } } else { logUnexpected("getFileNames()", response); return null; } } catch (IOException e) { throw new RuntimeException(e); } } HttpRemotePipeline(String stageName);  HttpRemotePipeline(String hostName, int port, String stageName);  HttpRemotePipeline(String hostName, int port, String stageName, boolean performanceLogging); @Override LocalDocument getDocument(LocalQuery query); @Override boolean saveFull(LocalDocument d); @Override boolean save(LocalDocument d); @Override boolean markPending(LocalDocument d); @Override boolean markFailed(LocalDocument d); @Override boolean markFailed(LocalDocument d, Throwable t); @Override boolean markProcessed(LocalDocument d); @Override boolean markDiscarded(LocalDocument d); @Override AbstractProcessStage getStageInstance(); DocumentFile<Local> getFile(String fileName, DocumentID<Local> docid); boolean saveFile(DocumentFile<Local> df); boolean deleteFile(String fileName, DocumentID<Local> docid); @SuppressWarnings("unchecked") List<String> getFileNames(DocumentID<?> docid); List<DocumentFile<Local>> getFiles(DocumentID<Local> docid); @Override String getStageName(); @Override boolean isPerformanceLogging(); }
HttpRemotePipeline implements RemotePipeline { @SuppressWarnings("unchecked") public List<String> getFileNames(DocumentID<?> docid) { try { HttpResponse response = core.get(fileUrl + "&" + HttpEndpointConstants.DOCID_PARAM + "=" + URLEncoder.encode(docid.toJSON(), "UTF-8")); if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { try { return (List<String>) SerializationUtils.toObject(EntityUtils.toString(response.getEntity())); } catch (JsonException e) { throw new IOException(e); } } else { logUnexpected("getFileNames()", response); return null; } } catch (IOException e) { throw new RuntimeException(e); } } HttpRemotePipeline(String stageName);  HttpRemotePipeline(String hostName, int port, String stageName);  HttpRemotePipeline(String hostName, int port, String stageName, boolean performanceLogging); @Override LocalDocument getDocument(LocalQuery query); @Override boolean saveFull(LocalDocument d); @Override boolean save(LocalDocument d); @Override boolean markPending(LocalDocument d); @Override boolean markFailed(LocalDocument d); @Override boolean markFailed(LocalDocument d, Throwable t); @Override boolean markProcessed(LocalDocument d); @Override boolean markDiscarded(LocalDocument d); @Override AbstractProcessStage getStageInstance(); DocumentFile<Local> getFile(String fileName, DocumentID<Local> docid); boolean saveFile(DocumentFile<Local> df); boolean deleteFile(String fileName, DocumentID<Local> docid); @SuppressWarnings("unchecked") List<String> getFileNames(DocumentID<?> docid); List<DocumentFile<Local>> getFiles(DocumentID<Local> docid); @Override String getStageName(); @Override boolean isPerformanceLogging();  }