use of org.wikidata.query.rdf.blazegraph.mwapi.MWApiServiceCall.ResultWithContinue in project wikidata-query-rdf by wikimedia.
the class MWApiServiceCallUnitTest method testResultsNoContinue.
@Test
public void testResultsNoContinue() throws Exception {
List<OutputVariable> outputVars = ImmutableList.of(new OutputVariable(makeVariable("var"), "@name"));
when(template.getItemsPath()).thenReturn("/api/result");
InputStream responseStream = new ByteArrayInputStream("<api><header value=\"heading\"></header><result name=\"result1\">datadata</result></api>".getBytes("UTF-8"));
ResultWithContinue results = createCall(outputVars).parseResponse(responseStream, binding);
assertNull(results.getContinue());
}
use of org.wikidata.query.rdf.blazegraph.mwapi.MWApiServiceCall.ResultWithContinue in project wikidata-query-rdf by wikimedia.
the class MWApiServiceCallUnitTest method testResultsWithContinue.
@Test
public void testResultsWithContinue() throws Exception {
List<OutputVariable> outputVars = ImmutableList.of(new OutputVariable(makeVariable("var"), "@name"));
when(template.getItemsPath()).thenReturn("/api/result");
InputStream responseStream = new ByteArrayInputStream("<api><continue sroffset=\"5\" continue=\"-||\"></continue><header value=\"heading\"></header><result name=\"result1\">datadata</result></api>".getBytes("UTF-8"));
ResultWithContinue results = createCall(outputVars).parseResponse(responseStream, binding);
Map<String, String> continueMap = results.getContinue();
assertThat(continueMap.keySet(), containsInAnyOrder("sroffset", "continue"));
assertThat(continueMap, hasEntry("sroffset", "5"));
assertThat(continueMap, hasEntry("continue", "-||"));
}
Aggregations