Commit bb25311d authored by Boris Lucas's avatar Boris Lucas
Browse files

Add Junit jar dependency, update build to run unit tests.

parent de8de325
......@@ -12,6 +12,7 @@ Class-Path: lib/xom-1.2.10.jar
lib/libpkcs11wrapper.jnilib.jar
lib/iaikPkcs11Provider.jar
lib/iaik_xsect.jar
lib/junit4-4.8.2
Permissions: all-permissions
Application-Name: LiberSign
Application-Library-Allowable-Codebase: *
......
......@@ -19,7 +19,9 @@ is divided into following sections:
- cleanup
-->
<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="SplittedSignatureApplet-impl">
<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1"
xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3"
basedir=".." default="default" name="SplittedSignatureApplet-impl">
<import file="jnlp-impl.xml"/>
<fail message="Please build using Ant 1.8.0 or higher.">
<condition>
......@@ -29,9 +31,9 @@ is divided into following sections:
</condition>
</fail>
<target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
<!--
<!--
======================
INITIALIZATION SECTION
INITIALIZATION SECTION
======================
-->
<target name="-pre-init">
......@@ -382,7 +384,7 @@ is divided into following sections:
<element name="customize" optional="true"/>
<sequential>
<property name="junit.forkmode" value="perTest"/>
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
<junit dir="${build.test.classes.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
<test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
......@@ -405,7 +407,7 @@ is divided into following sections:
<element name="customize" optional="true"/>
<sequential>
<property name="junit.forkmode" value="perTest"/>
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
<junit dir="${build.test.classes.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
<batchtest todir="${build.test.results.dir}">
<fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
......@@ -524,7 +526,7 @@ is divided into following sections:
<element name="customize" optional="true"/>
<sequential>
<property name="junit.forkmode" value="perTest"/>
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
<junit dir="${build.test.classes.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
<test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
......@@ -549,7 +551,7 @@ is divided into following sections:
<element name="customize" optional="true"/>
<sequential>
<property name="junit.forkmode" value="perTest"/>
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
<junit dir="${build.test.classes.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
<batchtest todir="${build.test.results.dir}">
<fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
......@@ -1251,6 +1253,7 @@ is divided into following sections:
<j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.src.dir}"/>
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.resources.dir}" excludes="" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile-test">
......@@ -1268,6 +1271,7 @@ is divided into following sections:
<j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${test.resources.dir}" excludes="" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile-test-single">
......@@ -1285,6 +1289,7 @@ is divided into following sections:
</target>
<target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
<j2seproject3:test includes="${includes}" testincludes="**/*Test.java"/>
</target>
<target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
<fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
......@@ -1312,6 +1317,7 @@ is divided into following sections:
<fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/>
<!--
=======================
TEST DEBUGGING SECTION
......
......@@ -41,6 +41,7 @@ file.reference.libpkcs11wrapper.jnilib.jar=lib/libpkcs11wrapper.jnilib.jar
file.reference.xmlsec-1.4.6.jar=lib/xmlsec-1.4.6.jar
file.reference.xom-1.2.10.jar=lib/xom-1.2.10.jar
file.reference.commons-lang-2.6.jar=lib/commons-lang-2.6.jar
file.reference.junit4-4.8.2.jar=lib/junit4-4.8.2.jar
includes=**
jar.archive.disabled=${jnlp.enabled}
jar.compress=true
......@@ -57,7 +58,8 @@ javac.classpath=\
${file.reference.iaik_jce_full.jar}:\
${file.reference.libpkcs11wrapper.jnilib.jar}:\
${file.reference.iaik_xsect.jar}:\
${file.reference.iaikPkcs11Provider.jar}
${file.reference.iaikPkcs11Provider.jar}:\
${file.reference.junit4-4.8.2.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
......@@ -124,4 +126,5 @@ source.reference.bcprov-jdk15on-150.jar=../../bcprov-jdk15on-150.zip
source.reference.iaikPkcs11Wrapper.jar=/home/svast/Bureau/mac os sign/iaikPkcs11Wrapper_1_3.zip!/src/java/src/
source.reference.xom-1.2.10.jar=/home/svast/src/xom-1.2.10.zip!/XOM/src/
src.dir=src
test.src.dir=test
test.src.dir=test/java
test.resources.dir=test/resources
......@@ -17,6 +17,7 @@ import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collections;
import static org.junit.Assert.assertFalse;
......@@ -77,7 +78,7 @@ public class CertVerifierTest {
public void checkCrlWithKeystore_test_success() throws Exception {
X509Certificate validCertificate = loadCertInP12AtPath("certificates/testcert_blucas@libriciel.fr.p12", "testcert");
boolean res = CertVerifier.checkCrlWithKeystore(validCertificate, adullactRoots, Collections.emptyList());
boolean res = CertVerifier.checkCrlWithKeystore(validCertificate, adullactRoots, new ArrayList<String>());
assertTrue(res);
}
......@@ -85,7 +86,7 @@ public class CertVerifierTest {
public void checkCrlWithKeystore_test_revoked() throws Exception {
X509Certificate revokedCertificate = loadCertInP12AtPath("certificates/boris.lucas-revocable@libriciel.fr.p12", "revocable");
CertVerifier.checkCrlWithKeystore(revokedCertificate, adullactRoots, Collections.emptyList());
CertVerifier.checkCrlWithKeystore(revokedCertificate, adullactRoots, new ArrayList<String>());
}
X509Certificate loadCertInP12AtPath(String path, String password) throws Exception {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment