Browse Source

DATAJDBC-576 - Polishing.

Consistent spelling of license. Tweak exception propagation. Consistently use asciidoc syntax for code blocks.

Original pull request: #239.
pull/240/head
Mark Paluch 5 years ago
parent
commit
3ecfa669b7
No known key found for this signature in database
GPG Key ID: 51A00FA751B91849
  1. 17
      README.adoc
  2. 5
      pom.xml
  3. 15
      spring-data-jdbc/src/test/java/org/springframework/data/jdbc/testing/LicenseListener.java

17
README.adoc

@ -159,19 +159,20 @@ Runs integration test against a single in memory database. @@ -159,19 +159,20 @@ Runs integration test against a single in memory database.
To run integration tests against all supported databases specify the Maven Profile `all-dbs`.
```
[source,bash]
----
./mvnw clean install -Pall-dbs
```
----
This requires an appropriate `container-license-acceptance.txt` to be on the classpath, signaling that you accept the licence of the databases used.
This requires an appropriate `container-license-acceptance.txt` to be on the classpath, signaling that you accept the license of the databases used.
If you don't want to accept these licences you may add the Maven Profile `ignore-missing-licence`.
If you don't want to accept these licences you may add the Maven Profile `ignore-missing-license`.
This will ignore the tests that require an explicit license acceptance.
```
./mvnw clean install -Pall-dbs,ignore-missing-licence
```
[source,bash]
----
./mvnw clean install -Pall-dbs,ignore-missing-license
----
If you want to run an integration tests against a different database you can do so by activating an apropriate Spring Profile.
Available are the following Spring Profiles:

5
pom.xml

@ -128,6 +128,7 @@ @@ -128,6 +128,7 @@
<includes>
<include>**/*IntegrationTests.java</include>
</includes>
<excludes>
<exclude>**/*HsqlIntegrationTests.java</exclude>
</excludes>
<systemPropertyVariables>
@ -231,7 +232,7 @@ @@ -231,7 +232,7 @@
</build>
</profile>
<profile>
<id>ignore-missing-licence</id>
<id>ignore-missing-license</id>
<build>
<plugins>
<plugin>
@ -239,7 +240,7 @@ @@ -239,7 +240,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<on-missing-licence>ignore-test</on-missing-licence>
<on-missing-license>ignore-test</on-missing-license>
</systemPropertyVariables>
</configuration>
</plugin>

15
spring-data-jdbc/src/test/java/org/springframework/data/jdbc/testing/LicenseListener.java

@ -28,7 +28,7 @@ import org.testcontainers.utility.LicenseAcceptance; @@ -28,7 +28,7 @@ import org.testcontainers.utility.LicenseAcceptance;
/**
* {@link TestExecutionListener} to selectively skip tests if the license for a particular database container was not
* accepted.
*
*
* @author Mark Paluch
* @author Jens Schauder
*/
@ -57,14 +57,13 @@ public class LicenseListener implements TestExecutionListener { @@ -57,14 +57,13 @@ public class LicenseListener implements TestExecutionListener {
LicenseAcceptance.assertLicenseAccepted(imageName);
} catch (IllegalStateException e) {
if (environment.getProperty("on-missing-licence", "fail").equals("ignore-test")) {
throw new AssumptionViolatedException(e.getMessage());
} else {
throw new IllegalStateException(
"You need to accept the licence for the database with which you are testing or set \"ignore-missing-licence\" as active profile in order to skip tests for which a licence is missing.",
e);
if (environment.getProperty("on-missing-license", "fail").equals("ignore-test")) {
throw new AssumptionViolatedException(e.getMessage(), e);
}
throw new IllegalStateException(
"You need to accept the license for the database with which you are testing or set \"ignore-missing-license\" as active profile in order to skip tests for which a license is missing.",
e);
}
}

Loading…
Cancel
Save