@Test
public void getDocumentWithResources() throws Exception {
LocaleId nbLocale = new LocaleId("de");
String docName = "my/path/document.txt";
String docUri = RestUtil.convertToDocumentURIId(docName);
Resource resource = createSourceDoc(docName, true);
sourceDocResource.putResource(docUri, resource, null);
TranslationsResource trans = createTargetDoc();
transResource.putTranslations(docUri, nbLocale, trans, null);
{
ClientResponse<Resource> response =
sourceDocResource.getResource(docUri, null);
assertThat(response.getResponseStatus(), is(Status.OK));
Resource doc = response.getEntity();
assertThat(doc.getTextFlows().size(), is(1));
}
ClientResponse<TranslationsResource> response =
transResource.getTranslations(docUri, nbLocale, null);
assertThat(response.getResponseStatus(), is(Status.OK));
TranslationsResource doc = response.getEntity();
assertThat("should have one textFlow", doc.getTextFlowTargets().size(),
is(1));
TextFlowTarget tft = doc.getTextFlowTargets().get(0);
assertThat(tft, notNullValue());
assertThat("should have a textflow with this id", tft.getResId(),
is("tf1"));