Skip to content

Commit

Permalink
added @Profile for ContractService
Browse files Browse the repository at this point in the history
  • Loading branch information
smirnovaae committed Nov 25, 2024
1 parent ca80e9d commit 2ee8e26
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import gov.cms.ab2d.contracts.model.ContractAPI;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Profile;

@FeignClient(name = "contract", url = "${contract.base.url}")
@Profile("prod")
public interface ContractFeignClient extends ContractAPI {
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
import gov.cms.ab2d.contracts.model.ContractDTO;
import java.util.List;
import java.util.Optional;

import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
@Profile("prod")
public class ContractServiceImpl implements ContractService {

private final ContractFeignClient contractFeignClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;

@SpringBootTest
@SpringBootTest(properties = "spring.profiles.active=prod")
@Testcontainers
@TestPropertySource(locations = "/application.common.properties")
class ContractServiceFeignImplTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.when;

@SpringBootTest
@SpringBootTest(properties = "spring.profiles.active=prod")
@Testcontainers
@TestPropertySource(locations = "/application.common.properties")
class ContractServiceImplTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
import gov.cms.ab2d.common.model.PdpClient;
import gov.cms.ab2d.common.repository.PdpClientRepository;
import gov.cms.ab2d.contracts.model.Contract;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.context.annotation.Profile;

import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;

@TestConfiguration
@Profile("test")
public class ContractServiceStub implements ContractService {
PdpClientRepository pdpClientRepository;
private ArrayList<Contract> contractMap;
Expand Down
2 changes: 1 addition & 1 deletion e2e-bfd-test/src/test/java/gov/cms/ab2d/SpringBootApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"gov.cms.ab2d.eventclient.clients",
"gov.cms.ab2d.snsclient.clients",
"gov.cms.ab2d.common.config",
"gov.cms.ab2d.common.feign",
"gov.cms.ab2d.common.model",
"gov.cms.ab2d.common.properties",
"gov.cms.ab2d.common.repository",
"gov.cms.ab2d.common.service",
"gov.cms.ab2d.common.util",
"gov.cms.ab2d.coverage.repository",
"gov.cms.ab2d.coverage.service",
"gov.cms.ab2d.job.service",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import gov.cms.ab2d.coverage.repository.CoverageSearchRepository;
import gov.cms.ab2d.coverage.service.CoverageService;
import gov.cms.ab2d.eventclient.clients.SQSEventClient;
import gov.cms.ab2d.eventclient.config.Ab2dEnvironment;
import gov.cms.ab2d.fhir.BundleUtils;
import gov.cms.ab2d.fhir.FhirVersion;
import gov.cms.ab2d.fhir.IdentifierUtils;
Expand Down Expand Up @@ -93,16 +92,16 @@
* In the db container, it generates coverage data for the contract, pre-processes, then processes each job
* (except the last one). All the data pulls from BFDs sandbox Synthea data.
*/
@SpringBootTest
@SpringBootTest(properties = "spring.profiles.active=test")
@ComponentScan(basePackages = {"gov.cms.ab2d.bfd.client",
"gov.cms.ab2d.eventclient.clients",
"gov.cms.ab2d.snsclient.clients",
"gov.cms.ab2d.common.config",
"gov.cms.ab2d.common.feign",
"gov.cms.ab2d.common.model",
"gov.cms.ab2d.common.properties",
"gov.cms.ab2d.common.repository",
"gov.cms.ab2d.common.service",
"gov.cms.ab2d.common.util",
"gov.cms.ab2d.coverage.repository",
"gov.cms.ab2d.coverage.service",
"gov.cms.ab2d.job.service",
Expand Down
3 changes: 2 additions & 1 deletion e2e-bfd-test/src/test/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ spring.liquibase.contexts=test

spring.main.allow-bean-definition-overriding=true


# Set max number of patients to be put into patient search queue
eob.job.patient.queue.max.size=10000

Expand Down Expand Up @@ -117,4 +118,4 @@ pcp.scaleToMax.time=10

contract.base.url=${PROPERTIES_SERVICE_URL:#{'localhost:8070'}}

spring.profiles.active: test
spring.profiles.active=test

0 comments on commit 2ee8e26

Please sign in to comment.