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.
To run integration tests against all supported databases specify the Maven Profile `all-dbs`. To run integration tests against all supported databases specify the Maven Profile `all-dbs`.
``` [source,bash]
----
./mvnw clean install -Pall-dbs ./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. This will ignore the tests that require an explicit license acceptance.
``` [source,bash]
./mvnw clean install -Pall-dbs,ignore-missing-licence ----
``` ./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. 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: Available are the following Spring Profiles:

5
pom.xml

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

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

@ -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 * {@link TestExecutionListener} to selectively skip tests if the license for a particular database container was not
* accepted. * accepted.
* *
* @author Mark Paluch * @author Mark Paluch
* @author Jens Schauder * @author Jens Schauder
*/ */
@ -57,14 +57,13 @@ public class LicenseListener implements TestExecutionListener {
LicenseAcceptance.assertLicenseAccepted(imageName); LicenseAcceptance.assertLicenseAccepted(imageName);
} catch (IllegalStateException e) { } catch (IllegalStateException e) {
if (environment.getProperty("on-missing-licence", "fail").equals("ignore-test")) { if (environment.getProperty("on-missing-license", "fail").equals("ignore-test")) {
throw new AssumptionViolatedException(e.getMessage()); throw new AssumptionViolatedException(e.getMessage(), e);
} 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);
} }
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