2021-11-27 15:46:54 +01:00
|
|
|
|
2013-06-20 02:57:31 +02:00
|
|
|
/**
|
2016-09-12 05:09:54 +02:00
|
|
|
* Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
|
2014-02-04 18:43:47 +01:00
|
|
|
*
|
2016-09-12 05:09:54 +02:00
|
|
|
* This file is part of Kiss4web.
|
2014-02-04 18:43:47 +01:00
|
|
|
*
|
2014-02-04 18:47:39 +01:00
|
|
|
* Kiss4web is free software: you can redistribute it and/or modify
|
2016-09-12 05:09:54 +02:00
|
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
2014-02-04 18:43:47 +01:00
|
|
|
* 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
|
2016-09-12 05:09:54 +02:00
|
|
|
* GNU Lesser General Public License for more details.
|
2014-02-04 18:43:47 +01:00
|
|
|
*
|
2016-09-12 05:09:54 +02:00
|
|
|
* You should have received a copy of the GNU Lesser 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
|
|
|
*/
|
2021-07-10 19:46:31 +02:00
|
|
|
import fr.devinsy.kiss4web.dispatcher.KissDispatcherUtils;
|
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
|
|
|
*/
|
2016-10-03 05:48:51 +02:00
|
|
|
public class FooSandbox
|
2013-06-20 02:57:31 +02:00
|
|
|
{
|
2016-09-12 05:09:54 +02:00
|
|
|
private static org.apache.log4j.Logger logger;
|
2013-06-20 02:57:31 +02:00
|
|
|
|
2016-09-08 03:45:06 +02:00
|
|
|
static
|
|
|
|
{
|
|
|
|
// Initialize logger.
|
|
|
|
org.apache.log4j.Logger logger = null;
|
2013-06-20 02:57:31 +02:00
|
|
|
|
2016-09-08 03:45:06 +02:00
|
|
|
org.apache.log4j.BasicConfigurator.configure();
|
2013-06-20 02:57:31 +02:00
|
|
|
|
2016-09-08 03:45:06 +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
|
|
|
|
2016-09-08 03:45:06 +02:00
|
|
|
logger.info("Enter");
|
2013-06-20 02:57:31 +02:00
|
|
|
|
2016-09-08 03:45:06 +02:00
|
|
|
//
|
|
|
|
logger.info("Set the log file format...");
|
2013-06-20 02:57:31 +02:00
|
|
|
|
2016-09-08 03:45:06 +02:00
|
|
|
// log =
|
|
|
|
// org.apache.log4j.Category.getInstance(Application.class.getName());
|
|
|
|
logger.info("... done.");
|
2013-06-20 02:57:31 +02:00
|
|
|
|
2016-09-08 03:45:06 +02:00
|
|
|
logger.debug("Exit");
|
|
|
|
logger = org.apache.log4j.Logger.getLogger(FooSandbox.class.getName());
|
|
|
|
}
|
2013-06-20 02:57:31 +02:00
|
|
|
|
2016-09-08 03:45:06 +02:00
|
|
|
/**
|
2021-11-27 15:46:54 +01:00
|
|
|
*
|
|
|
|
*/
|
2016-09-08 03:45:06 +02:00
|
|
|
public static String check(final String title, final StringBuffer source, final String model)
|
|
|
|
{
|
|
|
|
String result;
|
2013-06-20 02:57:31 +02:00
|
|
|
|
2016-09-08 03:45:06 +02:00
|
|
|
if (source.indexOf(model) == -1)
|
|
|
|
{
|
|
|
|
result = String.format("%-40s -> KO <-", title) + "\nGet:\n" + source + "\nWaiting:\n" + model;
|
2013-06-20 02:57:31 +02:00
|
|
|
|
2016-09-08 03:45:06 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
result = String.format("%-40s [ OK ] ", title);
|
|
|
|
}
|
2013-06-20 02:57:31 +02:00
|
|
|
|
2016-09-08 03:45:06 +02:00
|
|
|
//
|
|
|
|
return (result);
|
|
|
|
}
|
2013-06-20 02:57:31 +02:00
|
|
|
|
2016-09-08 03:45:06 +02:00
|
|
|
/**
|
2021-11-27 15:46:54 +01:00
|
|
|
*
|
|
|
|
*/
|
2016-09-08 03:45:06 +02:00
|
|
|
public static void main(final 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"));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-11-27 15:46:54 +01:00
|
|
|
*
|
|
|
|
*/
|
2016-09-08 03:45:06 +02:00
|
|
|
public static String testCaller(final String pathInfo, final String prefix)
|
|
|
|
{
|
|
|
|
String result;
|
2013-06-20 03:04:07 +02:00
|
|
|
|
2016-09-12 05:09:54 +02:00
|
|
|
result = "[" + pathInfo + "]=>[" + KissDispatcherUtils.pathInfoToClassName(pathInfo, prefix) + "]";
|
2013-06-20 03:04:07 +02:00
|
|
|
|
2016-09-08 03:45:06 +02:00
|
|
|
//
|
|
|
|
return (result);
|
|
|
|
}
|
2013-06-20 02:57:31 +02:00
|
|
|
}
|