use of de.symeda.sormas.api.infrastructure.country.CountryDto in project SORMAS-Project by hzi-braunschweig.
the class CountryFacadeEjb method toDto.
@Override
public CountryDto toDto(Country entity) {
if (entity == null) {
return null;
}
CountryDto dto = new CountryDto();
DtoHelper.fillDto(dto, entity);
dto.setDefaultName(entity.getDefaultName());
dto.setArchived(entity.isArchived());
dto.setExternalId(entity.getExternalId());
dto.setIsoCode(entity.getIsoCode());
dto.setUnoCode(entity.getUnoCode());
dto.setUuid(entity.getUuid());
dto.setSubcontinent(SubcontinentFacadeEjb.toReferenceDto(entity.getSubcontinent()));
dto.setCentrallyManaged(entity.isCentrallyManaged());
return dto;
}
use of de.symeda.sormas.api.infrastructure.country.CountryDto in project SORMAS-Project by hzi-braunschweig.
the class CountryFacadeEjbTest method testDearchive.
@Test
public void testDearchive() {
Country country = creator.createCountry("Romania", "ROU", "642");
country.setArchived(true);
getCountryFacade().dearchive(country.getUuid());
CountryDto actual = getCountryFacade().getByUuid(country.getUuid());
assertFalse(actual.isArchived());
}
use of de.symeda.sormas.api.infrastructure.country.CountryDto in project SORMAS-Project by hzi-braunschweig.
the class CountryFacadeEjbTest method testGetAllAfter.
@Test
public void testGetAllAfter() throws InterruptedException {
Country country1 = creator.createCountry("Romania", "ROU", "642");
getCountryService().doFlush();
Date date = new Date();
assertEquals(0, getCommunityFacade().getAllAfter(date).size());
// delay ignoring known rounding issues in change date filter
Thread.sleep(1);
Country country2 = creator.createCountry("Germany", "DEU", "276");
getCountryService().doFlush();
List<CountryDto> results = getCountryFacade().getAllAfter(date);
// List should have one entry
assertEquals(1, results.size());
assertTrue(entityIsEqualToDto(country2, results.get(0)));
}
use of de.symeda.sormas.api.infrastructure.country.CountryDto in project SORMAS-Project by hzi-braunschweig.
the class CountryFacadeEjbTest method testSaveCountrySuccessful.
@Test
public void testSaveCountrySuccessful() throws Exception {
CountryDto expected = new CountryDto();
expected.setDefaultName("Romania");
expected.setIsoCode("ROU");
expected.setUnoCode("642");
String uuid = getCountryFacade().save(expected).getUuid();
expected.setUuid(uuid);
Country actual = getCountryService().getByIsoCode("ROU", false).orElseThrow(() -> new Exception("Country not found"));
assertTrue(entityIsEqualToDto(actual, expected));
}
use of de.symeda.sormas.api.infrastructure.country.CountryDto in project SORMAS-Project by hzi-braunschweig.
the class CountryFacadeEjbTest method testGetCountryByUuid.
@Test
public void testGetCountryByUuid() {
Country expected = creator.createCountry("Romania", "ROU", "642");
getCountryService().doFlush();
CountryDto actual = getCountryFacade().getByUuid(expected.getUuid());
assertTrue(entityIsEqualToDto(expected, actual));
}
Aggregations