/** * Fetches a conceptReferenceTerm by uuid * * @see DelegatingCrudResource#getByUniqueId(java.lang.String) */ @Override public ConceptReferenceTermMap getByUniqueId(String uuid) { return Context.getService(RestHelperService.class).getObjectByUuid(ConceptReferenceTermMap.class, uuid); }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getByUniqueId(java.lang.String) */ @Override public ConceptMap getByUniqueId(String uniqueId) { return Context.getService(RestHelperService.class).getObjectByUuid(ConceptMap.class, uniqueId); }
@Override public EncounterProvider getByUniqueId(String uniqueId) { return Context.getService(RestHelperService.class).getObjectByUuid(EncounterProvider.class, uniqueId); }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResourceTest#newObject() */ @Override public ConceptMap newObject() { return Context.getService(RestHelperService.class).getObjectByUuid(ConceptMap.class, getUuidProperty()); }
@Override public ConceptReferenceTermMap newObject() { return Context.getService(RestHelperService.class).getObjectByUuid(ConceptReferenceTermMap.class, getUuidProperty()); }
@Test public void shouldCreateConceptReferenceTermMap() throws Exception { String termA = RestTestConstants1_9.CONCEPT_REFERENCE_TERM_UUID; String termB = RestTestConstants1_9.CONCEPT_REFERENCE_TERM2_UUID; String json = "{\"termA\": \"" + termA + "\", " + "\"termB\": \"" + termB + "\", " + "\"conceptMapType\": \"" + RestTestConstants1_9.CONCEPT_MAP_TYPE_UUID + "\"}"; SimpleObject result = deserialize(handle(newPostRequest(getURI(), json))); String uuid = (String) result.get("uuid"); ConceptReferenceTermMap termMap = service.getObjectByUuid(ConceptReferenceTermMap.class, uuid); assertThat(termMap.getTermA().getUuid(), is(termA)); assertThat(termMap.getTermB().getUuid(), is(termB)); assertThat(termMap.getConceptMapType().getUuid(), is(RestTestConstants1_9.CONCEPT_MAP_TYPE_UUID)); }
@Test public void shouldEditingConceptReferenceTerm() throws Exception { String json = "{\"termB\": \"" + RestTestConstants1_9.CONCEPT_REFERENCE_TERM2_UUID + "\"}"; handle(newPostRequest(getURI() + "/" + getUuid(), json)); ConceptReferenceTermMap termMap = service.getObjectByUuid(ConceptReferenceTermMap.class, getUuid()); assertThat(termMap.getTermB().getUuid(), is(RestTestConstants1_9.CONCEPT_REFERENCE_TERM2_UUID)); }
@Test public void shouldEditAnOrderSetMember() throws Exception { OrderSetMember orderSetMember = Context.getService(RestHelperService.class).getObjectByUuid(OrderSetMember.class, orderSetMemberUuid); Assert.assertEquals(null, orderSetMember.getOrderTemplate()); String json = "{\n" + "\"orderTemplate\": \"NEW TEST TEMPLATE\"\n" + " }"; deserialize(handle(newPostRequest(getURI() + "/" + getUuid(), json))); Assert.assertTrue(PropertyUtils.getProperty(orderSetMember, "orderTemplate").equals("NEW TEST TEMPLATE")); }
@Test public void shouldEditConceptMap() throws Exception { String json = "{\"sourceCode\": \"test\"}"; handle(newPostRequest(getURI() + "/" + getUuid(), json)); ConceptMap conceptMap = restHelperService.getObjectByUuid(ConceptMap.class, getUuid()); assertThat(conceptMap.getSourceCode(), is("test")); }
@Test public void shouldCreateConceptMap() throws Exception { String json = "{\"source\": \"" + RestTestConstants1_8.CONCEPT_SOURCE_UUID + "\", \"sourceCode\": \"test\"}"; SimpleObject newConceptMap = deserialize(handle(newPostRequest(getURI(), json))); String uuid = (String) newConceptMap.get("uuid"); ConceptMap conceptMap = restHelperService.getObjectByUuid(ConceptMap.class, uuid); assertThat(conceptMap.getConcept().getUuid(), is(RestTestConstants1_8.CONCEPT2_UUID)); assertThat(conceptMap.getSource().getUuid(), is(RestTestConstants1_8.CONCEPT_SOURCE_UUID)); assertThat(conceptMap.getSourceCode(), is("test")); }
@Test public void shouldEditConceptMap() throws Exception { String json = "{\"conceptReferenceTerm\": \"" + RestTestConstants1_9.CONCEPT_REFERENCE_TERM_UUID + "\"}"; handle(newPostRequest(getURI() + "/" + getUuid(), json)); ConceptMap conceptMap = restHelperService.getObjectByUuid(ConceptMap.class, getUuid()); assertThat(conceptMap.getConceptReferenceTerm().getUuid(), is(RestTestConstants1_9.CONCEPT_REFERENCE_TERM_UUID)); }
@Test public void shouldCreateConceptMap() throws Exception { String json = "{\"conceptReferenceTerm\": \"" + RestTestConstants1_9.CONCEPT_REFERENCE_TERM_UUID + "\", \"conceptMapType\": \"" + RestTestConstants1_9.CONCEPT_MAP_TYPE_UUID + "\"}"; SimpleObject newConceptMap = deserialize(handle(newPostRequest(getURI(), json))); String uuid = (String) newConceptMap.get("uuid"); ConceptMap conceptMap = restHelperService.getObjectByUuid(ConceptMap.class, uuid); assertThat(conceptMap.getConcept().getUuid(), is(RestTestConstants1_9.CONCEPT_UUID)); assertThat(conceptMap.getConceptMapType().getUuid(), is(RestTestConstants1_9.CONCEPT_MAP_TYPE_UUID)); assertThat(conceptMap.getConceptReferenceTerm().getUuid(), is(RestTestConstants1_9.CONCEPT_REFERENCE_TERM_UUID)); }
@Test public void shouldPurgeConceptMap() throws Exception { handle(newDeleteRequest(getURI() + "/" + getUuid(), new Parameter("purge", ""))); assertNull(restHelperService.getObjectByUuid(ConceptMap.class, getUuid())); } }
@Test public void shouldPurgeConceptMap() throws Exception { handle(newDeleteRequest(getURI() + "/" + getUuid(), new Parameter("purge", ""))); assertNull(restHelperService.getObjectByUuid(ConceptMap.class, getUuid())); } }
@Test public void shouldPurgeConceptReferenceTerm() throws Exception { handle(newDeleteRequest(getURI() + "/" + getUuid(), new Parameter("purge", "true"))); assertNull(service.getObjectByUuid(ConceptReferenceTermMap.class, getUuid())); }