Commit Graph

161 Commits

Author SHA1 Message Date
John Blum
61af587a0d Refactor all Unit & Integration Tests starting a Spring container with SpringRunner to extend STDG's IntegrationTestsSupport. 2021-03-30 11:25:08 -07:00
John Blum
ce73d4dbc0 Create the MappingPdxSerializerIncludedTypesRegistrar utility class and Spring BeanPostProcessor used to register additional class types to be 'included' in the accepted types de/serialized as PDX with the SDG MappingPdxSerializer. 2021-03-25 01:26:46 -07:00
John Blum
ee242bece8 Refactor configureTopology(..) to delegate to configureEnvironment(:Environment).
The new 'configureEnvironment(:Environment) method attempts to add a custom PropertySource to the Environment if the Environment is configurable, otherwise proceeds in setting a Java System Property as before.

The idea is, the Environment is more recycable than Java System Properties, particularly if the Spring ApplicationContext is refreshed.

Renames DEFAULT_CLUSTER_CONDITION_MATCH to DEFAULT_CLUSTER_AWARE_CONDITION_MATCH.

Renames DEFAULT_CLUSTER_CONDITION_STRICT_MATCH to DEFAULT_CLUSTER_AWARE_CONDITION_STRICT_MATCH.
2021-01-25 13:16:35 -08:00
John Blum
f018bc8d37 Adapt to API changes and behavior in Jackson 2.12.x. 2021-01-24 22:41:56 -08:00
John Blum
f6acac11b2 Declare @DirtiesContext to avoid conflicts in logger/logging cofiguration between tests in a Spring Boot (Test) context. 2021-01-21 15:45:52 -08:00
John Blum
a54c2bfb34 Add KubernetesClusterNotAvailableConfigurationIntegrationTests class.
Test and assert client Region DataPolicy configuration (PROXY).

Test and assert Environment configuration does not set the 'spring.data.gemfire.cache.client.region.shortcut' property.

Add preconditions for a Kubernetes runtime environment and logging set to INFO.
2021-01-21 14:50:11 -08:00
John Blum
3fcbf9c784 Rename CloudFoundryClusterAvailableConfigurationIntegrationTests to CloudFoundryClusterNotAvailableConfigurationIntegrationTests.
Test and assert client Region DataPolicy configuration (PROXY).

Test and assert Environment configuration does not set the 'spring.data.gemfire.cache.client.region.shortcut' property.

Add precoditions for a CloudFoundry runtime environment and logging not set to INFO.
2021-01-21 14:49:55 -08:00
John Blum
2066de0f84 Add logRuntimeEnvironment(..) to centralize logging for the runtime environment in ClusterAwareConfiguration.
Remove logging from configureTopology(..) and add call to logRuntimeEnvironmet(..) from doMatch(..).

Add ClusterAwareCondition.set(:Boolean) class method to allow Condition subclasses to set the clusterAvailable state; refactor reset() to call set(null).

Edit Javadoc.
2021-01-21 14:42:36 -08:00
John Blum
d091be0498 Add assertion asserting the 'spring.data.gemfire.cache.client.region.shortcut' property is still set to 'LOCAL' even when 'strictMatch' is 'true' and no cluster is available. 2021-01-20 14:44:51 -08:00
John Blum
4090cf4ebd Add 'strictMatch' annotation attribute to the @EnableClusterAware annotation.
Using 'strictMatch' enables fail-fast behavior so that users can configure their Spring Boot, Apache Geode ClientCache applications to fail on startup if no cluster is available across any environment.

Additionally, enhanced the log output to give users better information about the runtime environment and whether an Apache Geode-based cluster was found and available.

Resolves gh-99.
2021-01-15 19:45:47 -08:00
John Blum
4a20f7be61 Support awareness and discovery of secure (Auth and SSL eanbled) Apache Geode clusters using @EnableClusterAware annotation functionality.
Improves log details about the runtime environment (e.g. cloud, standalone/self-managed).

Resolves gh-57.

Resolves gh-99.
2021-01-15 01:32:48 -08:00
John Blum
f997c3e590 Add overloaded doOperationSafely(:ExceptionThrowingOperation<?>, :Supplier<?>) method to the ObjectUtils class.
Edit Javadoc.
2021-01-13 21:18:35 -08:00
John Blum
b73e149ea1 Create a Spring Boot application allowing a user to review Spring's property resolution precedence. 2020-12-07 22:14:27 -08:00
John Blum
cbbf8d9335 Wrap listener metadata state changes in a try-finally block inside the AEQ listener processEvents(:List<AsyncEvent>) method. 2020-12-01 16:47:34 -08:00
John Blum
cccadf68aa Add metadata and state to track the RepositoryAsyncEventListener.processEvents(:List<AsyncEvent>) method invocations.
Specifically, the listener state will track:

* The number of processEvents(:List<AsyncEvent>) method invocations.
* Whether the processEvents(..) method has ever been invoked.
* And, whether the processEvents(..) method has been invoked since the last check.

Introduces a protected doProcessEvents(:List<AsyncEvent>) method and changes processEvents(:List<AsyncEvent>) method to final.
2020-12-01 16:09:43 -08:00
John Blum
c25100ebe7 Add 'withSerialQueue()' builder method to configure the AEQ as a serial queue. 2020-12-01 15:50:47 -08:00
John Blum
cd28eb19a8 Change signature of the generated AsyncEventQueue (AEQ) ID.
This fixes a bug that manifests through GemFire/Geode's Management infrastructure, specifically with the MBean's ObjectName used to managed the AEQs across the cluster.
2020-12-01 10:46:59 -08:00
John Blum
27c907336a Change assertion error message in AsyncEventError class constructor.
Rename class member reference to the default AsyncEventError handler from DEFAULT_EVENT_ERROR_HANDLER to DEFAULT_ASYNC_EVENT_ERROR_HANDLER.
2020-12-01 10:42:39 -08:00
John Blum
bac650a70f Change JetBrains @NotNull annotation to Spring Framework's @NonNull annotation. 2020-11-10 11:51:03 -08:00
John Blum
c1f23c3f9d Optimize imports. 2020-11-05 11:47:04 -08:00
John Blum
77ab747c2c Fix test failure after Spring Boot upgraded from Jackson 2.11.2 to 2.11.3, which introduced an API (contractual) breaking change.
Seems Jackson introduced an API breaking change that now requires a PolymorphicTypeValidator when configuring and activating the default typing as a propery on the ObjectMapper.
2020-10-13 12:23:01 -07:00
John Blum
8abf6687d2 Modify AsyncInlineCachingRegionConfigurer to append to the list of AEQs registered on the Region when configuring Async, Inline Caching. 2020-09-18 16:47:41 -07:00
John Blum
cb34cd2201 Remove all source code (Javadoc) references to 'Pivotal GemFire' or 'GemFire' in general. 2020-09-17 21:24:16 -07:00
John Blum
800a0ee434 Add Integration Tests asserting the configuration and behavior of the AsyncInlineCachingRepositoryConfigurer using a custom AsyncEventErrorHandler and user-defined AsyncEventOperationRepositoryFunction.
Resolves gh-58.
2020-08-19 19:48:16 -07:00
John Blum
6af91f5eb5 Change AbstractAsyncEventOperationRepositoryFunction, CreateUpdateAsyncEventRepositoryFunction and RemoveAsyncEventRepositoryFunction to static member classes.
Add constructor requiring a reference to the associated RepositoryAsyncEventListener delegating AsyncEvent handling/processing to the Function.

Add alias methods from the RepositoryAsyncEventListener getAsyncEventErrorHandler() and getRepository() methods to the AsyncEventOperationRepositoryFunction classes.

Refatory type signatures and Generics usage.

Edit Javadoc.

Resolves gh-58.
2020-08-19 18:48:38 -07:00
John Blum
ecffa18654 Add protected API calls to construct the AEQ, the factory and the listener.
Add builder methods to configure Function post-processors applied to the AEQ, factory and listener.

Add API to configure an AsyncEventErrorHandler.

Edit Javadoc.

Resolves gh-58.
2020-08-19 18:48:38 -07:00
John Blum
01ebfadcbe Rename DEFAULT class member constant to DEFAULT_EVENT_ERROR_HANDLER.
Edit Javadoc.

Resolves gh-58.
2020-08-19 18:48:48 -07:00
John Blum
8da34ccf91 Add additional verification asserting no more interactions on the mock CrudRepository.
Resolves gh-58.
2020-08-19 18:48:38 -07:00
John Blum
430c64fdda Extends STDG's IntegrationTestsSupport class. 2020-08-18 01:04:20 -07:00
John Blum
5f1cd1db5d Add Integration Tests for AsyncInlineCachingRegionConfigurer and RepositoryAsyncEventListener.
Resolves gh-58.
2020-08-18 00:35:09 -07:00
John Blum
3eb26f9717 Create SDG RegionConfigurer implementation to configure a target Region with Asynchronous, Inline Caching functionality.
Resolves gh-58.
2020-08-17 22:34:02 -07:00
John Blum
08e7052cee Create GemFire/Geode AsyncEventListener implementation using a SD CrudRepository for persistent data access operations.
Resolves gh-58.
2020-08-14 15:01:28 -07:00
John Blum
10c11c180c Add new Spring ApplicationListener implementation to log the state of the Spring Environment consistently across contexts as needed.
The EnvironmentLoggingApplicationListener is automattically registered with the Spring Boot configured list of ApplicationListeners via the (SpringFactories) SPI.
2020-08-05 16:28:35 -07:00
John Blum
20b8c2d172 Cleanup all unsafe and unchecked compiler warnings. 2020-07-23 14:57:01 -07:00
John Blum
ba24c50ba2 Cleanup uses and/or overrides of Apache Geode, Spring and Test Framework (e.g. Mockito) deprecated APIs. 2020-07-23 14:57:09 -07:00
John Blum
73af4f0ccd Add postProcess(:Resource) method invocation to Resource resolution for all loaded Resources.
Resolves gh-92.
2020-07-23 12:25:15 -07:00
John Blum
61ec8ccb28 Refactor ResourceCapableCacheDataImporterExporter to not fail on missing Resources for import and rather log a warning.
It is valid that a Resource may not exist for a Region on import since the user may not want to import any data into the Region.

Resolves gh-92.
2020-07-22 16:59:47 -07:00
John Blum
f23675fec5 Refactor ResourceCapableCacheDataImporterExporter to use ObjectAwareUtils to initialize the import & export ResourceResolvers with the ApplicationContext, Environment and ResourceLoader managed objects if present.
Resolves gh-92.
2020-07-22 12:43:16 -07:00
John Blum
faaa218f51 Add ObjectAwareUtils abstract utility class for perforing functions on Spring Aware Objects.
Spring Aware Objects currently handled by ObjectAwareUtils includes, but is not limited to: ApplicationContextAware, ApplicationEventPublisherAware, BeanClassLoaderAware, BeanFactoryAware, BeanNameAware, EnvironmentAware and ResourceLoaderAware.
2020-07-22 12:42:38 -07:00
John Blum
7a13850ef0 Refactor ResourceCapableCacheDataImporterExporter import & export cache ResourceResolver base classes to be static.
Change AbstractCacheResourceResolver class to be ApplicationContextAware and EnvironmentAware.

Add getLogger() method to the AbstractCacheResourceResolver class.

Add Resource description in Logger message logged by onMissingResource(..) on export.

Annotate AbstractExportResourceResolver.onMisingResource(..) method signature with Spring Framework @NonNull and @Nullable annotations.

Separate logic from afterPropertiesSet() initializing the ApplicationContext, Environment and ResourceLoader objects on aware import/export ResourceResolvers into init methods.

Edit Javadoc.

Resolves gh-92.
2020-07-21 22:29:52 -07:00
John Blum
0cd771b236 Move filter on isImportProfilesActive(:Environment) before Region Predicate test in importInto(:Region).
Move the isImportProfilesActive(:Environment) method before the importInto(:Region) method.

Annotate toSet(..) class method signature with Spring Framework @NonNull and @Nullable annotations.

Edit Javadoc.

Resolves gh-92.
2020-07-21 22:09:49 -07:00
John Blum
bfb26e5980 Refactor ResourceLoaderResourceResolver to describe the Resource onMissingResource(..) when Resource is not null.
Remove 'final' modifier from setResourceLoader(:ResourceLoader).

Edit Javadoc.

Resolves gh-92.
2020-07-21 22:09:25 -07:00
John Blum
a439b8a81d Refactor the ResourceResolver interface, require(..) method to throw a ResourceNotFoundException.
Edit Javadoc.

Resolves gh-92.
2020-07-21 20:33:50 -07:00
John Blum
1976a5f3e6 Refactor FileResourceWriter to throw a ResourceWriteException on a IOException.
Resolves gh-92.
2020-07-20 21:51:38 -07:00
John Blum
e60231e308 Refactor LifecycleAwareCacheDataImporterExporter to configure the ExportResourceResolver, ImportResourceResolver, ResourceLoader, ResourceReader and ResourceWriter on the decorated, wrapped CacheDataImporterExporter if the importer/exporter is ResourceLoaderAware and Resource capable.
Resolves gh-92.
2020-07-20 20:56:42 -07:00
John Blum
9aa818f398 Refactor ResourceCapableCacheDataImporterExporter to use setter injection instead of field injection.
Fix bug with FileSystemExportResourceResolve to append the file system path with the file system path separator.

Resolves gh-92.
2020-07-20 18:33:02 -07:00
John Blum
d38442af2a Refactor AbstractResourceWriter to throw a ResourcewWriteException on an IOException during doWrite(..).
Additionally, add a preProcess(:WritableResource) to process the WritableResource before data for the target Resource is written.

Resolves gh-92.
2020-07-20 18:25:05 -07:00
John Blum
94b16dafbe Refactor AbstractResourceReader to throw a ResourceReadException on an IOException during doRead(..).
Additionally, add a preProcess(:Resource) method to process the Resource before data from the target Resource is read.

Resolves gh-92.
2020-07-20 18:25:05 -07:00
John Blum
3ed0145ea7 Refactor ResourceUtils and rename getWritableResource(:Resource) as asStrictlyWritableResource(:Resource).
Add additional, lenient asWritableResource(:Resource) method return an Optional<WritableResource> if the given Resource is not an instance of WritableResource.

Resolves gh-92.
2020-07-20 17:43:41 -07:00
John Blum
2d1cc28188 Refactor JsonCacheDataImporterExporter to extend ResourceCapableCacheDataImporterExporter.
Change doImportInto(:Region) logic to make use of the ImportResourceResolver and ResourceReader on import.

Change doExportFrom(:Region) logic to make use of the ExportResourceResolver and ResourceWriter on export.

Resolves gh-92.
2020-07-20 13:25:26 -07:00