Reputation: 3328
I spent a long time trying to run the example tests from here and here.
The @EnableGemFireMockObjects
annotation cannot be found and neither can
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
The example tests don't run. Presumably this is missing a Gradle dependency but I can't find a Gradle example in the documentation.
Upvotes: 0
Views: 360
Reputation: 7981
The Spring Test for Apache Geode project (STDG) should build just fine, by running (from the project root directory)...
$ gradlew clean build install
STDG can also be built with Maven, hence the inclusion of a pom.xml file, by running...
$ mvn clean install
NOTE: If you build with Maven first and then later switch to building with Gradle, make sure to remove the
target/
directly before building with Gradle.
Additionally, if you setup your IDE (e.g. IJ or STS) with the STDG project, importing from either the Maven or Gradle project models, after building (compiling) the STDG project, you should be able to run the Unit or Integration Tests individually from your IDE as well.
The Maven or Gradle files will ensure that your (test-time) classpath(s) are correct.
As for using STDG outside of the STDG project itself (the tests in STDG are not there for example, but there to test the functionality of STDG itself), see:
Spring Boot for Apache Geode (SBDG): https://github.com/spring-projects/spring-boot-data-geode. Specifically see the auto-configuration module test suite where STDG is used quite extensively.
Spring Session for Apache Geode (SSDG) also extensively uses the STDG project now to test Spring Session functionality with Apache Geode or Pivotal GemFire as the provider: https://github.com/spring-projects/spring-session-data-geode.
Eventually, I will be retrofitting the SDG test suite to use STDG as well, replacing the old test framework inside SDG on which STDG was founded.
Finally...
I did a presentation on the STDG project at the SpringOne Platform 2017 conference, the code of which is here:
https://github.com/jxblum/simplifying-apache-geode-with-spring-data
Here is 1 such test class from that example project:
I have not updated the project in quite awhile, but is still mostly applicable. Use SBDG and SSDG test suites as definitive examples for using STDG.
Hope this helps.
Upvotes: 1