|
@@ -17,7 +17,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import javax.script.Invocable;
|
|
|
+import javax.script.ScriptEngine;
|
|
|
+import javax.script.ScriptEngineManager;
|
|
|
import java.io.File;
|
|
|
+import java.io.FileReader;
|
|
|
import java.lang.reflect.InvocationHandler;
|
|
|
import java.lang.reflect.Method;
|
|
|
import java.lang.reflect.Proxy;
|
|
@@ -88,6 +92,13 @@ public class TestController {
|
|
|
GroovyShell groovyShell = new GroovyShell(binding);
|
|
|
Processor p = proxify(groovyShell.evaluate(new File(ResourceUtils.getURL("classpath:/groovy/fias/address/QueryAddress.groovy").getFile())));
|
|
|
Iterable<Address> yars0 = addrRepo.findAll(p.process());
|
|
|
+
|
|
|
+ ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn");
|
|
|
+ engine.eval(new FileReader(ResourceUtils.getURL("classpath:/js/QueryAddress.js").getFile()));
|
|
|
+ Invocable inv = (Invocable) engine;
|
|
|
+
|
|
|
+ Iterable<Address> yars1 = addrRepo.findAll((Predicate) inv.invokeFunction("process"));
|
|
|
+
|
|
|
return top;
|
|
|
}
|
|
|
|