Search in sources :

Example 6 with ColorThemeReference

use of org.xwiki.lesscss.internal.colortheme.ColorThemeReference in project xwiki-platform by xwiki.

the class CacheKeyFactoryTest method getCacheKeyWithContext.

@Test
public void getCacheKeyWithContext() throws Exception {
    // Mocks
    LESSResourceReference lessResource = mock(LESSResourceReference.class);
    SkinReference skin = mock(SkinReference.class);
    ColorThemeReference colorTheme = mock(ColorThemeReference.class);
    when(lessResource.serialize()).thenReturn("lessResource");
    when(skin.serialize()).thenReturn("skin");
    when(colorTheme.serialize()).thenReturn("colorTheme");
    when(xcontextCacheKeyFactory.getCacheKey()).thenReturn("XWikiContext[Mock]");
    // Test
    assertEquals("12_lessResource_4_skin_10_colorTheme_18_XWikiContext[Mock]", mocker.getComponentUnderTest().getCacheKey(lessResource, skin, colorTheme, true));
}
Also used : ColorThemeReference(org.xwiki.lesscss.internal.colortheme.ColorThemeReference) SkinReference(org.xwiki.lesscss.internal.skin.SkinReference) LESSResourceReference(org.xwiki.lesscss.resources.LESSResourceReference) Test(org.junit.Test)

Example 7 with ColorThemeReference

use of org.xwiki.lesscss.internal.colortheme.ColorThemeReference in project xwiki-platform by xwiki.

the class CacheKeyFactoryTest method getCacheKeyWithoutContext.

@Test
public void getCacheKeyWithoutContext() throws Exception {
    // Mocks
    LESSResourceReference lessResource = mock(LESSResourceReference.class);
    SkinReference skin = mock(SkinReference.class);
    ColorThemeReference colorTheme = mock(ColorThemeReference.class);
    when(lessResource.serialize()).thenReturn("lessResource");
    when(skin.serialize()).thenReturn("skin");
    when(colorTheme.serialize()).thenReturn("colorTheme");
    // Test
    assertEquals("12_lessResource_4_skin_10_colorTheme", mocker.getComponentUnderTest().getCacheKey(lessResource, skin, colorTheme, false));
}
Also used : ColorThemeReference(org.xwiki.lesscss.internal.colortheme.ColorThemeReference) SkinReference(org.xwiki.lesscss.internal.skin.SkinReference) LESSResourceReference(org.xwiki.lesscss.resources.LESSResourceReference) Test(org.junit.Test)

Example 8 with ColorThemeReference

use of org.xwiki.lesscss.internal.colortheme.ColorThemeReference in project xwiki-platform by xwiki.

the class ColorThemeListener method clearCacheFromColorTheme.

private void clearCacheFromColorTheme(XWikiDocument document) {
    ColorThemeReference colorThemeReference = colorThemeReferenceFactory.createReference(document.getDocumentReference());
    lessResourcesCache.clearFromColorTheme(colorThemeReference);
    colorThemeCache.clearFromColorTheme(colorThemeReference);
}
Also used : ColorThemeReference(org.xwiki.lesscss.internal.colortheme.ColorThemeReference)

Aggregations

ColorThemeReference (org.xwiki.lesscss.internal.colortheme.ColorThemeReference)8 Test (org.junit.Test)5 XWikiDocument (com.xpn.xwiki.doc.XWikiDocument)3 SkinReference (org.xwiki.lesscss.internal.skin.SkinReference)3 DocumentReference (org.xwiki.model.reference.DocumentReference)3 BaseObject (com.xpn.xwiki.objects.BaseObject)2 ArrayList (java.util.ArrayList)2 DocumentCreatedEvent (org.xwiki.bridge.event.DocumentCreatedEvent)2 DocumentDeletedEvent (org.xwiki.bridge.event.DocumentDeletedEvent)2 DocumentUpdatedEvent (org.xwiki.bridge.event.DocumentUpdatedEvent)2 LESSCompilerException (org.xwiki.lesscss.compiler.LESSCompilerException)2 DocumentColorThemeReference (org.xwiki.lesscss.internal.colortheme.DocumentColorThemeReference)2 LESSResourceReference (org.xwiki.lesscss.resources.LESSResourceReference)2 EntityReference (org.xwiki.model.reference.EntityReference)2 LocalDocumentReference (org.xwiki.model.reference.LocalDocumentReference)2 Event (org.xwiki.observation.event.Event)2 XWikiContext (com.xpn.xwiki.XWikiContext)1 DefaultLESSCompiler (org.xwiki.lesscss.internal.compiler.DefaultLESSCompiler)1