diff --git a/avni-server-api/src/test/java/org/avni/server/common/AbstractControllerIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/common/AbstractControllerIntegrationTest.java index 468812b31..f8e9e5697 100644 --- a/avni-server-api/src/test/java/org/avni/server/common/AbstractControllerIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/common/AbstractControllerIntegrationTest.java @@ -12,7 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.http.ResponseEntity; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; diff --git a/avni-server-api/src/test/java/org/avni/server/dao/SubjectMigrationIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/dao/SubjectMigrationIntegrationTest.java index cac20b5e3..e9c6e7550 100644 --- a/avni-server-api/src/test/java/org/avni/server/dao/SubjectMigrationIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/dao/SubjectMigrationIntegrationTest.java @@ -61,7 +61,7 @@ public class SubjectMigrationIntegrationTest extends AbstractControllerIntegrati private List getMigrations(SubjectType subjectType, DateTime lastModifiedDateTime, DateTime now) { CollectionModel> migrations = subjectMigrationController.getMigrationsByCatchmentAndLastModified(lastModifiedDateTime, now, subjectType.getUuid(), PageRequest.of(0, 10)); - return migrations.getContent().stream().map(Resource::getContent).collect(Collectors.toList()); + return migrations.getContent().stream().map(EntityModel::getContent).collect(Collectors.toList()); } private boolean hasMigrationFor(SubjectType subjectType, DateTime lastModifiedDateTime, DateTime now, Individual subject) { diff --git a/avni-server-api/src/test/java/org/avni/server/dao/application/FormElementRepositoryTest.java b/avni-server-api/src/test/java/org/avni/server/dao/application/FormElementRepositoryTest.java index fce42cea0..3a8d63612 100644 --- a/avni-server-api/src/test/java/org/avni/server/dao/application/FormElementRepositoryTest.java +++ b/avni-server-api/src/test/java/org/avni/server/dao/application/FormElementRepositoryTest.java @@ -29,7 +29,7 @@ public class FormElementRepositoryTest extends AbstractControllerIntegrationTest @Before public void setUp() throws Exception { super.setUp(); - pageRequest = new PageRequest(0, 100); + pageRequest = PageRequest.of(0, 100); setUser("demo-admin"); } diff --git a/avni-server-api/src/test/java/org/avni/server/importer/batch/csv/writer/UserAndCatchmentWriterIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/importer/batch/csv/writer/UserAndCatchmentWriterIntegrationTest.java index 54cc148e6..81ca0efe1 100644 --- a/avni-server-api/src/test/java/org/avni/server/importer/batch/csv/writer/UserAndCatchmentWriterIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/importer/batch/csv/writer/UserAndCatchmentWriterIntegrationTest.java @@ -13,6 +13,7 @@ import org.avni.server.service.builder.TestLocationService; import org.avni.server.service.builder.TestSubjectTypeService; import org.junit.Test; +import org.springframework.batch.item.Chunk; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.jdbc.Sql; @@ -96,7 +97,7 @@ private String[] has(String... errors) { private void success(String[] headers, String[] cells, boolean catchmentCreated, boolean userCreated) throws IDPException { long numberOfUsers = userRepository.count(); long numberOfCatchments = catchmentRepository.count(); - userAndCatchmentWriter.write(Collections.singletonList(new Row(headers, cells))); + userAndCatchmentWriter.write(Chunk.of(new Row(headers, cells))); if (catchmentCreated) assertEquals(catchmentRepository.count(), numberOfCatchments + 1); else @@ -109,7 +110,7 @@ private void success(String[] headers, String[] cells, boolean catchmentCreated, private void failure(String[] headers, String[] cells, String[] errorMessages) throws IDPException { try { - userAndCatchmentWriter.write(Collections.singletonList(new Row(headers, cells))); + userAndCatchmentWriter.write(Chunk.of(new Row(headers, cells))); fail(); } catch (RuntimeException e) { String message = e.getMessage(); @@ -129,7 +130,7 @@ private void failure(String[] headers, String[] cells, String[] errorMessages) t private void failsOnMissingHeader(String[] headers, String[] errorMessages, String... nonExistentErrorMessages) throws IDPException { try { - userAndCatchmentWriter.write(Collections.singletonList(new Row(headers, new String[]{}))); + userAndCatchmentWriter.write(Chunk.of(new Row(headers, new String[]{}))); fail(); } catch (RuntimeException e) { String message = e.getMessage(); diff --git a/avni-server-api/src/test/java/org/avni/server/service/sync/TestSyncService.java b/avni-server-api/src/test/java/org/avni/server/service/sync/TestSyncService.java index f1105f7d3..f0554919e 100644 --- a/avni-server-api/src/test/java/org/avni/server/service/sync/TestSyncService.java +++ b/avni-server-api/src/test/java/org/avni/server/service/sync/TestSyncService.java @@ -46,7 +46,7 @@ public List getSubjects(SubjectType subjectType, DateTime lastModifi public List getSubjects(SubjectType subjectType, DateTime lastModifiedDateTime, DateTime now) { CollectionModel> individuals = individualController.getIndividualsByOperatingIndividualScope(lastModifiedDateTime, now, subjectType.getUuid(), PageRequest.of(0, 10)); - return individuals.getContent().stream().map(Resource::getContent).collect(Collectors.toList()); + return individuals.getContent().stream().map(EntityModel::getContent).collect(Collectors.toList()); } public List getEnrolments(Program program) throws Exception { @@ -59,6 +59,6 @@ public List getEnrolments(Program program, DateTime lastModifi public List getEnrolments(Program program, DateTime lastModifiedDateTime, DateTime now) throws Exception { CollectionModel> enrolments = programEnrolmentController.getProgramEnrolmentsByOperatingIndividualScope(lastModifiedDateTime, now, program.getUuid(), PageRequest.of(0, 10)); - return enrolments.getContent().stream().map(Resource::getContent).collect(Collectors.toList()); + return enrolments.getContent().stream().map(EntityModel::getContent).collect(Collectors.toList()); } } diff --git a/avni-server-api/src/test/java/org/avni/server/web/FormControllerIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/web/FormControllerIntegrationTest.java index 5f2583e68..67633bf23 100644 --- a/avni-server-api/src/test/java/org/avni/server/web/FormControllerIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/web/FormControllerIntegrationTest.java @@ -76,7 +76,7 @@ public void setUp() throws Exception { @Test public void findByEntityId() { - Page fmPage = formMappingRepository.findByProgramId(1L, new PageRequest(0, 1)); + Page fmPage = formMappingRepository.findByProgramId(1L, PageRequest.of(0, 1)); assertEquals(1, fmPage.getContent().size()); } diff --git a/avni-server-api/src/test/java/org/avni/server/web/TransactionDataSyncTest.java b/avni-server-api/src/test/java/org/avni/server/web/TransactionDataSyncTest.java index 8d4daf38b..7cc884d04 100644 --- a/avni-server-api/src/test/java/org/avni/server/web/TransactionDataSyncTest.java +++ b/avni-server-api/src/test/java/org/avni/server/web/TransactionDataSyncTest.java @@ -358,6 +358,6 @@ private List getGroupSubjects(SubjectType groupSubjectType, DateTi CollectionModel> enrolments = groupSubjectController.getGroupSubjectsByOperatingIndividualScope(lastModifiedDateTime, now, groupSubjectType.getUuid(), PageRequest.of(0, 10)); - return enrolments.getContent().stream().map(Resource::getContent).collect(Collectors.toList()); + return enrolments.getContent().stream().map(EntityModel::getContent).collect(Collectors.toList()); } }