Ejemplo n.º 1
0
 @Test
 public void testRepresent() throws Exception {
   ChatListResource userResource =
       (ChatListResource) ServiceLocator.getAppContext().getBean("chatlistresource_1");
   DomRepresentation repr =
       (DomRepresentation) userResource.represent(new Variant(MediaType.TEXT_XML));
   String result = testHelper.indentXml(repr.getDocument());
   assertEquals(
       testHelper.getExpectedString("/org/bds/touch/rest/chatlistresource_expected_1.txt"),
       result);
 }
Ejemplo n.º 2
0
 /**
  * @param subPath
  * @throws IOException
  * @throws DOMException
  */
 private void getAndCheckJaxb(String subPath) throws Exception {
   final Response response = get(subPath);
   assertEquals(Status.SUCCESS_OK, response.getStatus());
   final DomRepresentation entity = response.getEntityAsDom();
   final Node xml = entity.getDocument().getFirstChild();
   System.out.println(subPath + ": " + entity.getText());
   assertEquals("person", xml.getNodeName());
   final NodeList nodeList = xml.getChildNodes();
   Node node = nodeList.item(0);
   assertEquals("firstname", node.getNodeName());
   assertEquals("Angela", node.getFirstChild().getNodeValue());
   node = nodeList.item(1);
   assertEquals("lastname", node.getNodeName());
   assertEquals("Merkel", node.getFirstChild().getNodeValue());
   assertEquals(2, nodeList.getLength());
 }