Resource doc = createSourceDoc(docName, false);
List<TextFlow> textFlows = doc.getTextFlows();
textFlows.clear();
TextFlow textFlow = new TextFlow("tf1");
textFlow.setContents("hello world!");
textFlows.add(textFlow);
TextFlow tf3 = new TextFlow("tf3");
tf3.setContents("more text");
textFlows.add(tf3);
// Marshaller m = null;
// JAXBContext jc = JAXBContext.newInstance(Resource.class);
// m = jc.createMarshaller();
// m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
// m.marshal(doc, System.out);
Response response = sourceDocResource.putResource(docUrl, doc, null);
assertThat(response.getStatus(), is(Status.CREATED.getStatusCode()));
assertThat(response.getMetadata().getFirst("Location").toString(),
endsWith(RESOURCE_PATH + docUrl));
ClientResponse<Resource> documentResponse =
sourceDocResource.getResource(docUrl, null);
assertThat(documentResponse.getResponseStatus(), is(Status.OK));
doc = documentResponse.getEntity();
assertThat(doc.getRevision(), is(1));
assertThat("Should have textFlows", doc.getTextFlows(), notNullValue());
assertThat("Should have 2 textFlows", doc.getTextFlows().size(), is(2));
assertThat("Should have tf1 textFlow", doc.getTextFlows().get(0)
.getId(), is("tf1"));
assertThat("Container1 should have tf3 textFlow", doc.getTextFlows()
.get(1).getId(), is(tf3.getId()));
textFlow = doc.getTextFlows().get(0);
textFlow.setId("tf2");
response = sourceDocResource.putResource(docUrl, doc, null);