kiss4web/test/FooPlayer.java

85 lines
1.8 KiB
Java
Raw Normal View History

/**
* Kiss4Web tests.
*/
2013-06-20 03:04:07 +02:00
import fr.devinsy.kiss4web.ServletDispatcher;
/**
*
*/
class FooPlayer
{
static private org.apache.log4j.Logger logger;
static
2013-06-20 03:04:07 +02:00
{
// Initialize logger.
org.apache.log4j.Logger logger = null;
2013-06-20 03:04:07 +02:00
org.apache.log4j.BasicConfigurator.configure();
2013-06-20 03:04:07 +02:00
logger = org.apache.log4j.Logger.getRootLogger();
// logger.setLevel (org.apache.log4j.Level.INFO);
logger.setLevel(org.apache.log4j.Level.INFO);
2013-06-20 03:04:07 +02:00
logger.info("Enter");
//
2013-06-20 03:04:07 +02:00
logger.info("Set the log file format...");
2013-06-20 03:04:07 +02:00
// log =
// org.apache.log4j.Category.getInstance(Application.class.getName());
logger.info("... done.");
2013-06-20 03:04:07 +02:00
logger.debug("Exit");
logger = org.apache.log4j.Logger.getLogger(FooPlayer.class.getName());
}
/**
*
*/
2013-06-20 03:04:07 +02:00
public static String check(final String title, final StringBuffer source, final String model)
{
String result;
2013-06-20 03:04:07 +02:00
if (source.indexOf(model) == -1)
{
2013-06-20 03:04:07 +02:00
result = String.format("%-40s -> KO <-", title) + "\nGet:\n" + source + "\nWaiting:\n" + model;
}
else
{
2013-06-20 03:04:07 +02:00
result = String.format("%-40s [ OK ] ", title);
}
//
return (result);
}
/**
*
*/
2013-06-20 03:04:07 +02:00
public static void main(final String[] args)
{
2013-06-20 03:04:07 +02:00
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"));
}
2013-06-20 03:04:07 +02:00
/**
*
*/
public static String testCaller(final String pathInfo, final String prefix)
{
String result;
result = "[" + pathInfo + "]=>[" + ServletDispatcher.pathInfoToClassName(pathInfo, prefix) + "]";
//
return (result);
}
}