01: /*
02: * soapUI, copyright (C) 2004-2007 eviware.com
03: *
04: * soapUI is free software; you can redistribute it and/or modify it under the
05: * terms of version 2.1 of the GNU Lesser General Public License as published by
06: * the Free Software Foundation.
07: *
08: * soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
09: * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10: * See the GNU Lesser General Public License for more details at gnu.org.
11: */
12:
13: package com.eviware.soapui.impl.wsdl.loadtest.log;
14:
15: import java.io.IOException;
16: import java.io.PrintWriter;
17: import java.util.Date;
18:
19: import javax.swing.ImageIcon;
20:
21: import com.eviware.soapui.model.testsuite.TestStep;
22: import com.eviware.soapui.support.UISupport;
23: import com.eviware.soapui.support.action.swing.ActionList;
24:
25: /**
26: * A simple message LoadTest Log entry
27: *
28: * @author Ole.Matzura
29: */
30:
31: public class LoadTestLogMessageEntry implements LoadTestLogEntry {
32: private final String message;
33: private long timestamp;
34: private ImageIcon icon;
35:
36: public LoadTestLogMessageEntry(String message) {
37: this .message = message;
38: timestamp = System.currentTimeMillis();
39:
40: icon = UISupport.createImageIcon("/loadtest_log_message.gif");
41: }
42:
43: public String getMessage() {
44: return message;
45: }
46:
47: public long getTimeStamp() {
48: return timestamp;
49: }
50:
51: public TestStep getTargetStep() {
52: return null;
53: }
54:
55: public ImageIcon getIcon() {
56: return icon;
57: }
58:
59: public String getType() {
60: return "Message";
61: }
62:
63: public boolean isError() {
64: return false;
65: }
66:
67: public ActionList getActions() {
68: return null;
69: }
70:
71: public void exportToFile(String fileName) throws IOException {
72: PrintWriter writer = new PrintWriter(fileName);
73: writer.write(new Date(timestamp).toString());
74: writer.write(":");
75: writer.write(message);
76: writer.close();
77: }
78: }
|