use of com.newrelic.agent.MockConfigService in project newrelic-java-agent by newrelic.
the class BrowserTransactionStateTest method setup.
@Before
public void setup() {
MockServiceManager serviceManager = new MockServiceManager();
serviceManager.setConfigService(new MockConfigService(AgentConfigFactory.createAgentConfig(Collections.<String, Object>emptyMap(), Collections.<String, Object>emptyMap(), null)));
ServiceFactory.setServiceManager(serviceManager);
MockitoAnnotations.initMocks(this);
}
use of com.newrelic.agent.MockConfigService in project newrelic-java-agent by newrelic.
the class TransactionTraceTest method setUp.
private void setUp(boolean isCaptureAtts, boolean captureRequestAtts, boolean requestUri, boolean simpleCompression) throws Exception {
iAgentConfig = mock(AgentConfig.class);
TransactionTracerConfig transTracerConfig = mock(TransactionTracerConfig.class);
when(iAgentConfig.getTransactionTracerConfig()).thenReturn(transTracerConfig);
when(iAgentConfig.isSimpleCompression()).thenReturn(simpleCompression);
MockServiceManager manager = new MockServiceManager();
ServiceFactory.setServiceManager(manager);
ImmutableMap<String, Object> distributedTracingSettings = ImmutableMap.<String, Object>builder().put(DistributedTracingConfig.ENABLED, Boolean.FALSE).build();
Map<String, Object> settings = new HashMap<>();
settings.put(AgentConfigImpl.DISTRIBUTED_TRACING, distributedTracingSettings);
setConfigAttributes(settings, isCaptureAtts, captureRequestAtts, requestUri, simpleCompression);
ConfigService cService = new MockConfigService(AgentConfigImpl.createAgentConfig(settings));
manager.setConfigService(cService);
manager.setTransactionTraceService(new TransactionTraceService());
manager.setTransactionService(new TransactionService());
manager.setAttributesService(new AttributesService());
}
use of com.newrelic.agent.MockConfigService in project newrelic-java-agent by newrelic.
the class SpringPointCutTest method beforeClass.
@BeforeClass
public static void beforeClass() throws Exception {
MockServiceManager serviceManager = new MockServiceManager();
ServiceFactory.setServiceManager(serviceManager);
serviceManager.start();
ThreadService threadService = new ThreadService();
serviceManager.setThreadService(threadService);
Map<String, Object> settings = AgentConfigFactoryTest.createStagingMap();
AgentConfig config = AgentConfigFactory.createAgentConfig(settings, null, null);
MockConfigService configService = new MockConfigService(null);
configService.setAgentConfig(config);
serviceManager.setConfigService(configService);
MockRPMServiceManager rpmServiceManager = new MockRPMServiceManager();
serviceManager.setRPMServiceManager(rpmServiceManager);
MockRPMService rpmService = new MockRPMService();
rpmService.setApplicationName("Unit Test");
rpmServiceManager.setRPMService(rpmService);
serviceManager.setNormalizationService(new NormalizationServiceImpl());
}
use of com.newrelic.agent.MockConfigService in project newrelic-java-agent by newrelic.
the class OptimizedClassMatcherTest method initializeServiceManager.
private void initializeServiceManager() {
MockServiceManager serviceManager = new MockServiceManager();
ServiceFactory.setServiceManager(serviceManager);
Map<String, Object> confProps = new HashMap<>();
confProps.put(AgentConfigImpl.APP_NAME, "Hello");
MockConfigService service = new MockConfigService(AgentConfigImpl.createAgentConfig(confProps));
serviceManager.setConfigService(service);
}
use of com.newrelic.agent.MockConfigService in project newrelic-java-agent by newrelic.
the class UtilizationServiceTest method before.
@Before
public void before() {
MockServiceManager mockServiceManager = new MockServiceManager();
config = mock(AgentConfig.class);
MockConfigService configService = new MockConfigService(null);
configService.setAgentConfig(config);
ServiceFactory.setServiceManager(mockServiceManager);
mockServiceManager.setConfigService(configService);
ThreadService mockThreadService = mock(ThreadService.class);
mockServiceManager.setThreadService(mockThreadService);
// Do not make AWS/Azure/GCP/PCF calls. Unit tests should work even without internet connection :)
when(config.getValue(UtilizationService.DETECT_DOCKER_KEY, true)).thenReturn(false);
when(config.getValue(UtilizationService.DETECT_AWS_KEY, true)).thenReturn(false);
when(config.getValue(UtilizationService.DETECT_AZURE_KEY, true)).thenReturn(false);
when(config.getValue(UtilizationService.DETECT_GOOGLE_CLOUD_PROVIDER_KEY, true)).thenReturn(false);
when(config.getValue(UtilizationService.DETECT_PIVOTAL_CLOUD_FOUNDRY_KEY, true)).thenReturn(false);
when(config.getValue(UtilizationService.DETECT_KUBERNETES_KEY, true)).thenReturn(false);
UtilizationDataConfig utilDataConfig = mock(UtilizationDataConfig.class);
when(config.getUtilizationDataConfig()).thenReturn(utilDataConfig);
}
Aggregations