View Javadoc

    1   /*
    2    *  soapUI, copyright (C) 2004-2007 eviware.com
    3    *
    4    *  soapUI is free software; you can redistribute it and/or modify it under the
    5    *  terms of version 2.1 of the GNU Lesser General Public License as published by
    6    *  the Free Software Foundation.
    7    *
    8    *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
    9    *  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.support.UISupport;
    22  import com.eviware.soapui.support.action.swing.ActionList;
    23
    24  /***
    25   * A simple message LoadTest Log entry
    26   *
    27   * @author Ole.Matzura
    28   */
    29
    30  public class LoadTestLogMessageEntry implements LoadTestLogEntry
    31  {
    32  	private final String message;
    33  	private long timestamp;
    34  	private ImageIcon icon;
    35  	private boolean discarded;
    36
    37  	public LoadTestLogMessageEntry(String message)
    38  	{
    39  		this.message = message;
    40  		timestamp = System.currentTimeMillis();
    41
    42  		icon = UISupport.createImageIcon( "/loadtest_log_message.gif");
    43  	}
    44
    45  	public String getMessage()
    46  	{
    47  		return message;
    48  	}
    49
    50  	public long getTimeStamp()
    51  	{
    52  		return timestamp;
    53  	}
    54
    55  	public String getTargetStepName()
    56  	{
    57  		return null;
    58  	}
    59
    60  	public ImageIcon getIcon()
    61  	{
    62  		return icon;
    63  	}
    64
    65  	public String getType()
    66  	{
    67  		return "Message";
    68  	}
    69
    70  	public boolean isError()
    71  	{
    72  		return false;
    73  	}
    74
    75  	public ActionList getActions()
    76  	{
    77  		return null;
    78  	}
    79
    80  	public void exportToFile(String fileName) throws IOException
    81  	{
    82  		PrintWriter writer = new PrintWriter(fileName );
    83  		writer.write( new Date(timestamp).toString() );
    84  		writer.write( ":" );
    85  		writer.write( message );
    86  		writer.close();
    87  	}
    88
    89  	public void discard()
    90  	{
    91  		discarded = true;
    92  	}
    93
    94  	public boolean isDiscarded()
    95  	{
    96  		return discarded;
    97  	}
    98  }