001    /******************************************************************************
002     * Copyright (C) MActor Developers. All rights reserved.                        *
003     * ---------------------------------------------------------------------------*
004     * This file is part of MActor.                                               *
005     *                                                                            *
006     * MActor is free software; you can redistribute it and/or modify             *
007     * it under the terms of the GNU General Public License as published by       *
008     * the Free Software Foundation; either version 2 of the License, or          *
009     * (at your option) any later version.                                        *
010     *                                                                            *
011     * MActor is distributed in the hope that it will be useful,                  *
012     * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
013     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
014     * GNU General Public License for more details.                               *
015     *                                                                            *
016     * You should have received a copy of the GNU General Public License          *
017     * along with MActor; if not, write to the Free Software                      *
018     * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA *
019     ******************************************************************************/
020    package org.mactor.framework;
021    
022    import java.util.Calendar;
023    
024    import org.mactor.framework.TestSummary_old.MessageInfo;
025    
026    public class TestSuiteSummary_old {
027            private Calendar testStart;
028            private Calendar testComplete;
029            private int successCount;
030            private int failedCount;
031            private long averageSuccessCompleteTimeMs;
032            private long averageFailedCompleteTimeMs;
033            private int messageSentCount;
034            private int messageReceivedCount;
035            public void addSummary(TestSummary_old summary) {
036                    if (testStart == null)
037                            testStart = summary.getTestStartTime();
038                    testComplete = summary.getTestCompleteTime();
039                    long t = (summary.getTestCompleteTime().getTime().getTime() - summary.getTestStartTime().getTime().getTime());
040                    if (summary.isSuccess()) {
041                            successCount++;
042                            averageSuccessCompleteTimeMs += t;
043                    } else {
044                            failedCount++;
045                            averageFailedCompleteTimeMs += t;
046                    }
047                    for (MessageInfo mi : summary.getMessageHistory()) {
048                            if (mi.isIncoming())
049                                    messageReceivedCount++;
050                            else
051                                    messageSentCount++;
052                    }
053            }
054            public long getAverageFailedCompleteTimeMs() {
055                    return averageFailedCompleteTimeMs;
056            }
057            public long getAverageSuccessCompleteTimeMs() {
058                    return averageSuccessCompleteTimeMs;
059            }
060            public int getFailedCount() {
061                    return failedCount;
062            }
063            public int getMessageReceivedCount() {
064                    return messageReceivedCount;
065            }
066            public int getMessageSentCount() {
067                    return messageSentCount;
068            }
069            public int getSuccessCount() {
070                    return successCount;
071            }
072            public Calendar getTestComplete() {
073                    return testComplete;
074            }
075            public Calendar getTestStart() {
076                    return testStart;
077            }
078    }