use of org.xwiki.icon.IconSet in project xwiki-platform by xwiki.
the class DefaultIconSetCacheTest method putByDocRef.
@Test
public void putByDocRef() throws Exception {
IconSet iconSet = new IconSet("key");
DocumentReference docRef = new DocumentReference("a", "b", "c");
when(entityReferenceSerializer.serialize(docRef)).thenReturn("a:b.c");
mocker.getComponentUnderTest().put(docRef, iconSet);
verify(cache).set("DOC:a:b.c", iconSet);
}
use of org.xwiki.icon.IconSet in project xwiki-platform by xwiki.
the class DefaultIconSetCacheTest method getByNameAndWiki.
@Test
public void getByNameAndWiki() throws Exception {
IconSet iconSet = new IconSet("key");
when(cache.get("NAMED:6wikiId_key")).thenReturn(iconSet);
IconSet result = mocker.getComponentUnderTest().get("key", "wikiId");
assertTrue(iconSet == result);
}
use of org.xwiki.icon.IconSet in project xwiki-platform by xwiki.
the class DefaultIconSetLoaderTest method loadIconSetFromWikiDocument.
@Test
public void loadIconSetFromWikiDocument() throws Exception {
DocumentReference iconSetRef = new DocumentReference("xwiki", "IconThemes", "Default");
DocumentReference iconClassRef = new DocumentReference("wikiId", "IconThemesCode", "IconThemeClass");
when(documentAccessBridge.getProperty(eq(iconSetRef), eq(iconClassRef), eq("name"))).thenReturn("MyIconTheme");
DocumentModelBridge doc = mock(DocumentModelBridge.class);
when(documentAccessBridge.getDocumentInstance(iconSetRef)).thenReturn(doc);
StringWriter content = new StringWriter();
IOUtils.copyLarge(new InputStreamReader(getClass().getResourceAsStream("/test.iconset")), content);
when(doc.getContent()).thenReturn(content.toString());
// Test
IconSet result = mocker.getComponentUnderTest().loadIconSet(iconSetRef);
// Verify
verifies(result);
assertEquals("MyIconTheme", result.getName());
}
use of org.xwiki.icon.IconSet in project xwiki-platform by xwiki.
the class DefaultIconSetLoaderTest method loadIconSet.
@Test
public void loadIconSet() throws Exception {
Reader content = new InputStreamReader(getClass().getResourceAsStream("/test.iconset"));
// Test
IconSet result = mocker.getComponentUnderTest().loadIconSet(content, "FontAwesome");
// Verify
verifies(result);
assertEquals("FontAwesome", result.getName());
}
use of org.xwiki.icon.IconSet in project xwiki-platform by xwiki.
the class DefaultIconSetManagerTest method getDefaultIconSet.
@Test
public void getDefaultIconSet() throws Exception {
// Mock
IconSet iconSet = new IconSet("default");
when(iconSetLoader.loadIconSet(any(Reader.class), eq("default"))).thenReturn(iconSet);
InputStream is = getClass().getResourceAsStream("/test.iconset");
when(xwiki.getResourceAsStream("/resources/icons/default.iconset")).thenReturn(is);
// Test
assertEquals(iconSet, mocker.getComponentUnderTest().getIconSet("default"));
// Verify
verifyZeroInteractions(queryManager);
}
Aggregations