use of com.newrelic.agent.instrumentation.PointCutConfiguration in project newrelic-java-agent by newrelic.
the class ClassTransformerConfigImplTest method testPointcutGroupDisabled.
@Test
public void testPointcutGroupDisabled() {
Map<String, Object> configuration = new HashMap<>();
configuration.put("class_transformer:my_pointcut_group:enabled", true);
configuration.put("class_transformer:instrumentation_default:enabled", false);
configuration.put("app_name", "Unit Test");
configuration = buildConfigMap(configuration);
AgentConfig agentConfig = AgentConfigImpl.createAgentConfig(configuration);
ConfigService configService = ConfigServiceFactory.createConfigService(agentConfig, Collections.<String, Object>emptyMap());
ServiceManager serviceManager = new MockServiceManager(configService);
ServiceFactory.setServiceManager(serviceManager);
PointCutConfiguration pointCutConfiguration = new PointCutConfiguration("PointcutClassName", "my_pointcut_group", true, agentConfig.getClassTransformerConfig());
assertTrue(pointCutConfiguration.isEnabled());
}
use of com.newrelic.agent.instrumentation.PointCutConfiguration in project newrelic-java-agent by newrelic.
the class ClassTransformerConfigImplTest method testPoincutExplicitEnable.
@Test
public void testPoincutExplicitEnable() {
Map<String, Object> config = new HashMap<>();
config.put("class_transformer:PointcutClassName:enabled", true);
config.put("class_transformer:instrumentation_default:enabled", true);
config.put("app_name", "Unit Test");
config = buildConfigMap(config);
AgentConfig agentConfig = AgentConfigImpl.createAgentConfig(config);
ConfigService configService = ConfigServiceFactory.createConfigService(agentConfig, Collections.<String, Object>emptyMap());
ServiceManager serviceManager = new MockServiceManager(configService);
ServiceFactory.setServiceManager(serviceManager);
PointCutConfiguration pointCutConfiguration = new PointCutConfiguration("PointcutClassName", null, true, agentConfig.getClassTransformerConfig());
assertTrue(pointCutConfiguration.isEnabled());
}
use of com.newrelic.agent.instrumentation.PointCutConfiguration in project newrelic-java-agent by newrelic.
the class ClassTransformerConfigImplTest method testPointcutDisabled.
@Test
public void testPointcutDisabled() {
Map<String, Object> configuration = new HashMap<>();
configuration.put("class_transformer:instrumentation_default:enabled", true);
configuration.put("class_transformer:my_pointcut_group:enabled", false);
configuration.put("app_name", "Unit Test");
configuration = buildConfigMap(configuration);
AgentConfig agentConfig = AgentConfigImpl.createAgentConfig(configuration);
ClassTransformerConfig classTransformerConfig = agentConfig.getClassTransformerConfig();
ConfigService configService = ConfigServiceFactory.createConfigService(agentConfig, Collections.<String, Object>emptyMap());
ServiceManager serviceManager = new MockServiceManager(configService);
ServiceFactory.setServiceManager(serviceManager);
PointCutConfiguration pointCutConfiguration = new PointCutConfiguration("name", "my_pointcut_group", true, classTransformerConfig);
assertFalse(pointCutConfiguration.isEnabled());
}
use of com.newrelic.agent.instrumentation.PointCutConfiguration in project newrelic-java-agent by newrelic.
the class ClassTransformerConfigImplTest method testPointcutEnabled.
@Test
public void testPointcutEnabled() {
Map<String, Object> classTransformerMap = new HashMap<>();
ClassTransformerConfig config = ClassTransformerConfigImpl.createClassTransformerConfig(classTransformerMap, true, false);
Map<String, Object> configSettings = new HashMap<>();
configSettings.put(AgentConfigImpl.CLASS_TRANSFORMER, classTransformerMap);
configSettings.put(AgentConfigImpl.APP_NAME, "Unit Test");
AgentConfig agentConfig = AgentConfigImpl.createAgentConfig(configSettings);
ConfigService configService = ConfigServiceFactory.createConfigService(agentConfig, Collections.<String, Object>emptyMap());
ServiceManager serviceManager = new MockServiceManager(configService);
ServiceFactory.setServiceManager(serviceManager);
PointCutConfiguration pointCutConfiguration = new PointCutConfiguration("name", null, true, config);
assertTrue(pointCutConfiguration.isEnabled());
}
Aggregations