use of com.newrelic.agent.instrumentation.classmatchers.OptimizedClassMatcher.Match in project newrelic-java-agent by newrelic.
the class OptimizedClassMatcherTest method testSlowMatch.
@Test
public void testSlowMatch() throws IOException {
Match match = getMatch(matcher, TestStatement.class);
Assert.assertNotNull(match);
Assert.assertEquals(3, match.getMethods().size());
Assert.assertTrue(match.getMethods().contains(new Method("close", "()V")));
Assert.assertTrue(match.getMethods().contains(new Method("cancel", "()V")));
Assert.assertTrue(match.getMethods().contains(new Method("executeBatch", "()[I")));
Assert.assertEquals(1, match.getClassMatches().size());
Assert.assertTrue(match.getClassMatches().containsKey(match4));
}
use of com.newrelic.agent.instrumentation.classmatchers.OptimizedClassMatcher.Match in project newrelic-java-agent by newrelic.
the class OptimizedClassMatcherTest method testAccessMatch.
@Test
public void testAccessMatch() throws IOException {
Match match = getMatch(matcher, HashMap.class);
Assert.assertNotNull(match);
Assert.assertTrue(match.getMethods().size() > 0);
Assert.assertTrue(match.getMethods().contains(new Method("size", "()I")));
Assert.assertFalse(match.getMethods().contains(new Method("init", "()V")));
Assert.assertTrue(match.getClassMatches().containsKey(match6));
}
use of com.newrelic.agent.instrumentation.classmatchers.OptimizedClassMatcher.Match in project newrelic-java-agent by newrelic.
the class OptimizedClassMatcherTest method testGenericsMatch.
@Test
public void testGenericsMatch() throws IOException {
InstrumentationContext instrumentationContext = getInstrumentationContext(matcher, ArgGenerics.class);
Match match = instrumentationContext.getMatches().values().iterator().next();
Assert.assertNotNull(match);
Assert.assertEquals(3, match.getMethods().size());
Assert.assertTrue(match.getMethods().contains(new Method("add", "(Ljava/lang/Object;)Z")));
Assert.assertEquals(match.getMethods().size(), match.getClassMatches().size());
Assert.assertTrue(match.getClassMatches().containsKey(match7));
Assert.assertEquals(2, instrumentationContext.getBridgeMethods().size());
Assert.assertEquals(new Method("add", "(Ljava/lang/String;)Z"), instrumentationContext.getBridgeMethods().get(new Method("add", "(Ljava/lang/Object;)Z")));
}
use of com.newrelic.agent.instrumentation.classmatchers.OptimizedClassMatcher.Match in project newrelic-java-agent by newrelic.
the class OptimizedClassMatcherTest method testSingleMatch.
@Test
public void testSingleMatch() throws IOException {
Match match = getMatch(matcher, HashSet.class);
Assert.assertNotNull(match);
Assert.assertEquals(1, match.getMethods().size());
Assert.assertTrue(match.getMethods().contains(new Method("size", "()I")));
Assert.assertEquals(1, match.getClassMatches().size());
Assert.assertTrue(match.getClassMatches().containsKey(match1));
}
use of com.newrelic.agent.instrumentation.classmatchers.OptimizedClassMatcher.Match in project newrelic-java-agent by newrelic.
the class OptimizedClassMatcherTest method testMultipleMatch.
@Test
public void testMultipleMatch() throws IOException {
Match match = getMatch(matcher, ArrayList.class);
Assert.assertNotNull(match);
Assert.assertEquals(3, match.getMethods().size());
Assert.assertTrue(match.getMethods().contains(new Method("size", "()I")));
Assert.assertTrue(match.getMethods().contains(new Method("get", "(I)Ljava/lang/Object;")));
Assert.assertEquals(3, match.getClassMatches().size());
Assert.assertTrue(match.getClassMatches().containsKey(match1));
Assert.assertTrue(match.getClassMatches().containsKey(match2));
}
Aggregations