Author: radu Date: Mon Nov 28 18:11:54 2016 New Revision: 1771784 URL: http://svn.apache.org/viewvc?rev=1771784&view=rev Log: SLING-6166 - Update the HTL bundles to use the SLING-6165 request-scoped resource resolver
Added: sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/utils/ScriptUtils.java Modified: sling/trunk/bundles/scripting/sightly/engine/pom.xml sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/SightlyJavaCompilerService.java sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/RenderUnitProvider.java sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/ScriptUseProvider.java sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/runtime/RenderContextImpl.java sling/trunk/bundles/scripting/sightly/engine/src/test/java/org/apache/sling/scripting/sightly/impl/compiler/SightlyJavaCompilerServiceTest.java sling/trunk/bundles/scripting/sightly/js-use-provider/pom.xml sling/trunk/bundles/scripting/sightly/js-use-provider/src/main/java/org/apache/sling/scripting/sightly/js/impl/JsUseProvider.java sling/trunk/bundles/scripting/sightly/testing/src/main/provisioning/model.txt sling/trunk/bundles/scripting/sightly/testing/src/test/java/org/apache/sling/scripting/sightly/it/performance/PerformanceIT.java Modified: sling/trunk/bundles/scripting/sightly/engine/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/sightly/engine/pom.xml?rev=1771784&r1=1771783&r2=1771784&view=diff ============================================================================== --- sling/trunk/bundles/scripting/sightly/engine/pom.xml (original) +++ sling/trunk/bundles/scripting/sightly/engine/pom.xml Mon Nov 28 18:11:54 2016 @@ -202,7 +202,7 @@ <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.scripting.api</artifactId> - <version>2.1.8</version> + <version>2.1.11-SNAPSHOT</version> <scope>provided</scope> </dependency> <dependency> Modified: sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/SightlyJavaCompilerService.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/SightlyJavaCompilerService.java?rev=1771784&r1=1771783&r2=1771784&view=diff ============================================================================== --- sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/SightlyJavaCompilerService.java (original) +++ sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/SightlyJavaCompilerService.java Mon Nov 28 18:11:54 2016 @@ -36,9 +36,10 @@ import org.apache.sling.commons.compiler import org.apache.sling.commons.compiler.CompilerMessage; import org.apache.sling.commons.compiler.JavaCompiler; import org.apache.sling.commons.compiler.Options; +import org.apache.sling.scripting.api.resource.ScriptingResourceResolverProvider; import org.apache.sling.scripting.sightly.SightlyException; import org.apache.sling.scripting.sightly.impl.engine.compiled.SourceIdentifier; -import org.apache.sling.scripting.sightly.impl.engine.runtime.RenderContextImpl; +import org.apache.sling.scripting.sightly.impl.utils.ScriptUtils; import org.apache.sling.scripting.sightly.render.RenderContext; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; @@ -73,6 +74,9 @@ public class SightlyJavaCompilerService @Reference private SightlyEngineConfiguration sightlyEngineConfiguration = null; + @Reference + private ScriptingResourceResolverProvider scriptingResourceResolverProvider = null; + private Options options; /** @@ -85,14 +89,13 @@ public class SightlyJavaCompilerService * @return object instance of the requested class */ public Object getInstance(RenderContext renderContext, String className) { - RenderContextImpl rci = (RenderContextImpl) renderContext; LOG.debug("Attempting to load class {}.", className); if (className.contains(".")) { if (resourceBackedPojoChangeMonitor.getLastModifiedDateForJavaUseObject(className) > 0) { // it looks like the POJO comes from the repo and it was changed since it was last loaded LOG.debug("Class {} identifies a POJO from the repository that was changed since the last time it was instantiated.", className); - Object result = compileRepositoryJavaClass(rci.getScriptResourceResolver(), className); + Object result = compileRepositoryJavaClass(scriptingResourceResolverProvider.getRequestScopedResourceResolver(), className); resourceBackedPojoChangeMonitor.clearJavaUseObject(className); return result; } @@ -103,10 +106,14 @@ public class SightlyJavaCompilerService } catch (Exception e) { // the object definitely doesn't come from a bundle so we should attempt to compile it from the repo LOG.debug("Class {} identifies a POJO from the repository and it needs to be compiled.", className); - return compileRepositoryJavaClass(rci.getScriptResourceResolver(), className); + return compileRepositoryJavaClass(scriptingResourceResolverProvider.getRequestScopedResourceResolver(), className); } } else { - Resource pojoResource = rci.resolveScript(className + ".java"); + Resource pojoResource = ScriptUtils.resolveScript( + scriptingResourceResolverProvider.getRequestScopedResourceResolver(), + renderContext, + className + ".java" + ); if (pojoResource != null) { SourceIdentifier sourceIdentifier = new SourceIdentifier(sightlyEngineConfiguration, pojoResource.getPath()); String fqcn = sourceIdentifier.getFullyQualifiedClassName(); Modified: sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/RenderUnitProvider.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/RenderUnitProvider.java?rev=1771784&r1=1771783&r2=1771784&view=diff ============================================================================== --- sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/RenderUnitProvider.java (original) +++ sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/RenderUnitProvider.java Mon Nov 28 18:11:54 2016 @@ -31,13 +31,14 @@ import org.apache.sling.api.resource.Res import org.apache.sling.api.scripting.SlingScriptHelper; import org.apache.sling.scripting.api.CachedScript; import org.apache.sling.scripting.api.ScriptCache; +import org.apache.sling.scripting.api.resource.ScriptingResourceResolverProvider; import org.apache.sling.scripting.sightly.ResourceResolution; import org.apache.sling.scripting.sightly.SightlyException; import org.apache.sling.scripting.sightly.impl.engine.SightlyCompiledScript; import org.apache.sling.scripting.sightly.impl.engine.SightlyScriptEngine; import org.apache.sling.scripting.sightly.impl.engine.SightlyScriptEngineFactory; -import org.apache.sling.scripting.sightly.impl.engine.runtime.RenderContextImpl; import org.apache.sling.scripting.sightly.impl.utils.BindingsUtils; +import org.apache.sling.scripting.sightly.impl.utils.ScriptUtils; import org.apache.sling.scripting.sightly.java.compiler.RenderUnit; import org.apache.sling.scripting.sightly.render.RenderContext; import org.apache.sling.scripting.sightly.use.ProviderOutcome; @@ -84,14 +85,17 @@ public class RenderUnitProvider implemen @Reference private ScriptEngineManager scriptEngineManager; + @Reference + private ScriptingResourceResolverProvider scriptingResourceResolverProvider; + @Override public ProviderOutcome provide(String identifier, RenderContext renderContext, Bindings arguments) { if (identifier.endsWith("." + SightlyScriptEngineFactory.EXTENSION)) { - RenderContextImpl rci = (RenderContextImpl) renderContext; Bindings globalBindings = renderContext.getBindings(); SlingScriptHelper sling = BindingsUtils.getHelper(globalBindings); SlingHttpServletRequest request = BindingsUtils.getRequest(globalBindings); - final Resource renderUnitResource = rci.resolveScript(identifier); + final Resource renderUnitResource = ScriptUtils.resolveScript(scriptingResourceResolverProvider + .getRequestScopedResourceResolver(), renderContext, identifier); if (renderUnitResource == null) { Resource caller = ResourceResolution.getResourceForRequest(request.getResourceResolver(), request); if (caller != null) { Modified: sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/ScriptUseProvider.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/ScriptUseProvider.java?rev=1771784&r1=1771783&r2=1771784&view=diff ============================================================================== --- sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/ScriptUseProvider.java (original) +++ sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/ScriptUseProvider.java Mon Nov 28 18:11:54 2016 @@ -25,14 +25,16 @@ import org.apache.commons.lang.StringUti import org.apache.sling.api.resource.Resource; import org.apache.sling.api.scripting.SlingBindings; import org.apache.sling.api.scripting.SlingScript; +import org.apache.sling.scripting.api.resource.ScriptingResourceResolverProvider; import org.apache.sling.scripting.sightly.impl.engine.SightlyScriptEngineFactory; -import org.apache.sling.scripting.sightly.impl.engine.runtime.RenderContextImpl; import org.apache.sling.scripting.sightly.impl.utils.BindingsUtils; +import org.apache.sling.scripting.sightly.impl.utils.ScriptUtils; import org.apache.sling.scripting.sightly.render.RenderContext; import org.apache.sling.scripting.sightly.use.ProviderOutcome; import org.apache.sling.scripting.sightly.use.UseProvider; import org.osgi.framework.Constants; import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; import org.osgi.service.metatype.annotations.AttributeDefinition; import org.osgi.service.metatype.annotations.Designate; import org.osgi.service.metatype.annotations.ObjectClassDefinition; @@ -76,16 +78,19 @@ public class ScriptUseProvider implement private static final Logger log = LoggerFactory.getLogger(ScriptUseProvider.class); + @Reference + private ScriptingResourceResolverProvider scriptingResourceResolverProvider; + @Override public ProviderOutcome provide(String scriptName, RenderContext renderContext, Bindings arguments) { - RenderContextImpl rci = (RenderContextImpl) renderContext; - Bindings globalBindings = rci.getBindings(); + Bindings globalBindings = renderContext.getBindings(); Bindings bindings = BindingsUtils.merge(globalBindings, arguments); String extension = scriptExtension(scriptName); if (extension == null || extension.equals(SightlyScriptEngineFactory.EXTENSION)) { return ProviderOutcome.failure(); } - Resource scriptResource = rci.resolveScript(scriptName); + Resource scriptResource = ScriptUtils.resolveScript(scriptingResourceResolverProvider.getRequestScopedResourceResolver(), + renderContext, scriptName); if (scriptResource == null) { log.debug("Path does not match an existing resource: {}", scriptName); return ProviderOutcome.failure(); Modified: sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/runtime/RenderContextImpl.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/runtime/RenderContextImpl.java?rev=1771784&r1=1771783&r2=1771784&view=diff ============================================================================== --- sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/runtime/RenderContextImpl.java (original) +++ sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/runtime/RenderContextImpl.java Mon Nov 28 18:11:54 2016 @@ -44,16 +44,11 @@ public class RenderContextImpl implement private static final AbstractRuntimeObjectModel OBJECT_MODEL = new SlingRuntimeObjectModel(); private final Bindings bindings; - private final ResourceResolver scriptResourceResolver; private final ExtensionRegistryService extensionRegistryService; - private final SlingScriptHelper sling; public RenderContextImpl(ScriptContext scriptContext) { bindings = scriptContext.getBindings(ScriptContext.ENGINE_SCOPE); - scriptResourceResolver = (ResourceResolver) scriptContext.getAttribute(SlingScriptConstants.ATTR_SCRIPT_RESOURCE_RESOLVER, - SlingScriptConstants.SLING_SCOPE); - sling = BindingsUtils.getHelper(bindings); - extensionRegistryService = sling.getService(ExtensionRegistryService.class); + extensionRegistryService = BindingsUtils.getHelper(bindings).getService(ExtensionRegistryService.class); } @Override @@ -80,19 +75,4 @@ public class RenderContextImpl implement return extension.call(this, arguments); } - public ResourceResolver getScriptResourceResolver() { - return scriptResourceResolver; - } - - public Resource resolveScript(String scriptIdentifier) { - SlingHttpServletRequest request = BindingsUtils.getRequest(bindings); - Resource caller = ResourceResolution.getResourceForRequest(scriptResourceResolver, request); - Resource result = ResourceResolution.getResourceFromSearchPath(caller, scriptIdentifier); - if (result == null) { - caller = sling.getScript().getScriptResource(); - result = ResourceResolution.getResourceFromSearchPath(caller, scriptIdentifier); - } - return result; - } - } Added: sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/utils/ScriptUtils.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/utils/ScriptUtils.java?rev=1771784&view=auto ============================================================================== --- sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/utils/ScriptUtils.java (added) +++ sling/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/utils/ScriptUtils.java Mon Nov 28 18:11:54 2016 @@ -0,0 +1,39 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ +package org.apache.sling.scripting.sightly.impl.utils; + +import org.apache.sling.api.SlingHttpServletRequest; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.scripting.SlingScriptHelper; +import org.apache.sling.scripting.sightly.ResourceResolution; +import org.apache.sling.scripting.sightly.render.RenderContext; + +public class ScriptUtils { + + public static Resource resolveScript(ResourceResolver resolver, RenderContext renderContext, String scriptIdentifier) { + SlingHttpServletRequest request = BindingsUtils.getRequest(renderContext.getBindings()); + Resource caller = ResourceResolution.getResourceForRequest(resolver, request); + Resource result = ResourceResolution.getResourceFromSearchPath(caller, scriptIdentifier); + if (result == null) { + SlingScriptHelper sling = BindingsUtils.getHelper(renderContext.getBindings()); + caller = resolver.getResource(sling.getScript().getScriptResource().getPath()); + result = ResourceResolution.getResourceFromSearchPath(caller, scriptIdentifier); + } + return result; + } +} Modified: sling/trunk/bundles/scripting/sightly/engine/src/test/java/org/apache/sling/scripting/sightly/impl/compiler/SightlyJavaCompilerServiceTest.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/sightly/engine/src/test/java/org/apache/sling/scripting/sightly/impl/compiler/SightlyJavaCompilerServiceTest.java?rev=1771784&r1=1771783&r2=1771784&view=diff ============================================================================== --- sling/trunk/bundles/scripting/sightly/engine/src/test/java/org/apache/sling/scripting/sightly/impl/compiler/SightlyJavaCompilerServiceTest.java (original) +++ sling/trunk/bundles/scripting/sightly/engine/src/test/java/org/apache/sling/scripting/sightly/impl/compiler/SightlyJavaCompilerServiceTest.java Mon Nov 28 18:11:54 2016 @@ -32,6 +32,7 @@ import org.apache.sling.commons.compiler import org.apache.sling.commons.compiler.CompilerMessage; import org.apache.sling.commons.compiler.JavaCompiler; import org.apache.sling.commons.compiler.Options; +import org.apache.sling.scripting.api.resource.ScriptingResourceResolverProvider; import org.apache.sling.scripting.sightly.impl.engine.ResourceBackedPojoChangeMonitor; import org.apache.sling.scripting.sightly.impl.engine.SightlyEngineConfiguration; import org.apache.sling.scripting.sightly.impl.engine.SightlyJavaCompilerService; @@ -102,10 +103,11 @@ public class SightlyJavaCompilerServiceT private void getInstancePojoTest(String pojoPath, String className) throws Exception { RenderContextImpl renderContext = Mockito.mock(RenderContextImpl.class); + ScriptingResourceResolverProvider scriptingResourceResolverProvider = Mockito.mock(ScriptingResourceResolverProvider.class); Resource pojoResource = Mockito.mock(Resource.class); when(pojoResource.getPath()).thenReturn(pojoPath); ResourceResolver resolver = Mockito.mock(ResourceResolver.class); - when(renderContext.getScriptResourceResolver()).thenReturn(resolver); + when(scriptingResourceResolverProvider.getRequestScopedResourceResolver()).thenReturn(resolver); when(resolver.getResource(pojoPath)).thenReturn(pojoResource); when(pojoResource.adaptTo(InputStream.class)).thenReturn(IOUtils.toInputStream("DUMMY", "UTF-8")); JavaCompiler javaCompiler = Mockito.mock(JavaCompiler.class); @@ -121,11 +123,12 @@ public class SightlyJavaCompilerServiceT return MockPojo.class; } }); - Whitebox.setInternalState(compiler, "classLoaderWriter", clw); - Whitebox.setInternalState(compiler, "javaCompiler", javaCompiler); SightlyEngineConfiguration sightlyEngineConfiguration = mock(SightlyEngineConfiguration.class); when(sightlyEngineConfiguration.getBundleSymbolicName()).thenReturn("org.apache.sling.scripting.sightly"); when(sightlyEngineConfiguration.getScratchFolder()).thenReturn("/org/apache/sling/scripting/sightly"); + Whitebox.setInternalState(compiler, "classLoaderWriter", clw); + Whitebox.setInternalState(compiler, "javaCompiler", javaCompiler); + Whitebox.setInternalState(compiler, "scriptingResourceResolverProvider", scriptingResourceResolverProvider); Whitebox.setInternalState(compiler, "sightlyEngineConfiguration", sightlyEngineConfiguration); Object obj = compiler.getInstance(renderContext, className); assertTrue("Expected to obtain a " + MockPojo.class.getName() + " object.", obj instanceof MockPojo); Modified: sling/trunk/bundles/scripting/sightly/js-use-provider/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/sightly/js-use-provider/pom.xml?rev=1771784&r1=1771783&r2=1771784&view=diff ============================================================================== --- sling/trunk/bundles/scripting/sightly/js-use-provider/pom.xml (original) +++ sling/trunk/bundles/scripting/sightly/js-use-provider/pom.xml Mon Nov 28 18:11:54 2016 @@ -112,7 +112,7 @@ <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.scripting.api</artifactId> - <version>2.1.8</version> + <version>2.1.11-SNAPSHOT</version> <scope>provided</scope> </dependency> <dependency> Modified: sling/trunk/bundles/scripting/sightly/js-use-provider/src/main/java/org/apache/sling/scripting/sightly/js/impl/JsUseProvider.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/sightly/js-use-provider/src/main/java/org/apache/sling/scripting/sightly/js/impl/JsUseProvider.java?rev=1771784&r1=1771783&r2=1771784&view=diff ============================================================================== --- sling/trunk/bundles/scripting/sightly/js-use-provider/src/main/java/org/apache/sling/scripting/sightly/js/impl/JsUseProvider.java (original) +++ sling/trunk/bundles/scripting/sightly/js-use-provider/src/main/java/org/apache/sling/scripting/sightly/js/impl/JsUseProvider.java Mon Nov 28 18:11:54 2016 @@ -18,17 +18,14 @@ ******************************************************************************/ package org.apache.sling.scripting.sightly.js.impl; -import java.util.HashMap; -import java.util.Map; import javax.script.Bindings; import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; -import org.apache.sling.api.resource.LoginException; import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ResourceResolver; -import org.apache.sling.api.resource.ResourceResolverFactory; import org.apache.sling.api.scripting.SlingScriptHelper; +import org.apache.sling.scripting.api.resource.ScriptingResourceResolverProvider; import org.apache.sling.scripting.sightly.SightlyException; import org.apache.sling.scripting.sightly.js.impl.async.AsyncContainer; import org.apache.sling.scripting.sightly.js.impl.async.AsyncExtractor; @@ -79,7 +76,6 @@ public class JsUseProvider implements Us private static final Logger LOGGER = LoggerFactory.getLogger(JsUseProvider.class); private static final String JS_ENGINE_NAME = "javascript"; private static final JsValueAdapter jsValueAdapter = new JsValueAdapter(new AsyncExtractor()); - private static final String SLING_SCRIPTING_USER = "sling-scripting"; @Reference private ScriptEngineManager scriptEngineManager = null; @@ -88,7 +84,7 @@ public class JsUseProvider implements Us private ProxyAsyncScriptableFactory proxyAsyncScriptableFactory = null; @Reference - private ResourceResolverFactory rrf = null; + private ScriptingResourceResolverProvider scriptingResourceResolverProvider = null; @Override public ProviderOutcome provide(String identifier, RenderContext renderContext, Bindings arguments) { @@ -102,30 +98,20 @@ public class JsUseProvider implements Us } SlingScriptHelper scriptHelper = Utils.getHelper(globalBindings); JsEnvironment environment = null; - ResourceResolver slingScriptingResolver = null; try { environment = new JsEnvironment(jsEngine); environment.initialize(); - Map<String, Object> authenticationInfo = new HashMap<String, Object>() {{ - put(ResourceResolverFactory.SUBSERVICE, SLING_SCRIPTING_USER); - }}; - slingScriptingResolver = rrf.getServiceResourceResolver(authenticationInfo); + ResourceResolver slingScriptingResolver = scriptingResourceResolverProvider.getRequestScopedResourceResolver(); Resource callerScript = slingScriptingResolver.getResource(scriptHelper.getScript().getScriptResource().getPath()); Resource scriptResource = Utils.getScriptResource(callerScript, identifier, globalBindings); globalBindings.put(ScriptEngine.FILENAME, scriptResource.getPath()); proxyAsyncScriptableFactory.registerProxies(globalBindings); AsyncContainer asyncContainer = environment.runResource(scriptResource, globalBindings, arguments); return ProviderOutcome.success(jsValueAdapter.adapt(asyncContainer)); - } catch (LoginException e) { - LOGGER.error("Cannot obtain a resource resolver backed by the " + SLING_SCRIPTING_USER + " service user.", e); - return ProviderOutcome.failure(e); } finally { if (environment != null) { environment.cleanup(); } - if (slingScriptingResolver != null) { - slingScriptingResolver.close(); - } } } } Modified: sling/trunk/bundles/scripting/sightly/testing/src/main/provisioning/model.txt URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/sightly/testing/src/main/provisioning/model.txt?rev=1771784&r1=1771783&r2=1771784&view=diff ============================================================================== --- sling/trunk/bundles/scripting/sightly/testing/src/main/provisioning/model.txt (original) +++ sling/trunk/bundles/scripting/sightly/testing/src/main/provisioning/model.txt Mon Nov 28 18:11:54 2016 @@ -20,6 +20,8 @@ # Dependencies [artifacts] org.apache.sling/org.apache.sling.launchpad/9-SNAPSHOT/slingstart + org.apache.sling/org.apache.sling.scripting.api/2.1.11-SNAPSHOT + org.apache.sling/org.apache.sling.scripting.core/2.0.43-SNAPSHOT org.apache.sling/org.apache.sling.scripting.sightly.compiler org.apache.sling/org.apache.sling.scripting.sightly.compiler.java org.apache.sling/org.apache.sling.scripting.sightly Modified: sling/trunk/bundles/scripting/sightly/testing/src/test/java/org/apache/sling/scripting/sightly/it/performance/PerformanceIT.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/sightly/testing/src/test/java/org/apache/sling/scripting/sightly/it/performance/PerformanceIT.java?rev=1771784&r1=1771783&r2=1771784&view=diff ============================================================================== --- sling/trunk/bundles/scripting/sightly/testing/src/test/java/org/apache/sling/scripting/sightly/it/performance/PerformanceIT.java (original) +++ sling/trunk/bundles/scripting/sightly/testing/src/test/java/org/apache/sling/scripting/sightly/it/performance/PerformanceIT.java Mon Nov 28 18:11:54 2016 @@ -109,15 +109,13 @@ public class PerformanceIT { HttpStatus.SC_OK); } - // modified threshold to 12 because of SLING-6156; will be restored by SLING-6166 - @PerformanceTest(runinvocations = INVOCATIONS, warmupinvocations = WARMUP_INVOCATIONS, threshold = 12) + @PerformanceTest(runinvocations = INVOCATIONS, warmupinvocations = WARMUP_INVOCATIONS, threshold = 4) public void test6SlyJSAsync() { getStringContent("/sightlyperf/loop.html?selector=sly-js-async&count=" + CONTENT_LOOP_COUNT, HttpStatus.SC_OK); } - // modified threshold to 12 because of SLING-6156; will be restored by SLING-6166 - @PerformanceTest(runinvocations = INVOCATIONS, warmupinvocations = WARMUP_INVOCATIONS, threshold = 12) + @PerformanceTest(runinvocations = INVOCATIONS, warmupinvocations = WARMUP_INVOCATIONS, threshold = 4) public void test7SlyJSSync() { getStringContent("/sightlyperf/loop.html?selector=sly-js-sync&count=" + CONTENT_LOOP_COUNT, HttpStatus.SC_OK);