Trace trace = Trace.newInstance(app, TraceId.valueOf("0"), httpFrame);
assertEndpointAnalysis(trace, grailsFrame, httpFrame);
}
private static EndPointAnalysis assertEndpointAnalysis(Trace trace, Frame grailsFrame, Frame httpFrame) {
EndPointAnalysis ep = endPointAnalyzer.locateEndPoint(trace);
assertNotNull("No analysis", ep);
Operation operation = grailsFrame.getOperation();
String resourceKey = GrailsControllerMethodEndPointAnalyzer.makeResourceKey(operation.getSourceCodeLocation());
EndPointName epName = EndPointName.valueOf(resourceKey);
assertEquals("Mismatched endpoint name", epName, ep.getEndPointName());
assertEquals("Mismatched label", operation.getLabel(), ep.getResourceLabel());
assertEquals("Mismatched score", EndPointAnalysis.depth2score(FrameUtil.getDepth(grailsFrame)), ep.getScore());
if (httpFrame == null) {
assertEquals("Mismatched grails example", operation.getLabel(), ep.getExample());
} else {
String expected = EndPointAnalysis.createHttpExampleRequest(httpFrame);
assertEquals("Mismatched http example", expected, ep.getExample());
}
return ep;
}