RumInjector implements HtmlToInject { public static void addRumHit(HttpServletRequest httpRequest, Counter httpCounter) { final String requestName = httpRequest.getParameter("requestName"); if (requestName == null) { return; } try { final long serverTime = Long.parseLong(httpRequest.getParameter("serverTime")); final long timeToFirstByte = Long .parseLong(httpRequest.getParameter("timeToFirstByte")); final long domProcessing = Long.parseLong(httpRequest.getParameter("domProcessing")); final long pageRendering = Long.parseLong(httpRequest.getParameter("pageRendering")); final long networkTime = Math.max(timeToFirstByte - serverTime, 0); httpCounter.addRumHit(requestName, networkTime, domProcessing, pageRendering); } catch (final NumberFormatException e) { return; } } private  RumInjector(HttpServletRequest httpRequest, String requestName); static HttpServletResponse createRumResponseWrapper(HttpServletRequest httpRequest,
			HttpServletResponse httpResponse, String requestName); @Override String getContent(); @Override String getBeforeTag(); static boolean isRumResource(String resourceName); static void addRumHit(HttpServletRequest httpRequest, Counter httpCounter);  }
@Test public void testAddRumHit() { final Counter httpCounter = new Counter(Counter.HTTP_COUNTER_NAME, "dbweb.png"); addRumHit(httpCounter, null, null, null, null, null); final String requestName = "test"; addRumHit(httpCounter, requestName, null, null, null, null); addRumHit(httpCounter, requestName, "a", "b", "c", "d"); addRumHit(httpCounter, requestName, "100", "200", "300", "400"); httpCounter.addRequest(requestName, 100, 10, 10, false, 1); addRumHit(httpCounter, requestName, "100", "200", "300", "400"); addRumHit(httpCounter, requestName, "100", "200", "300", "400"); addRumHit(httpCounter, requestName, "-100", "200", "300", "400"); addRumHit(httpCounter, requestName, "300001", "200", "300", "400"); addRumHit(httpCounter, requestName, "100", "-200", "300", "400"); addRumHit(httpCounter, requestName, "100", "300101", "300", "400"); addRumHit(httpCounter, requestName, "100", "200", "-300", "400"); addRumHit(httpCounter, requestName, "100", "200", "300001", "400"); addRumHit(httpCounter, requestName, "100", "200", "300", "-400"); addRumHit(httpCounter, requestName, "100", "200", "300", "300001"); }