use of org.apache.geode.cache.CacheXmlException in project geode by apache.
the class DiskRegionIllegalCacheXMLvaluesJUnitTest method createRegion.
public void createRegion(String path) {
DistributedSystem ds = null;
try {
boolean exceptionOccurred = false;
File dir = new File("testingDirectoryForXML");
dir.mkdir();
dir.deleteOnExit();
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(CACHE_XML_FILE, TestUtil.getResourcePath(getClass(), path));
ds = DistributedSystem.connect(props);
try {
CacheFactory.create(ds);
} catch (IllegalArgumentException ex) {
exceptionOccurred = true;
System.out.println("ExpectedStrings: Received expected IllegalArgumentException:" + ex.getMessage());
} catch (CacheXmlException ex) {
exceptionOccurred = true;
System.out.println("ExpectedStrings: Received expected CacheXmlException:" + ex.getMessage());
} catch (Exception e) {
e.printStackTrace();
fail("test failed due to " + e);
}
if (!exceptionOccurred) {
fail(" exception did not occur although was expected");
}
} finally {
if (ds != null && ds.isConnected()) {
ds.disconnect();
ds = null;
}
}
}
Aggregations