This commit is contained in:
Ahmed El Sayed (Mamoun) 2020-07-30 17:18:41 -07:00
Родитель 09ffbaf74e
Коммит 903da5b60d
2 изменённых файлов: 1 добавлений и 28 удалений

Просмотреть файл

@ -89,33 +89,7 @@ public class JavaFunctionBroker {
private void addSearchPathsToClassLoader(FunctionMethodDescriptor function) throws IOException {
URL jarUrl = new File(function.getJarPath()).toURI().toURL();
classLoaderProvider.addUrl(jarUrl);
if(function.getLibDirectory().isPresent()) {
registerWithClassLoaderProvider(function.getLibDirectory().get());
} else {
registerWithClassLoaderProviderWorkerLibOnly();
}
}
void registerWithClassLoaderProviderWorkerLibOnly() {
try {
if(SystemUtils.IS_JAVA_1_8 && !isTesting()) {
String workerLibPath = System.getenv(Constants.FUNCTIONS_WORKER_DIRECTORY) + "/lib";
File workerLib = new File(workerLibPath);
verifyLibrariesExist (workerLib, workerLibPath);
classLoaderProvider.addDirectory(workerLib);
}
} catch (Exception ex) {
ExceptionUtils.rethrow(ex);
}
}
private boolean isTesting(){
if(System.getProperty("azure.functions.worker.java.skip.testing") != null
&& System.getProperty("azure.functions.worker.java.skip.testing").equals("true")) {
return true;
} else {
return false;
}
function.getLibDirectory().ifPresent(d -> registerWithClassLoaderProvider(d));
}
void registerWithClassLoaderProvider(File libDirectory) {

Просмотреть файл

@ -28,7 +28,6 @@ public class SimpleParamReturnTest extends FunctionsTestBase {
@Test
public void testStringData() throws Exception {
stringReturnValue = stringInput;
System.setProperty("azure.functions.worker.java.skip.testing", "true");
try (FunctionsTestHost host = new FunctionsTestHost()) {
this.loadFunction(host, "returnStringTestId", "ReturnStringFunction");
InvocationResponse stringResponse = host.call("getret", "returnStringTestId");