Upgraded lib and dev environment.

This commit is contained in:
Christian P. MOMON 2021-11-27 15:46:54 +01:00
parent 9b9721f275
commit b70b496bbf
29 changed files with 246 additions and 117 deletions

View file

@ -2,28 +2,29 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="lib" path="lib/servlet-api.jar" sourcepath="/KIWA/resources/extra-jars/servlet-api-2.4-sources.jar"/>
<classpathentry kind="lib" path="lib/commons-codec-1.8.jar" sourcepath="lib/commons-codec-1.8-sources.jar"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="lib" path="lib/commons-fileupload-1.3.jar" sourcepath="lib/commons-fileupload-1.3-sources.jar"/>
<classpathentry kind="lib" path="lib/commons-lang3-3.1-sources.jar"/>
<classpathentry kind="lib" path="lib/commons-lang3-3.1.jar" sourcepath="lib/commons-lang3-3.1-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/log4j-1.2.17-source.zip"/>
<classpathentry kind="lib" path="lib/Logs/log4j-1.2.17.jar"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-api-1.7.5-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-api-1.7.5.jar"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-log4j12-1.7.5-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-log4j12-1.7.5.jar"/>
<classpathentry kind="lib" path="lib/UnitTesting/hamcrest-core-1.3-sources.jar"/>
<classpathentry kind="lib" path="lib/UnitTesting/hamcrest-core-1.3.jar"/>
<classpathentry kind="lib" path="lib/UnitTesting/junit-4.11-sources.jar"/>
<classpathentry kind="lib" path="lib/UnitTesting/junit-4.11.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes>
<attribute name="module" value="true"/>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/devinsy-utils-0.3.2-sources.zip"/>
<classpathentry kind="lib" path="lib/devinsy-utils-0.3.2.jar"/>
<classpathentry kind="lib" path="lib/commons-codec-1.8.jar" sourcepath="lib/commons-codec-1.8-sources.jar"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="lib" path="lib/commons-fileupload-1.3.jar" sourcepath="lib/commons-fileupload-1.3-sources.jar"/>
<classpathentry kind="lib" path="lib/commons-lang3-3.1.jar" sourcepath="lib/commons-lang3-3.1-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/log4j-1.2.17.jar" sourcepath="lib/Logs/log4j-1.2.17-source.zip"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-api-1.7.5.jar" sourcepath="lib/Logs/slf4j-api-1.7.5-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-log4j12-1.7.5.jar" sourcepath="lib/Logs/slf4j-log4j12-1.7.5-sources.jar"/>
<classpathentry kind="lib" path="lib/UnitTesting/hamcrest-core-1.3.jar" sourcepath="lib/UnitTesting/hamcrest-core-1.3-sources.jar"/>
<classpathentry kind="lib" path="lib/UnitTesting/junit-4.12.jar" sourcepath="lib/UnitTesting/junit-4.12-sources.jar"/>
<classpathentry kind="lib" path="lib/devinsy-strings-0.11.4.jar" sourcepath="lib/devinsy-strings-0.11.4-sources.zip"/>
<classpathentry kind="lib" path="lib/tomcat9-servlet-api-9.0.31.jar" sourcepath="lib/tomcat9-servlet-api-9.0.31-sources.jar"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v9.0.46">
<attributes>
<attribute name="owner.project.facets" value="jst.utility"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/xidyn-1.11.2.jar" sourcepath="lib/xidyn-1.11.2-sources.zip"/>
<classpathentry kind="lib" path="lib/commons-io-2.7.jar" sourcepath="lib/commons-io-2.7-sources.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -1,14 +1,18 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
@ -30,7 +34,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assertion_message=0
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16
@ -161,7 +164,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
@ -235,7 +237,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert
org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
@ -395,7 +396,6 @@ org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator=true
org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true
org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true

View file

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="Apache Tomcat v9.0.46"/>
<fixed facet="java"/>
<fixed facet="jst.utility"/>
<installed facet="java" version="1.6"/>
<installed facet="jst.utility" version="1.0"/>
<installed facet="java" version="11"/>
</faceted-project>

View file

@ -1,11 +1,17 @@
Description of used libraries:
== Description of used libraries.
Various:
- commons-codec: digest tools.
- commons-fileupload:
- commons-io:
- devinsy-utils: util tools
- hamcrest-core: required by junit
- junit: unit tests API
- log4j: log API
- servlet-api: servlet API
Log libs:
- log4j: log API
- slf4j-api: facade log API
- slf4j-log4j12: adaptation layer between slf4j and log4j
UnitTest libs:
- hamcrest-core: required by junit
- junit: unit tests API

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/commons-io-2.7.jar Normal file

Binary file not shown.

Binary file not shown.

BIN
lib/commons-lang3-3.11.jar Normal file

Binary file not shown.

Binary file not shown.

BIN
lib/commons-text-1.9.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/devinsy-xml-0.11.0.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/xidyn-1.11.2.jar Normal file

Binary file not shown.

View file

@ -1,3 +1,4 @@
/**
* Copyright (C) 2006-2010, 2013-2016 Christian Pierre MOMON
*
@ -50,8 +51,8 @@ public class FooSandbox
}
/**
*
*/
*
*/
public static String check(final String title, final StringBuffer source, final String model)
{
String result;
@ -71,8 +72,8 @@ public class FooSandbox
}
/**
*
*/
*
*/
public static void main(final String[] args)
{
System.out.println("----------------------------");
@ -84,8 +85,8 @@ public class FooSandbox
}
/**
*
*/
*
*/
public static String testCaller(final String pathInfo, final String prefix)
{
String result;

View file

@ -1,5 +1,5 @@
/**
* Copyright (C) 2016 Christian Pierre MOMON
* Copyright (C) 2016-2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
@ -28,8 +28,7 @@ import fr.devinsy.kiss4web.dispatcher.hooks.ShortURLHook;
import fr.devinsy.kiss4web.mocks.HttpServletRequestMock;
/**
*
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
* The Class BlankCatcherTest.
*/
public class BlankCatcherTest
{
@ -44,7 +43,7 @@ public class BlankCatcherTest
HttpServletRequestMock source = new HttpServletRequestMock();
source.setPathInfo(null);
Assert.assertTrue(BlankHook.matches(source));
Assert.assertTrue(new BlankHook().matches(null, source));
}
/**
@ -56,7 +55,7 @@ public class BlankCatcherTest
HttpServletRequestMock source = new HttpServletRequestMock();
source.setPathInfo("");
Assert.assertTrue(BlankHook.matches(source));
Assert.assertTrue(new BlankHook().matches(null, source));
}
/**
@ -68,6 +67,6 @@ public class BlankCatcherTest
HttpServletRequestMock source = new HttpServletRequestMock();
source.setPathInfo("/");
Assert.assertFalse(BlankHook.matches(source));
Assert.assertFalse(new BlankHook().matches(null, source));
}
}

View file

@ -44,7 +44,7 @@ public class RootCatcherTest
HttpServletRequestMock source = new HttpServletRequestMock();
source.setPathInfo(null);
Assert.assertFalse(RootHook.matches(source));
Assert.assertFalse(new RootHook().matches(null, source));
}
/**
@ -56,7 +56,7 @@ public class RootCatcherTest
HttpServletRequestMock source = new HttpServletRequestMock();
source.setPathInfo("");
Assert.assertFalse(RootHook.matches(source));
Assert.assertFalse(new RootHook().matches(null, source));
}
/**
@ -68,7 +68,7 @@ public class RootCatcherTest
HttpServletRequestMock source = new HttpServletRequestMock();
source.setPathInfo("/");
Assert.assertTrue(RootHook.matches(source));
Assert.assertTrue(new RootHook().matches(null, source));
}
/**
@ -80,6 +80,6 @@ public class RootCatcherTest
HttpServletRequestMock source = new HttpServletRequestMock();
source.setPathInfo("/toto");
Assert.assertFalse(RootHook.matches(source));
Assert.assertFalse(new RootHook().matches(null, source));
}
}

View file

@ -0,0 +1,100 @@
/**
* Copyright (C) 2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
* 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
* 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,
* 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.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Kiss4web. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.kiss4web.dispatcher;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.kiss4web.dispatcher.hooks.ShortURLHook;
/**
* The Class DispatcherFactoryTest.
*/
public class DispatcherFactoryTest
{
private static Logger logger = LoggerFactory.getLogger(ShortURLHook.class);
/**
*
*/
@Test
public void testTranslateToClassName01()
{
String source = "/";
String target = KissDispatcherFactory.translateToClassName(source);
Assert.assertEquals("IndexXhtml", target);
}
/**
*
*/
@Test
public void testTranslateToClassName02()
{
String source = "/foo";
String target = KissDispatcherFactory.translateToClassName(source);
Assert.assertEquals("Foo", target);
}
/**
*
*/
@Test
public void testTranslateToClassName03()
{
String source = "/foo.xhtml";
String target = KissDispatcherFactory.translateToClassName(source);
Assert.assertEquals("FooXhtml", target);
}
/**
*
*/
@Test
public void testTranslateToClassName04()
{
String source = "/foo/bar.xhtml";
String target = KissDispatcherFactory.translateToClassName(source);
Assert.assertEquals("foo.BarXhtml", target);
}
/**
*
*/
@Test
public void testTranslateToClassName05()
{
String source = "/fooBarBaz/fooBarBaz.xhtml";
String target = KissDispatcherFactory.translateToClassName(source);
Assert.assertEquals("fooBarBaz.FooBarBazXhtml", target);
}
/**
*
*/
@Test
public void testTranslateToClassName06()
{
String source = "/foo_bar-baz/foo_bar-baz.xhtml";
String target = KissDispatcherFactory.translateToClassName(source);
Assert.assertEquals("foo_bar-baz.FooBarBazXhtml", target);
}
}

View file

@ -1,6 +1,7 @@
package fr.devinsy.kiss4web.mocks;
/**
* Copyright (C) 2016 Christian Pierre MOMON
* Copyright (C) 2016-2021 Christian Pierre MOMON
*
* This file is part of Kiss4web.
*
@ -39,6 +40,7 @@ import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpUpgradeHandler;
import javax.servlet.http.Part;
import org.slf4j.Logger;
@ -47,8 +49,7 @@ import org.slf4j.LoggerFactory;
import fr.devinsy.kiss4web.dispatcher.hooks.ShortURLHook;
/**
*
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
* The Class HttpServletRequestMock.
*/
public class HttpServletRequestMock implements HttpServletRequest
{
@ -56,6 +57,27 @@ public class HttpServletRequestMock implements HttpServletRequest
private String pathInfo;
@Override
public boolean authenticate(final HttpServletResponse arg0) throws IOException, ServletException
{
// TODO Auto-generated method stub
return false;
}
@Override
public String changeSessionId()
{
// TODO Auto-generated method stub
return null;
}
@Override
public AsyncContext getAsyncContext()
{
// TODO Auto-generated method stub
return null;
}
@Override
public Object getAttribute(final String name)
{
@ -91,6 +113,13 @@ public class HttpServletRequestMock implements HttpServletRequest
return 0;
}
@Override
public long getContentLengthLong()
{
// TODO Auto-generated method stub
return 0;
}
@Override
public String getContentType()
{
@ -119,6 +148,13 @@ public class HttpServletRequestMock implements HttpServletRequest
return 0;
}
@Override
public DispatcherType getDispatcherType()
{
// TODO Auto-generated method stub
return null;
}
@Override
public String getHeader(final String name)
{
@ -224,6 +260,20 @@ public class HttpServletRequestMock implements HttpServletRequest
return null;
}
@Override
public Part getPart(final String arg0) throws IOException, IllegalStateException, ServletException
{
// TODO Auto-generated method stub
return null;
}
@Override
public Collection<Part> getParts() throws IOException, IllegalStateException, ServletException
{
// TODO Auto-generated method stub
return null;
}
@Override
public String getPathInfo()
{
@ -342,6 +392,13 @@ public class HttpServletRequestMock implements HttpServletRequest
return 0;
}
@Override
public ServletContext getServletContext()
{
// TODO Auto-generated method stub
return null;
}
@Override
public String getServletPath()
{
@ -370,6 +427,20 @@ public class HttpServletRequestMock implements HttpServletRequest
return null;
}
@Override
public boolean isAsyncStarted()
{
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isAsyncSupported()
{
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isRequestedSessionIdFromCookie()
{
@ -412,6 +483,20 @@ public class HttpServletRequestMock implements HttpServletRequest
return false;
}
@Override
public void login(final String arg0, final String arg1) throws ServletException
{
// TODO Auto-generated method stub
}
@Override
public void logout() throws ServletException
{
// TODO Auto-generated method stub
}
@Override
public void removeAttribute(final String name)
{
@ -438,41 +523,6 @@ public class HttpServletRequestMock implements HttpServletRequest
this.pathInfo = pathInfo;
}
@Override
public AsyncContext getAsyncContext()
{
// TODO Auto-generated method stub
return null;
}
@Override
public DispatcherType getDispatcherType()
{
// TODO Auto-generated method stub
return null;
}
@Override
public ServletContext getServletContext()
{
// TODO Auto-generated method stub
return null;
}
@Override
public boolean isAsyncStarted()
{
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isAsyncSupported()
{
// TODO Auto-generated method stub
return false;
}
@Override
public AsyncContext startAsync()
{
@ -481,45 +531,16 @@ public class HttpServletRequestMock implements HttpServletRequest
}
@Override
public AsyncContext startAsync(ServletRequest arg0, ServletResponse arg1)
public AsyncContext startAsync(final ServletRequest arg0, final ServletResponse arg1)
{
// TODO Auto-generated method stub
return null;
}
@Override
public boolean authenticate(HttpServletResponse arg0) throws IOException, ServletException
{
// TODO Auto-generated method stub
return false;
}
@Override
public Part getPart(String arg0) throws IOException, IllegalStateException, ServletException
public <T extends HttpUpgradeHandler> T upgrade(final Class<T> arg0) throws IOException, ServletException
{
// TODO Auto-generated method stub
return null;
}
@Override
public Collection<Part> getParts() throws IOException, IllegalStateException, ServletException
{
// TODO Auto-generated method stub
return null;
}
@Override
public void login(String arg0, String arg1) throws ServletException
{
// TODO Auto-generated method stub
}
@Override
public void logout() throws ServletException
{
// TODO Auto-generated method stub
}
}