diff --git a/avni-server-api/build.gradle b/avni-server-api/build.gradle index 149b8da1d..a77e4412e 100644 --- a/avni-server-api/build.gradle +++ b/avni-server-api/build.gradle @@ -70,7 +70,7 @@ dependencies { implementation "com.zaxxer:HikariCP" implementation "org.apache.poi:poi:3.16-beta2" implementation "org.apache.poi:poi-ooxml:3.16-beta2" - implementation 'org.apache.httpcomponents:httpclient' + implementation 'org.apache.httpcomponents.client5:httpclient5:5.2.3' implementation 'com.auth0:jwks-rsa:0.3.0' implementation 'com.auth0:java-jwt:3.3.0' // implementation(group: 'org.hibernate', name: 'hibernate-search-orm', version: '5.9.2.Final') { diff --git a/avni-server-api/src/main/java/org/avni/messaging/api/ManualMessageController.java b/avni-server-api/src/main/java/org/avni/messaging/api/ManualMessageController.java index 39f4ad9ac..b6bdb8be6 100644 --- a/avni-server-api/src/main/java/org/avni/messaging/api/ManualMessageController.java +++ b/avni-server-api/src/main/java/org/avni/messaging/api/ManualMessageController.java @@ -4,6 +4,7 @@ import org.avni.messaging.service.MessagingService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -18,6 +19,7 @@ public ManualMessageController(MessagingService messagingService) { } @RequestMapping(value = "/web/scheduleManualMessage", method = RequestMethod.POST) + @Transactional public ResponseEntity.BodyBuilder save(@RequestBody ManualMessageContract manualMessageContract) { messagingService.scheduleManualMessage(manualMessageContract.getReceiverId(), manualMessageContract.getReceiverType(), diff --git a/avni-server-api/src/main/java/org/avni/messaging/service/MessagingService.java b/avni-server-api/src/main/java/org/avni/messaging/service/MessagingService.java index a43b242c8..175c71993 100644 --- a/avni-server-api/src/main/java/org/avni/messaging/service/MessagingService.java +++ b/avni-server-api/src/main/java/org/avni/messaging/service/MessagingService.java @@ -126,7 +126,6 @@ public void onUserEntitySave(Long userId, User createdBy) throws RuleExecutionEx } } - @Transactional public Page findByEntityTypeAndEntityTypeId(EntityType entityType, Long entityTypeId, Pageable pageable) { return messageRuleRepository.findByEntityTypeAndEntityTypeId(entityType, entityTypeId, pageable); } @@ -162,7 +161,6 @@ public void sendMessages(Duration duration) { requests.forEach(this::sendMessage); } - @Transactional public void scheduleManualMessage(String receiverId, ReceiverType receiverType, String messageTemplateId, String[] parameters, DateTime scheduledDateTime) { ManualMessage manualMessage = new ManualMessage(messageTemplateId, parameters); manualMessage.assignUUIDIfRequired(); diff --git a/avni-server-api/src/main/java/org/avni/server/dao/ProgramEnrolmentRepository.java b/avni-server-api/src/main/java/org/avni/server/dao/ProgramEnrolmentRepository.java index 79be95297..26903a4d1 100644 --- a/avni-server-api/src/main/java/org/avni/server/dao/ProgramEnrolmentRepository.java +++ b/avni-server-api/src/main/java/org/avni/server/dao/ProgramEnrolmentRepository.java @@ -108,7 +108,6 @@ default boolean isEntityChanged(SyncParameters syncParameters) { ) > 0; } - @Transactional @Modifying(clearAutomatically = true) @Query(value = "update program_enrolment enl set " + "address_id = :addressId, " + diff --git a/avni-server-api/src/main/java/org/avni/server/domain/AbstractEncounter.java b/avni-server-api/src/main/java/org/avni/server/domain/AbstractEncounter.java index 5fb71c95e..37e1e5fc4 100644 --- a/avni-server-api/src/main/java/org/avni/server/domain/AbstractEncounter.java +++ b/avni-server-api/src/main/java/org/avni/server/domain/AbstractEncounter.java @@ -39,7 +39,7 @@ public class AbstractEncounter extends SyncAttributeEntity { private ObservationCollection observations; @Column(name = ColumnNames.EncounterCancelDateTime) - private DateTime cancelDateTime; + private Instant cancelDateTime; @Column(name = ColumnNames.EncounterCancelObservations) @Type(value = ObservationCollectionUserType.class) @@ -114,7 +114,7 @@ public void setMaxVisitDateTime(DateTime maxVisitDateTime) { } public DateTime getCancelDateTime() { - return cancelDateTime; + return DateTimeUtil.toJodaDateTime(cancelDateTime); } public boolean isCancelled() { @@ -122,7 +122,7 @@ public boolean isCancelled() { } public void setCancelDateTime(DateTime cancelDateTime) { - this.cancelDateTime = cancelDateTime; + this.cancelDateTime = DateTimeUtil.toInstant(cancelDateTime); } public ObservationCollection getCancelObservations() { diff --git a/avni-server-api/src/main/java/org/avni/server/domain/CHSBaseEntity.java b/avni-server-api/src/main/java/org/avni/server/domain/CHSBaseEntity.java index 300437ac3..9e5be91a9 100644 --- a/avni-server-api/src/main/java/org/avni/server/domain/CHSBaseEntity.java +++ b/avni-server-api/src/main/java/org/avni/server/domain/CHSBaseEntity.java @@ -6,6 +6,8 @@ import org.hibernate.proxy.LazyInitializer; import jakarta.persistence.*; + +import java.util.Objects; import java.util.UUID; @MappedSuperclass @@ -74,10 +76,10 @@ public static boolean equals(IdHolder a, Object other) { IdHolder otherIdHolder = lazyInitializer2 == null ? (IdHolder) other : (IdHolder) lazyInitializer2.getImplementation(); - if (otherIdHolder.getId() == null && a.getId() == null && otherIdHolder.getUuid() == null && a.getUuid() == null) return otherIdHolder == a; + if (a.getId() != null && Objects.equals(a.getId(), otherIdHolder.getId())) return true; + if (a.getUuid() != null && Objects.equals(a.getUuid(), otherIdHolder.getUuid())) return true; - if (a.getId() != null ? !a.getId().equals(otherIdHolder.getId()) : otherIdHolder.getId() != null) return false; - return a.getUuid() != null ? a.getUuid().equals(otherIdHolder.getUuid()) : otherIdHolder.getUuid() == null; + return false; } @Override @@ -86,5 +88,4 @@ public int hashCode() { result = 31 * result + (uuid != null ? uuid.hashCode() : 0); return result; } - } diff --git a/avni-server-api/src/main/java/org/avni/server/framework/api/ApiConfiguration.java b/avni-server-api/src/main/java/org/avni/server/framework/api/ApiConfiguration.java index abdbfade9..9741f488f 100644 --- a/avni-server-api/src/main/java/org/avni/server/framework/api/ApiConfiguration.java +++ b/avni-server-api/src/main/java/org/avni/server/framework/api/ApiConfiguration.java @@ -37,7 +37,7 @@ public void addInterceptors(InterceptorRegistry registry) { } @Bean - public ObjectMapper myObjectMapper() { + public ObjectMapper objectMapper() { return ObjectMapperSingleton.getObjectMapper(); } } diff --git a/avni-server-api/src/main/java/org/avni/server/service/MetadataBundleAndFileHandler.java b/avni-server-api/src/main/java/org/avni/server/service/MetadataBundleAndFileHandler.java index aa8fd44a8..5306ce65c 100644 --- a/avni-server-api/src/main/java/org/avni/server/service/MetadataBundleAndFileHandler.java +++ b/avni-server-api/src/main/java/org/avni/server/service/MetadataBundleAndFileHandler.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; +import org.avni.server.util.ObjectMapperSingleton; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; @@ -18,8 +19,7 @@ @Service public class MetadataBundleAndFileHandler { - - private static final ObjectMapper objectMapper = new ObjectMapper(); + private static final ObjectMapper objectMapper = ObjectMapperSingleton.getObjectMapper(); protected File extractZip(MultipartFile zipFile) throws IOException { File tempDir = Files.createTempDirectory("metadata-zip").toFile(); @@ -77,7 +77,7 @@ protected Map> parseJsonFiles(List files, File Map jsonMapFile = new HashMap<>(); if (jsonContent.toString().trim().startsWith("[")) { - List> jsonArray = objectMapper.readValue(jsonContent.toString(), new TypeReference>>() {}); + List> jsonArray = ObjectMapperSingleton.getObjectMapper().readValue(jsonContent.toString(), new TypeReference>>() {}); for (Map jsonObject : jsonArray) { String uuid = (String) jsonObject.get("uuid"); if (uuid != null) { diff --git a/avni-server-api/src/main/java/org/avni/server/service/UserService.java b/avni-server-api/src/main/java/org/avni/server/service/UserService.java index d1eaa06f4..af34dae7e 100644 --- a/avni-server-api/src/main/java/org/avni/server/service/UserService.java +++ b/avni-server-api/src/main/java/org/avni/server/service/UserService.java @@ -84,7 +84,6 @@ private User createUpdateUser(User user) { return savedUser; } - @Transactional public void addToDefaultUserGroup(User user) { if (user.getOrganisationId() != null) { //Not a super-admin Group group = groupRepository.findByNameAndOrganisationId(Group.Everyone, user.getOrganisationId()); @@ -130,7 +129,6 @@ public boolean isNonScopeEntityChanged(DateTime lastModifiedDateTime) { return userRepository.existsByLastModifiedDateTimeGreaterThan(DateTimeUtil.toInstant(lastModifiedDateTime)); } - @Transactional public User findByUuid(String uuid) { return userRepository.findByUuid(uuid); } diff --git a/avni-server-api/src/main/java/org/avni/server/service/UserSubjectAssignmentService.java b/avni-server-api/src/main/java/org/avni/server/service/UserSubjectAssignmentService.java index b542bd114..6cdf3f9c4 100644 --- a/avni-server-api/src/main/java/org/avni/server/service/UserSubjectAssignmentService.java +++ b/avni-server-api/src/main/java/org/avni/server/service/UserSubjectAssignmentService.java @@ -101,7 +101,6 @@ private void addToSyncAttributes(String st, List syncAttributes syncAttributes.add(ConceptContract.create(concept)); } - @Transactional public LinkedHashMap searchSubjects(SubjectSearchRequest subjectSearchRequest) { List> searchResults = subjectSearchRepository.search(subjectSearchRequest, new SubjectAssignmentSearchQueryBuilder()); List subjectIds = searchResults.stream().map(s -> Long.parseLong(s.get("id").toString())).collect(Collectors.toList()); diff --git a/avni-server-api/src/main/java/org/avni/server/service/application/MenuItemService.java b/avni-server-api/src/main/java/org/avni/server/service/application/MenuItemService.java index 048263a4e..2a154b886 100644 --- a/avni-server-api/src/main/java/org/avni/server/service/application/MenuItemService.java +++ b/avni-server-api/src/main/java/org/avni/server/service/application/MenuItemService.java @@ -26,7 +26,6 @@ public boolean isNonScopeEntityChanged(DateTime lastModifiedDateTime) { return menuItemRepository.existsByLastModifiedDateTimeGreaterThan(lastModifiedDateTime); } - @Transactional public List findAll() { return menuItemRepository.findAll(); } @@ -36,12 +35,10 @@ public MenuItem save(MenuItem menuItem) { return menuItemRepository.save(menuItem); } - @Transactional public MenuItem find(String uuid) { return menuItemRepository.findByUuid(uuid); } - @Transactional public MenuItem find(Long id) { return menuItemRepository.findEntity(id); } diff --git a/avni-server-api/src/main/java/org/avni/server/util/ObjectMapperSingleton.java b/avni-server-api/src/main/java/org/avni/server/util/ObjectMapperSingleton.java index 9d383fa0d..06b93d2f7 100644 --- a/avni-server-api/src/main/java/org/avni/server/util/ObjectMapperSingleton.java +++ b/avni-server-api/src/main/java/org/avni/server/util/ObjectMapperSingleton.java @@ -7,7 +7,7 @@ public final class ObjectMapperSingleton { private static final ObjectMapper objectMapper = new ObjectMapper() .registerModule(new JodaModule()) - .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); private ObjectMapperSingleton() { } diff --git a/avni-server-api/src/test/java/org/avni/messaging/repository/GlificRestClientTest.java b/avni-server-api/src/test/java/org/avni/messaging/repository/GlificRestClientTest.java index cfec0dec8..2f545b104 100644 --- a/avni-server-api/src/test/java/org/avni/messaging/repository/GlificRestClientTest.java +++ b/avni-server-api/src/test/java/org/avni/messaging/repository/GlificRestClientTest.java @@ -2,6 +2,7 @@ import com.github.tomakehurst.wiremock.WireMockServer; import com.github.tomakehurst.wiremock.client.WireMock; +import jakarta.transaction.Transactional; import org.avni.messaging.contract.glific.GlificAuth; import org.avni.messaging.contract.glific.GlificMessageTemplateResponse; import org.avni.messaging.contract.glific.GlificResponse; @@ -26,6 +27,7 @@ @Sql(value = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = {"/test-data.sql"}) @Sql(value = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) +@Transactional public class GlificRestClientTest extends AbstractControllerIntegrationTest { private String SAMPLE_AUTH_RESPONSE = "{\"data\":{\"access_token\":\"SFMyNTY.YjQ2M2MzMmMtNGZlOC00OTEyLWIzYTEtZmRhZTRkOGQ1ZTIx.3TjKqpElrD5N2ffGHEAFX91cyp7zwoTztYR8p1jwwgA\",\"renewal_token\":\"SFMyNTY.MjYxODllMTgtNDM1OC00YjJjLTlmN2MtOTA5MzMwYzM3ZjA2.dDigSwftcGFGHu4o9MwkASp2KqH6eitp1aRmeYSgi5M\",\"token_expiry_time\":\"2022-10-13T21:42:33.342529Z\"}}"; 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 707a39153..5b966e64d 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 @@ -5,6 +5,7 @@ import org.avni.server.dao.UserRepository; import org.avni.server.domain.User; import org.avni.server.framework.security.UserContextHolder; +import org.avni.server.util.ObjectMapperSingleton; import org.avni.server.web.TestWebContextService; import org.junit.After; import org.junit.Before; @@ -49,7 +50,7 @@ public abstract class AbstractControllerIntegrationTest { @Autowired private TestWebContextService testWebContextService; - protected static ObjectMapper mapper = new ObjectMapper(); + protected static ObjectMapper mapper = ObjectMapperSingleton.getObjectMapper(); @PersistenceContext private EntityManager em; @@ -66,10 +67,14 @@ public void setUp() throws Exception { @After public void teardown() { - UserContextHolder.clear(); template.getRestTemplate().setInterceptors(new ArrayList<>()); testWebContextService.setRoles(); em.getEntityManagerFactory().getCache().evictAll(); + try { + em.createNativeQuery("reset role;").executeUpdate(); + } catch (Exception ignored) { + } + UserContextHolder.clear(); } protected void post(String path, Object json) { diff --git a/avni-server-api/src/test/java/org/avni/server/dao/EntityApprovalStatusRepositoryIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/dao/EntityApprovalStatusRepositoryIntegrationTest.java index a2fff4678..e0ea5df5f 100644 --- a/avni-server-api/src/test/java/org/avni/server/dao/EntityApprovalStatusRepositoryIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/dao/EntityApprovalStatusRepositoryIntegrationTest.java @@ -1,5 +1,6 @@ package org.avni.server.dao; +import jakarta.transaction.Transactional; import org.avni.server.application.Subject; import org.avni.server.common.AbstractControllerIntegrationTest; import org.avni.server.domain.ApprovalStatus; @@ -23,6 +24,7 @@ @Sql(value = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(value = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) +@Transactional public class EntityApprovalStatusRepositoryIntegrationTest extends AbstractControllerIntegrationTest { @Autowired private TestDataSetupService testDataSetupService; diff --git a/avni-server-api/src/test/java/org/avni/server/dao/LocationRepositoryIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/dao/LocationRepositoryIntegrationTest.java index c9a854317..d4c17969e 100644 --- a/avni-server-api/src/test/java/org/avni/server/dao/LocationRepositoryIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/dao/LocationRepositoryIntegrationTest.java @@ -1,5 +1,6 @@ package org.avni.server.dao; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.avni.server.domain.AddressLevel; import org.avni.server.domain.factory.AddressLevelTypeBuilder; @@ -13,6 +14,7 @@ import static org.assertj.core.api.Assertions.assertThat; @Sql({"/test-data.sql"}) +@Transactional public class LocationRepositoryIntegrationTest extends AbstractControllerIntegrationTest { @Autowired diff --git a/avni-server-api/src/test/java/org/avni/server/dao/OrganisationRepositoryIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/dao/OrganisationRepositoryIntegrationTest.java index 4290da7c7..372f71115 100644 --- a/avni-server-api/src/test/java/org/avni/server/dao/OrganisationRepositoryIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/dao/OrganisationRepositoryIntegrationTest.java @@ -1,10 +1,12 @@ package org.avni.server.dao; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.avni.server.dao.ImplementationRepository; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; +@Transactional public class OrganisationRepositoryIntegrationTest extends AbstractControllerIntegrationTest { @Autowired private ImplementationRepository implementationRepository; diff --git a/avni-server-api/src/test/java/org/avni/server/dao/ProgramEnrolmentRepositoryIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/dao/ProgramEnrolmentRepositoryIntegrationTest.java index be59a2a46..cd6c00a93 100644 --- a/avni-server-api/src/test/java/org/avni/server/dao/ProgramEnrolmentRepositoryIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/dao/ProgramEnrolmentRepositoryIntegrationTest.java @@ -1,5 +1,6 @@ package org.avni.server.dao; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.avni.server.domain.*; import org.avni.server.domain.factory.UserBuilder; @@ -36,6 +37,7 @@ public class ProgramEnrolmentRepositoryIntegrationTest extends AbstractControlle private ProgramEnrolmentRepository programEnrolmentRepository; @Test + @Transactional public void updateSyncAttributesForIndividual_should_update_last_modified_datetime() throws Exception { TestDataSetupService.TestOrganisationData organisationData = testDataSetupService.setupOrganisation(); TestDataSetupService.TestCatchmentData catchmentData = testDataSetupService.setupACatchment(); diff --git a/avni-server-api/src/test/java/org/avni/server/dao/QueryRepositoryTest.java b/avni-server-api/src/test/java/org/avni/server/dao/QueryRepositoryTest.java index 770b36370..a019ea118 100644 --- a/avni-server-api/src/test/java/org/avni/server/dao/QueryRepositoryTest.java +++ b/avni-server-api/src/test/java/org/avni/server/dao/QueryRepositoryTest.java @@ -19,7 +19,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; - public class QueryRepositoryTest extends AbstractControllerIntegrationTest { @Autowired 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 e9c6e7550..55b434259 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 @@ -1,5 +1,6 @@ package org.avni.server.dao; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.avni.server.dao.sync.SyncEntityName; import org.avni.server.domain.*; @@ -32,6 +33,7 @@ @Sql(value = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(value = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) +@Transactional public class SubjectMigrationIntegrationTest extends AbstractControllerIntegrationTest { @Autowired private TestDataSetupService testDataSetupService; diff --git a/avni-server-api/src/test/java/org/avni/server/dao/UserRepositoryTest.java b/avni-server-api/src/test/java/org/avni/server/dao/UserRepositoryTest.java index 3bfaca558..7888ee5e6 100644 --- a/avni-server-api/src/test/java/org/avni/server/dao/UserRepositoryTest.java +++ b/avni-server-api/src/test/java/org/avni/server/dao/UserRepositoryTest.java @@ -1,5 +1,6 @@ package org.avni.server.dao; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.avni.server.domain.accessControl.PrivilegeType; import org.avni.server.framework.security.UserContextHolder; @@ -11,6 +12,7 @@ import static org.junit.Assert.assertTrue; @Sql({"/test-data.sql"}) +@Transactional public class UserRepositoryTest extends AbstractControllerIntegrationTest { @Autowired private UserRepository userRepository; diff --git a/avni-server-api/src/test/java/org/avni/server/dao/accessControl/PrivilegeRepositoryTest.java b/avni-server-api/src/test/java/org/avni/server/dao/accessControl/PrivilegeRepositoryTest.java index 046d465cf..8ecda4f3f 100644 --- a/avni-server-api/src/test/java/org/avni/server/dao/accessControl/PrivilegeRepositoryTest.java +++ b/avni-server-api/src/test/java/org/avni/server/dao/accessControl/PrivilegeRepositoryTest.java @@ -1,5 +1,6 @@ package org.avni.server.dao.accessControl; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.avni.server.dao.PrivilegeRepository; import org.avni.server.domain.accessControl.Privilege; @@ -17,6 +18,7 @@ @Sql(scripts = {"/test-data.sql"}, executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) +@Transactional public class PrivilegeRepositoryTest extends AbstractControllerIntegrationTest { @Autowired private PrivilegeRepository privilegeRepository; 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 3a8d63612..0046f3b0d 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 @@ -1,5 +1,6 @@ package org.avni.server.dao.application; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.avni.server.dao.application.FormElementRepository; import org.joda.time.DateTime; @@ -19,6 +20,7 @@ @Sql(scripts = {"/test-data.sql"}, executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) +@Transactional public class FormElementRepositoryTest extends AbstractControllerIntegrationTest { @Autowired private FormElementRepository formElementRepository; diff --git a/avni-server-api/src/test/java/org/avni/server/dao/application/FormMappingRepositoryTest.java b/avni-server-api/src/test/java/org/avni/server/dao/application/FormMappingRepositoryTest.java index a79da4c5a..24378ab6a 100644 --- a/avni-server-api/src/test/java/org/avni/server/dao/application/FormMappingRepositoryTest.java +++ b/avni-server-api/src/test/java/org/avni/server/dao/application/FormMappingRepositoryTest.java @@ -44,7 +44,7 @@ private void tryFailedFormMappingSave(FormMapping formMapping) { formMappingRepository.saveFormMapping(formMapping); fail("Successfully saved form mapping"); } catch (JpaSystemException ignored) { - ignored.printStackTrace(); +// ignored.printStackTrace(); } } diff --git a/avni-server-api/src/test/java/org/avni/server/importer/batch/csv/writer/BulkLocationEditorIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/importer/batch/csv/writer/BulkLocationEditorIntegrationTest.java index bb3860f1d..47f70562f 100644 --- a/avni-server-api/src/test/java/org/avni/server/importer/batch/csv/writer/BulkLocationEditorIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/importer/batch/csv/writer/BulkLocationEditorIntegrationTest.java @@ -1,5 +1,6 @@ package org.avni.server.importer.batch.csv.writer; +import jakarta.transaction.Transactional; import org.avni.server.application.*; import org.avni.server.dao.LocationRepository; import org.avni.server.dao.application.FormRepository; @@ -24,6 +25,7 @@ @Sql(value = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(value = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) +@Transactional public class BulkLocationEditorIntegrationTest extends BaseCSVImportTest { @Autowired private TestDataSetupService testDataSetupService; 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 81ca0efe1..350d353fe 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 @@ -18,7 +18,6 @@ import org.springframework.test.context.jdbc.Sql; import java.util.Arrays; -import java.util.Collections; import java.util.UUID; import static org.junit.Assert.*; diff --git a/avni-server-api/src/test/java/org/avni/server/service/AddressLevelCacheIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/service/AddressLevelCacheIntegrationTest.java index 3dc931c4f..251e86c39 100644 --- a/avni-server-api/src/test/java/org/avni/server/service/AddressLevelCacheIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/service/AddressLevelCacheIntegrationTest.java @@ -1,5 +1,6 @@ package org.avni.server.service; +import jakarta.transaction.Transactional; import org.avni.server.application.projections.CatchmentAddressProjection; import org.avni.server.common.AbstractControllerIntegrationTest; import org.avni.server.dao.LocationRepository; @@ -29,6 +30,7 @@ @Sql(value = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(value = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) +@Transactional public class AddressLevelCacheIntegrationTest extends AbstractControllerIntegrationTest { private static final long ADDRESS_LEVEL_TYPE_ID = 1L; @@ -398,4 +400,4 @@ public void validateCacheClearedAndGCRemovesTheOldEntryValueFromMemory_attempt_2 public void validateCacheClearedAndGCRemovesTheOldEntryValueFromMemory_attempt_3() throws InterruptedException { givenAddressLevelCachesAreFullyPopulated_whenCallGetCatchmentAddressesForNewCatchmentId_thenValidateCacheClearedAndGCRemovesTheOldEntryValueFromMemory(); } -} \ No newline at end of file +} diff --git a/avni-server-api/src/test/java/org/avni/server/service/AddressLevelServiceIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/service/AddressLevelServiceIntegrationTest.java index 972194dc0..cbc568eb7 100644 --- a/avni-server-api/src/test/java/org/avni/server/service/AddressLevelServiceIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/service/AddressLevelServiceIntegrationTest.java @@ -1,5 +1,6 @@ package org.avni.server.service; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.avni.server.dao.AddressLevelTypeRepository; import org.avni.server.domain.AddressLevel; @@ -21,6 +22,7 @@ @Sql(value = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(value = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) +@Transactional public class AddressLevelServiceIntegrationTest extends AbstractControllerIntegrationTest { @Autowired private TestDataSetupService testDataSetupService; diff --git a/avni-server-api/src/test/java/org/avni/server/service/AddressLevelServiceTest.java b/avni-server-api/src/test/java/org/avni/server/service/AddressLevelServiceTest.java index 24c76d7c2..678afec8f 100644 --- a/avni-server-api/src/test/java/org/avni/server/service/AddressLevelServiceTest.java +++ b/avni-server-api/src/test/java/org/avni/server/service/AddressLevelServiceTest.java @@ -7,6 +7,7 @@ import org.avni.server.dao.LocationRepository; import org.avni.server.domain.*; import org.avni.server.framework.security.UserContextHolder; +import org.avni.server.util.ObjectMapperSingleton; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -68,9 +69,8 @@ public void shouldFetchDifferentAddressIdsWhenSubjectTypeChanges() throws JsonPr )); String orgConfig = "[{\"subjectTypeUUID\": \"first-subject-type-uuid\", \"locationTypeUUIDs\": [\"first-address-level-type-uuid\"]},{\"subjectTypeUUID\": \"second-subject-type-uuid\", \"locationTypeUUIDs\": [\"second-address-level-type-uuid\"]}]"; - ObjectMapper objectMapper = new ObjectMapper(); when(organisationConfigService.getSettingsByKey(KeyType.customRegistrationLocations.toString())).thenReturn( - asList(objectMapper.readValue(orgConfig, Map[].class)) + asList(ObjectMapperSingleton.getObjectMapper().readValue(orgConfig, Map[].class)) ); when(addressLevelTypeRepository.findAllByUuidIn(singletonList("first-address-level-type-uuid"))) .thenReturn(singletonList(createAddressLevelType(1L))); diff --git a/avni-server-api/src/test/java/org/avni/server/service/GroupSubjectServiceIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/service/GroupSubjectServiceIntegrationTest.java index b8aaf500c..457fc1745 100644 --- a/avni-server-api/src/test/java/org/avni/server/service/GroupSubjectServiceIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/service/GroupSubjectServiceIntegrationTest.java @@ -1,5 +1,6 @@ package org.avni.server.service; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.avni.server.dao.GroupRoleRepository; import org.avni.server.dao.UserSubjectAssignmentRepository; @@ -24,6 +25,7 @@ @Sql(scripts = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) @Sql(scripts = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) +@Transactional public class GroupSubjectServiceIntegrationTest extends AbstractControllerIntegrationTest { @Autowired private TestSubjectTypeService testSubjectTypeService; @@ -41,6 +43,7 @@ public class GroupSubjectServiceIntegrationTest extends AbstractControllerIntegr private TestGroupSubjectService testGroupSubjectService; @Test + @Transactional public void on_addition_of_member_to_a_group__assign_member_to_the_user_assigned_to_the_group() throws ValidationException { TestDataSetupService.TestOrganisationData testOrganisationData = testDataSetupService.setupOrganisation(); TestDataSetupService.TestCatchmentData testCatchmentData = testDataSetupService.setupACatchment(); diff --git a/avni-server-api/src/test/java/org/avni/server/service/IndividualServiceIntegration2Test.java b/avni-server-api/src/test/java/org/avni/server/service/IndividualServiceIntegration2Test.java index b152d151b..2b0564c1b 100644 --- a/avni-server-api/src/test/java/org/avni/server/service/IndividualServiceIntegration2Test.java +++ b/avni-server-api/src/test/java/org/avni/server/service/IndividualServiceIntegration2Test.java @@ -1,5 +1,6 @@ package org.avni.server.service; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.avni.server.dao.GroupRoleRepository; import org.avni.server.domain.*; diff --git a/avni-server-api/src/test/java/org/avni/server/service/IndividualServiceIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/service/IndividualServiceIntegrationTest.java index ce569f020..e32145e27 100644 --- a/avni-server-api/src/test/java/org/avni/server/service/IndividualServiceIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/service/IndividualServiceIntegrationTest.java @@ -1,5 +1,6 @@ package org.avni.server.service; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.avni.server.domain.Individual; import org.junit.Before; @@ -10,6 +11,7 @@ import static org.assertj.core.api.Assertions.assertThat; @Sql(scripts = {"/test-data.sql"}) +@Transactional public class IndividualServiceIntegrationTest extends AbstractControllerIntegrationTest { @Autowired private IndividualService individualService; diff --git a/avni-server-api/src/test/java/org/avni/server/service/OrganisationConfigServiceTest.java b/avni-server-api/src/test/java/org/avni/server/service/OrganisationConfigServiceTest.java index 398722089..510e77ffc 100644 --- a/avni-server-api/src/test/java/org/avni/server/service/OrganisationConfigServiceTest.java +++ b/avni-server-api/src/test/java/org/avni/server/service/OrganisationConfigServiceTest.java @@ -1,5 +1,6 @@ package org.avni.server.service; +import jakarta.transaction.Transactional; import org.avni.server.application.OrganisationConfigSettingKey; import org.avni.server.dao.OrganisationConfigRepository; import org.avni.server.domain.JsonObject; @@ -23,6 +24,7 @@ @RunWith(PowerMockRunner.class) @PrepareForTest({UserContextHolder.class}) +@Transactional public class OrganisationConfigServiceTest { @Test diff --git a/avni-server-api/src/test/java/org/avni/server/service/UserSubjectAssignmentServiceIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/service/UserSubjectAssignmentServiceIntegrationTest.java index cd398c9cb..44038044c 100644 --- a/avni-server-api/src/test/java/org/avni/server/service/UserSubjectAssignmentServiceIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/service/UserSubjectAssignmentServiceIntegrationTest.java @@ -1,6 +1,7 @@ package org.avni.server.service; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.avni.server.dao.GroupRoleRepository; import org.avni.server.dao.UserSubjectAssignmentRepository; @@ -25,6 +26,7 @@ @Sql(scripts = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) @Sql(scripts = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) +@Transactional public class UserSubjectAssignmentServiceIntegrationTest extends AbstractControllerIntegrationTest { @Autowired private TestSubjectTypeService testSubjectTypeService; diff --git a/avni-server-api/src/test/java/org/avni/server/service/accessControl/AccessControlServiceIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/service/accessControl/AccessControlServiceIntegrationTest.java index c31546680..272cb482c 100644 --- a/avni-server-api/src/test/java/org/avni/server/service/accessControl/AccessControlServiceIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/service/accessControl/AccessControlServiceIntegrationTest.java @@ -1,5 +1,6 @@ package org.avni.server.service.accessControl; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.avni.server.domain.*; import org.avni.server.domain.accessControl.SubjectPartitionCheckStatus; @@ -22,6 +23,7 @@ @Sql(value = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(value = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) +@Transactional public class AccessControlServiceIntegrationTest extends AbstractControllerIntegrationTest { @Autowired private TestDataSetupService testDataSetupService; diff --git a/avni-server-api/src/test/java/org/avni/server/service/identifier/IdentifierUserAssignmentRepositoryTest.java b/avni-server-api/src/test/java/org/avni/server/service/identifier/IdentifierUserAssignmentRepositoryTest.java index 06c148660..be1f230b3 100644 --- a/avni-server-api/src/test/java/org/avni/server/service/identifier/IdentifierUserAssignmentRepositoryTest.java +++ b/avni-server-api/src/test/java/org/avni/server/service/identifier/IdentifierUserAssignmentRepositoryTest.java @@ -1,5 +1,6 @@ package org.avni.server.service.identifier; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.avni.server.dao.IdentifierSourceRepository; import org.avni.server.dao.IdentifierUserAssignmentRepository; @@ -18,6 +19,7 @@ @Sql(value = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(value = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) +@Transactional public class IdentifierUserAssignmentRepositoryTest extends AbstractControllerIntegrationTest { @Autowired private IdentifierSourceRepository identifierSourceRepository; diff --git a/avni-server-api/src/test/java/org/avni/server/service/sync/ResetSyncServiceIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/service/sync/ResetSyncServiceIntegrationTest.java index 22db7e86f..f712361c2 100644 --- a/avni-server-api/src/test/java/org/avni/server/service/sync/ResetSyncServiceIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/service/sync/ResetSyncServiceIntegrationTest.java @@ -1,5 +1,6 @@ package org.avni.server.service.sync; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.avni.server.dao.LocationRepository; import org.avni.server.dao.UserRepository; diff --git a/avni-server-api/src/test/java/org/avni/server/web/ConceptControllerIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/web/ConceptControllerIntegrationTest.java index ebc04f4a2..81dcc5747 100644 --- a/avni-server-api/src/test/java/org/avni/server/web/ConceptControllerIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/web/ConceptControllerIntegrationTest.java @@ -1,11 +1,11 @@ package org.avni.server.web; import org.avni.server.common.AbstractControllerIntegrationTest; -import org.junit.Before; -import org.junit.Test; import org.avni.server.dao.ConceptRepository; import org.avni.server.domain.Concept; import org.avni.server.domain.ConceptDataType; +import org.junit.Before; +import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.jdbc.Sql; diff --git a/avni-server-api/src/test/java/org/avni/server/web/ConceptDirtyCheckingIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/web/ConceptDirtyCheckingIntegrationTest.java index 0a66f315e..f36f1929c 100644 --- a/avni-server-api/src/test/java/org/avni/server/web/ConceptDirtyCheckingIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/web/ConceptDirtyCheckingIntegrationTest.java @@ -1,5 +1,6 @@ package org.avni.server.web; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.avni.server.dao.ConceptRepository; import org.junit.Assert; diff --git a/avni-server-api/src/test/java/org/avni/server/web/EncounterControllerIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/web/EncounterControllerIntegrationTest.java index 90e720fea..52cf71b64 100644 --- a/avni-server-api/src/test/java/org/avni/server/web/EncounterControllerIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/web/EncounterControllerIntegrationTest.java @@ -1,10 +1,10 @@ package org.avni.server.web; import org.avni.server.common.AbstractControllerIntegrationTest; -import org.junit.Assert; -import org.junit.Test; import org.avni.server.dao.EncounterRepository; import org.avni.server.domain.Encounter; +import org.junit.Assert; +import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.jdbc.Sql; diff --git a/avni-server-api/src/test/java/org/avni/server/web/EncounterTypesIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/web/EncounterTypesIntegrationTest.java index c4443ebbf..40722a74e 100644 --- a/avni-server-api/src/test/java/org/avni/server/web/EncounterTypesIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/web/EncounterTypesIntegrationTest.java @@ -1,5 +1,6 @@ package org.avni.server.web; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.junit.Before; import org.junit.Test; 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 67633bf23..59f32c0a2 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 @@ -1,5 +1,6 @@ package org.avni.server.web; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.hibernate.Hibernate; import org.junit.Before; diff --git a/avni-server-api/src/test/java/org/avni/server/web/FormMappingsIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/web/FormMappingsIntegrationTest.java index f77f0570c..ab460060e 100644 --- a/avni-server-api/src/test/java/org/avni/server/web/FormMappingsIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/web/FormMappingsIntegrationTest.java @@ -1,5 +1,6 @@ package org.avni.server.web; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.junit.Before; import org.junit.Test; diff --git a/avni-server-api/src/test/java/org/avni/server/web/IndividualControllerIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/web/IndividualControllerIntegrationTest.java index ec3b56cce..ed56651c4 100644 --- a/avni-server-api/src/test/java/org/avni/server/web/IndividualControllerIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/web/IndividualControllerIntegrationTest.java @@ -1,5 +1,6 @@ package org.avni.server.web; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.junit.Assert; import org.junit.Before; diff --git a/avni-server-api/src/test/java/org/avni/server/web/MetadataDiffControllerIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/web/MetadataDiffControllerIntegrationTest.java index 412c7da2a..b92725972 100644 --- a/avni-server-api/src/test/java/org/avni/server/web/MetadataDiffControllerIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/web/MetadataDiffControllerIntegrationTest.java @@ -1,5 +1,6 @@ package org.avni.server.web; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.junit.Before; import org.junit.Test; @@ -12,6 +13,7 @@ @Sql(value = {"/test-data.sql"}, executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(value = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) +@Transactional public class MetadataDiffControllerIntegrationTest extends AbstractControllerIntegrationTest { @Before @@ -30,4 +32,4 @@ public void testCompareMetadataZips() throws Exception { .file(file2)) .andExpect(status().isOk()); } -} \ No newline at end of file +} diff --git a/avni-server-api/src/test/java/org/avni/server/web/ProgramEncounterControllerIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/web/ProgramEncounterControllerIntegrationTest.java index 1cfe0223f..ce8eb4f78 100644 --- a/avni-server-api/src/test/java/org/avni/server/web/ProgramEncounterControllerIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/web/ProgramEncounterControllerIntegrationTest.java @@ -1,5 +1,6 @@ package org.avni.server.web; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.avni.server.dao.ProgramEncounterRepository; import org.avni.server.domain.Encounter; diff --git a/avni-server-api/src/test/java/org/avni/server/web/ProgramEnrolmentControllerIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/web/ProgramEnrolmentControllerIntegrationTest.java index acfb621e8..5bb64f782 100644 --- a/avni-server-api/src/test/java/org/avni/server/web/ProgramEnrolmentControllerIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/web/ProgramEnrolmentControllerIntegrationTest.java @@ -1,5 +1,6 @@ package org.avni.server.web; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.avni.server.dao.ProgramEnrolmentRepository; import org.avni.server.domain.Individual; diff --git a/avni-server-api/src/test/java/org/avni/server/web/SampleControllerIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/web/SampleControllerIntegrationTest.java index 3fd0a8b66..a992ba3da 100644 --- a/avni-server-api/src/test/java/org/avni/server/web/SampleControllerIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/web/SampleControllerIntegrationTest.java @@ -1,5 +1,6 @@ package org.avni.server.web; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.junit.Before; import org.junit.Test; @@ -10,6 +11,7 @@ import static org.junit.Assert.assertThat; @Sql({"/test-data-openchs-organisation.sql"}) +@Transactional public class SampleControllerIntegrationTest extends AbstractControllerIntegrationTest { @Before 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 7cc884d04..cef74519c 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 @@ -1,5 +1,6 @@ package org.avni.server.web; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.avni.server.dao.GroupRoleRepository; import org.avni.server.dao.UserRepository; @@ -174,6 +175,7 @@ public void setup() { } @Test + @Transactional public void sync() throws Exception { // Catchment tx entities Individual inTheCatchment = testSubjectService.save(new SubjectBuilder().withMandatoryFieldsForNewEntity().withSubjectType(subjectTypeWithCatchmentBasedSync).withLocation(catchmentData.getAddressLevel1()).build()); diff --git a/avni-server-api/src/test/java/org/avni/server/web/api/SubjectApiControllerIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/web/api/SubjectApiControllerIntegrationTest.java index c83526d0a..ff5f077a0 100644 --- a/avni-server-api/src/test/java/org/avni/server/web/api/SubjectApiControllerIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/web/api/SubjectApiControllerIntegrationTest.java @@ -1,5 +1,6 @@ package org.avni.server.web.api; +import jakarta.transaction.Transactional; import org.avni.server.common.AbstractControllerIntegrationTest; import org.avni.server.domain.*; import org.avni.server.domain.factory.txData.ObservationCollectionBuilder; @@ -25,6 +26,7 @@ @Sql(value = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(value = {"/tear-down.sql"}, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) +@Transactional public class SubjectApiControllerIntegrationTest extends AbstractControllerIntegrationTest { @Autowired private TestDataSetupService testDataSetupService;