@Test public void testPrepareNextRequestUrlNotNull() throws Exception { CloseableHttpResponse httpResponse = mock(CloseableHttpResponse.class); Header header = new BasicHeader("Link", "</api/next>; rel=\"next\""); when(httpResponse.getAllHeaders()).thenReturn(new Header[] {header}); HttpRequest result = SoftwareHeritageOriginsImporter.prepareNextRequest(httpResponse); assertNotNull(result); assertEquals("/api/next", result.getRequestLine().getUri()); }
protected static HttpRequest prepareNextRequest(CloseableHttpResponse httpResponse) { String nextUrl = getNextLinkFromHeaders(httpResponse.getAllHeaders()); if (StringUtils.isNotBlank(nextUrl)) { return new HttpGet(nextUrl); } else { return null; } }
SoftwareHeritageOriginsImporter implements eu.dnetlib.iis.common.java.Process { protected static HttpRequest prepareNextRequest(CloseableHttpResponse httpResponse) { String nextUrl = getNextLinkFromHeaders(httpResponse.getAllHeaders()); if (StringUtils.isNotBlank(nextUrl)) { return new HttpGet(nextUrl); } else { return null; } } }
SoftwareHeritageOriginsImporter implements eu.dnetlib.iis.common.java.Process { protected static HttpRequest prepareNextRequest(CloseableHttpResponse httpResponse) { String nextUrl = getNextLinkFromHeaders(httpResponse.getAllHeaders()); if (StringUtils.isNotBlank(nextUrl)) { return new HttpGet(nextUrl); } else { return null; } } SoftwareHeritageOriginsImporter(); }
SoftwareHeritageOriginsImporter implements eu.dnetlib.iis.common.java.Process { protected static HttpRequest prepareNextRequest(CloseableHttpResponse httpResponse) { String nextUrl = getNextLinkFromHeaders(httpResponse.getAllHeaders()); if (StringUtils.isNotBlank(nextUrl)) { return new HttpGet(nextUrl); } else { return null; } } SoftwareHeritageOriginsImporter(); @Override Map<String, PortType> getInputPorts(); @Override Map<String, PortType> getOutputPorts(); @Override void run(PortBindings portBindings, Configuration conf, Map<String, String> parameters); }
SoftwareHeritageOriginsImporter implements eu.dnetlib.iis.common.java.Process { protected static HttpRequest prepareNextRequest(CloseableHttpResponse httpResponse) { String nextUrl = getNextLinkFromHeaders(httpResponse.getAllHeaders()); if (StringUtils.isNotBlank(nextUrl)) { return new HttpGet(nextUrl); } else { return null; } } SoftwareHeritageOriginsImporter(); @Override Map<String, PortType> getInputPorts(); @Override Map<String, PortType> getOutputPorts(); @Override void run(PortBindings portBindings, Configuration conf, Map<String, String> parameters); static final String DEFAULT_METAFILE_NAME; }