use of com.newrelic.agent.instrumentation.classmatchers.ChildClassMatcher in project newrelic-java-agent by newrelic.
the class InstrumentationConstructorTest method childClassMatcher.
@Test
public void childClassMatcher() throws Exception {
ChildClassMatcher classMatcher = load("!child_class_matcher 'java/lang/Object'");
Assert.assertEquals(new ChildClassMatcher("java/lang/Object"), classMatcher);
}
use of com.newrelic.agent.instrumentation.classmatchers.ChildClassMatcher in project newrelic-java-agent by newrelic.
the class ExtensionDomParserTest method testSuperclassPointCut.
@Test
public void testSuperclassPointCut() throws Exception {
Extension ext = ExtensionDomParser.readFile(getFile(SUPERCLASS_FILE_PATH));
Instrumentation inst = ext.getInstrumentation();
List<Pointcut> thePcs = inst.getPointcut();
Assert.assertEquals(2, thePcs.size());
Pointcut pc = thePcs.get(0);
Assert.assertNotNull(pc.getClassName());
Assert.assertEquals("test.SuperTest", pc.getClassName().getValue());
List<ExtensionClassAndMethodMatcher> pcs = ExtensionConversionUtility.convertToPointCutsForValidation(ext);
Assert.assertNotNull(pcs);
Assert.assertEquals(2, pcs.size());
ExtensionClassAndMethodMatcher actual = pcs.get(0);
Assert.assertTrue(actual.getClassMatcher() instanceof ChildClassMatcher);
ExtensionClassAndMethodMatcher returnMatcher = pcs.get(1);
Assert.assertTrue(returnMatcher.getClassMatcher() instanceof ChildClassMatcher);
Assert.assertTrue(returnMatcher.getMethodMatcher() instanceof ExactReturnTypeMethodMatcher);
Assert.assertTrue(returnMatcher.getMethodMatcher().matches(Opcodes.ACC_PUBLIC, "bogus", "()Lcom/framework/Result;", com.google.common.collect.ImmutableSet.<String>of()));
Assert.assertFalse(returnMatcher.getMethodMatcher().matches(Opcodes.ACC_PUBLIC, "test", "()[Lcom/framework/Result;", com.google.common.collect.ImmutableSet.<String>of()));
Assert.assertFalse(returnMatcher.getMethodMatcher().matches(Opcodes.ACC_PUBLIC, "dude", "(Lcom/framework/Result;)V", com.google.common.collect.ImmutableSet.<String>of()));
}
Aggregations