Move all Spring Boot auto-configuration classes, functionality and supporting infrastructure to the geode-spring-boot-autoconfigure module.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
apply plugin: 'io.spring.convention.spring-module'
|
||||
apply from: IDE_GRADLE
|
||||
|
||||
description = "Spring Boot for Apache Geode Auto-Configuration"
|
||||
|
||||
repositories {
|
||||
maven { url "https://repo.spring.io/libs-snapshot" }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
compile "org.springframework:spring-context-support"
|
||||
compile "org.springframework:spring-jcl"
|
||||
compile "org.springframework.data:spring-data-geode:$springDataGeodeVersion"
|
||||
|
||||
compile("org.springframework.boot:spring-boot-starter") {
|
||||
exclude group: "org.springframework.boot", module: "spring-boot-starter-logging";
|
||||
}
|
||||
|
||||
compile project(":geode-spring-boot")
|
||||
|
||||
testCompile "org.assertj:assertj-core"
|
||||
testCompile "junit:junit"
|
||||
testCompile "org.mockito:mockito-core"
|
||||
testCompile "org.projectlombok:lombok"
|
||||
testCompile "edu.umd.cs.mtc:multithreadedtc"
|
||||
|
||||
testCompile("org.springframework.boot:spring-boot-starter-test") {
|
||||
exclude group: "org.springframework.boot", module: "spring-boot-starter-logging";
|
||||
}
|
||||
|
||||
testCompile slf4jDependencies
|
||||
testCompile "org.springframework.data:spring-test-data-geode"
|
||||
|
||||
testRuntime "javax.cache:cache-api"
|
||||
|
||||
// integrationTestRuntime "org.springframework.shell:spring-shell"
|
||||
|
||||
}
|
||||
@@ -24,9 +24,12 @@ import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* The Author class...
|
||||
* The {@link Author} class is an Abstract Data Type (ADT) modeling a book author.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see lombok
|
||||
* @see org.springframework.data.annotation.Id
|
||||
* @see org.springframework.data.gemfire.mapping.annotation.Region
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Data
|
||||
@@ -32,6 +32,8 @@ import lombok.RequiredArgsConstructor;
|
||||
* @see lombok
|
||||
* @see org.springframework.data.annotation.Id
|
||||
* @see org.springframework.data.gemfire.mapping.annotation.Region
|
||||
* @see example.app.model.Author
|
||||
* @see example.app.model.ISBN
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Region("Books")
|
||||
@@ -33,6 +33,8 @@ import example.app.service.BookService;
|
||||
*
|
||||
* @author John Blum
|
||||
* @see example.app.model.Book
|
||||
* @see example.app.model.ISBN
|
||||
* @see example.app.repo.BookRepository
|
||||
* @see example.app.service.BookService
|
||||
* @see org.springframework.cache.annotation.Cacheable
|
||||
* @see org.springframework.stereotype.Service
|
||||
@@ -25,6 +25,7 @@ import org.springframework.geode.cache.support.CacheLoaderSupport;
|
||||
* The {@link EchoCacheLoader} class is an implementation of {@link CacheLoader} that echos the key as the value.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.apache.geode.cache.CacheLoader
|
||||
* @see org.springframework.geode.cache.support.CacheLoaderSupport
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@@ -28,6 +28,8 @@ import lombok.RequiredArgsConstructor;
|
||||
* tracking the recorded temperature, unit and timestamp of the event.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see java.time.LocalDateTime
|
||||
* @see lombok
|
||||
* @see example.geode.query.cq.event.TemperatureUnit
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@@ -26,9 +26,12 @@ import org.apache.geode.cache.query.CqEvent;
|
||||
import org.springframework.data.gemfire.listener.annotation.ContinuousQuery;
|
||||
|
||||
/**
|
||||
* The TemperatureReadingsContinuousQueriesHandler class...
|
||||
* The {@link TemperatureReadingsContinuousQueriesHandler} class is a POJO containing Apache Geode/Pivotal GemFire
|
||||
* Continuous Query (CQ) definitions.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.apache.geode.cache.query.CqEvent
|
||||
* @see org.springframework.data.gemfire.listener.annotation.ContinuousQuery
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@@ -21,7 +21,7 @@ import java.net.URL;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
/**
|
||||
* The {@link UrlRevealed} class...
|
||||
* The {@link UrlRevealed} class is a disclosure of Java's {@link URL} class.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see java.net.URL
|
||||
@@ -22,6 +22,7 @@ import javax.annotation.Resource;
|
||||
|
||||
import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.client.ClientRegionShortcut;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -70,53 +71,53 @@ public class AutoConfiguredCachingIntegrationTests extends IntegrationTestsSuppo
|
||||
|
||||
private void assertBook(Book book, String title) {
|
||||
|
||||
assertThat(book).isNotNull();
|
||||
assertThat(book.isNew()).isFalse();
|
||||
assertThat(book.getTitle()).isEqualTo(title);
|
||||
Assertions.assertThat(book).isNotNull();
|
||||
Assertions.assertThat(book.isNew()).isFalse();
|
||||
Assertions.assertThat(book.getTitle()).isEqualTo(title);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bookServiceWasConfiguredCorrectly() {
|
||||
|
||||
assertThat(this.bookService).isNotNull();
|
||||
assertThat(this.bookService.isCacheMiss()).isFalse();
|
||||
Assertions.assertThat(this.bookService).isNotNull();
|
||||
Assertions.assertThat(this.bookService.isCacheMiss()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cachedBooksRegionWasConfiguredCorrectly() {
|
||||
|
||||
assertThat(this.cachedBooks).isNotNull();
|
||||
Assertions.assertThat(this.cachedBooks).isNotNull();
|
||||
assertThat(this.cachedBooks.getName()).isEqualTo("CachedBooks");
|
||||
assertThat(this.cachedBooks.getFullPath()).isEqualTo(RegionUtils.toRegionPath("CachedBooks"));
|
||||
assertThat(this.cachedBooks).isEmpty();
|
||||
Assertions.assertThat(this.cachedBooks).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void geodeAsTheCachingProviderWasAutoConfiguredCorrectly() {
|
||||
|
||||
assertThat(this.cachedBooks).isEmpty();
|
||||
Assertions.assertThat(this.cachedBooks).isEmpty();
|
||||
|
||||
Book bookOne = this.bookService.findByTitle("Star Wars 3 - Revenge of the Sith");
|
||||
|
||||
assertBook(bookOne, "Star Wars 3 - Revenge of the Sith");
|
||||
assertThat(this.bookService.isCacheMiss()).isTrue();
|
||||
assertThat(this.cachedBooks).hasSize(1);
|
||||
assertThat(this.cachedBooks.get(bookOne.getTitle())).isEqualTo(bookOne);
|
||||
Assertions.assertThat(this.bookService.isCacheMiss()).isTrue();
|
||||
Assertions.assertThat(this.cachedBooks).hasSize(1);
|
||||
Assertions.assertThat(this.cachedBooks.get(bookOne.getTitle())).isEqualTo(bookOne);
|
||||
|
||||
Book bookOneAgain = this.bookService.findByTitle(bookOne.getTitle());
|
||||
|
||||
assertThat(bookOneAgain).isEqualTo(bookOne);
|
||||
assertThat(this.bookService.isCacheMiss()).isFalse();
|
||||
assertThat(this.cachedBooks).hasSize(1);
|
||||
assertThat(this.cachedBooks.get(bookOne.getTitle())).isEqualTo(bookOne);
|
||||
Assertions.assertThat(bookOneAgain).isEqualTo(bookOne);
|
||||
Assertions.assertThat(this.bookService.isCacheMiss()).isFalse();
|
||||
Assertions.assertThat(this.cachedBooks).hasSize(1);
|
||||
Assertions.assertThat(this.cachedBooks.get(bookOne.getTitle())).isEqualTo(bookOne);
|
||||
|
||||
Book bookTwo = this.bookService.findByTitle("Star Wars 6 - Return of the Jedi");
|
||||
|
||||
assertBook(bookTwo, "Star Wars 6 - Return of the Jedi");
|
||||
assertThat(this.bookService.isCacheMiss()).isTrue();
|
||||
assertThat(this.cachedBooks).hasSize(2);
|
||||
assertThat(this.cachedBooks.get(bookOne.getTitle())).isEqualTo(bookOne);
|
||||
assertThat(this.cachedBooks.get(bookTwo.getTitle())).isEqualTo(bookTwo);
|
||||
Assertions.assertThat(this.bookService.isCacheMiss()).isTrue();
|
||||
Assertions.assertThat(this.cachedBooks).hasSize(2);
|
||||
Assertions.assertThat(this.cachedBooks.get(bookOne.getTitle())).isEqualTo(bookOne);
|
||||
Assertions.assertThat(this.cachedBooks.get(bookTwo.getTitle())).isEqualTo(bookTwo);
|
||||
}
|
||||
|
||||
@SpringBootApplication(scanBasePackageClasses = NonBeanType.class)
|
||||
@@ -28,6 +28,7 @@ import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.LoaderHelper;
|
||||
import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.client.ClientRegionShortcut;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
@@ -97,7 +98,7 @@ public class AutoConfiguredContinuousQueryIntegrationTests extends ForkingClient
|
||||
@Before
|
||||
public void setup() {
|
||||
|
||||
assertThat(this.temperatureReadingsTemplate.<Long, TemperatureReading>get(1L))
|
||||
Assertions.assertThat(this.temperatureReadingsTemplate.<Long, TemperatureReading>get(1L))
|
||||
.isEqualTo(TemperatureReading.of(99));
|
||||
|
||||
assertThat(this.temperatureReadings.sizeOnServer()).isEqualTo(8);
|
||||
@@ -106,9 +107,9 @@ public class AutoConfiguredContinuousQueryIntegrationTests extends ForkingClient
|
||||
@Test
|
||||
public void assertTemperatureReadingsAreCorrect() {
|
||||
|
||||
assertThat(this.temperatureReadingsHandler.getTemperatureReadingCount()).isEqualTo(4);
|
||||
assertThat(this.temperatureReadingsHandler.getBoilingTemperatures()).contains(300, 242);
|
||||
assertThat(this.temperatureReadingsHandler.getFreezingTemperatures()).contains(16, -51);
|
||||
Assertions.assertThat(this.temperatureReadingsHandler.getTemperatureReadingCount()).isEqualTo(4);
|
||||
Assertions.assertThat(this.temperatureReadingsHandler.getBoilingTemperatures()).contains(300, 242);
|
||||
Assertions.assertThat(this.temperatureReadingsHandler.getFreezingTemperatures()).contains(16, -51);
|
||||
}
|
||||
|
||||
@SpringBootApplication
|
||||
@@ -27,6 +27,7 @@ import lombok.RequiredArgsConstructor;
|
||||
* {@link Customer} class and Abstract Data Type (ADT) modeling a customer.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see lombok
|
||||
* @see org.springframework.data.annotation.Id
|
||||
* @see org.springframework.data.gemfire.mapping.annotation.Region
|
||||
* @since 1.0.0
|
||||
@@ -1,5 +1,4 @@
|
||||
apply plugin: 'io.spring.convention.spring-module'
|
||||
|
||||
apply from: IDE_GRADLE
|
||||
|
||||
description = "Spring Boot for Apache Geode"
|
||||
@@ -31,8 +30,6 @@ dependencies {
|
||||
testCompile slf4jDependencies
|
||||
testCompile "org.springframework.data:spring-test-data-geode"
|
||||
|
||||
testRuntime "javax.cache:cache-api"
|
||||
|
||||
// integrationTestRuntime "org.springframework.shell:spring-shell"
|
||||
|
||||
}
|
||||
|
||||
@@ -28,9 +28,12 @@ import org.springframework.beans.factory.BeanFactory;
|
||||
* @see org.springframework.data.gemfire.support.GemfireBeanFactoryLocator
|
||||
* @since 1.0.0
|
||||
*/
|
||||
// TODO: remove this class once and refactor the SDG GemfireBeanFactoryLocator!
|
||||
// TODO: remove this class and refactor the SDG GemfireBeanFactoryLocator!
|
||||
public class GemfireBeanFactoryLocatorProxy extends GemfireBeanFactoryLocator {
|
||||
|
||||
/**
|
||||
* Clear all {@link BeanFactory} references stored during application runtime.
|
||||
*/
|
||||
public static void clear() {
|
||||
BEAN_FACTORIES.clear();
|
||||
}
|
||||
Reference in New Issue
Block a user