com.unitedinternet.portal.selenium.utils.logging
Class LoggingUtils

java.lang.Object
  extended by com.unitedinternet.portal.selenium.utils.logging.LoggingUtils

public final class LoggingUtils
extends java.lang.Object

Utility Methods to support easy usage from an (junit4 driven) selenium test.

Author:
Robert Zimmermann $Id: LoggingUtils.java 52 2008-02-05 19:58:00Z bobbyde $

Method Summary
static java.io.BufferedWriter createWriter(java.lang.String resultFileNameAndPath, java.lang.String resultEncoding)
          Deprecated. use the 3 parameters version instead
static java.io.BufferedWriter createWriter(java.lang.String resultFileNameAndPath, java.lang.String resultEncoding, boolean replaceExistingFile)
          Create an BufferedWriter handling encodings right.
static java.lang.String timeStampForFileName()
          Current date-time as string with format "yyyy-MM-dd_HH-mm".
static java.lang.String timeStampForFileName(java.lang.String simpleDateFormat)
          Current date-time string with provided format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createWriter

public static java.io.BufferedWriter createWriter(java.lang.String resultFileNameAndPath,
                                                  java.lang.String resultEncoding,
                                                  boolean replaceExistingFile)
                                           throws java.lang.RuntimeException
Create an BufferedWriter handling encodings right. The writer is only created. Nothing will be written yet. Checks that the file to be written is writeable. Replacing existing files is configurable. Closing the writer has to taken care of on the caller side.

Parameters:
resultFileNameAndPath - location and filename where to write later
resultEncoding - any encoding supported by the used jdk. UTF-8 is recommended.
replaceExistingFile - if true try to replace an already existing file.
Returns:
BufferedWriter ready to be written to
Throws:
java.lang.RuntimeException - if file already exists or file cannot be written or if an IOException occurs during writer creation

createWriter

@Deprecated
public static java.io.BufferedWriter createWriter(java.lang.String resultFileNameAndPath,
                                                             java.lang.String resultEncoding)
                                           throws java.lang.RuntimeException
Deprecated. use the 3 parameters version instead

Create an BufferedWriter handling encodings right. The writer is only created. Nothing will be written yet. Checks that no such file already exists and the file to be written is writeable. Closing the writer has to taken care of on the caller side.

Parameters:
resultFileNameAndPath - location and filename where to write later
resultEncoding - any encoding supported by the used jdk. UTF-8 is recommended.
Returns:
BufferedWriter ready to be written to
Throws:
java.lang.RuntimeException - if file already exists or file cannot be written or if an IOException occurs during writer creation

timeStampForFileName

public static java.lang.String timeStampForFileName()
Current date-time as string with format "yyyy-MM-dd_HH-mm". Example result: 2007-12-28_12-28

Returns:
fixed format "yyyy-MM-dd_HH-mm" date-time as string

timeStampForFileName

public static java.lang.String timeStampForFileName(java.lang.String simpleDateFormat)
Current date-time string with provided format.

Parameters:
simpleDateFormat - string format to be used
Returns:
date-time as string in given format
See Also:
SimpleDateFormat


Copyright © 2009. All Rights Reserved.