XTC4y - eXtreme Testing Collection 4 you

Readme

This readme describes the basic usage of the current alpha version of the 
eXtreme Testing Collection 4 you - project. Actually there are four limited 
testing utilities implemented:
1. An InvocationStack used to trace calls on interfaces
2. An AbstractClassImplementor used to instanciate abstract classes
3. A simple LogClassLoader to trace calls on methods
4. A ClassDescriptor framework used for modifying or creating class on the fly.

1. InvocationStack
------------------
Then InvocationStack makes usage of the Proxy class in the java.lang.reflect 
Package. It is used to instanciate interfaces and trace method calls on that 
interface at a given time. This may be useful testing the Java Listener 
mechanism without dummy implementation of a interface. It may be used as 
follow:

//create invocationstack
InvocationStack is = new InvocationStack(???Ifc.class);
???Ifc ifc = (??Ifc)is.getProxyObject();

//register interface on handler
//i.e. button.addActionListener(ifc);

//trace method calls
Method method = is.getMethod("actionPerformed");
Method2 calledMethod = is.popMethod();
assertEquals("actionPerformed should be called", method, calledMethod);
-------------------------------------------------------------------------------

2. AbstractClassImplementor
---------------------------
The AbstractClassImplementor is thought to be used for testing implemented 
methods on an abstract class. i.e. you've implemented the following abstract 
class:
(It's clear the followin class makes no sense, it's just a stupid example :-))

public abstract class AbstractClass {
       public Object getObject() {
	      return new String("test");
       }	      

       public abstract Object getAbstractObject() {

       }
}

Now you could use the implementor in a JUnit test class as follow:

AbstractClassImplementor loader = new AbstractClassImplementor(false);
Class cl = loader.getImplementedClass(AbstractClass.class);	
Object obj = cl.newInstance();	
AbstractClass aclass = (AbstractClass)obj;	

assertTrue("The returned object should be an instance of string", 
           aClass.getObject() instanceof String);
assertEquals("The string doesn't match", "test", aClass.getObject);

Anonther example is provided in the package com.chaoswg.xtc4y.test
-------------------------------------------------------------------------------

3. LogClassLoader
-----------------
The LogClassLoader is just a basic implementation of it's vision. It is used 
for tracing method calls in a given framework without changing it's source. 
Every method of all the classes loaded through this ClassLoader is 
supplemented with a System.out.println message at it's begin and at it's end.
An example of how to use this ClassLoader is provided in the package 
com.chaoswg.xtc4y.test.classloaders.
Now the LogClassLoader supports the log4j framework of the jakarte project at 
apache. Every class instanciates a Logger named with its fqn and adds a begin 
and end debug message to every method call (except abstract and static methods)
-------------------------------------------------------------------------------

4. ClassDescriptor
------------------
The com.chaoswg.xtc4y.classdesc package contains several classes for an object 
oriented representation of a class file or java bytecode. Through it's methods 
a current class may be adapted at runtime or even a new class may be created 
on the fly.
As an example of how this framework may be used is provided in the form of the 
LoadClassLoader or the AbstractClassImplementor.
Currently not all java tags are supported. They should be added before 
releasing the first version
-------------------------------------------------------------------------------

Any suggestions and rmarks are welcomed, post them in the specific forum on 
the sourceforge page.

regards

Toggweiler Mike