Improve build, add test management, update lib.

This commit is contained in:
Christian P. MOMON 2013-06-25 03:11:22 +02:00
parent 2fb862090f
commit 0ab32b6088
14 changed files with 126 additions and 30 deletions

View file

@ -1,12 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="tests"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="lib/servlet-api.jar"/>
<classpathentry kind="lib" path="lib/log4j-1.2.14.jar"/>
<classpathentry kind="lib" path="lib/devinsy-utils-0.1.4.jar"/>
<classpathentry kind="lib" path="lib/commons-fileupload-1.2.1.jar"/>
<classpathentry kind="lib" path="lib/commons-codec-1.4.jar"/>
<classpathentry kind="lib" path="lib/hamcrest-core-1.3.jar"/>
<classpathentry kind="lib" path="lib/junit-4.11.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
/dist
/bin
/build

View file

@ -88,7 +88,7 @@ org.eclipse.jdt.core.formatter.indent_empty_lines=false
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert

3
build.properties Normal file
View file

@ -0,0 +1,3 @@
product.name=kiss4web
product.revision.major=0
product.revision.minor=2

108
build.xml
View file

@ -1,38 +1,96 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="dist" name="Create Jar for Project KISS4WEB">
<!--ANT 1.7 is required -->
<!-- Run Eclipse before to run ant. -->
<property name="product" value="devinsy-kiss4web" />
<buildnumber file="build.num" description="Id of the build"/>
<property name="version" value="0.1.${build.number}" /> <!-- AUTOMATIC MANAGEMENT -->
<!--ANT 1.7 is required -->
<property file="build.properties"/>
<property name="build.dir" value="${basedir}/build" />
<property name="dist.name" value="${product}-${version}" />
<property name="dist.jar" value="${basedir}/dist/${dist.name}.jar" />
<property name="dist.srczip" value="${basedir}/dist/${dist.name}-sources.zip" />
<tstamp>
<format property="TODAY" pattern="dd/MM/yyyy HH:mm:ss" />
</tstamp>
<property name="build.src" value="${basedir}/src" />
<property name="build.classes" value="${build.dir}/classes" />
<property name="test.src" value="${basedir}/test" />
<property name="test.classes" value="${build.dir}/test-classes" />
<property name="dist.dir" value="${basedir}/dist" />
<property name="debug" value="on"/>
<path id="build.classpath">
<fileset dir="lib" includes="**/*.jar"/>
</path>
<path id="test.classpath.compile">
<path refid="build.classpath"/>
<pathelement path="${build.classes}"/>
</path>
<path id="test.classpath.run">
<path refid="test.classpath.compile"/>
<pathelement path="${test.classes}"/>
</path>
<!-- ***** Help ***** -->
<target name="help" description="Display detailed usage information">
<echo>Type ant -p</echo>
</target>
<!-- ***** Clean ***** -->
<target name="clean" description="Clean temporary directories">
<delete dir="${build.dir}"/>
</target>
<!-- ***** Compile ***** -->
<target name="compile" description="Compile main code">
<mkdir dir="${build.dir}/classes"/>
<javac srcdir="${build.src}" destdir="${build.classes}" debug="${debug}" deprecation="on" includeantruntime="false">
<classpath refid="test.classpath.compile"/>
</javac>
</target>
<!-- ***** Compile test ***** -->
<target name="compile-test" description="Compile test code">
<mkdir dir="${test.classes}"/>
<javac srcdir="${test.src}" destdir="${test.classes}" debug="${debug}" deprecation="on" includeantruntime="false">
<classpath refid="test.classpath.compile"/>
</javac>
</target>
<!-- ***** Test ***** -->
<target name="test" description="Run unit tests" depends="clean,compile,compile-test">
<mkdir dir="${build.dir}/test-reports"/>
<junit printsummary="yes" haltonfailure="yes">
<classpath refid="test.classpath.run"/>
<formatter type="plain" usefile="true" />
<batchtest fork="yes" todir="${build.dir}/test-reports/">
<fileset dir="test">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<!-- TARGET DIST -->
<target name="dist" description="Build distribution directory">
<delete file="${dist.zip}" />
<!-- ***** Dist ***** -->
<target name="dist" description="Build distribution" depends="clean,compile">
<!-- -->
<mkdir dir="${dist.dir}"/>
<buildnumber file="build.num" description="Id of the build"/> <!-- AUTOMATIC MANAGEMENT -->
<property name="dist.version" value="${product.revision.major}.${product.revision.minor}.${build.number}" />
<property name="dist.name" value="${product.name}-${dist.version}" />
<!-- Package compiled -->
<property name="dist.jar" value="${dist.dir}/${dist.name}.jar" />
<tstamp>
<format property="dist.time" pattern="dd/MM/yyyy HH:mm:ss" /> <!-- TODAY -->
</tstamp>
<jar destfile="${dist.jar}" >
<manifest>
<attribute name="Built-By" value="${user.name} using DEVINSY-UTILS ANT"/>
<attribute name="Built-Date" value="${TODAY}"/>
</manifest>
<fileset dir="${basedir}/bin" excludes="TestTree/**" />
<manifest>
<attribute name="Built-By" value="${user.name} using ant"/>
<attribute name="Built-Date" value="${dist.time}"/>
</manifest>
<fileset dir="${basedir}/build" excludes="TestTree/**" />
<zipfileset dir="${basedir}/" includes="LICENSE"/>
</jar>
<zip destfile="${dist.srczip}"
update="true"
preserve0permissions="true">
<fileset dir="${basedir}/src"/>
<!-- Package sources -->
<property name="dist.srczip" value="${basedir}/dist/${dist.name}-sources.zip" />
<zip destfile="${dist.srczip}" update="true" preserve0permissions="true">
<fileset dir="${basedir}/src"/>
<zipfileset dir="${basedir}/" includes="LICENSE"/>
</zip>
</target>
</target>
</project>

9
lib/README Normal file
View file

@ -0,0 +1,9 @@
Description of used libraries:
- 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

Binary file not shown.

Binary file not shown.

BIN
lib/hamcrest-core-1.3.jar Normal file

Binary file not shown.

BIN
lib/junit-4.11-sources.jar Normal file

Binary file not shown.

BIN
lib/junit-4.11.jar Normal file

Binary file not shown.

View file

@ -3,6 +3,8 @@ package fr.devinsy.util.web;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.codec.digest.DigestUtils;
import fr.devinsy.kiss4web.CookieHelper;
/**
@ -147,7 +149,7 @@ public class SimpleSecurityAgent
{
String result;
result = org.apache.commons.codec.digest.DigestUtils.md5Hex(source);
result = DigestUtils.md5Hex(source);
//
return (result);

View file

@ -7,7 +7,7 @@ import fr.devinsy.kiss4web.ServletDispatcher;
/**
*
*/
class FooTester
class FooPlayer
{
static private org.apache.log4j.Logger logger;
@ -32,7 +32,7 @@ class FooTester
logger.info("... done.");
logger.debug("Exit");
logger = org.apache.log4j.Logger.getLogger(FooTester.class.getName());
logger = org.apache.log4j.Logger.getLogger(FooPlayer.class.getName());
}
/**

21
test/one/Foo2Test.java Normal file
View file

@ -0,0 +1,21 @@
package one;
import org.junit.Test;
public class Foo2Test
{
// private Logger logger =
// LoggerFactory.getLogger(PdfGenerationAmqpServiceInjectedTest.class);
/**
*
*/
@Test
public void test2a()
{
// logger.debug("===== test starting...");
// logger.debug("===== test done.");
}
}