kiss4web/test/FooSandbox.java

99 lines
2.8 KiB
Java
Raw Permalink Normal View History

/**
* Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
2014-02-04 18:43:47 +01:00
*
* This file is part of Kiss4web.
2014-02-04 18:43:47 +01:00
*
* Kiss4web is free software: you can redistribute it and/or modify
* 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.
*
* 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 Lesser General Public License for more details.
2014-02-04 18:43:47 +01:00
*
* You should have received a copy of the GNU Lesser General Public License
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
*/
import fr.devinsy.kiss4web.KissDispatcherUtils;
/**
2014-02-04 18:43:47 +01:00
* Kiss4Web tests.
*/
2016-10-03 05:48:51 +02:00
public class FooSandbox
{
private static org.apache.log4j.Logger logger;
2016-09-08 03:45:06 +02:00
static
{
// Initialize logger.
org.apache.log4j.Logger logger = null;
2016-09-08 03:45:06 +02:00
org.apache.log4j.BasicConfigurator.configure();
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);
2016-09-08 03:45:06 +02:00
logger.info("Enter");
2016-09-08 03:45:06 +02:00
//
logger.info("Set the log file format...");
2016-09-08 03:45:06 +02:00
// log =
// org.apache.log4j.Category.getInstance(Application.class.getName());
logger.info("... done.");
2016-09-08 03:45:06 +02:00
logger.debug("Exit");
logger = org.apache.log4j.Logger.getLogger(FooSandbox.class.getName());
}
2016-09-08 03:45:06 +02:00
/**
*
*/
2016-09-08 03:45:06 +02:00
public static String check(final String title, final StringBuffer source, final String model)
{
String result;
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;
2016-09-08 03:45:06 +02:00
}
else
{
result = String.format("%-40s [ OK ] ", title);
}
2016-09-08 03:45:06 +02:00
//
return (result);
}
2016-09-08 03:45:06 +02: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"));
}
/**
2013-06-20 03:04:07 +02: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
result = "[" + pathInfo + "]=>[" + KissDispatcherUtils.pathInfoToClassName(pathInfo, prefix) + "]";
2013-06-20 03:04:07 +02:00
2016-09-08 03:45:06 +02:00
//
return (result);
}
}