Github user jaredjstewart commented on a diff in the pull request:

    https://github.com/apache/geode/pull/668#discussion_r131968121
  
    --- Diff: 
geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/CacheXmlParserJUnitTest.java
 ---
    @@ -111,10 +113,31 @@ public void testCacheXmlParserWithSimplePool() {
         InternalDistributedSystem system =
             InternalDistributedSystem.newInstanceForTesting(dm, nonDefault);
         when(dm.getSystem()).thenReturn(system);
    -    InternalDistributedSystem.connect(nonDefault);
     
    -    CacheXmlParser.parse(getClass()
    -        
.getResourceAsStream("CacheXmlParserJUnitTest.testSimpleClientCacheXml.cache.xml"));
    +    Cache cache = new CacheFactory()
    +        .set("cache-xml-file", 
"CacheXmlParserJUnitTest.testSimpleClientCacheXml.cache.xml")
    +        .create(InternalDistributedSystem.connect(nonDefault));
    +    cache.close();
    +  }
    +
    +  /**
    +   * Test that {@link CacheXmlParser} can parse the test cache.xml file, 
using the Apache Xerces XML
    +   * parser.
    +   * 
    +   * @since Geode 1.3
    +   */
    +  @Test
    +  public void testCacheXmlParserWithSimplePoolXerces() {
    +    String prevParserFactory = 
System.setProperty("javax.xml.parsers.SAXParserFactory",
    +        "org.apache.xerces.jaxp.SAXParserFactoryImpl");
    +
    +    testCacheXmlParserWithSimplePool();
    +
    +    if (prevParserFactory != null) {
    --- End diff --
    
    This cleanup of system properties can be made simpler by using the 
`RestoreSystemProperties` JUnit rule.  All you need to do is add this member 
variable to your test class: 
    
    ```  @Rule
      public final RestoreSystemProperties restoreSystemProperties = new 
RestoreSystemProperties();
    ```
    
    (For an example, see 
[LocatorLauncherTest](https://github.com/apache/geode/blob/d1db2f02d2ce45a437b34488934e5b1d53c7b5ca/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java).)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to