devinsy-rss/tests/XidvcTester.java

91 lines
1.7 KiB
Java
Raw Permalink Normal View History

2010-06-17 21:34:38 +02:00
/**
* Kiss4Web tests.
2010-06-17 21:34:38 +02:00
*/
import fr.devinsy.kiss4web.*;
2010-06-17 21:34:38 +02:00
/**
*
*/
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"));
}
}