@GetTags(type = Patient.class) public TagList getAllTagsPatient() { TagList tagList = new TagList(); tagList.add(new Tag((String) null, "Patient", "DogLabel")); tagList.add(new Tag("http://cats", "AllCat", "CatLabel")); return tagList; }
@GetTags public TagList getAllTags() { TagList tagList = new TagList(); tagList.add(new Tag((String) null, "AllDog", "DogLabel")); tagList.add(new Tag("http://cats", "AllCat", "CatLabel")); return tagList; }
@GetTags(type = Observation.class) public TagList getAllTagsObservationIdVersion(@IdParam IdDt theId) { TagList tagList = new TagList(); tagList.add( new Tag( (String) null, "Patient" + theId.getIdPart() + theId.getVersionIdPart(), "DogLabel")); tagList.add(new Tag("http://cats", "AllCat", "CatLabel")); return tagList; }
@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); }
@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); }