diff --git a/src/main/java/code/shubham/commons/configurations/MicrometerConfiguration.java b/src/main/java/code/shubham/commons/configurations/MicrometerConfiguration.java index 6b6ae2d..6ed30bc 100644 --- a/src/main/java/code/shubham/commons/configurations/MicrometerConfiguration.java +++ b/src/main/java/code/shubham/commons/configurations/MicrometerConfiguration.java @@ -44,9 +44,7 @@ public String get(String key) { @Override public String apiKey() { - return MicrometerConfiguration.this.newRelicApiKey; // for production - // purposes take it - // from config file + return MicrometerConfiguration.this.newRelicApiKey; } @Override @@ -56,14 +54,7 @@ public Duration step() { @Override public String serviceName() { - return MicrometerConfiguration.this.serviceName + "." + MicrometerConfiguration.this.serviceModule; // for - // production - // purposes - // take - // it - // from - // config - // file + return MicrometerConfiguration.this.serviceName + "." + MicrometerConfiguration.this.serviceModule; } }; diff --git a/src/test/java/code/shubham/commons/dao/address/CountryTest.java b/src/test/java/code/shubham/commons/dao/address/CountryTest.java index e179681..af1f963 100644 --- a/src/test/java/code/shubham/commons/dao/address/CountryTest.java +++ b/src/test/java/code/shubham/commons/dao/address/CountryTest.java @@ -5,9 +5,11 @@ import code.shubham.test.AbstractSpringBootTest; import org.junit.jupiter.api.*; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.TestPropertySource; import static org.junit.jupiter.api.Assertions.*; +@TestPropertySource(properties = "newrelic.config.agent_enabled=false") class CountryTest extends AbstractSpringBootTest { @Autowired diff --git a/src/test/java/code/shubham/test/AbstractSpringBootTest.java b/src/test/java/code/shubham/test/AbstractSpringBootTest.java index 34cd70d..caee631 100644 --- a/src/test/java/code/shubham/test/AbstractSpringBootTest.java +++ b/src/test/java/code/shubham/test/AbstractSpringBootTest.java @@ -6,11 +6,13 @@ import code.shubham.commons.kafka.KafkaPublisher; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; import java.util.Arrays; import java.util.Set; -@SpringBootTest(classes = TemplateServiceJavaSpringBootApplication.class) +@SpringBootTest(classes = TemplateServiceJavaSpringBootApplication.class, + properties = { "newrelic.config.agent_enabled", "false", "NEWRELIC_API_KEY", "TEST_KEY" }) public abstract class AbstractSpringBootTest extends AbstractTest { protected TestKafkaConsumer kafkaConsumer;