This is an automated email from the ASF dual-hosted git repository.
sai_boorlagadda pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push:
new db6d865 GEODE-4860: make sure the extensions xsd is upgradable (#1904)
db6d865 is described below
commit db6d865c17f4cb50ac8f88fec16107774028c63a
Author: Sai Boorlagadda <[email protected]>
AuthorDate: Thu May 3 14:23:31 2018 -0700
GEODE-4860: make sure the extensions xsd is upgradable (#1904)
JAXB ignores unknown properties during unmarshalling. Added a test
to make sure that an xml can be unmarshalled while ignoring any
unknown properties.
---
.../apache/geode/internal/config/JAXBServiceTest.java | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git
a/geode-core/src/test/java/org/apache/geode/internal/config/JAXBServiceTest.java
b/geode-core/src/test/java/org/apache/geode/internal/config/JAXBServiceTest.java
index 9f0cc7a..2e9bad2 100644
---
a/geode-core/src/test/java/org/apache/geode/internal/config/JAXBServiceTest.java
+++
b/geode-core/src/test/java/org/apache/geode/internal/config/JAXBServiceTest.java
@@ -139,6 +139,23 @@ public class JAXBServiceTest {
assertThat(newXml).isEqualTo(prettyXml);
}
+ @Test
+ public void unmarshallIgnoresUnknownProperties() {
+ // say xml has a type attribute that is removed in the new version
+ String existingXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"
standalone=\"yes\"?>\n"
+ + "<cache version=\"1.0\"
xsi:schemaLocation=\"http://geode.apache.org/schema/cache "
+ + "http://geode.apache.org/schema/cache/cache-1.0.xsd\" "
+ + "xmlns=\"http://geode.apache.org/schema/cache\" "
+ + "xmlns:ns2=\"http://geode.apache.org/schema/CustomOne\" "
+ + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" + "
<ns2:custom-one>\n"
+ + " <ns2:id>one</ns2:id>\n" + "
<ns2:type>onetype</ns2:type>\n"
+ + " <ns2:value>onevalue</ns2:value>\n" + "
</ns2:custom-one>\n" + "</cache>";
+
+ CacheConfig cacheConfig = service.unMarshall(existingXML);
+ List elements = cacheConfig.getCustomCacheElements();
+ assertThat(elements.get(0)).isInstanceOf(ElementOne.class);
+ }
+
public static void setBasicValues(CacheConfig cache) {
cache.setCopyOnRead(true);
CacheConfig.GatewayReceiver receiver = new CacheConfig.GatewayReceiver();
--
To stop receiving notification emails like this one, please contact
[email protected].