@Test public void saveGlobalProperties_shouldAssignUuidToAllNewProperties() { // get the current global properties List<GlobalProperty> globalProperties = adminService.getAllGlobalProperties(); // and now add a new one to it and save it globalProperties.add(new GlobalProperty("new prop", "new prop value", "desc")); adminService.saveGlobalProperties(globalProperties); assertNotNull(adminService.getGlobalPropertyObject("new prop").getUuid()); }
@Test @Ignore public void setImplementationId_shouldSetUuidOnImplementationIdGlobalProperty() { ImplementationId validId = new ImplementationId(); validId.setImplementationId("JUNIT-TEST"); validId.setName("JUNIT-TEST implementation id"); validId.setPassphrase("This is the junit test passphrase"); validId.setDescription("This is the junit impl id used for testing of the openmrs API only."); adminService.setImplementationId(validId); GlobalProperty gp = adminService.getGlobalPropertyObject(OpenmrsConstants.GLOBAL_PROPERTY_IMPLEMENTATION_ID); assertNotNull(gp.getUuid()); }
@Test public void shouldGetASystemSettingWithDotByName() throws Exception { final String name = "concept.defaultConceptMapType"; MockHttpServletRequest req = request(RequestMethod.GET, getURI() + "/" + name); SimpleObject result = deserialize(handle(req)); GlobalProperty gp = service.getGlobalPropertyObject(name); assertEquals(gp.getUuid(), PropertyUtils.getProperty(result, "uuid")); assertEquals(gp.getProperty(), PropertyUtils.getProperty(result, "property")); assertEquals(gp.getDescription(), PropertyUtils.getProperty(result, "description")); assertEquals(gp.getValue(), PropertyUtils.getProperty(result, "value")); } }
@Test public void shouldGetASystemSettingByName() throws Exception { final String name = service.getAllGlobalProperties().get(0).getProperty(); MockHttpServletRequest req = request(RequestMethod.GET, getURI() + "/" + name); SimpleObject result = deserialize(handle(req)); GlobalProperty gp = service.getGlobalPropertyObject(name); assertEquals(gp.getUuid(), PropertyUtils.getProperty(result, "uuid")); assertEquals(gp.getProperty(), PropertyUtils.getProperty(result, "property")); assertEquals(gp.getDescription(), PropertyUtils.getProperty(result, "description")); assertEquals(gp.getValue(), PropertyUtils.getProperty(result, "value")); }
@Test public void shouldFindASystemSettingWithUUID() throws Exception { SimpleObject property = deserialize(handle(newGetRequest(getURI() + "/" + getUuid()))); GlobalProperty expectedProperty = service.getGlobalPropertyByUuid(getUuid()); assertNotNull(property); assertEquals(expectedProperty.getUuid(), PropertyUtils.getProperty(property, "uuid")); assertEquals(expectedProperty.getProperty(), PropertyUtils.getProperty(property, "property")); assertEquals(expectedProperty.getValue(), PropertyUtils.getProperty(property, "value")); }