Example #1
0
  @Test
  public void testGetAllTagsPatientIdVersion() throws Exception {

    HttpGet httpGet =
        new HttpGet("http://localhost:" + ourPort + "/Patient/111/_history/222/_tags");
    HttpResponse status = ourClient.execute(httpGet);

    String responseContent = IOUtils.toString(status.getEntity().getContent());
    IOUtils.closeQuietly(status.getEntity().getContent());

    ourLog.info("Response was:\n{}", responseContent);

    assertEquals(200, status.getStatusLine().getStatusCode());

    TagList actual = ourCtx.newXmlParser().parseTagList(responseContent);
    TagList expected = new TagList();
    expected.addTag(null, "Patient111222", "DogLabel");
    expected.addTag("http://cats", "AllCat", "CatLabel");
    assertEquals(expected, actual);
  }
Example #2
0
  @Test
  public void testAddTagsById() throws Exception {

    TagList tagList = new TagList();
    tagList.addTag("scheme", "term", "label");

    HttpPost httpPost = new HttpPost("http://localhost:" + ourPort + "/Patient/111/_tags");
    httpPost.setEntity(
        new StringEntity(
            ourCtx.newJsonParser().encodeTagListToString(tagList),
            ContentType.create(EncodingEnum.JSON.getResourceContentType(), "UTF-8")));
    HttpResponse status = ourClient.execute(httpPost);

    String responseContent = IOUtils.toString(status.getEntity().getContent());
    IOUtils.closeQuietly(status.getEntity().getContent());

    ourLog.info("Response was:\n{}", responseContent);

    assertEquals(200, status.getStatusLine().getStatusCode());
    assertEquals("add111", ourLastOutcome);
    assertEquals(tagList, ourLastTagList);
  }