use of net.codestory.rest.RestAssert in project datashare by ICIJ.
the class TaskResourceTest method test_findNames_with_sync_models_false.
@Test
public void test_findNames_with_sync_models_false() {
AbstractModels.syncModels(true);
RestAssert response = post("/api/task/findNames/EMAIL", "{\"options\":{\"syncModels\":\"false\", \"waitForNlpApp\": false}}");
response.should().haveType("application/json");
assertThat(AbstractModels.isSync()).isFalse();
}
use of net.codestory.rest.RestAssert in project datashare by ICIJ.
the class TaskResourceTest method test_index_file.
@Test
public void test_index_file() {
RestAssert response = post("/api/task/batchUpdate/index/" + getClass().getResource("/docs/doc.txt").getPath().substring(1), "{}");
ShouldChain responseBody = response.should().haveType("application/json");
List<String> taskNames = taskManager.waitTasksToBeDone(1, SECONDS).stream().map(t -> t.name).collect(toList());
responseBody.should().contain(format("{\"name\":\"%s\"", taskNames.get(0)));
responseBody.should().contain(format("{\"name\":\"%s\"", taskNames.get(1)));
}
use of net.codestory.rest.RestAssert in project datashare by ICIJ.
the class TaskResourceTest method test_findNames_should_create_resume.
@Test
public void test_findNames_should_create_resume() {
RestAssert response = post("/api/task/findNames/EMAIL", "{\"options\":{\"waitForNlpApp\": false}}");
response.should().haveType("application/json");
List<String> taskNames = taskManager.waitTasksToBeDone(1, SECONDS).stream().map(t -> t.name).collect(toList());
assertThat(taskNames.size()).isEqualTo(2);
verify(taskFactory).createResumeNlpTask(local(), singleton(Pipeline.Type.EMAIL));
ArgumentCaptor<Pipeline> pipelineArgumentCaptor = ArgumentCaptor.forClass(Pipeline.class);
HashMap<String, String> properties = getDefaultProperties();
properties.put("waitForNlpApp", "false");
verify(taskFactory).createNlpTask(eq(local()), pipelineArgumentCaptor.capture(), eq(new PropertiesProvider(properties).getProperties()), any());
assertThat(pipelineArgumentCaptor.getValue().getType()).isEqualTo(Pipeline.Type.EMAIL);
}
Aggregations