Search in sources :

Example 1 with CountryCriteria

use of de.symeda.sormas.api.infrastructure.country.CountryCriteria in project SORMAS-Project by hzi-braunschweig.

the class CountryFacadeEjbTest method testCount.

@Test
public void testCount() {
    creator.createCountry("Romania", "ROU", "642");
    creator.createCountry("Germany", "DEU", "276");
    CountryCriteria criteria = new CountryCriteria().nameCodeLike("ROU");
    long count = getCountryFacade().count(criteria);
    assertEquals(1, count);
}
Also used : CountryCriteria(de.symeda.sormas.api.infrastructure.country.CountryCriteria) Test(org.junit.Test) AbstractBeanTest(de.symeda.sormas.backend.AbstractBeanTest)

Example 2 with CountryCriteria

use of de.symeda.sormas.api.infrastructure.country.CountryCriteria in project SORMAS-Project by hzi-braunschweig.

the class CountryImporterTest method testDontImportDuplicateCountry.

@Test
public void testDontImportDuplicateCountry() throws IOException, InvalidColumnException, InterruptedException, CsvValidationException, URISyntaxException {
    TestDataCreator.RDCF rdcf = new TestDataCreator().createRDCF("Default Region", "Default District", "Default Community", "Default Facility");
    UserDto user = creator.createUser(rdcf.region.getUuid(), rdcf.district.getUuid(), rdcf.facility.getUuid(), "Default", "User", UserRole.ADMIN);
    File countryCsvFile = new File(getClass().getClassLoader().getResource("sormas_country_import_test.csv").toURI());
    InfrastructureImporter importer = new CountryImporterExtension(countryCsvFile, user);
    assertEquals(ImportResultStatus.COMPLETED_WITH_ERRORS, importer.runImport());
    assertEquals(1, getCountryFacade().count(new CountryCriteria()));
}
Also used : CountryCriteria(de.symeda.sormas.api.infrastructure.country.CountryCriteria) UserDto(de.symeda.sormas.api.user.UserDto) TestDataCreator(de.symeda.sormas.ui.TestDataCreator) File(java.io.File) AbstractBeanTest(de.symeda.sormas.ui.AbstractBeanTest) Test(org.junit.Test)

Example 3 with CountryCriteria

use of de.symeda.sormas.api.infrastructure.country.CountryCriteria in project SORMAS-Project by hzi-braunschweig.

the class CountryFacadeEjbTest method testGetIndexList.

@Test
public void testGetIndexList() {
    Country expected = creator.createCountry("Romania", "ROU", "642");
    creator.createCountry("Germany", "DEU", "276");
    CountryCriteria criteria = new CountryCriteria().nameCodeLike("ROU");
    List<CountryIndexDto> actualList = getCountryFacade().getIndexList(criteria, null, null, null);
    assertEquals(1, actualList.size());
    CountryIndexDto actual = actualList.get(0);
    assertEquals(expected.getUuid(), actual.getUuid());
    assertEquals(expected.getIsoCode(), actual.getIsoCode());
}
Also used : CountryCriteria(de.symeda.sormas.api.infrastructure.country.CountryCriteria) Country(de.symeda.sormas.backend.infrastructure.country.Country) CountryIndexDto(de.symeda.sormas.api.infrastructure.country.CountryIndexDto) Test(org.junit.Test) AbstractBeanTest(de.symeda.sormas.backend.AbstractBeanTest)

Aggregations

CountryCriteria (de.symeda.sormas.api.infrastructure.country.CountryCriteria)3 Test (org.junit.Test)3 AbstractBeanTest (de.symeda.sormas.backend.AbstractBeanTest)2 CountryIndexDto (de.symeda.sormas.api.infrastructure.country.CountryIndexDto)1 UserDto (de.symeda.sormas.api.user.UserDto)1 Country (de.symeda.sormas.backend.infrastructure.country.Country)1 AbstractBeanTest (de.symeda.sormas.ui.AbstractBeanTest)1 TestDataCreator (de.symeda.sormas.ui.TestDataCreator)1 File (java.io.File)1