rupweb
rupweb

Reputation: 3328

Going through Spring Test Data Geode but @EnableGemFireMockObjects annotation is not found

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

Answers (2)

John Blum
John Blum

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:

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:

https://github.com/jxblum/simplifying-apache-geode-with-spring-data/blob/master/simplifying-apachegeode-testing-springdata-complete/src/test/java/example/app/tests/SpringApacheGeodeConfigurationUnitTests.java

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

rupweb
rupweb

Reputation: 3328

Per Javalibs I needed to add

implementation 'org.springframework.data:spring-data-geode-test:0.0.11.RELEASE'

to gradle.build dependencies group.

Upvotes: 0

Related Questions