use of com.example.http.HttpRequestClass in project newrelic-java-agent by newrelic.
the class HttpServerTest method testCatCallSetName.
@Test
public void testCatCallSetName() throws IOException, URISyntaxException {
Introspector intro = InstrumentationTestRunner.getIntrospector();
HttpRequestClass myClass = new HttpRequestClass();
myClass.performCatHttp(server.getEndPoint());
assertEquals(2, intro.getFinishedTransactionCount());
Collection<String> names = intro.getTransactionNames();
assertEquals(2, names.size());
String txName1 = "OtherTransaction/Custom/com.example.http.HttpRequestClass/performCatHttp";
String txName2 = "WebTransaction/Custom/ExternalHTTPServer";
assertTrue(names.contains(txName1));
assertTrue(names.contains(txName2));
Collection<ExternalRequest> externals = intro.getExternalRequests(txName1);
assertEquals(1, externals.size());
ExternalRequest req = externals.iterator().next();
assertEquals(1, req.getCount());
assertEquals("localhost", req.getHostname());
CatHelper.verifyOneSuccessfulCat(intro, txName1);
}
use of com.example.http.HttpRequestClass in project newrelic-java-agent by newrelic.
the class HttpServerTest method testCatCallDefaultName.
// this one creates a new path hash at the end
@Test
public void testCatCallDefaultName() throws IOException, URISyntaxException {
Introspector intro = InstrumentationTestRunner.getIntrospector();
HttpRequestClass myClass = new HttpRequestClass();
myClass.performCatHttpNoSetName(server.getEndPoint());
assertEquals(2, intro.getFinishedTransactionCount());
Collection<String> names = intro.getTransactionNames();
assertEquals(2, names.size());
String txName1 = "OtherTransaction/Custom/com.example.http.HttpRequestClass/performCatHttpNoSetName";
String txName2 = "WebTransaction/Custom/ExternalHTTPServer";
assertTrue(names.contains(txName1));
assertTrue(names.contains(txName2));
Collection<ExternalRequest> externals = intro.getExternalRequests(txName1);
assertEquals(1, externals.size());
ExternalRequest req = externals.iterator().next();
assertEquals(1, req.getCount());
assertEquals("localhost", req.getHostname());
CatHelper.verifyOneSuccessfulCat(intro, txName1);
}
use of com.example.http.HttpRequestClass in project newrelic-java-agent by newrelic.
the class HttpServerTest method testExternalCall.
@Test
public void testExternalCall() throws IOException, URISyntaxException {
Introspector intro = InstrumentationTestRunner.getIntrospector();
HttpRequestClass myClass = new HttpRequestClass();
myClass.performHttp(server.getEndPoint());
assertEquals(2, intro.getFinishedTransactionCount());
Collection<String> names = intro.getTransactionNames();
assertEquals(2, names.size());
String txName1 = "OtherTransaction/Custom/com.example.http.HttpRequestClass/performHttp";
String txName2 = "WebTransaction/Custom/ExternalHTTPServer";
assertTrue(names.contains(txName1));
assertTrue(names.contains(txName2));
Collection<ExternalRequest> externals = intro.getExternalRequests(txName1);
assertEquals(1, externals.size());
ExternalRequest req = externals.iterator().next();
assertEquals(1, req.getCount());
assertEquals("localhost", req.getHostname());
assertEquals("NewRelicApacheHttp", req.getLibrary());
}
Aggregations