All Packages  This Package  Class Hierarchy  Class Search  Index

Class app.authkit.test.AuthTest
java.lang.Object
   |
   +----app.authkit.test.AuthTest

  Summary

public abstract class  AuthTest
     extends java.lang.Object
{
          // Constructors 1
     public AuthTest();

          // Methods 17
     public static void explain(String);
     public static void explain(Throwable);
     public static Authorization makeAuth(String);
     public static void tell(String);

     protected String formatPrivilege(String, Privilege, Authorization);
     protected String getWhich(Authorization);
     protected void hexLine(PrintStream, String, byte[], int, int);
     protected void putHexTo(PrintStream, String, String, byte[], int);
     protected void putHexTo(String, byte[]);
     protected void putHexTo(String, String, String, byte[], int);
     protected void resession(Authorization, InputStream) throws IOException;
     protected void resession(Authorization, String);
     protected void tellGranted(String, Authorization);
     protected void tellPrivilege(String, Privilege, Authorization);
     protected void tellWhich(Authorization);
     public void testAuth(Authorization, String, String[]);
     public void testAuthOne(Authorization, boolean, String);
}

AuthTest is a superclass for testing AuthKit code. Each subclass tests some code by providing a testAuthOne() override, or perhaps an override of testAuth().

A subclass may provide none of the usual test methods, instead providing only a main() method for command-line execution. In those case, the utilitarian methods of this class are available.

The property "authkit.imp" is usually used as the fully qualified class name of an Authorization to instantiate and use.


  Cross Reference

Extended By:
TestAttach, TestAuth, TestDetach, TestExternalize, TestLoader, TestPrivs, TestReattach, TestReleaseSelf, TestTwo





  Constructors

· AuthTest

Summary  |  Top
   public AuthTest() 

Default constructor



  Methods

· testAuth

Summary  |  Top
   public void testAuth(Authorization auth, 
                        String interactProp, 
                        String[] args) 

Do the test over all the args. First, read the "interact" property and pass its state to testAuthOne(). The default flag state is true.



· testAuthOne

Summary  |  Top
   public void testAuthOne(Authorization auth, 
                           boolean interact, 
                           String arg) 

Do the test on one arg.



· makeAuth

Summary  |  Top
   public static Authorization makeAuth(String propName) 

The returned Authorization is unattached to any underlying session.



· tellGranted

Summary  |  Top
   protected void tellGranted(String prefix, 
                              Authorization auth) 

Show the enumerated past granted privileges.



· tellPrivilege

Summary  |  Top
   protected void tellPrivilege(String prefix, 
                                Privilege priv, 
                                Authorization auth) 

Show the past and current state of a single Privilege. If not previously granted, then no past-granted date appears.



· formatPrivilege

Summary  |  Top
   protected String formatPrivilege(String prefix, 
                                    Privilege priv, 
                                    Authorization auth) 

Assemble the past and current state of a single Privilege. If not previously granted, then no past-granted date appears.



· tellWhich

Summary  |  Top
   protected void tellWhich(Authorization auth) 

Call getWhich() and print with prefix.



· getWhich

Summary  |  Top
   protected String getWhich(Authorization auth) 

If unattached to a session, create a new session, then return a String uniquely identifying that session: i.e. return getPublicIdentifier().



· resession

Summary  |  Top
   protected void resession(Authorization auth, 
                            String filename) 

Attach the Authorization to the secret identifier loaded from the given filename. The Authorization must be in a released state.

THIS IS INSECURE. DO NOT USE IN PRODUCTION CODE.



· resession

Summary  |  Top
   protected void resession(Authorization auth, 
                            InputStream in)  throws IOException

Attach the Authorization to the secret identifier read from the given InputStream. The stream is not closed. The Authorization must be in a released state. A try/finally block ensures the secret buffer is erased in all cases.



· putHexTo

Summary  |  Top
   protected void putHexTo(String filename, 
                           byte[] bytes) 

Append all bytes, in hex, to file.



· putHexTo

Summary  |  Top
   protected void putHexTo(String filename, 
                           String header, 
                           String prefix, 
                           byte[] bytes, 
                           int count) 

Append bytes, in hex, to file.



· putHexTo

Summary  |  Top
   protected void putHexTo(PrintStream out, 
                           String header, 
                           String prefix, 
                           byte[] bytes, 
                           int count) 

Print bytes in hex to PrintStream.



· hexLine

Summary  |  Top
   protected void hexLine(PrintStream out, 
                          String prefix, 
                          byte[] bytes, 
                          int offset, 
                          int count) 

Print the bytes in hex as one line of text, preceded by a given non-null prefix, and followed by a call to PrintStream.println().



· tell

Summary  |  Top
   public static void tell(String toTell) 

Emit line of text on stdout.



· explain

Summary  |  Top
   public static void explain(String text) 

Emit line of text on stderr.



· explain

Summary  |  Top
   public static void explain(Throwable toExplain) 

Emit stack trace on stderr.



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