SGF-755 - Add serializable-object-filter and validate-serializable-objects attributes to EnableGemFireProperties.
This commit is contained in:
@@ -362,15 +362,15 @@ public @interface EnableGemFireProperties {
|
||||
boolean removeUnresponsiveClient() default GemFirePropertiesConfiguration.DEFAULT_REMOVE_UNRESPONSIVE_CLIENT;
|
||||
|
||||
/**
|
||||
* A semicolon-separated list of items that become full class names of objects that the system will serialize
|
||||
* when the property {@link #validateSerializableObjects()} is set to {@literal true}.
|
||||
* A List of items that become full class names of objects that the system will serialize when the property
|
||||
* {@link #validateSerializableObjects()} is set to {@literal true}.
|
||||
*
|
||||
* The list is expanded using the patterns specified in the createFilter method at
|
||||
* <a href="https://docs.oracle.com/javase/9/docs/api/java/io/ObjectInputFilter.Config.html">Class ObjectInputFilter.Config</a>.
|
||||
*
|
||||
* Defaults to unset.
|
||||
*/
|
||||
String serializableObjectFilter() default GemFirePropertiesConfiguration.DEFAULT_SERIALIZABLE_OBJECT_FILTER;
|
||||
String[] serializableObjectFilter() default {};
|
||||
|
||||
/**
|
||||
* Receive buffer sizes in bytes of the TCP/IP connections used for data transmission. To minimize the buffer size
|
||||
|
||||
@@ -74,12 +74,14 @@ public class GemFirePropertiesConfiguration extends EmbeddedServiceConfiguration
|
||||
public static final String DEFAULT_NAME = "";
|
||||
public static final String DEFAULT_REDUNDANCY_ZONE = "";
|
||||
public static final String DEFAULT_REMOTE_LOCATORS = "";
|
||||
public static final String DEFAULT_SERIALIZABLE_OBJECT_FILTER = "";
|
||||
public static final String DEFAULT_USER_COMMAND_PACKAGES = "";
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static final String[] DEFAULT_GROUPS = {};
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static final String[] DEFAULT_SERIALIZABLE_OBJECT_FILTER = {};
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -173,7 +175,7 @@ public class GemFirePropertiesConfiguration extends EmbeddedServiceConfiguration
|
||||
annotationAttributes.get("removeUnresponsiveClient"), DEFAULT_REMOVE_UNRESPONSIVE_CLIENT);
|
||||
|
||||
gemfireProperties.setProperty("serializable-object-filter",
|
||||
annotationAttributes.get("serializableObjectFilter"));
|
||||
(String[]) annotationAttributes.get("serializableObjectFilter"));
|
||||
|
||||
gemfireProperties.setPropertyIfNotDefault("socket-buffer-size",
|
||||
annotationAttributes.get("socketBufferSize"), DEFAULT_SOCKET_BUFFER_SIZE);
|
||||
|
||||
@@ -375,6 +375,25 @@ public class EnableGemFirePropertiesIntegrationTests {
|
||||
assertThat(gemfireProperties.getProperty("security-shiro-init")).isEqualTo("/path/to/shiro.ini");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void serializableObjectFilterAndValidateSerializableObjectsGemFirePropertiesConfiguration() {
|
||||
|
||||
this.applicationContext =
|
||||
newApplicationContext(TestSerializableObjectFilterAndValidateSerializableObjectsGemFirePropertiesConfiguration.class);
|
||||
|
||||
assertThat(this.applicationContext).isNotNull();
|
||||
assertThat(this.applicationContext.containsBean("gemfireProperties")).isTrue();
|
||||
|
||||
Properties gemfireProperties = this.applicationContext.getBean("gemfireProperties", Properties.class);
|
||||
|
||||
assertThat(gemfireProperties).isNotNull();
|
||||
assertThat(gemfireProperties.containsKey("serializable-object-filter")).isTrue();
|
||||
assertThat(gemfireProperties.getProperty("serializable-object-filter"))
|
||||
.isEqualTo("example.app.model.TypeOne,example.app.model.TypeTwo");
|
||||
assertThat(gemfireProperties.containsKey("validate-serializable-objects")).isTrue();
|
||||
assertThat(gemfireProperties.getProperty("validate-serializable-objects")).isEqualTo("true");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sslGemFirePropertiesConfiguration() {
|
||||
|
||||
@@ -516,6 +535,12 @@ public class EnableGemFirePropertiesIntegrationTests {
|
||||
@EnableSecurity
|
||||
static class TestSecurityGemFirePropertiesConfiguration { }
|
||||
|
||||
@EnableGemFireMockObjects
|
||||
@PeerCacheApplication
|
||||
@EnableGemFireProperties(serializableObjectFilter = { "example.app.model.TypeOne", "example.app.model.TypeTwo" },
|
||||
validateSerializableObjects = true)
|
||||
static class TestSerializableObjectFilterAndValidateSerializableObjectsGemFirePropertiesConfiguration { }
|
||||
|
||||
@EnableGemFireMockObjects
|
||||
@PeerCacheApplication
|
||||
@EnableGemFireProperties
|
||||
|
||||
Reference in New Issue
Block a user