Search in sources :

Example 1 with InterfaceMatcher

use of com.newrelic.agent.instrumentation.classmatchers.InterfaceMatcher in project newrelic-java-agent by newrelic.

the class ExtensionDomParserTest method testInterfacePointCut.

@Test
public void testInterfacePointCut() throws Exception {
    Extension ext = ExtensionDomParser.readFile(getFile(INTERFACE_FILE_PATH));
    Instrumentation inst = ext.getInstrumentation();
    List<Pointcut> thePcs = inst.getPointcut();
    Assert.assertEquals(1, thePcs.size());
    Pointcut pc = thePcs.get(0);
    Assert.assertNull(pc.getClassName());
    Assert.assertEquals("javax.servlet.Filter", pc.getInterfaceName());
    // Assert.assertEquals(ClassType.INTERFACE_NAME, pc.getClassType());
    List<ExtensionClassAndMethodMatcher> pcs = ExtensionConversionUtility.convertToPointCutsForValidation(ext);
    Assert.assertNotNull(pcs);
    Assert.assertEquals(1, pcs.size());
    ExtensionClassAndMethodMatcher actual = pcs.get(0);
    Assert.assertTrue(actual.getClassMatcher() instanceof InterfaceMatcher);
}
Also used : Extension(com.newrelic.agent.extension.beans.Extension) Pointcut(com.newrelic.agent.extension.beans.Extension.Instrumentation.Pointcut) ExtensionClassAndMethodMatcher(com.newrelic.agent.instrumentation.custom.ExtensionClassAndMethodMatcher) Instrumentation(com.newrelic.agent.extension.beans.Extension.Instrumentation) InterfaceMatcher(com.newrelic.agent.instrumentation.classmatchers.InterfaceMatcher) Test(org.junit.Test)

Example 2 with InterfaceMatcher

use of com.newrelic.agent.instrumentation.classmatchers.InterfaceMatcher in project newrelic-java-agent by newrelic.

the class InstrumentationConstructorTest method interfaceMatcher.

@Test
public void interfaceMatcher() throws Exception {
    InterfaceMatcher classMatcher = load("!interface_matcher 'java/lang/Runnable'");
    Assert.assertEquals(new InterfaceMatcher("java/lang/Runnable"), classMatcher);
}
Also used : InterfaceMatcher(com.newrelic.agent.instrumentation.classmatchers.InterfaceMatcher) Test(org.junit.Test)

Aggregations

InterfaceMatcher (com.newrelic.agent.instrumentation.classmatchers.InterfaceMatcher)2 Test (org.junit.Test)2 Extension (com.newrelic.agent.extension.beans.Extension)1 Instrumentation (com.newrelic.agent.extension.beans.Extension.Instrumentation)1 Pointcut (com.newrelic.agent.extension.beans.Extension.Instrumentation.Pointcut)1 ExtensionClassAndMethodMatcher (com.newrelic.agent.instrumentation.custom.ExtensionClassAndMethodMatcher)1