You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2015/01/23 14:50:57 UTC
svn commit: r1654212 - in /sling/trunk/contrib/scripting/sightly/engine/src:
main/java/org/apache/sling/scripting/sightly/impl/compiler/
main/java/org/apache/sling/scripting/sightly/impl/engine/
main/java/org/apache/sling/scripting/sightly/impl/engine/...
Author: fmeschbe
Date: Fri Jan 23 13:50:56 2015
New Revision: 1654212
URL: http://svn.apache.org/r1654212
Log:
SLING-4342 [Sightly] Reduce the number of repository reads
* reduces the number of repository reads by optimising
the SightlyJavaCompilerService and UnitLoader
* enhances documentation for UnitChangeMonitor
* removes useless SightlyRenderException
Apply patch by Radu Cotescu (thanks a lot)
Removed:
sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/runtime/SightlyRenderException.java
Modified:
sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/compiler/SightlyJavaCompilerService.java
sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/UnitChangeMonitor.java
sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/UnitLoader.java
sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/IncludeRuntimeExtension.java
sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/PojoUseProvider.java
sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/UseProviderUtils.java
sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/runtime/RenderContextImpl.java
sling/trunk/contrib/scripting/sightly/engine/src/test/java/org/apache/sling/scripting/sightly/impl/compiler/SightlyJavaCompilerServiceTest.java
Modified: sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/compiler/SightlyJavaCompilerService.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/compiler/SightlyJavaCompilerService.java?rev=1654212&r1=1654211&r2=1654212&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/compiler/SightlyJavaCompilerService.java (original)
+++ sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/compiler/SightlyJavaCompilerService.java Fri Jan 23 13:50:56 2015
@@ -44,6 +44,7 @@ import org.apache.sling.commons.compiler
import org.apache.sling.commons.compiler.Options;
import org.apache.sling.jcr.compiler.JcrJavaCompiler;
import org.apache.sling.scripting.sightly.ResourceResolution;
+import org.apache.sling.scripting.sightly.SightlyException;
import org.apache.sling.scripting.sightly.impl.engine.UnitChangeMonitor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -80,40 +81,51 @@ public class SightlyJavaCompilerService
* compilation. In case the requested class does not denote a fully qualified classname, this service will try to find the class through
* Sling's servlet resolution mechanism and compile the class on-the-fly if required.
*
- * @param resource the lookup will be performed based on this resource
- * @param className name of class to use for object instantiation
+ * @param resolver a {@link ResourceResolver} with read access to resources from the search path (see {@link
+ * ResourceResolver#getSearchPath()})
+ * @param callingScript the lookup will be performed based on this resource only if the {@code className} does not identify a fully
+ * qualified class name; otherwise this parameter can be {@code null}
+ * @param className name of class to use for object instantiation
* @return object instance of the requested class
* @throws CompilerException in case of any runtime exception
*/
- public Object getInstance(Resource resource, String className) {
-
- LOG.debug("Attempting to obtain bean instance of resource '{}' and class '{}'", resource.getPath(), className);
-
- // assume fully qualified class name
+ public Object getInstance(ResourceResolver resolver, Resource callingScript, String className) {
if (className.contains(".")) {
- try {
- String pojoPath = getPathFromJavaName(className);
- return loadPOJOFromRepo(resource.getResourceResolver(), className, pojoPath);
- } catch (CompilerException e1) {
- if (e1.getFailureCause() == CompilerException.CompilerExceptionCause.MISSING_REPO_POJO) {
- // the POJO might have been loaded once and come from a bundle
+ String pojoPath = getPathFromJavaName(className);
+ if (unitChangeMonitor.getLastModifiedDateForJavaUseObject(pojoPath) > 0) {
+ // it looks like the POJO comes from the repo and it was changed since it was last loaded
+ Resource pojoResource = resolver.getResource(pojoPath);
+ if (pojoResource != null) {
+ // clear the cache as we need to recompile the POJO object
+ unitChangeMonitor.clearJavaUseObject(pojoPath);
+ return compileSource(pojoResource, className);
+ } else {
+ throw new SightlyException(String.format("Resource %s identifying class %s has been removed.", pojoPath, className));
+ }
+ } else {
+ try {
+ // the object either comes from a bundle or from the repo but it was not registered by the UnitChangeMonitor
return loadObject(className);
+ } catch (CompilerException cex) {
+ // the object definitely doesn't come from a bundle so we should attempt to compile it from the repo
+ Set<String> possiblePaths = getPossiblePojoPaths(pojoPath);
+ for (String possiblePath : possiblePaths) {
+ Resource pojoResource = resolver.getResource(possiblePath);
+ if (pojoResource != null) {
+ return compileSource(pojoResource, className);
+ }
+ }
}
- throw e1;
}
} else {
- LOG.debug("trying to find Java source based on resource: {}", resource.getPath());
- // try to find Java source in JCR from a non-fully qualified class name
- Resource scriptResource = ResourceResolution
- .getResourceFromSearchPath(resource, className + ".java");
- if (scriptResource != null) {
- String pojoPath = scriptResource.getPath();
- LOG.debug("found Java bean script resource: " + scriptResource.getPath());
- return loadPOJOFromRepo(resource.getResourceResolver(), getJavaNameFromPath(pojoPath), pojoPath);
- } else {
- return loadPOJOFromBundle(resource, className);
+ if (callingScript != null) {
+ Resource pojoResource = ResourceResolution.getResourceFromSearchPath(callingScript, className + ".java");
+ if (pojoResource != null) {
+ return getInstance(resolver, null, getJavaNameFromPath(pojoResource.getPath()));
+ }
}
}
+ throw new SightlyException("Cannot find class " + className + ".");
}
/**
@@ -134,36 +146,6 @@ public class SightlyJavaCompilerService
}
}
- private Object loadPOJOFromRepo(ResourceResolver resolver, String className, String pojoPath) {
- if (unitChangeMonitor.getLastModifiedDateForJavaUseObject(pojoPath) > 0) {
- Resource pojoResource = resolver.getResource(pojoPath);
- if (pojoResource != null) {
- // remove it from the monitor so that next time we load it from the classloader's cache
- unitChangeMonitor.clearJavaUseObject(pojoPath);
- return compileSource(pojoResource, className);
- } else {
- throw new CompilerException(CompilerException.CompilerExceptionCause.MISSING_REPO_POJO, String.format("Resource %s " +
- "identifying class %s has been removed.", pojoPath, className));
- }
- } else {
- try {
- // the POJO might have been compiled before from the repo but not cached by the unitChangeMonitor
- return loadObject(className);
- } catch (CompilerException e) {
- // the POJO was never compiled, nor cached by unitChangeMonitor
- Set<String> possiblePaths = getPossiblePojoPaths(pojoPath);
- Resource pojoResource;
- for (String possiblePath : possiblePaths) {
- pojoResource = resolver.getResource(possiblePath);
- if (pojoResource != null) {
- return compileSource(pojoResource, className);
- }
- }
- throw new CompilerException(CompilerException.CompilerExceptionCause.MISSING_REPO_POJO);
- }
- }
- }
-
/**
* For a JCR path obtained from expanding a generated class name this method generates all the alternative path names that can be
* obtained by expanding the mentioned class' name.
@@ -231,18 +213,6 @@ public class SightlyJavaCompilerService
}
}
- private Object loadPOJOFromBundle(Resource resource, String className) {
- Resource resourceType = resource.getResourceResolver().getResource(resource.getResourceType());
- if (resourceType == null) {
- resourceType = resource;
- }
- String resourceTypeDir = resourceType.getPath();
- String fullyQualifiedClassName = getJavaNameFromPath(resourceTypeDir) + "." + className;
- LOG.debug("Java bean source not found, trying to locate using" + " component directory as packagename: {}", resourceTypeDir);
- LOG.debug("loading Java class: " + fullyQualifiedClassName);
- return loadObject(fullyQualifiedClassName);
- }
-
/**
* Instantiate and return an instance of a class.
*
Modified: sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/UnitChangeMonitor.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/UnitChangeMonitor.java?rev=1654212&r1=1654211&r2=1654212&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/UnitChangeMonitor.java (original)
+++ sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/UnitChangeMonitor.java Fri Jan 23 13:50:56 2015
@@ -59,16 +59,34 @@ public class UnitChangeMonitor {
@Reference
private SlingSettingsService slingSettings = null;
+ /**
+ * Returns the last modified date for a Sightly script.
+ *
+ * @param script the script's full path
+ * @return the script's last modified date or 0 if there's no information about the script
+ */
public long getLastModifiedDateForScript(String script) {
Long date = slyScriptsMap.get(script);
return date != null ? date : 0;
}
+ /**
+ * Returns the last modified date of a generated Java source file.
+ *
+ * @param file the full path of the generated source file
+ * @return the file's last modified date or 0 if there's no information about the file
+ */
public long getLastModifiedDateForJavaSourceFile(String file) {
Long date = slySourcesMap.get(file);
return date != null ? date : 0;
}
+ /**
+ * Returns the last modified date for a Java Use-API object stored in the repository.
+ *
+ * @param path the full path of the file defining the Java Use-API object
+ * @return the Java Use-API file's last modified date or 0 if there's no information about this file
+ */
public long getLastModifiedDateForJavaUseObject(String path) {
Long date = slyJavaUseMap.get(path);
return date != null ? date : 0;
Modified: sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/UnitLoader.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/UnitLoader.java?rev=1654212&r1=1654211&r2=1654212&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/UnitLoader.java (original)
+++ sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/UnitLoader.java Fri Jan 23 13:50:56 2015
@@ -56,7 +56,6 @@ import org.apache.sling.scripting.sightl
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.engine.runtime.RenderUnit;
-import org.apache.sling.scripting.sightly.impl.engine.runtime.SightlyRenderException;
import org.apache.sling.settings.SlingSettingsService;
import org.osgi.service.component.ComponentContext;
import org.slf4j.Logger;
@@ -137,15 +136,13 @@ public class UnitLoader {
}
lock.lock();
}
- createClass(adminResolver, sourceIdentifier, bindings, encoding, renderContext);
- Resource javaClassResource = adminResolver.getResource(sourceIdentifier.getSourceFullPath());
+ Resource javaClassResource = createClass(adminResolver, sourceIdentifier, bindings, encoding, renderContext);
obj = sightlyJavaCompilerService.compileSource(javaClassResource, sourceIdentifier.getFullyQualifiedName());
} else {
- Resource javaClassResource = adminResolver.getResource(sourceIdentifier.getSourceFullPath());
- obj = sightlyJavaCompilerService.getInstance(javaClassResource, sourceIdentifier.getFullyQualifiedName());
+ obj = sightlyJavaCompilerService.getInstance(adminResolver, null, sourceIdentifier.getFullyQualifiedName());
}
if (!(obj instanceof RenderUnit)) {
- throw new SightlyRenderException("Class is not a RenderUnit instance");
+ throw new SightlyException("Class is not a RenderUnit instance");
}
return (RenderUnit) obj;
} finally {
@@ -185,7 +182,8 @@ public class UnitLoader {
}
}
- private synchronized void writeSource(ResourceResolver resolver, String sourceFullPath, String source) {
+ private synchronized Resource writeSource(ResourceResolver resolver, String sourceFullPath, String source) {
+ Resource sourceResource;
try {
String sourceParentPath = ResourceUtil.getParent(sourceFullPath);
Map<String, Object> sourceFolderProperties = new HashMap<String, Object>();
@@ -194,7 +192,7 @@ public class UnitLoader {
Map<String, Object> sourceFileProperties = new HashMap<String, Object>();
sourceFileProperties.put(JCR_PRIMARY_TYPE, NT_FILE);
- createResource(resolver, sourceFullPath, sourceFileProperties, null, false, false);
+ sourceResource = createResource(resolver, sourceFullPath, sourceFileProperties, null, false, false);
Map<String, Object> ntResourceProperties = new HashMap<String, Object>();
ntResourceProperties.put(JCR_PRIMARY_TYPE, NT_RESOURCE);
@@ -203,8 +201,9 @@ public class UnitLoader {
createResource(resolver, sourceFullPath + "/" + JCR_CONTENT, ntResourceProperties, NT_RESOURCE, true, true);
log.debug("Successfully written Java source file to repository: {}", sourceFullPath);
} catch (PersistenceException e) {
- log.error("Repository error while writing Java source file: " + sourceFullPath, e);
+ throw new SightlyException("Repository error while writing Java source file: " + sourceFullPath, e);
}
+ return sourceResource;
}
private SourceIdentifier obtainIdentifier(Resource resource) {
@@ -213,7 +212,7 @@ public class UnitLoader {
return new SourceIdentifier(resource, CLASS_NAME_PREFIX, basePath);
}
- private void createClass(ResourceResolver resolver, SourceIdentifier identifier, Bindings bindings, String encoding,
+ private Resource createClass(ResourceResolver resolver, SourceIdentifier identifier, Bindings bindings, String encoding,
RenderContextImpl renderContext) {
String scriptSource = null;
try {
@@ -221,7 +220,7 @@ public class UnitLoader {
if (scriptResource != null) {
scriptSource = IOUtils.toString(scriptResource.adaptTo(InputStream.class), encoding);
String javaSourceCode = obtainResultSource(scriptSource, identifier, bindings, renderContext);
- writeSource(resolver, identifier.getSourceFullPath(), javaSourceCode);
+ return writeSource(resolver, identifier.getSourceFullPath(), javaSourceCode);
}
} catch (SightlyParsingException e) {
String offendingInput = e.getOffendingInput();
@@ -233,10 +232,10 @@ public class UnitLoader {
} else {
throw e;
}
-
} catch (IOException e) {
- throw new SightlyRenderException(e);
+ throw new SightlyException(e);
}
+ throw new SightlyException("Unable to generate Java class for template " + identifier.getResource().getPath());
}
private String obtainResultSource(String scriptSource, SourceIdentifier identifier, Bindings bindings, RenderContextImpl renderContext) {
Modified: sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/IncludeRuntimeExtension.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/IncludeRuntimeExtension.java?rev=1654212&r1=1654211&r2=1654212&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/IncludeRuntimeExtension.java (original)
+++ sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/IncludeRuntimeExtension.java Fri Jan 23 13:50:56 2015
@@ -35,9 +35,9 @@ import org.apache.sling.api.SlingHttpSer
import org.apache.sling.api.scripting.SlingBindings;
import org.apache.sling.api.scripting.SlingScriptHelper;
import org.apache.sling.api.servlets.ServletResolver;
+import org.apache.sling.scripting.sightly.SightlyException;
import org.apache.sling.scripting.sightly.extension.RuntimeExtension;
import org.apache.sling.scripting.sightly.impl.engine.runtime.RenderContextImpl;
-import org.apache.sling.scripting.sightly.impl.engine.runtime.SightlyRenderException;
import org.apache.sling.scripting.sightly.impl.plugin.IncludePlugin;
import org.apache.sling.scripting.sightly.render.RenderContext;
import org.slf4j.Logger;
@@ -68,7 +68,7 @@ public class IncludeRuntimeExtension imp
Map options = (Map) arguments[1];
String path = buildPath(originalPath, options);
if (path == null) {
- throw new SightlyRenderException("Path for include is empty");
+ throw new SightlyException("Path for data-sly-include is empty");
}
StringWriter output = new StringWriter();
final Bindings bindings = renderContext.getBindings();
Modified: sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/PojoUseProvider.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/PojoUseProvider.java?rev=1654212&r1=1654211&r2=1654212&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/PojoUseProvider.java (original)
+++ sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/PojoUseProvider.java Fri Jan 23 13:50:56 2015
@@ -84,7 +84,7 @@ public class PojoUseProvider implements
try {
ResourceResolver adminResolver = RenderContextImpl.getScriptResourceResolver(renderContext);
Resource resource = ResourceResolution.getResourceForRequest(adminResolver, sling.getRequest());
- Object result = sightlyJavaCompilerService.getInstance(resource, identifier);
+ Object result = sightlyJavaCompilerService.getInstance(adminResolver, resource, identifier);
if (result instanceof Use) {
((Use) result).init(bindings);
}
Modified: sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/UseProviderUtils.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/UseProviderUtils.java?rev=1654212&r1=1654211&r2=1654212&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/UseProviderUtils.java (original)
+++ sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/UseProviderUtils.java Fri Jan 23 13:50:56 2015
@@ -68,27 +68,9 @@ public class UseProviderUtils {
* @return the script resource if found, {@code null} otherwise
*/
public static Resource locateScriptResource(ResourceResolver resourceResolver, SlingScriptHelper sling, String script) {
- Resource result = null;
- if (script.startsWith("/")) {
- result = resourceResolver.getResource(script);
- }
- if (result == null) {
- Resource componentResource = ResourceResolution.getResourceForRequest(resourceResolver, sling.getRequest());
- result = ResourceResolution.getResourceFromSearchPath(componentResource, script);
- }
- if (result != null) {
- checkSearchPath(result, resourceResolver);
- }
+ Resource componentResource = ResourceResolution.getResourceForRequest(resourceResolver, sling.getRequest());
+ Resource result = ResourceResolution.getResourceFromSearchPath(componentResource, script);
return result;
}
- private static void checkSearchPath(Resource resource, ResourceResolver resourceResolver) {
- String resourcePath = resource.getPath();
- for (String path : resourceResolver.getSearchPath()) {
- if (resourcePath.startsWith(path)) {
- return;
- }
- }
- throw new SightlyException("Use plugin cannot access path: " + resource.getPath());
- }
}
Modified: sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/runtime/RenderContextImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/runtime/RenderContextImpl.java?rev=1654212&r1=1654211&r2=1654212&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/runtime/RenderContextImpl.java (original)
+++ sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/runtime/RenderContextImpl.java Fri Jan 23 13:50:56 2015
@@ -91,7 +91,7 @@ public class RenderContextImpl implement
public Object call(String functionName, Object... arguments) {
RuntimeExtension extension = mapping.get(functionName);
if (extension == null) {
- throw new SightlyRenderException("Runtime extension is not available: " + functionName);
+ throw new SightlyException("Runtime extension is not available: " + functionName);
}
return extension.call(this, arguments);
}
@@ -337,7 +337,7 @@ public class RenderContextImpl implement
method = extractMethodInheritanceChain(cls, method);
return method.invoke(obj);
} catch (Exception e) {
- throw new SightlyRenderException(e);
+ throw new SightlyException(e);
}
}
Modified: sling/trunk/contrib/scripting/sightly/engine/src/test/java/org/apache/sling/scripting/sightly/impl/compiler/SightlyJavaCompilerServiceTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/engine/src/test/java/org/apache/sling/scripting/sightly/impl/compiler/SightlyJavaCompilerServiceTest.java?rev=1654212&r1=1654211&r2=1654212&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/sightly/engine/src/test/java/org/apache/sling/scripting/sightly/impl/compiler/SightlyJavaCompilerServiceTest.java (original)
+++ sling/trunk/contrib/scripting/sightly/engine/src/test/java/org/apache/sling/scripting/sightly/impl/compiler/SightlyJavaCompilerServiceTest.java Fri Jan 23 13:50:56 2015
@@ -78,7 +78,6 @@ public class SightlyJavaCompilerServiceT
private void getInstancePojoTest(String pojoPath, String className) throws Exception {
Resource pojoResource = Mockito.mock(Resource.class);
ResourceResolver resolver = Mockito.mock(ResourceResolver.class);
- when(pojoResource.getResourceResolver()).thenReturn(resolver);
when(resolver.getResource(pojoPath)).thenReturn(pojoResource);
JcrJavaCompiler jcrJavaCompiler = Mockito.mock(JcrJavaCompiler.class);
CompilationResult compilationResult = Mockito.mock(CompilationResult.class);
@@ -91,7 +90,7 @@ public class SightlyJavaCompilerServiceT
}
});
Whitebox.setInternalState(compiler, "jcrJavaCompiler", jcrJavaCompiler);
- Object obj = compiler.getInstance(pojoResource, className);
+ Object obj = compiler.getInstance(resolver, null, className);
assertTrue("Expected to obtain a " + MockPojo.class.getName() + " object.", obj instanceof MockPojo);
}
}