You are currently viewing a snapshot of taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to, please file a bug.

All Packages  This Package  Class Hierarchy  Class Search  Index

Class grendel.SelfTest


This is the base grendel SelfTest. Running this classes main() will execute the main() of all the SelfTest classes within the Grendel project.

This class also contains useful stuff for all of the Grendel SelfTest classes to use. It is expected that all of those classes will inherit from this one.

public class  SelfTest
     extends selftest.SelfTestRoot
          // Fields 6
     private static StupidAuthenticator authenticator;
     static byte[] copybuf;
     private static boolean firsttime;
     protected static File playdir;
     protected static Properties props;
     protected static Session session;

          // Constructors 1
     public SelfTest();

          // Methods 11
     public void cleanDirectory(File);
     public void cleanPlayDirectory();
     public void endTests();
     public String getStackTrace(Throwable);
     public void installFile(String, String);
     public static void main(String[]);
     public void makePlayDir();
     public String prettyTime(long);
     public void setUserAndPassword(String, String);
     public void startTests(String[]);
     public void writeKnownBug(Object, String, int, String);



   protected static Properties props

The Properties instance that all the javamail stuff will use. We try not to use calypso.util.Preferences during SelfTest, because there's no real way to control the values to be found there. Typically, your SelfTest code will stuff values into this Properties database so that the Store you're using will pull those values out.


   private static StupidAuthenticator authenticator

A stupid authenticator that we use to stuff in name/password info into our tests.


   protected static Session session

The javax.mail.Session object. This is created for you by startTests.


   protected static File playdir

The directory where you can store temporary stuff. If you want to use this, be sure to call makePlayDir() at the beginning of your test; that will ensure that the directory exists and is empty.


   private static boolean firsttime


   static byte[] copybuf



   public SelfTest() 

Default constructor



   public static void main(String[] args) 

Run all the grendel selftests. Every package within grendel ought to add itself here.


   public void startTests(String[] args) 

Initialize things. If a subclass overrides this method, it must call this superclass's method (via super.startTests()) The framework requires args to be passed down to SelfTestRoot.startTests.


   public void endTests() 

Clean up at the end. If a subclass overrides this method, it must call this superclass's method (via super.endTests())


   public void setUserAndPassword(String user, 
                                  String password) 

Stuff in the name and password we want to be used for the next test.


   public void makePlayDir() 

Creates an empty directory for your test to put stuff into. If a previously running test made one, it gets blown away.

The very first time this is called, we make sure that the directory doesn't already exist. We want to make sure not to blow away something that was already sitting on disk that doesn't belong to us.


   public void cleanDirectory(File dir) 

Recursively cleans out the contents of the given directory. Potentially very dangerous!


   public void cleanPlayDirectory() 

Blows away the play directory. Since endTests() calls this, there generally won't be any reason for anyone else to.


   public String getStackTrace(Throwable t) 

Given a throwable, return as a string the stack trace from it.


   public void installFile(String resname, 
                           String filename) 

Takes a file from the jar file and stores it into the play directory.

Parameter Description
resname The name of the resource to grab from the jar file. This name is interpreted relative to the package that your SelfTest subclass is in.
filename The name of the file to create. This name is interpreted relative to the playdir.


   public String prettyTime(long time) 

Given a long that represents a time, returns a String representation of it suitable for putting in a log message.


   public void writeKnownBug(Object o, 
                             String methodName, 
                             int bugnum, 
                             String message) 

Report a bug that we already know about and that has an outstanding bug report sitting in the bug database.

All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.4