Ad-hoc markdown conversion.
This commit is contained in:
parent
d6601ee58d
commit
3046b50d4a
|
@ -1,79 +1,82 @@
|
||||||
jtestdataaccessor
|
# jtestdataaccessor
|
||||||
=================
|
This add-on to su4sml provides access to test data in unit tests.
|
||||||
|
|
||||||
jtestdataaccessor - provide access to test data in unit tests.
|
## Installation
|
||||||
|
|
||||||
Installation
|
|
||||||
************
|
|
||||||
Prerequisites:
|
Prerequisites:
|
||||||
o Java 1.5
|
* Java 1.5
|
||||||
o Apache Maven 2 [1] or AntLR >= 2.7.6 and JUnit >= 4.0
|
* [Apache Maven 2](http://maven.apache.org/) or AntLR >= 2.7.6 and JUnit >= 4.0
|
||||||
|
|
||||||
After installing the prerequisites, a simple call to
|
After installing the prerequisites, a simple call to
|
||||||
|
```
|
||||||
$ mvn install
|
$ mvn install
|
||||||
|
```
|
||||||
in the jtestdataaccessor directory should compile, unit test and install the
|
in the jtestdataaccessor directory should compile, unit test and install the
|
||||||
jtestdataaccessor library into the local Maven repository under ~/.m2.
|
jtestdataaccessor library into the local Maven repository under ~/.m2.
|
||||||
|
|
||||||
To create a .jar from the project,
|
To create a .jar from the project,
|
||||||
|
```
|
||||||
$ mvn package
|
$ mvn package
|
||||||
|
```
|
||||||
can be used. The generated .jar file will be stored in the target/ directory.
|
can be used. The generated .jar file will be stored in the target/ directory.
|
||||||
Since the .jar does not include AntLR and JUnit, they need to be on the
|
Since the .jar does not include AntLR and JUnit, they need to be on the
|
||||||
classpath when using the library. This can be avoided by using
|
classpath when using the library. This can be avoided by using
|
||||||
|
```
|
||||||
$ mvn assembly:assembly
|
$ mvn assembly:assembly
|
||||||
|
```
|
||||||
which will create target/jtestdataaccessor-bin.jar which includes those two
|
which will create target/jtestdataaccessor-bin.jar which includes those two
|
||||||
libraries as well.
|
libraries as well.
|
||||||
|
|
||||||
Javadoc documentation (and more) can be created by
|
Javadoc documentation (and more) can be created by
|
||||||
|
```
|
||||||
$ mvn site
|
$ mvn site
|
||||||
|
```
|
||||||
which creates the target/site/ directory containing an overview of the project
|
which creates the target/site/ directory containing an overview of the project
|
||||||
as well as the Javadoc documentation and the cross-referenced source code.
|
as well as the Javadoc documentation and the cross-referenced source code.
|
||||||
|
|
||||||
|
|
||||||
Unfortunately, there might be a problem with the AntLR version used by the
|
Unfortunately, there might be a problem with the AntLR version used by the
|
||||||
Maven AntLR plugin [2] - if the unit tests fail (see below if Maven does not
|
[Maven AntLR plugin](http://maven.apache.org/plugins/maven-antlr-plugin/), if
|
||||||
|
the unit tests fail (see below if Maven does not
|
||||||
even execute them because of missing dependencies), this is most likely the
|
even execute them because of missing dependencies), this is most likely the
|
||||||
case. A workaround until the real problem is fixed is to modify the file
|
case. A workaround until the real problem is fixed is to modify the file
|
||||||
~/.m2/repository/org/apache/maven/plugins/maven-antlr-plugin/2.0-beta-1/maven-antlr-plugin-2.0-beta-1.pom
|
`~/.m2/repository/org/apache/maven/plugins/maven-antlr-plugin/2.0-beta-1/maven-antlr-plugin-2.0-beta-1.pom`
|
||||||
(or similar, if the problem persists in future releases after adapting the
|
(or similar, if the problem persists in future releases after adapting the
|
||||||
pom.xml file to use such a release) by changing the AntLR dependency of groupId
|
pom.xml file to use such a release) by changing the AntLR dependency of groupId
|
||||||
= antlr, artifactId = antlrall to groupId = antlr, artifactId = antlr and
|
= antlr, artifactId = antlrall to groupId = antlr, artifactId = antlr and
|
||||||
version = 2.7.7 - after calling
|
version = 2.7.7 - after calling
|
||||||
|
```
|
||||||
$ mvn clean
|
$ mvn clean
|
||||||
|
```
|
||||||
to cleanup the generated and compiled sources,
|
to cleanup the generated and compiled sources,
|
||||||
|
```
|
||||||
$ mvn install
|
$ mvn install
|
||||||
|
```
|
||||||
should succeed.
|
should succeed.
|
||||||
|
|
||||||
The other problem is the missing support for Junit 4 in the current surefire
|
The other problem is the missing support for Junit 4 in the current surefire
|
||||||
plugin, so the unit tests might not be executable at all. This can be solved by
|
plugin, so the unit tests might not be executable at all. This can be solved by
|
||||||
adding the settings from [3] in ~/.m2/settings.xml - when doing so, the '...'
|
adding the settings from the [Maven Snapshot Guide](http://maven.apache.org/guides/development/guide-plugin-snapshot-repositories.html)
|
||||||
need to be replaced by <profiles> and </profiles>, respectively. Now
|
in `~/.m2/settings.xml` - when doing so, the '...'
|
||||||
|
need to be replaced by `<profiles>` and `</profiles>`, respectively. Now
|
||||||
|
```
|
||||||
$ mvn -Papache install
|
$ mvn -Papache install
|
||||||
|
```
|
||||||
should finally succeed (-Papache should be required only once, and the snapshot
|
should finally succeed (-Papache should be required only once, and the snapshot
|
||||||
will be updated periodically afterwards).
|
will be updated periodically afterwards).
|
||||||
|
|
||||||
|
|
||||||
Usage
|
##Usage
|
||||||
*****
|
|
||||||
To use the library, a depedency in the pom.xml of the project which looks like
|
To use the library, a depedency in the pom.xml of the project which looks like
|
||||||
|
```xml
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ch.ethz.infsec.jtestdataaccessor</groupId>
|
<groupId>ch.ethz.infsec.jtestdataaccessor</groupId>
|
||||||
<artifactId>jtestdataaccessor</artifactId>
|
<artifactId>jtestdataaccessor</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
```
|
||||||
can be used. The library is then added to the classpath during unit testing and
|
can be used. The library is then added to the classpath during unit testing and
|
||||||
may therefore be used in those tests. Some examples of the usage may be found
|
may therefore be used in those tests. Some examples of the usage may be found
|
||||||
in the src/test/ subtree.
|
in the [src/test/](./src/test/) subtree.
|
||||||
|
|
||||||
|
|
||||||
References
|
|
||||||
**********
|
|
||||||
[1] Apache Maven.
|
|
||||||
http://maven.apache.org/
|
|
||||||
[2] Maven AntLR Plugin
|
|
||||||
http://maven.apache.org/plugins/maven-antlr-plugin/
|
|
||||||
[3] Maven Snapshot Guide.
|
|
||||||
http://maven.apache.org/guides/development/guide-plugin-snapshot-repositories.html
|
|
||||||
|
|
||||||
|
|
||||||
$Id$
|
|
Loading…
Reference in New Issue