use of org.apache.geode.cache.CacheXmlException in project geode by apache.
the class CacheXml66DUnitTest method testBadKeyConstraintClass.
/**
* Tests parsing an XML file with a non-existent key constraint class.
*/
@Test
public void testBadKeyConstraintClass() throws Exception {
setXmlFile(findFile("badKeyConstraintClass.xml"));
IgnoredException expectedException = IgnoredException.addIgnoredException("While reading Cache XML file");
try {
getCache();
fail("Should have thrown a CacheXmlException");
} catch (CacheXmlException ex) {
assertTrue(ex.getCause() instanceof ClassNotFoundException);
} finally {
expectedException.remove();
}
}
use of org.apache.geode.cache.CacheXmlException in project geode by apache.
the class CacheXml66DUnitTest method testLoaderNotLoader.
/**
* Tests parsing an XML file that specifies a cache listener that is not a {@code CacheLoader}.
*/
@Test
public void testLoaderNotLoader() throws Exception {
setXmlFile(findFile("loaderNotLoader.xml"));
IgnoredException expectedException = IgnoredException.addIgnoredException("While reading Cache XML file");
try {
getCache();
fail("Should have thrown a CacheXmlException");
} catch (CacheXmlException ex) {
Throwable cause = ex.getCause();
assertNull("Didn't expect a " + cause, cause);
} finally {
expectedException.remove();
}
}
use of org.apache.geode.cache.CacheXmlException in project geode by apache.
the class CacheXml66DUnitTest method testXmlFileIsDirectory.
/**
* Tests creating a cache with a XML file that is a directory
*/
@Test
public void testXmlFileIsDirectory() throws Exception {
File dir = new File(this.getName() + "dir");
dir.mkdirs();
dir.deleteOnExit();
setXmlFile(dir);
IgnoredException expectedException = IgnoredException.addIgnoredException(LocalizedStrings.GemFireCache_DECLARATIVE_XML_FILE_0_IS_NOT_A_FILE.toLocalizedString(dir));
try {
getCache();
fail("Should have thrown a CacheXmlException");
} catch (CacheXmlException ex) {
// pass...
} finally {
expectedException.remove();
}
}
use of org.apache.geode.cache.CacheXmlException in project geode by apache.
the class CacheXml66DUnitTest method testBadScope.
/**
* Tests parsing an XML file with a bad scope. This error should be caught by the XML parser.
*/
@Test
public void testBadScope() throws Exception {
setXmlFile(findFile("badScope.xml"));
IgnoredException expectedException = IgnoredException.addIgnoredException("While reading Cache XML file");
try {
getCache();
fail("Should have thrown a CacheXmlException");
} catch (CacheXmlException ex) {
assertTrue(ex.getCause() instanceof SAXException);
} finally {
expectedException.remove();
}
}
use of org.apache.geode.cache.CacheXmlException in project geode by apache.
the class CacheXmlParser method endAsyncEventListener.
private void endAsyncEventListener() {
Declarable d = createDeclarable();
if (!(d instanceof AsyncEventListener)) {
throw new CacheXmlException(LocalizedStrings.CacheXmlParser_A_0_IS_NOT_AN_INSTANCE_OF_A_ASYNCEVENTLISTENER.toLocalizedString(d.getClass().getName()));
}
AsyncEventQueueCreation eventChannel = peekAsyncEventQueueContext(ASYNC_EVENT_LISTENER);
eventChannel.setAsyncEventListener((AsyncEventListener) d);
}
Aggregations