use of org.openmrs.ImplementationId in project openmrs-core by openmrs.
the class AdministrationServiceTest method setImplementationId_shouldOverwriteImplementationIdInDatabaseIfExists.
/**
* @see AdministrationService#setImplementationId(ImplementationId)
*/
@Test
@Ignore
public void setImplementationId_shouldOverwriteImplementationIdInDatabaseIfExists() {
executeDataSet("org/openmrs/api/include/AdministrationServiceTest-general.xml");
// sanity check to make sure we have an implementation id
Assert.assertNotNull(adminService.getImplementationId());
// so a NonUniqueObjectException doesn't occur on the global property later
Context.clearSession();
// save a second valid id
ImplementationId validId2 = new ImplementationId();
validId2.setImplementationId("JUNIT-TEST 2");
validId2.setName("JUNIT-TEST (#2) implementation id");
validId2.setPassphrase("This is the junit test passphrase 2");
validId2.setDescription("This is the junit impl id (2) used for testing of the openmrs API only.");
adminService.setImplementationId(validId2);
assertEquals(validId2, adminService.getImplementationId());
}
use of org.openmrs.ImplementationId in project openmrs-core by openmrs.
the class AdministrationServiceTest method setImplementationId_shouldThrowAPIExceptionIfGivenAPipeInTheImplementationIdCode.
/**
* @see AdministrationService#setImplementationId(ImplementationId)
*/
@Test
public void setImplementationId_shouldThrowAPIExceptionIfGivenAPipeInTheImplementationIdCode() {
// save an impl id with an invalid hl7 code
ImplementationId invalidId2 = new ImplementationId();
invalidId2.setImplementationId("pipe|pipe");
invalidId2.setName("an invalid impl id for a unit test");
invalidId2.setPassphrase("some valid passphrase");
invalidId2.setDescription("Some valid description");
try {
adminService.setImplementationId(invalidId2);
fail("An exception should be thrown on an invalid impl id save");
} catch (APIException e) {
// expected exception
}
ImplementationId afterInvalid2 = adminService.getImplementationId();
assertNull("There shouldn't be an impl id defined after setting an invalid impl id", afterInvalid2);
}
use of org.openmrs.ImplementationId in project openmrs-core by openmrs.
the class AdministrationServiceTest method setImplementationId_shouldThrowAPIExceptionIfGivenEmptyImplementationIdObject.
/**
* This uses a try/catch so that we can make sure no blank id is saved to the database.
*
* @see AdministrationService#setImplementationId(ImplementationId)
*/
@Test()
public void setImplementationId_shouldThrowAPIExceptionIfGivenEmptyImplementationIdObject() {
// save a blank impl id. exception thrown
try {
adminService.setImplementationId(new ImplementationId());
fail("An exception should be thrown on a blank impl id save");
} catch (APIException e) {
// expected exception
}
ImplementationId afterBlank = adminService.getImplementationId();
assertNull("There shouldn't be an impl id defined after setting a blank impl id", afterBlank);
}
use of org.openmrs.ImplementationId in project openmrs-core by openmrs.
the class AdministrationServiceTest method setImplementationId_shouldCreateImplementationIdInDatabase.
/**
* @see AdministrationService#setImplementationId(ImplementationId)
*/
@Test
@Ignore
public void setImplementationId_shouldCreateImplementationIdInDatabase() {
// save a valid impl id
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);
assertEquals(validId, adminService.getImplementationId());
}
use of org.openmrs.ImplementationId in project openmrs-core by openmrs.
the class AdministrationServiceTest method setImplementationId_shouldNotFailIfGivenImplementationIdIsNull.
/**
* @see AdministrationService#setImplementationId(ImplementationId)
*/
@Test
public void setImplementationId_shouldNotFailIfGivenImplementationIdIsNull() {
// save a null impl id. no exception thrown
adminService.setImplementationId(null);
ImplementationId afterNull = adminService.getImplementationId();
assertNull("There shouldn't be an impl id defined after setting a null impl id", afterNull);
}
Aggregations