Skip to content

Commit

Permalink
DMP-4583: ARM Performance Analysis (#2623)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-Edwards-cgi authored Mar 3, 2025
1 parent 2605352 commit 47e4c98
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* Base class for integration tests running against a containerized Postgres with Testcontainers.
*/
@SpringBootTest
@ActiveProfiles({"intTest"})
@ActiveProfiles({"intTest", "in-memory-caching"})
@Import(IntegrationTestConfiguration.class)
public class PostgresIntegrationBase {

Expand Down Expand Up @@ -52,6 +52,10 @@ public class PostgresIntegrationBase {
).withDatabaseName("darts")
.withUsername("darts")
.withPassword("darts");
POSTGRES.setCommand("postgres", "-c", String.format("max_connections=%d", SERVER_MAX_CONNECTIONS));

// container will be automatically stopped
POSTGRES.start();
}

@DynamicPropertySource
Expand All @@ -61,12 +65,6 @@ static void configureProperties(DynamicPropertyRegistry registry) {
registry.add("spring.datasource.password", POSTGRES::getPassword);
}

static {
POSTGRES.setCommand("postgres", "-c", String.format("max_connections=%d", SERVER_MAX_CONNECTIONS));

// container will be automatically stopped
POSTGRES.start();
}

@BeforeEach
void clearDb() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import java.util.UUID;

import static java.util.Objects.nonNull;
import static uk.gov.hmcts.darts.common.enums.ExternalLocationTypeEnum.ARM;
import static uk.gov.hmcts.darts.common.enums.ObjectRecordStatusEnum.ARM_INGESTION;
import static uk.gov.hmcts.darts.common.enums.ObjectRecordStatusEnum.ARM_RAW_DATA_FAILED;
import static uk.gov.hmcts.darts.common.util.EodHelper.equalsAnyStatus;
Expand Down Expand Up @@ -135,9 +134,8 @@ public void updateExternalObjectDirectoryStatus(ExternalObjectDirectoryEntity ar
public ExternalObjectDirectoryEntity createArmExternalObjectDirectoryEntity(ExternalObjectDirectoryEntity externalObjectDirectory,
ObjectRecordStatusEntity status,
UserAccountEntity userAccount) {

ExternalObjectDirectoryEntity armExternalObjectDirectoryEntity = new ExternalObjectDirectoryEntity();
armExternalObjectDirectoryEntity.setExternalLocationType(externalLocationTypeRepository.getReferenceById(ARM.getId()));
armExternalObjectDirectoryEntity.setExternalLocationType(EodHelper.armLocation());
armExternalObjectDirectoryEntity.setStatus(status);
armExternalObjectDirectoryEntity.setExternalLocation(externalObjectDirectory.getExternalLocation());
armExternalObjectDirectoryEntity.setVerificationAttempts(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,4 @@ public CacheManager cacheManager() {
log.debug("Using in memory caching ...");
return new ConcurrentMapCacheManager();
}


}
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
package uk.gov.hmcts.darts.common.repository;

import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import uk.gov.hmcts.darts.common.entity.ExternalLocationTypeEntity;

import java.util.Optional;

@Repository
public interface ExternalLocationTypeRepository extends JpaRepository<ExternalLocationTypeEntity, Integer> {

@Cacheable("externalLocationTypeEntity")
@Override
ExternalLocationTypeEntity getReferenceById(Integer id);

@Cacheable("externalLocationTypeEntityOptional")
@Override
Optional<ExternalLocationTypeEntity> findById(Integer id);
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package uk.gov.hmcts.darts.common.repository;

import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import uk.gov.hmcts.darts.common.entity.ObjectRecordStatusEntity;
import uk.gov.hmcts.darts.common.enums.ObjectRecordStatusEnum;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

@Repository
public interface ObjectRecordStatusRepository extends JpaRepository<ObjectRecordStatusEntity, Integer> {
Expand All @@ -19,4 +21,11 @@ default List<ObjectRecordStatusEntity> getReferencesByStatus(List<ObjectRecordSt
return responseList;
}

@Cacheable("objectRecordStatusEntity")
@Override
ObjectRecordStatusEntity getReferenceById(Integer id);

@Cacheable("objectRecordStatusEntityOptional")
@Override
Optional<ObjectRecordStatusEntity> findById(Integer id);
}

0 comments on commit 47e4c98

Please sign in to comment.