Package org.apache.synapse.aspects.statistics.view

Examples of org.apache.synapse.aspects.statistics.view.Statistics


                    }
                }
            }

            if (endLog != null && startLog != null) {
                Statistics statistics;
                switch (componentType) {
                    case SEQUENCE: {
                        if (startLog.isResponse()) {
                            statistics = statisticsView.getOutStatistics();
                        } else {
                            statistics = statisticsView.getInStatistics();
                        }
                        statistics.update(endLog.getTime() - startLog.getTime(), endLog.isFault());
                        if (endLog.isFault()) {
                            statistics.addErrorLog(endLog.getErrorLog());
                        }
                        break;
                    }
                    case ENDPOINT: {
                        statistics = statisticsView.getInStatistics();
                        statistics.update(endLog.getTime() - startLog.getTime(), endLog.isFault());
                        if (endLog.isFault()) {
                            statistics.addErrorLog(endLog.getErrorLog());
                        }
                        break;
                    }
                    case PROXYSERVICE: {
                        Statistics inStatistics = statisticsView.getInStatistics();
                        Statistics outStatistics = statisticsView.getOutStatistics();
                        inStatistics.update(endLog.getTime() - startLog.getTime(), endLog.isFault());
                        if (endLog.isFault()) {
                            inStatistics.addErrorLog(endLog.getErrorLog());
                        }
                        if (!endLog.isEndAnyLog()) {
                            StatisticsLog lastLog = statisticsLogs.get(statisticsLogs.size() - 1);
                            if (lastLog != endLog) {
                                outStatistics.update(
                                        lastLog.getTime() - endLog.getTime(), lastLog.isFault());
                                if (lastLog.isFault()) {
                                    outStatistics.addErrorLog(lastLog.getErrorLog());
                                }
                            }
                        }
                        return;
                    }
                }
                startLog = null;
                endLog = null;
            }
        }

        if (startLog != null && componentType == ComponentType.PROXYSERVICE) {
            Statistics inStatistics = statisticsView.getInStatistics();
            StatisticsLog lastLog = statisticsLogs.get(statisticsLogs.size() - 1);
            if (lastLog != startLog) {
                inStatistics.update(lastLog.getTime() - startLog.getTime(), lastLog.isFault());
            }
        }
    }
View Full Code Here


    private long value2 = 112L;
    private long value3 = 220L;

    public void testRecordCreation() {

        Statistics stats1 = new Statistics(resourceId);
        stats1.update(value1, false);

        Statistics stats2 = new Statistics(resourceId);
        stats2.update(value2, false);
        stats2.update(value3, true);

        StatisticsRecord record = new StatisticsRecord(resourceId,
                ComponentType.SEQUENCE, true, stats1);

        assertEquals(1, record.getTotalCount());
View Full Code Here

        assertEquals(value2, update.getMinTime());
        assertEquals(Double.valueOf((value2+value3)/2), update.getAvgTime());
    }

    public void testRecordUpdateOperations() {
        Statistics stats1 = new Statistics(resourceId);
        stats1.update(value1, false);

        Statistics stats2 = new Statistics(resourceId);
        stats2.update(value2, false);
        stats2.update(value3, true);

        StatisticsRecord record = new StatisticsRecord(resourceId,
                ComponentType.SEQUENCE, true, stats1);
        StatisticsRecord update = new StatisticsRecord(resourceId,
                ComponentType.SEQUENCE, true, stats2);
View Full Code Here

TOP

Related Classes of org.apache.synapse.aspects.statistics.view.Statistics

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.