diff options
author | Christian Maierhofer <cmaierhofer@iaik.tugraz.at> | 2016-06-24 09:09:49 +0200 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2016-08-17 16:54:15 +0200 |
commit | bfff992ce5e09e176b6509752e4404dd4286544b (patch) | |
tree | cf77e3f5444f19ca2a8487ade38d864ec2cfcdfe /pdf-as-tests/build.gradle | |
parent | da64c825de6ad061f5c734630faf0d6e9606dc12 (diff) | |
download | pdf-as-4-bfff992ce5e09e176b6509752e4404dd4286544b.tar.gz pdf-as-4-bfff992ce5e09e176b6509752e4404dd4286544b.tar.bz2 pdf-as-4-bfff992ce5e09e176b6509752e4404dd4286544b.zip |
added testsuite functionality for pdfbox2
Diffstat (limited to 'pdf-as-tests/build.gradle')
-rw-r--r-- | pdf-as-tests/build.gradle | 75 |
1 files changed, 52 insertions, 23 deletions
diff --git a/pdf-as-tests/build.gradle b/pdf-as-tests/build.gradle index 71b3a4a7..9b14f7e2 100644 --- a/pdf-as-tests/build.gradle +++ b/pdf-as-tests/build.gradle @@ -14,33 +14,72 @@ repositories { maven { url "https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/" } } +configurations{ + pdfBox2Compile + pdfBox1Compile +} + +sourceSets{ + pdfBox2{ + compileClasspath = configurations.pdfBox2Compile + } + pdfBox1{ + compileClasspath = configurations.pdfBox1Compile + } +} + dependencies { compile project (':pdf-as-lib') testCompile project (':pdf-as-moa') - testCompile project (':pdf-as-pdfbox') + compile project (':signature-standards:sigs-pkcs7detached') compile project (':signature-standards:sigs-pades') compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.7' testCompile group: 'junit', name: 'junit', version: '4.+' - testCompile group: 'org.apache.pdfbox', name: 'preflight', version: '1.8.7' - testCompile group: 'org.apache.pdfbox', name: 'pdfbox', version: '1.8.7' testCompile group: 'org.icepdf', name: 'icepdf-core', version: '5.0.7' + + pdfBox1Compile project (':pdf-as-pdfbox') + pdfBox1Compile group: 'org.apache.pdfbox', name: 'preflight', version: '1.8.7' + pdfBox1Compile group: 'org.apache.pdfbox', name: 'pdfbox', version: '1.8.7' + + pdfBox2Compile project (':pdf-as-pdfbox-2') + pdfBox2Compile group: 'org.apache.pdfbox', name: 'preflight', version: '2.0.2' + pdfBox2Compile group: 'org.apache.pdfbox', name: 'pdfbox', version: '2.0.2' + pdfBox2Compile group: 'org.apache.pdfbox', name: 'pdfbox-tools', version: '2.0.2' + } + logger.info("Building tasks for Test suites") def suiteDir = new File(projectDir, "src/test/test-suites") logger.info("Searching: " + suiteDir.absolutePath) +//Eclipse UI shows an error because source set dependencies are not recognized, so we add the dependencies manually +eclipse.classpath.plusConfigurations+=[configurations.pdfBox1Compile] + suiteDir.eachDir { File subDir -> def dirname = subDir.name logger.info("Test Suite " + subDir.name + " found in " + subDir.absolutePath) - + task "runTestSuite${dirname.capitalize()}"(type: Test) { + description "runs tests from Test Suite: " + dirname systemProperties 'test.dir': subDir.absolutePath + + //based on executed testsuit we setup the classpath + if(dirname =="public_pdfbox1"){ + classpath += sourceSets.pdfBox1.compileClasspath + compileTestJava.classpath += sourceSets.pdfBox1.compileClasspath + } + if(dirname =="public_pdfbox2"){ + classpath += sourceSets.pdfBox2.compileClasspath + compileTestJava.classpath += sourceSets.pdfBox2.compileClasspath + } + include '**/ParameterizedSignatureTestSuite.class' beforeSuite { TestDescriptor descriptor -> + if(descriptor.getParent() == null) { logger.quiet("++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); } @@ -87,11 +126,15 @@ suiteDir.eachDir { File subDir -> } } } + + } + test.dependsOn tasks.getByPath("runTestSuite${dirname.capitalize()}") + task "cleanTestSuite${dirname.capitalize()}"(type: Delete) { outputs.upToDateWhen { false } delete fileTree (dir: subDir.absolutePath, include: "index.html") @@ -119,25 +162,6 @@ tasks.getByPath(":pdf-as-lib:test").dependsOn test test { include '**/DummyTest.class' - /*beforeSuite { TestDescriptor descriptor -> - logger.quiet("++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); - logger.quiet("Starting suite: " + descriptor.getName()) - } - - afterSuite { TestDescriptor descriptor, TestResult result -> - logger.quiet("Ending suite: " + descriptor.getName()); - logger.quiet("\tResult (SUCCESS/ERROR/SKIPPED/TOTAL): " + - result.getSuccessfulTestCount() + "/" + - result.getFailedTestCount() + "/" + - result.getSkippedTestCount() + "/" + - result.getTestCount()); - logger.quiet("\tDuration: " + (result.getEndTime() - result.getStartTime()) + " MS"); - if(descriptor.getClassName().equals("at.gv.egiz.param_tests.ParameterizedSignatureTestSuite")) { - logger.quiet("\tReport @ file:///" + subDir.absolutePath + "/index.html") - } - logger.quiet("++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); - }*/ - beforeTest { TestDescriptor descriptor -> logger.quiet("------------------"); logger.quiet("Running test: " + descriptor.getName()) @@ -146,4 +170,9 @@ test { afterTest { TestDescriptor descriptor, TestResult result -> logger.quiet("Ending test: " + descriptor.getName() + " result " + result) } + } + + + + |