@Test public void testGetTotalStringStats() throws Exception { String adapterName = this.getClass().getSimpleName() + "." + getName(); Adapter adapter = createAdapter(adapterName); List<BaseComponentMBean> mBeans = createJmxManagers(adapter); try { start(adapter); register(mBeans); ObjectName workflowObj = createWorkflowObjectName(adapterName); ObjectName metricsObj = createMetricsObjectName(adapterName); MessageMetricsStatisticsMBean stats = JMX.newMBeanProxy(mBeanServer, metricsObj, MessageMetricsStatisticsMBean.class); WorkflowManagerMBean workflow = JMX.newMBeanProxy(mBeanServer, workflowObj, WorkflowManagerMBean.class); assertNotNull(stats.getTotalStringStats()); SerializableAdaptrisMessage msg = createMessageForInjection(null); workflow.processAsync(msg); assertNotNull(stats.getTotalStringStats()); } finally { stop(adapter); } }
@Override public String getTotalStringStats() { long timeinMillis = Calendar.getInstance().getTimeInMillis(); StringBuffer buffer = new StringBuffer(); buffer.append(wrappedComponent.getStats().size()); buffer.append(" time slice(s) have been recorded.\n"); if (wrappedComponent.getStats().size() > 0) { MessageStatistic timeSlice = (MessageStatistic) wrappedComponent.getStats().get(wrappedComponent.getStats().size() - 1); buffer.append("Current time slice statistics; \n"); buffer.append(" Time Slice ends in - " + (timeSlice.getEndMillis() - timeinMillis) / 1000 + " seconds.\n"); buffer.append(" Message count - " + timeSlice.getTotalMessageCount() + "\n"); buffer.append(" Message total size - " + timeSlice.getTotalMessageSize()); } return buffer.toString(); }
MessageMetricsStatistics extends ChildRuntimeInfoComponentImpl implements MessageMetricsStatisticsMBean { @Override public String getTotalStringStats() { long timeinMillis = Calendar.getInstance().getTimeInMillis(); StringBuffer buffer = new StringBuffer(); buffer.append(wrappedComponent.getStats().size()); buffer.append(" time slice(s) have been recorded.\n"); if (wrappedComponent.getStats().size() > 0) { MessageStatistic timeSlice = (MessageStatistic) wrappedComponent.getStats().get(wrappedComponent.getStats().size() - 1); buffer.append("Current time slice statistics; \n"); buffer.append(" Time Slice ends in - " + (timeSlice.getEndMillis() - timeinMillis) / 1000 + " seconds.\n"); buffer.append(" Message count - " + timeSlice.getTotalMessageCount() + "\n"); buffer.append(" Message total size - " + timeSlice.getTotalMessageSize()); } return buffer.toString(); } }
MessageMetricsStatistics extends ChildRuntimeInfoComponentImpl implements MessageMetricsStatisticsMBean { @Override public String getTotalStringStats() { long timeinMillis = Calendar.getInstance().getTimeInMillis(); StringBuffer buffer = new StringBuffer(); buffer.append(wrappedComponent.getStats().size()); buffer.append(" time slice(s) have been recorded.\n"); if (wrappedComponent.getStats().size() > 0) { MessageStatistic timeSlice = (MessageStatistic) wrappedComponent.getStats().get(wrappedComponent.getStats().size() - 1); buffer.append("Current time slice statistics; \n"); buffer.append(" Time Slice ends in - " + (timeSlice.getEndMillis() - timeinMillis) / 1000 + " seconds.\n"); buffer.append(" Message count - " + timeSlice.getTotalMessageCount() + "\n"); buffer.append(" Message total size - " + timeSlice.getTotalMessageSize()); } return buffer.toString(); } private  MessageMetricsStatistics(); protected  MessageMetricsStatistics(WorkflowManager owner, MessageMetricsInterceptorImpl interceptor); }
MessageMetricsStatistics extends ChildRuntimeInfoComponentImpl implements MessageMetricsStatisticsMBean { @Override public String getTotalStringStats() { long timeinMillis = Calendar.getInstance().getTimeInMillis(); StringBuffer buffer = new StringBuffer(); buffer.append(wrappedComponent.getStats().size()); buffer.append(" time slice(s) have been recorded.\n"); if (wrappedComponent.getStats().size() > 0) { MessageStatistic timeSlice = (MessageStatistic) wrappedComponent.getStats().get(wrappedComponent.getStats().size() - 1); buffer.append("Current time slice statistics; \n"); buffer.append(" Time Slice ends in - " + (timeSlice.getEndMillis() - timeinMillis) / 1000 + " seconds.\n"); buffer.append(" Message count - " + timeSlice.getTotalMessageCount() + "\n"); buffer.append(" Message total size - " + timeSlice.getTotalMessageSize()); } return buffer.toString(); } private  MessageMetricsStatistics(); protected  MessageMetricsStatistics(WorkflowManager owner, MessageMetricsInterceptorImpl interceptor); @Override int getNumberOfTimeSlices(); @Override int getTimeSliceDurationSeconds(); @Override String getTotalStringStats(); @Override ParentRuntimeInfoComponent getParentRuntimeInfoComponent(); @Override List<MessageStatistic> getStatistics(); @Override List<MessageStatistic> getStatistics(int fromIndex, int toIndex); @Override void clearStatistics(); }
MessageMetricsStatistics extends ChildRuntimeInfoComponentImpl implements MessageMetricsStatisticsMBean { @Override public String getTotalStringStats() { long timeinMillis = Calendar.getInstance().getTimeInMillis(); StringBuffer buffer = new StringBuffer(); buffer.append(wrappedComponent.getStats().size()); buffer.append(" time slice(s) have been recorded.\n"); if (wrappedComponent.getStats().size() > 0) { MessageStatistic timeSlice = (MessageStatistic) wrappedComponent.getStats().get(wrappedComponent.getStats().size() - 1); buffer.append("Current time slice statistics; \n"); buffer.append(" Time Slice ends in - " + (timeSlice.getEndMillis() - timeinMillis) / 1000 + " seconds.\n"); buffer.append(" Message count - " + timeSlice.getTotalMessageCount() + "\n"); buffer.append(" Message total size - " + timeSlice.getTotalMessageSize()); } return buffer.toString(); } private  MessageMetricsStatistics(); protected  MessageMetricsStatistics(WorkflowManager owner, MessageMetricsInterceptorImpl interceptor); @Override int getNumberOfTimeSlices(); @Override int getTimeSliceDurationSeconds(); @Override String getTotalStringStats(); @Override ParentRuntimeInfoComponent getParentRuntimeInfoComponent(); @Override List<MessageStatistic> getStatistics(); @Override List<MessageStatistic> getStatistics(int fromIndex, int toIndex); @Override void clearStatistics();  }