Search in sources :

Example 1 with InstrumentedClass

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

the class WeaveTest method classAnnotation.

@Test
public void classAnnotation() throws NoSuchMethodException, SecurityException {
    InstrumentedClass annotation = TestClass.class.getAnnotation(InstrumentedClass.class);
    Assert.assertNotNull(annotation);
    Assert.assertFalse(annotation.legacy());
}
Also used : InstrumentedClass(com.newrelic.agent.instrumentation.InstrumentedClass) Test(org.junit.Test)

Example 2 with InstrumentedClass

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

the class AgentTest method testAnnotations.

@Test
public void testAnnotations() throws SecurityException, NoSuchMethodException {
    InstrumentedClass annotation = HttpServlet.class.getAnnotation(InstrumentedClass.class);
    Assert.assertNotNull(annotation);
    Assert.assertFalse(annotation.legacy());
    Method m = HttpServlet.class.getMethod("service", ServletRequest.class, ServletResponse.class);
    Assert.assertNotNull(m);
    InstrumentedMethod methodAnnotation = m.getAnnotation(InstrumentedMethod.class);
    Assert.assertNotNull(methodAnnotation);
    Assert.assertEquals(InstrumentationType.TracedWeaveInstrumentation, methodAnnotation.instrumentationTypes()[0]);
// Assert.assertEquals(HttpServletPointCut.class.getName(), methodAnnotation.instrumentationName());
// m = HttpServlet.class.getMethod("service", HttpServletRequest.class, HttpServletResponse.class);
// annotations = m.getAnnotations();
// Assert.assertTrue(annotations.length == 0);
// Assert.assertTrue(Arrays.asList(annotations).toString(), annotations[0] instanceof Instrumented);
}
Also used : InstrumentedMethod(com.newrelic.agent.instrumentation.InstrumentedMethod) Method(java.lang.reflect.Method) InstrumentedMethod(com.newrelic.agent.instrumentation.InstrumentedMethod) InstrumentedClass(com.newrelic.agent.instrumentation.InstrumentedClass) Test(org.junit.Test)

Aggregations

InstrumentedClass (com.newrelic.agent.instrumentation.InstrumentedClass)2 Test (org.junit.Test)2 InstrumentedMethod (com.newrelic.agent.instrumentation.InstrumentedMethod)1 Method (java.lang.reflect.Method)1