devinsy-unix/tests/XidvcTester.java
2012-09-16 22:50:49 +02:00

90 lines
1.7 KiB
Java

/**
* Kiss4Web tests.
*/
import fr.devinsy.kiss4web.*;
/**
*
*/
class XidvcTester
{
static private org.apache.log4j.Logger logger;
static
{
// Initialize logger.
org.apache.log4j.Logger logger = null;
org.apache.log4j.BasicConfigurator.configure ();
logger = org.apache.log4j.Logger.getRootLogger ();
//logger.setLevel (org.apache.log4j.Level.INFO);
logger.setLevel (org.apache.log4j.Level.INFO);
logger.info ("Enter");
//
logger.info ("Set the log file format...");
// log = org.apache.log4j.Category.getInstance(Application.class.getName());
logger.info ("... done.");
logger.debug ("Exit");
logger = org.apache.log4j.Logger.getLogger (XidvcTester.class.getName ());
}
/**
*
*/
public static String check (String title, StringBuffer source, String model)
{
String result;
if (source.indexOf (model) == -1)
{
result = String.format ("%-40s -> KO <-", title) + "\nGet:\n" + source + "\nWaiting:\n" + model;
}
else
{
result = String.format ("%-40s [ OK ] ", title);
}
//
return (result);
}
/**
*
*/
public static String testCaller (String pathInfo, String prefix)
{
String result;
result = "[" + pathInfo + "]=>[" + ServletDispatcher.pathInfoToClassName(pathInfo, prefix) + "]";
//
return(result);
}
/**
*
*/
public static void main(String[] args)
{
System.out.println ("----------------------------");
System.out.println(testCaller("/", "fr.devinsy.website"));
System.out.println(testCaller("/good/", "fr.devinsy.website"));
System.out.println(testCaller("/good/morning", "fr.devinsy.website"));
System.out.println(testCaller("/good/day_day", "fr.devinsy.website"));
System.out.println(testCaller("/good/day.xhtml", "fr.devinsy.website"));
}
}