@Test public void testInterceptor() throws Exception { LifecycleHelper.init(metricsInterceptor); LifecycleHelper.start(metricsInterceptor); AdaptrisMessage message = createMessage(); assertEquals(0, metricsInterceptor.getStats().size()); submitMessage(message); assertEquals(1, metricsInterceptor.getStats().size()); assertEquals(10, ((MetadataStatistic) metricsInterceptor.getStats().get(0)).getValue(COUNTER_1)); assertEquals(10, ((MetadataStatistic) metricsInterceptor.getStats().get(0)).getValue(COUNTER_2)); assertEquals(0, ((MetadataStatistic) metricsInterceptor.getStats().get(0)).getValue(this.getClass().getSimpleName())); assertEquals(0, ((MetadataStatistic) metricsInterceptor.getStats().get(0)).getValue("blah")); }
private int getValue(String key, AdaptrisMessage msg) { if (!msg.headersContainsKey(key)) { return 0; } return Integer.parseInt(msg.getMetadataValue(key)); }
MetadataTotalsInterceptor extends MetadataMetricsInterceptorImpl { private int getValue(String key, AdaptrisMessage msg) { if (!msg.headersContainsKey(key)) { return 0; } return Integer.parseInt(msg.getMetadataValue(key)); } }
MetadataTotalsInterceptor extends MetadataMetricsInterceptorImpl { private int getValue(String key, AdaptrisMessage msg) { if (!msg.headersContainsKey(key)) { return 0; } return Integer.parseInt(msg.getMetadataValue(key)); } MetadataTotalsInterceptor();  MetadataTotalsInterceptor(List<String> keys); }
MetadataTotalsInterceptor extends MetadataMetricsInterceptorImpl { private int getValue(String key, AdaptrisMessage msg) { if (!msg.headersContainsKey(key)) { return 0; } return Integer.parseInt(msg.getMetadataValue(key)); } MetadataTotalsInterceptor();  MetadataTotalsInterceptor(List<String> keys); @Override synchronized void workflowStart(AdaptrisMessage inputMsg); @Override synchronized void workflowEnd(AdaptrisMessage inputMsg, final AdaptrisMessage outputMsg); List<String> getMetadataKeys(); void setMetadataKeys(List<String> l); }
MetadataTotalsInterceptor extends MetadataMetricsInterceptorImpl { private int getValue(String key, AdaptrisMessage msg) { if (!msg.headersContainsKey(key)) { return 0; } return Integer.parseInt(msg.getMetadataValue(key)); } MetadataTotalsInterceptor();  MetadataTotalsInterceptor(List<String> keys); @Override synchronized void workflowStart(AdaptrisMessage inputMsg); @Override synchronized void workflowEnd(AdaptrisMessage inputMsg, final AdaptrisMessage outputMsg); List<String> getMetadataKeys(); void setMetadataKeys(List<String> l);  }