freehep-nar:nar-integration-test

Run integration tests using Surefire. This goal was copied from Maven's surefire plugin to accomodate a few things for the NAR plugin: 1. To test a jar file with its native module we can only run after the package phase, so we use the integration-test phase. 2. We need to set java.library.path to an AOL (architecture-os-linker) specific value, but AOL is only known in the NAR plugin and thus cannot be set from the pom. 3. To have the java.library.path definition picked up by java we need the "pertest" forkmode. To use this goal you need to put the test sources in the regular test directories but disable the running of the tests by the maven-surefire-plugin.

Mojo Attributes:

  • Requires a Maven 2.0 project to execute.
  • Requires dependency resolution of artifacts in scope: test
  • Automatically executes within the lifecycle phase: integration-test

Required Parameters

Name Type Description
architecture String The Architecture for the nar, Some choices are: "x86", "i386", "amd64", "ppc", "sparc", ... Defaults to a derived value from ${os.arch}
basedir File The base directory of the project being tested. This can be obtained in your unit test by System.getProperty("basedir").
failOnError boolean Fail on compilation/linking error. Default value is true.
libtool boolean Set use of libtool. If set to true, the "libtool " will be prepended to the command line for compatible processors. Default value is false.
runtime String Sets the type of runtime library, possible values "dynamic", "static". Default value is dynamic.
testClassesDirectory File The directory containing generated test classes of the project being tested.
testSourceDirectory File The test source directory containing test class sources.

Optional Parameters

Name Type Description
aol String Architecture-OS-Linker name. Defaults to: arch-os-linker.
argLine String Arbitrary options to set on the command line.
artifactFactory ArtifactFactory Creates the artifact
artifactResolver ArtifactResolver Resolves the artifacts needed.
c C C Compiler
childDelegation boolean When false it makes tests run using the standard classloader delegation instead of the default Maven isolated classloader. Only used when forking (forkMode is not "none").

Setting it to false helps with some problems caused by conflicts between xml parsers in the classpath and the Java 5 provider parser. Default value is false.
cpp Cpp C++ Compiler
disableXmlReport boolean Flag to disable the generation of report files in xml format. Default value is false.
environmentVariables Map Additional environments to set on the command line.
excludedGroups String Excluded groups. Any methods/classes/etc with one of the groups specified in this list will specifically not be run.
excludes List List of patterns (separated by commas) used to specify the tests that should be excluded in testing. When not specified and when the test parameter is not specified, the default excludes will be **/Abstract*Test.java **/Abstract*TestCase.java **/*$*
forkMode String Option to specify the forking mode. Can be "never", "once" or "always". "none" and "pertest" are also accepted for backwards compatibility. Default value is once.
fortran Fortran Fortran Compiler
groups String Groups for this test. Only classes/methods/etc decorated with one of the groups specified here will be included in test run, if specified.
includes List List of patterns (separated by commas) used to specify the tests that should be included in testing. When not specified and when the test parameter is not specified, the default includes will be **/Test*.java **/*Test.java **/*TestCase.java
java Java Java info for includes and linking
javah Javah Javah info
jvm String Option to specify the jvm (or path to the java executable) to use with the forking options. For the default, the jvm will be the same as the one used to run Maven.
libraries List List of libraries to create
linker Linker Linker
maxCores int Maximum number of Cores/CPU's to use. 0 means unlimited.
metadataSource ArtifactMetadataSource For retrieval of artifact's metadata.
os String The Operating System for the nar. Some choices are: "Windows", "Linux", "MacOSX", "SunOS", ... Defaults to a derived value from ${os.name} FIXME table missing
output String Name of the output
parallel boolean When you use the parallel attribute, TestNG will try to run all your test methods in separate threads, except for methods that depend on each other, which will be run in the same thread in order to respect their order of execution. Default value is false.
printSummary boolean Option to print summary of test suites or just print the test cases that has errors. Default value is true.
redirectTestOutputToFile boolean When forking, set this to true to redirect the unit test standard output to a file (found in reportsDirectory/testName-output.txt). Default value is false.
remoteRepositories List The plugin remote repositories declared in the pom.
reportFormat String Selects the formatting for the test report to be generated. Can be set as brief or plain. Default value is brief.
reportsDirectory File Base directory where all reports are written to.
skip boolean Set this to 'true' to bypass unit tests entirely. Its use is NOT RECOMMENDED, but quite convenient on occasion.
skipExec boolean Set this to 'true' to bypass unit tests execution, but still compile them. Its use is NOT RECOMMENDED, but quite convenient on occasion.
skipNAR boolean Skip running of NAR plugins (any) altogether. Default value is false.
suiteXmlFiles File[] List of TestNG suite xml file locations, seperated by commas. It should be noted that if suiteXmlFiles is specified, no other tests will be run, ignoring other parameters, like includes and excludes.
systemProperties Properties List of System properties to pass to the JUnit tests.
targetDirectory File Target directory for Nar file construction Defaults to "${project.build.directory}/nar" for "nar-compile" goal Defaults to "${project.build.directory}/test-nar" for "nar-testCompile" goal
test String Specify this parameter(can be a comma separated list) if you want to use the test pattern matching notation, Ant pattern matching, to select tests to run. The Ant pattern will be used to create an include pattern formatted like **/${test}.java When used, the includes and excludes patterns parameters are ignored.
testFailureIgnore boolean Set this to true to ignore a failure during testing. Its use is NOT RECOMMENDED, but quite convenient on occasion.
tests List List of tests to create
threadCount int The attribute thread-count allows you to specify how many threads should be allocated for this execution. Only makes sense to use in conjunction with parallel. Default value is 5.
trimStackTrace boolean Whether to trim the stack trace in the reports to just the lines within the test, or show the full trace. Default value is true.
useFile boolean Option to generate a file test report or just output the test report to the console. Default value is true.
useSystemClassLoader boolean Option to pass dependencies to the system's classloader instead of using an isolated class loader when forking. Prevents problems with JDKs which implement the service provider lookup mechanism by using the system's classloader. Default value is false.
workingDirectory File Command line working directory.

Parameter Details

aol Architecture-OS-Linker name. Defaults to: arch-os-linker.
  • Type: java.lang.String
  • Required: No

architecture The Architecture for the nar, Some choices are: "x86", "i386", "amd64", "ppc", "sparc", ... Defaults to a derived value from ${os.arch}
  • Type: java.lang.String
  • Required: Yes
  • Expression: ${os.arch}

argLine Arbitrary options to set on the command line.
  • Type: java.lang.String
  • Required: No
  • Expression: ${argLine}

artifactFactory Creates the artifact
  • Type: org.apache.maven.artifact.factory.ArtifactFactory
  • Required: No

artifactResolver Resolves the artifacts needed.
  • Type: org.apache.maven.artifact.resolver.ArtifactResolver
  • Required: No

basedir The base directory of the project being tested. This can be obtained in your unit test by System.getProperty("basedir").
  • Type: java.io.File
  • Required: Yes
  • Expression: ${basedir}

c C Compiler
  • Type: org.freehep.maven.nar.C
  • Required: No

childDelegation When false it makes tests run using the standard classloader delegation instead of the default Maven isolated classloader. Only used when forking (forkMode is not "none").

Setting it to false helps with some problems caused by conflicts between xml parsers in the classpath and the Java 5 provider parser.
  • Type: boolean
  • Required: No
  • Expression: ${childDelegation}
  • Default: false

cpp C++ Compiler
  • Type: org.freehep.maven.nar.Cpp
  • Required: No

disableXmlReport Flag to disable the generation of report files in xml format.
  • Type: boolean
  • Required: No
  • Expression: ${disableXmlReport}
  • Default: false

environmentVariables Additional environments to set on the command line.
  • Type: java.util.Map
  • Required: No

excludedGroups Excluded groups. Any methods/classes/etc with one of the groups specified in this list will specifically not be run.
  • Type: java.lang.String
  • Required: No
  • Expression: ${excludedGroups}

excludes List of patterns (separated by commas) used to specify the tests that should be excluded in testing. When not specified and when the test parameter is not specified, the default excludes will be **/Abstract*Test.java **/Abstract*TestCase.java **/*$*
  • Type: java.util.List
  • Required: No

failOnError Fail on compilation/linking error.
  • Type: boolean
  • Required: Yes
  • Default: true

forkMode Option to specify the forking mode. Can be "never", "once" or "always". "none" and "pertest" are also accepted for backwards compatibility.
  • Type: java.lang.String
  • Required: No
  • Expression: ${forkMode}
  • Default: once

fortran Fortran Compiler
  • Type: org.freehep.maven.nar.Fortran
  • Required: No

groups Groups for this test. Only classes/methods/etc decorated with one of the groups specified here will be included in test run, if specified.
  • Type: java.lang.String
  • Required: No
  • Expression: ${groups}

includes List of patterns (separated by commas) used to specify the tests that should be included in testing. When not specified and when the test parameter is not specified, the default includes will be **/Test*.java **/*Test.java **/*TestCase.java
  • Type: java.util.List
  • Required: No

java Java info for includes and linking
  • Type: org.freehep.maven.nar.Java
  • Required: No

javah Javah info
  • Type: org.freehep.maven.nar.Javah
  • Required: No

jvm Option to specify the jvm (or path to the java executable) to use with the forking options. For the default, the jvm will be the same as the one used to run Maven.
  • Type: java.lang.String
  • Required: No
  • Expression: ${jvm}

libraries List of libraries to create
  • Type: java.util.List
  • Required: No

libtool Set use of libtool. If set to true, the "libtool " will be prepended to the command line for compatible processors.
  • Type: boolean
  • Required: Yes
  • Default: false

linker Linker
  • Type: org.freehep.maven.nar.Linker
  • Required: No

maxCores Maximum number of Cores/CPU's to use. 0 means unlimited.
  • Type: int
  • Required: No

metadataSource For retrieval of artifact's metadata.
  • Type: org.apache.maven.artifact.metadata.ArtifactMetadataSource
  • Required: No

os The Operating System for the nar. Some choices are: "Windows", "Linux", "MacOSX", "SunOS", ... Defaults to a derived value from ${os.name} FIXME table missing
  • Type: java.lang.String
  • Required: No

output Name of the output
  • Type: java.lang.String
  • Required: No
  • Expression: ${project.artifactId}-${project.version}

parallel When you use the parallel attribute, TestNG will try to run all your test methods in separate threads, except for methods that depend on each other, which will be run in the same thread in order to respect their order of execution.
  • Type: boolean
  • Required: No
  • Expression: ${parallel}
  • Default: false

printSummary Option to print summary of test suites or just print the test cases that has errors.
  • Type: boolean
  • Required: No
  • Expression: ${surefire.printSummary}
  • Default: true

redirectTestOutputToFile When forking, set this to true to redirect the unit test standard output to a file (found in reportsDirectory/testName-output.txt).
  • Type: boolean
  • Required: No
  • Expression: ${maven.test.redirectTestOutputToFile}
  • Default: false

remoteRepositories The plugin remote repositories declared in the pom.
  • Type: java.util.List
  • Required: No
  • Expression: ${project.pluginArtifactRepositories}

reportFormat Selects the formatting for the test report to be generated. Can be set as brief or plain.
  • Type: java.lang.String
  • Required: No
  • Expression: ${surefire.reportFormat}
  • Default: brief

reportsDirectory Base directory where all reports are written to.
  • Type: java.io.File
  • Required: No
  • Expression: ${project.build.directory}/surefire-reports

runtime Sets the type of runtime library, possible values "dynamic", "static".
  • Type: java.lang.String
  • Required: Yes
  • Default: dynamic

skip Set this to 'true' to bypass unit tests entirely. Its use is NOT RECOMMENDED, but quite convenient on occasion.
  • Type: boolean
  • Required: No
  • Expression: ${maven.test.skip}

skipExec Set this to 'true' to bypass unit tests execution, but still compile them. Its use is NOT RECOMMENDED, but quite convenient on occasion.
  • Type: boolean
  • Required: No
  • Expression: ${maven.test.skip.exec}

skipNAR Skip running of NAR plugins (any) altogether.
  • Type: boolean
  • Required: No
  • Expression: ${nar.skip}
  • Default: false

suiteXmlFiles List of TestNG suite xml file locations, seperated by commas. It should be noted that if suiteXmlFiles is specified, no other tests will be run, ignoring other parameters, like includes and excludes.
  • Type: java.io.File[]
  • Required: No

systemProperties List of System properties to pass to the JUnit tests.
  • Type: java.util.Properties
  • Required: No

targetDirectory Target directory for Nar file construction Defaults to "${project.build.directory}/nar" for "nar-compile" goal Defaults to "${project.build.directory}/test-nar" for "nar-testCompile" goal
  • Type: java.io.File
  • Required: No

test Specify this parameter(can be a comma separated list) if you want to use the test pattern matching notation, Ant pattern matching, to select tests to run. The Ant pattern will be used to create an include pattern formatted like **/${test}.java When used, the includes and excludes patterns parameters are ignored.
  • Type: java.lang.String
  • Required: No
  • Expression: ${test}

testClassesDirectory The directory containing generated test classes of the project being tested.
  • Type: java.io.File
  • Required: Yes
  • Expression: ${project.build.testOutputDirectory}

testFailureIgnore Set this to true to ignore a failure during testing. Its use is NOT RECOMMENDED, but quite convenient on occasion.
  • Type: boolean
  • Required: No
  • Expression: ${maven.test.failure.ignore}

testSourceDirectory The test source directory containing test class sources.
  • Type: java.io.File
  • Required: Yes
  • Expression: ${project.build.testSourceDirectory}

tests List of tests to create
  • Type: java.util.List
  • Required: No

threadCount The attribute thread-count allows you to specify how many threads should be allocated for this execution. Only makes sense to use in conjunction with parallel.
  • Type: int
  • Required: No
  • Expression: ${threadCount}
  • Default: 5

trimStackTrace Whether to trim the stack trace in the reports to just the lines within the test, or show the full trace.
  • Type: boolean
  • Required: No
  • Expression: ${trimStackTrace}
  • Default: true

useFile Option to generate a file test report or just output the test report to the console.
  • Type: boolean
  • Required: No
  • Expression: ${surefire.useFile}
  • Default: true

useSystemClassLoader Option to pass dependencies to the system's classloader instead of using an isolated class loader when forking. Prevents problems with JDKs which implement the service provider lookup mechanism by using the system's classloader.
  • Type: boolean
  • Required: No
  • Expression: ${surefire.useSystemClassLoader}
  • Default: false

workingDirectory Command line working directory.
  • Type: java.io.File
  • Required: No