Search in sources :

Example 1 with ContentStoreResourceConnector

use of org.craftercms.engine.util.groovy.ContentStoreResourceConnector in project engine by craftercms.

the class RestScriptsControllerTest method createSiteContext.

private SiteContext createSiteContext(ContentStoreService storeService) {
    SiteContext siteContext = spy(new SiteContext());
    CacheTemplate cacheTemplate = CacheTemplateMockUtils.createCacheTemplate();
    ContentStoreResourceConnector resourceConnector = new ContentStoreResourceConnector(siteContext);
    ScriptFactory scriptFactory = new GroovyScriptFactory(siteContext, resourceConnector, Collections.emptyMap(), false);
    when(siteContext.getSiteName()).thenReturn("test");
    when(siteContext.getContext()).thenReturn(mock(Context.class));
    when(siteContext.getRestScriptsPath()).thenReturn("/scripts");
    when(siteContext.getStoreService()).thenReturn(storeService);
    when(siteContext.getScriptFactory()).thenReturn(scriptFactory);
    when(siteContext.getCacheTemplate()).thenReturn(cacheTemplate);
    return siteContext;
}
Also used : RequestContext(org.craftercms.commons.http.RequestContext) SiteContext(org.craftercms.engine.service.context.SiteContext) Context(org.craftercms.core.service.Context) ServletContext(javax.servlet.ServletContext) ContentStoreResourceConnector(org.craftercms.engine.util.groovy.ContentStoreResourceConnector) SiteContext(org.craftercms.engine.service.context.SiteContext) GroovyScriptFactory(org.craftercms.engine.scripting.impl.GroovyScriptFactory) CacheTemplate(org.craftercms.core.util.cache.CacheTemplate) GroovyScriptFactory(org.craftercms.engine.scripting.impl.GroovyScriptFactory) ScriptFactory(org.craftercms.engine.scripting.ScriptFactory)

Aggregations

ServletContext (javax.servlet.ServletContext)1 RequestContext (org.craftercms.commons.http.RequestContext)1 Context (org.craftercms.core.service.Context)1 CacheTemplate (org.craftercms.core.util.cache.CacheTemplate)1 ScriptFactory (org.craftercms.engine.scripting.ScriptFactory)1 GroovyScriptFactory (org.craftercms.engine.scripting.impl.GroovyScriptFactory)1 SiteContext (org.craftercms.engine.service.context.SiteContext)1 ContentStoreResourceConnector (org.craftercms.engine.util.groovy.ContentStoreResourceConnector)1