2013-06-20 02:57:31 +02:00
|
|
|
/**
|
2014-02-04 18:43:47 +01:00
|
|
|
* Copyright (C) 2006-2010, 2013-2014 Christian Pierre MOMON
|
|
|
|
*
|
|
|
|
* This file is part of Devinsy-utils.
|
|
|
|
*
|
2014-02-04 18:47:39 +01:00
|
|
|
* Kiss4web is free software: you can redistribute it and/or modify
|
2014-02-04 18:43:47 +01:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
2014-02-04 18:47:39 +01:00
|
|
|
* Kiss4web is distributed in the hope that it will be useful,
|
2014-02-04 18:43:47 +01:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2014-02-04 18:47:39 +01:00
|
|
|
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
|
2013-06-20 02:57:31 +02:00
|
|
|
*/
|
2013-06-20 03:04:07 +02:00
|
|
|
import fr.devinsy.kiss4web.ServletDispatcher;
|
2013-06-20 02:57:31 +02:00
|
|
|
|
|
|
|
/**
|
2014-02-04 18:43:47 +01:00
|
|
|
* Kiss4Web tests.
|
2013-06-20 02:57:31 +02:00
|
|
|
*/
|
2013-06-26 16:52:15 +02:00
|
|
|
class FooSandbox
|
2013-06-20 02:57:31 +02:00
|
|
|
{
|
|
|
|
static private org.apache.log4j.Logger logger;
|
|
|
|
|
|
|
|
static
|
2013-06-20 03:04:07 +02:00
|
|
|
{
|
2013-06-20 02:57:31 +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 02:57:31 +02:00
|
|
|
|
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 02:57:31 +02:00
|
|
|
|
2013-06-20 03:04:07 +02:00
|
|
|
logger.info("Enter");
|
2013-06-20 02:57:31 +02:00
|
|
|
|
|
|
|
//
|
2013-06-20 03:04:07 +02:00
|
|
|
logger.info("Set the log file format...");
|
2013-06-20 02:57:31 +02:00
|
|
|
|
2013-06-20 03:04:07 +02:00
|
|
|
// log =
|
|
|
|
// org.apache.log4j.Category.getInstance(Application.class.getName());
|
|
|
|
logger.info("... done.");
|
2013-06-20 02:57:31 +02:00
|
|
|
|
2013-06-20 03:04:07 +02:00
|
|
|
logger.debug("Exit");
|
2013-06-26 16:52:15 +02:00
|
|
|
logger = org.apache.log4j.Logger.getLogger(FooSandbox.class.getName());
|
2013-06-20 02:57:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2013-06-20 03:04:07 +02:00
|
|
|
public static String check(final String title, final StringBuffer source, final String model)
|
2013-06-20 02:57:31 +02:00
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
2013-06-20 03:04:07 +02:00
|
|
|
if (source.indexOf(model) == -1)
|
2013-06-20 02:57:31 +02:00
|
|
|
{
|
2013-06-20 03:04:07 +02:00
|
|
|
result = String.format("%-40s -> KO <-", title) + "\nGet:\n" + source + "\nWaiting:\n" + model;
|
2013-06-20 02:57:31 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-06-20 03:04:07 +02:00
|
|
|
result = String.format("%-40s [ OK ] ", title);
|
2013-06-20 02:57:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
return (result);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2013-06-20 03:04:07 +02:00
|
|
|
public static void main(final String[] args)
|
2013-06-20 02:57:31 +02:00
|
|
|
{
|
2013-06-20 03:04:07 +02:00
|
|
|
System.out.println("----------------------------");
|
2013-06-20 02:57:31 +02:00
|
|
|
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);
|
|
|
|
}
|
2013-06-20 02:57:31 +02:00
|
|
|
}
|