Search in sources :

Example 1 with CacheLoadingException

use of com.celements.common.cache.CacheLoadingException in project celements-blog by celements.

the class BlogCacheTest method testGetCachedDocRefs_QueryException.

@Test
public void testGetCachedDocRefs_QueryException() throws Exception {
    WikiReference wikiRef = new WikiReference("wiki");
    SpaceReference spaceRef = new SpaceReference("blogSpace", wikiRef);
    expectXWQL(wikiRef, null);
    replayDefault();
    try {
        cache.getCachedDocRefs(spaceRef);
        fail("expecting CacheLoadingException");
    } catch (CacheLoadingException exc) {
    // expected
    }
    verifyDefault();
}
Also used : SpaceReference(org.xwiki.model.reference.SpaceReference) CacheLoadingException(com.celements.common.cache.CacheLoadingException) WikiReference(org.xwiki.model.reference.WikiReference) Test(org.junit.Test)

Example 2 with CacheLoadingException

use of com.celements.common.cache.CacheLoadingException in project celements-blog by celements.

the class BlogCacheTest method testGetCachedDocRefs_XWikiException.

@Test
public void testGetCachedDocRefs_XWikiException() throws Exception {
    WikiReference wikiRef = new WikiReference("wiki");
    SpaceReference spaceRef = new SpaceReference("blogSpace", wikiRef);
    DocumentReference docRef = new DocumentReference(wikiRef.getName(), "space", "blog1");
    expectXWQL(wikiRef, Arrays.asList(docRef));
    expect(cache.blogService.getBlogSpaceRef(eq(docRef))).andThrow(new XWikiException()).once();
    replayDefault();
    try {
        cache.getCachedDocRefs(spaceRef);
        fail("expecting CacheLoadingException");
    } catch (CacheLoadingException exc) {
    // expected
    }
    verifyDefault();
}
Also used : SpaceReference(org.xwiki.model.reference.SpaceReference) CacheLoadingException(com.celements.common.cache.CacheLoadingException) WikiReference(org.xwiki.model.reference.WikiReference) DocumentReference(org.xwiki.model.reference.DocumentReference) XWikiException(com.xpn.xwiki.XWikiException) Test(org.junit.Test)

Aggregations

CacheLoadingException (com.celements.common.cache.CacheLoadingException)2 Test (org.junit.Test)2 SpaceReference (org.xwiki.model.reference.SpaceReference)2 WikiReference (org.xwiki.model.reference.WikiReference)2 XWikiException (com.xpn.xwiki.XWikiException)1 DocumentReference (org.xwiki.model.reference.DocumentReference)1