org.sonatype.sisu.litmus.testsupport
Class TestUtil

java.lang.Object
  extended by org.sonatype.sisu.litmus.testsupport.TestUtil

public final class TestUtil
extends Object

Test utilities.

Since:
1.0

Field Summary
protected  File baseDir
           
static String BASEDIR
           
protected  org.slf4j.Logger log
           
static String TARGET
           
static String TMP
           
 
Constructor Summary
TestUtil(Class owner)
           
TestUtil(Object owner)
           
 
Method Summary
 File createTempDir()
           
 File createTempDir(File dir, String prefix)
           
 File createTempDir(String prefix)
           
 File createTempFile()
           
 File createTempFile(File dir, String prefix)
           
 File createTempFile(String prefix)
           
 File getBaseDir()
           
 org.slf4j.Logger getLog()
           
 File getTargetDir()
           
 File getTmpDir()
           
protected  File initBaseDir()
          Determine the value of ${basedir}, which should be the base directory of the module which the concrete test class is defined in.
 File resolveFile(String path)
          Resolve the given path to a file rooted to baseDir.
 String resolvePath(String path)
          Resolve the given path to a path rooted to baseDir.
 void setTmpDir(File tmpDir)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BASEDIR

public static final String BASEDIR
See Also:
Constant Field Values

TARGET

public static final String TARGET
See Also:
Constant Field Values

TMP

public static final String TMP
See Also:
Constant Field Values

baseDir

protected final File baseDir

log

@NonNls
protected final org.slf4j.Logger log
Constructor Detail

TestUtil

public TestUtil(Class owner)

TestUtil

public TestUtil(Object owner)
Method Detail

getBaseDir

public File getBaseDir()

getLog

public org.slf4j.Logger getLog()

initBaseDir

protected File initBaseDir()
Determine the value of ${basedir}, which should be the base directory of the module which the concrete test class is defined in.

If The system property basedir is already set, then that value is used, otherwise we determine the value from the code-source of the containing concrete class and set the basedir system property to that value.

Returns:
The base directory of the module which contains the concrete test class.
See Also:
This field is always initialized to the value which this method returns.

getTargetDir

public File getTargetDir()

getTmpDir

public File getTmpDir()

setTmpDir

public void setTmpDir(File tmpDir)

resolveFile

public File resolveFile(@NonNls
                        String path)
Resolve the given path to a file rooted to baseDir.

Parameters:
path - The path to resolve.
Returns:
The resolved file for the given path.

resolvePath

public String resolvePath(String path)
Resolve the given path to a path rooted to baseDir.

Parameters:
path - The path to resolve.
Returns:
The resolved path for the given path.
See Also:
resolveFile(String)

createTempFile

public File createTempFile(File dir,
                           String prefix)

createTempFile

public File createTempFile(String prefix)

createTempFile

public File createTempFile()
Since:
1.1

createTempDir

public File createTempDir(File dir,
                          String prefix)

createTempDir

public File createTempDir(String prefix)

createTempDir

public File createTempDir()
Since:
1.1


Copyright © 2008-2012 Sonatype, Inc.. All Rights Reserved.