/** * @verifies load objects based on the resource description * @see RestAssuredService#loadObjects(String, com.burkeware.search.api.resource.Resource) */ @Test public void loadObjects_shouldLoadObjectsBasedOnTheResourceDescription() throws Exception { Resource resource = null; resource = Context.getResource("Cohort Resource"); Assert.assertNotNull(resource); service.loadObjects(StringUtil.EMPTY, resource); List<Cohort> cohorts = service.getObjects(StringUtil.EMPTY, Cohort.class); for (Cohort cohort : cohorts) { resource = Context.getResource("Cohort Member Resource"); Assert.assertNotNull(resource); service.loadObjects(cohort.getUuid(), resource); List<Patient> patients = service.getObjects(StringUtil.EMPTY, Patient.class); for (Patient patient : patients) { resource = Context.getResource("Observation Resource"); Assert.assertNotNull(resource); service.loadObjects(patient.getUuid(), resource); } } List<Patient> patients = service.getObjects("name:A*", Patient.class); Assert.assertNotNull(patients); Assert.assertTrue(patients.size() > 0); for (Patient patient : patients) { Assert.assertNotNull(patient); Assert.assertEquals(Patient.class, patient.getClass()); } Patient patient = service.getObject("name: " + StringUtil.quote(REST_PATIENT_NAME), Patient.class); Assert.assertNotNull(patient); Assert.assertEquals(Patient.class, patient.getClass()); }
/** * @verifies return empty list when no object match the search string and class * @see RestAssuredService#getObjects(String, Class) */ @Test public void getObjects_shouldReturnEmptyListWhenNoObjectMatchTheSearchStringAndClass() throws Exception { List<Patient> patients = service.getObjects("name:Zz*", Patient.class); Assert.assertNotNull(patients); Assert.assertTrue(patients.size() == 0); }
/** * @verifies return empty list when no object match the search string and resource * @see RestAssuredService#getObjects(String, com.burkeware.search.api.resource.Resource) */ @Test public void getObjects_shouldReturnEmptyListWhenNoObjectMatchTheSearchStringAndResource() throws Exception { Resource resource = Context.getResource("Cohort Member Resource"); List<Object> patients = service.getObjects("name:Zz*", resource); Assert.assertNotNull(patients); Assert.assertTrue(patients.size() == 0); }
/** * @verifies return all object matching the search search string and class * @see RestAssuredService#getObjects(String, Class) */ @Test public void getObjects_shouldReturnAllObjectMatchingTheSearchSearchStringAndClass() throws Exception { List<Patient> patients = service.getObjects("name:Ab*", Patient.class); Assert.assertNotNull(patients); Assert.assertTrue(patients.size() > 0); for (Patient patient : patients) { Assert.assertNotNull(patient); Assert.assertEquals(Patient.class, patient.getClass()); } }
/** * @verifies return all object matching the search search string and resource * @see RestAssuredService#getObjects(String, com.burkeware.search.api.resource.Resource) */ @Test public void getObjects_shouldReturnAllObjectMatchingTheSearchSearchStringAndResource() throws Exception { Resource resource = Context.getResource("Cohort Member Resource"); List<Object> patients = service.getObjects("name:Ab*", resource); Assert.assertNotNull(patients); Assert.assertTrue(patients.size() > 0); for (Object patient : patients) { Assert.assertNotNull(patient); Assert.assertEquals(Patient.class, patient.getClass()); } }
/** * @verifies load object from filesystem based on the resource description * @see RestAssuredService#loadObjects(String, com.burkeware.search.api.resource.Resource, * java.io.File) */ @Test public void loadObjects_shouldLoadObjectFromFilesystemBasedOnTheResourceDescription() throws Exception { URL corpus = RestAssuredService.class.getResource("sample/corpus"); Resource resource = Context.getResource("Patient Resource"); Assert.assertNotNull(resource); service.loadObjects(StringUtil.EMPTY, resource, new File(corpus.getPath())); List<Patient> patients = service.getObjects("name:Test*", Patient.class); Assert.assertNotNull(patients); Assert.assertTrue(patients.size() > 0); for (Patient patient : patients) { Assert.assertNotNull(patient); Assert.assertEquals(Patient.class, patient.getClass()); } Patient patient = service.getObject("name: " + StringUtil.quote(FILE_PATIENT_NAME), Patient.class); Assert.assertNotNull(patient); Assert.assertEquals(Patient.class, patient.getClass()); }