Tests: Unify core test resources across JUnit and ScalaTest

Fixes a test failure running the ScalaTests under Ant
This commit is contained in:
str4d
2019-08-10 17:19:21 +00:00
parent 8586c28b5f
commit 459eb7fdcd
12 changed files with 7 additions and 19 deletions

View File

@ -29,11 +29,7 @@ sourceSets {
} }
} }
resources { resources {
srcDir 'java/test/junit' srcDir 'java/test/resources'
include 'resources/*'
include 'net/i2p/crypto/eddsa/test.data'
include 'net/i2p/crypto/eddsa/math/baseDblPrecmp'
include 'net/i2p/crypto/eddsa/math/basePrecmp'
} }
} }
jmh { jmh {

View File

@ -237,14 +237,6 @@
</classpath> </classpath>
<compilerarg line="${javac.compilerargs}" /> <compilerarg line="${javac.compilerargs}" />
</javac> </javac>
<!-- EdDSA test vectors -->
<copy todir="./build/obj">
<fileset dir="./test/junit/">
<include name="net/i2p/crypto/eddsa/test.data"/>
<include name="net/i2p/crypto/eddsa/math/baseDblPrecmp"/>
<include name="net/i2p/crypto/eddsa/math/basePrecmp"/>
</fileset>
</copy>
</target> </target>
<!-- jars with tests --> <!-- jars with tests -->
<target name="jarScalaTest" depends="scalatest.compileTest"> <target name="jarScalaTest" depends="scalatest.compileTest">
@ -321,6 +313,7 @@
<pathelement location="${scalatest.jar}" /> <pathelement location="${scalatest.jar}" />
<pathelement location="./build/obj_cobertura" /> <pathelement location="./build/obj_cobertura" />
<pathelement location="./build/obj" /> <pathelement location="./build/obj" />
<pathelement location="./test/resources" />
<pathelement location="../../build/jbigi.jar" /> <pathelement location="../../build/jbigi.jar" />
<pathelement location="${with.clover}" /> <pathelement location="${with.clover}" />
<pathelement location="${with.cobertura}" /> <pathelement location="${with.cobertura}" />
@ -363,6 +356,7 @@
<pathelement location="${junit.home}/junit4.jar" /> <pathelement location="${junit.home}/junit4.jar" />
<pathelement location="./build/obj_cobertura" /> <pathelement location="./build/obj_cobertura" />
<pathelement location="./build/obj" /> <pathelement location="./build/obj" />
<pathelement location="./test/resources" />
<pathelement location="../../build/jbigi.jar" /> <pathelement location="../../build/jbigi.jar" />
<pathelement location="${with.clover}" /> <pathelement location="${with.clover}" />
<pathelement location="${with.cobertura}" /> <pathelement location="${with.cobertura}" />

View File

@ -10,10 +10,7 @@ import org.scalatest.Matchers
class CertUtilSpec extends FunSpec with Matchers { class CertUtilSpec extends FunSpec with Matchers {
describe("CertUtil") { describe("CertUtil") {
// For some stupid gradle issues, it don't copies reosurces. So hacky way. val certFileUrl = getClass.getResource("/meeh_at_mail.i2p.crt")
// When added to junit directory, it get copied. Until a better way is found,
// this is the non-optimal solution.
val certFileUrl = getClass.getResource("/resources/meeh_at_mail.i2p.crt")
val certFile = new File(certFileUrl.toURI) val certFile = new File(certFileUrl.toURI)
it("should be able to read a certificate") { it("should be able to read a certificate") {

View File

@ -17,10 +17,10 @@ class SU3FileSpec extends FunSpec with Matchers {
} }
describe("SU3File") { describe("SU3File") {
val certFileUrl = getClass.getResource("/resources/meeh_at_mail.i2p.crt") val certFileUrl = getClass.getResource("/meeh_at_mail.i2p.crt")
val certFile = new File(certFileUrl.toURI) val certFile = new File(certFileUrl.toURI)
val seedFileUrl = getClass.getResource("/resources/i2pseeds.su3") val seedFileUrl = getClass.getResource("/i2pseeds.su3")
val seedFile = new File(seedFileUrl.toURI) val seedFile = new File(seedFileUrl.toURI)
it("should be able to verify a valid file") { it("should be able to verify a valid file") {

View File

@ -5,6 +5,7 @@
- Fix compilation bug after SSU HMAC implementation move - Fix compilation bug after SSU HMAC implementation move
- Temporarily mitigate discrepancy between Ant and Gradle in - Temporarily mitigate discrepancy between Ant and Gradle in
SingleFileNamingServiceTest SingleFileNamingServiceTest
- Unify core test resources across JUnit and ScalaTest
2019-08-05 zzz 2019-08-05 zzz
* i2ptunnel: * i2ptunnel: