Search in sources :

Example 1 with GroovyScriptFactory

use of org.craftercms.engine.scripting.impl.GroovyScriptFactory in project engine by craftercms.

the class RestScriptsControllerTest method createSiteContext.

private SiteContext createSiteContext(ContentStoreService storeService) {
    SiteContext siteContext = mock(SiteContext.class);
    ContentStoreResourceConnector resourceConnector = new ContentStoreResourceConnector(siteContext);
    ScriptFactory scriptFactory = new GroovyScriptFactory(resourceConnector, Collections.<String, Object>emptyMap());
    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);
    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) 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 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