You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by wo...@apache.org on 2005/08/23 05:12:46 UTC
cvs commit: jakarta-jmeter/src/reports/org/apache/jmeter/report/writers DefaultPageSummary.java ReportSummary.java PageSummary.java DefaultReportSummary.java ReportWriter.java
woolfel 2005/08/22 20:12:46
Added: src/reports/org/apache/jmeter/report/writers
DefaultPageSummary.java ReportSummary.java
PageSummary.java DefaultReportSummary.java
ReportWriter.java
Log:
checking some basic classes for reports
peter lin
Revision Changes Path
1.1 jakarta-jmeter/src/reports/org/apache/jmeter/report/writers/DefaultPageSummary.java
Index: DefaultPageSummary.java
===================================================================
//$Header: /home/cvs/jakarta-jmeter/src/reports/org/apache/jmeter/report/writers/DefaultPageSummary.java,v 1.1 2005/08/23 03:12:46 woolfel Exp $
/*
* Copyright 2001,2003-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.jmeter.report.writers;
/**
* @author Peter Lin
*
* This is a basic implementation of PageSummary interface.
*/
public class DefaultPageSummary implements PageSummary {
private long START = 0;
private long END = 0;
private String Title;
private String FileName;
private boolean Success;
/**
*
*/
public DefaultPageSummary() {
super();
}
/**
* Returns the elapsed time in milliseconds
*/
public long getElapsedTime() {
return END - START;
}
public long getEndTimeStamp() {
return END;
}
/* (non-Javadoc)
* @see org.apache.jmeter.report.writers.PageSummary#getFileName()
*/
public String getFileName() {
return FileName;
}
/* (non-Javadoc)
* @see org.apache.jmeter.report.writers.PageSummary#getPageTitle()
*/
public String getPageTitle() {
return Title;
}
public long getStartTimeStamp() {
return START;
}
/* (non-Javadoc)
* @see org.apache.jmeter.report.writers.PageSummary#isSuccessful()
*/
public boolean isSuccessful() {
return Success;
}
/* (non-Javadoc)
* @see org.apache.jmeter.report.writers.PageSummary#pageStarted()
*/
public void pageStarted() {
START = System.currentTimeMillis();
}
/* (non-Javadoc)
* @see org.apache.jmeter.report.writers.PageSummary#pageEnded()
*/
public void pageEnded() {
END = System.currentTimeMillis();
}
/* (non-Javadoc)
* @see org.apache.jmeter.report.writers.PageSummary#setFileName(java.lang.String)
*/
public void setFileName(String file) {
this.FileName = file;
}
/* (non-Javadoc)
* @see org.apache.jmeter.report.writers.PageSummary#setPageTitle(java.lang.String)
*/
public void setPageTitle(String title) {
this.Title = title;
}
/* (non-Javadoc)
* @see org.apache.jmeter.report.writers.PageSummary#setSuccessful(boolean)
*/
public void setSuccessful(boolean success) {
this.Success = success;
}
}
1.1 jakarta-jmeter/src/reports/org/apache/jmeter/report/writers/ReportSummary.java
Index: ReportSummary.java
===================================================================
//$Header: /home/cvs/jakarta-jmeter/src/reports/org/apache/jmeter/report/writers/ReportSummary.java,v 1.1 2005/08/23 03:12:46 woolfel Exp $
/*
* Copyright 2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.jmeter.report.writers;
/**
* @author Peter Lin
*
* The purpose of ReportSummary is to provide a detailed description of the
* reports generated, how long it took and where the generated files are
* located.
*/
public interface ReportSummary extends Cloneable {
/**
* Add a page summary to the report summary
* @param summary
*/
void addPageSummary(PageSummary summary);
/**
* This should be the elapsed time to run all the reports. Classes
* implementing it should simply add up the elapsed time for each
* report page.
* @return
*/
long getElapsedTime();
/**
* The method should return a list of the pages generated for the
* report and whether it succeeded or not
* @return
*/
PageSummary[] getPagesSummaries();
/**
* Remove a page summary from the report summary.
* @param summary
*/
void removePageSummary(PageSummary summary);
}
1.1 jakarta-jmeter/src/reports/org/apache/jmeter/report/writers/PageSummary.java
Index: PageSummary.java
===================================================================
//$Header: /home/cvs/jakarta-jmeter/src/reports/org/apache/jmeter/report/writers/PageSummary.java,v 1.1 2005/08/23 03:12:46 woolfel Exp $
/*
* Copyright 2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.jmeter.report.writers;
/**
* @author pete
*
* PageSummary defines the summary of a report page and the runtime
* information for debugging and logging purposes. It's a good idea
* to return summary so that automated process can start the report
* and a summary of how the reports ran.
*/
public interface PageSummary extends Cloneable {
long getElapsedTime();
long getEndTimeStamp();
String getFileName();
String getPageTitle();
long getStartTimeStamp();
boolean isSuccessful();
void pageStarted();
void pageEnded();
void setFileName(String file);
void setPageTitle(String title);
void setSuccessful(boolean success);
}
1.1 jakarta-jmeter/src/reports/org/apache/jmeter/report/writers/DefaultReportSummary.java
Index: DefaultReportSummary.java
===================================================================
//$Header: /home/cvs/jakarta-jmeter/src/reports/org/apache/jmeter/report/writers/DefaultReportSummary.java,v 1.1 2005/08/23 03:12:46 woolfel Exp $
/*
* Copyright 2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.jmeter.report.writers;
import java.util.ArrayList;
import java.util.Iterator;
/**
* @author Peter Lin
*
* The default implementation of ReportSummary just contains the stats
* and basic information. It doesn't contain the actual report. In the
* future we may want to implement a version with all the details to
* display in a Swing GUI.
*/
public class DefaultReportSummary implements ReportSummary {
protected ArrayList pages = new ArrayList();
/**
*
*/
public DefaultReportSummary() {
super();
}
/**
* Add a PageSummary to the report
*/
public void addPageSummary(PageSummary summary) {
this.pages.add(summary);
}
/**
* current implementation simply iterates over the Page summaries
* and adds the times.
*/
public long getElapsedTime() {
long elpasedTime = 0;
Iterator itr = this.pages.iterator();
while (itr.hasNext()) {
elpasedTime += ((PageSummary)itr.next()).getElapsedTime();
}
return elpasedTime;
}
/**
* The current implementation calls ArrayList.toArray(Object[])
*/
public PageSummary[] getPagesSummaries() {
PageSummary[] ps = new PageSummary[this.pages.size()];
return (PageSummary[])this.pages.toArray(ps);
}
/**
* remove a PageSummary
*/
public void removePageSummary(PageSummary summary) {
this.pages.remove(summary);
}
}
1.1 jakarta-jmeter/src/reports/org/apache/jmeter/report/writers/ReportWriter.java
Index: ReportWriter.java
===================================================================
//$Header: /home/cvs/jakarta-jmeter/src/reports/org/apache/jmeter/report/writers/ReportWriter.java,v 1.1 2005/08/23 03:12:46 woolfel Exp $
/*
* Copyright 2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.jmeter.report.writers;
import org.apache.jmeter.testelement.TestElement;
/**
* @author Peter Lin
*
* ReportWriter defines the basic operations of a report writer. A report
* plan may have multiple report writers. it might be nice to have a pdf
* writer in the future.
*/
public interface ReportWriter {
ReportSummary writeReport(TestElement element);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org