GH-251 Fixed JDK 11 issues

- Added JDK 11 hook in FunctionCreatorConfiguration for javax.annotation to be loaded from current CL
- Ensured the file: protocol resources end with the forward slash. See UrlClassPath.getLoader of JDK 11 for more details as to why
- Re-enabled conditional  tests by removing Java 8 assumptions
- Part of the issue was also, the invoker plugin which was only generating ‘it/..’ directory every other time due to exists condition, thus resulting in some test failures every other time (missing directory)

Resolves #251
This commit is contained in:
Oleg Zhurakousky
2019-01-23 20:03:22 +01:00
parent 741341f43a
commit a2df13d1b3
5 changed files with 11 additions and 19 deletions

View File

@@ -17,8 +17,7 @@
<properties> <properties>
<wrapper.version>1.0.10.RELEASE</wrapper.version> <wrapper.version>1.0.10.RELEASE</wrapper.version>
<spring.cloud.deployer.version>1.3.2.RELEASE</spring.cloud.deployer.version> <spring.cloud.deployer.version>2.0.0.RELEASE</spring.cloud.deployer.version>
<skip.invoke>true</skip.invoke>
</properties> </properties>
<dependencies> <dependencies>
@@ -81,7 +80,6 @@
<version>3.0.1</version> <version>3.0.1</version>
<configuration> <configuration>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath> <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
<skipInvocation>${skip.invoke}</skipInvocation>
</configuration> </configuration>
<executions> <executions>
<execution> <execution>

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2017 the original author or authors. * Copyright 2017-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -141,6 +141,7 @@ public class ApplicationBootstrap {
return new URLClassLoader(child.toArray(new URL[0]), base); return new URLClassLoader(child.toArray(new URL[0]), base);
} }
private URL[] findClassPath(Class<?> mainClass) { private URL[] findClassPath(Class<?> mainClass) {
ClassLoader base = mainClass.getClassLoader(); ClassLoader base = mainClass.getClassLoader();
if (!(base instanceof URLClassLoader)) { if (!(base instanceof URLClassLoader)) {
@@ -152,10 +153,7 @@ public class ApplicationBootstrap {
result.add(mainClass.getProtectionDomain().getCodeSource().getLocation()); result.add(mainClass.getProtectionDomain().getCodeSource().getLocation());
for (URL url : list) { for (URL url : list) {
String path = url.toString(); String path = url.toString();
path = path.substring(0, path.length() - "/META-INF".length()); path = path.substring(0, path.length() - "/META-INF".length()) + "/";
if (path.endsWith("!")) {
path = path + "/";
}
result.add(new URL(path)); result.add(new URL(path));
} }
return result.toArray(new URL[result.size()]); return result.toArray(new URL[result.size()]);

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2017 the original author or authors. * Copyright 2017-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2017 the original author or authors. * Copyright 2017-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2017 the original author or authors. * Copyright 2017-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -21,13 +21,11 @@ import java.lang.reflect.InvocationTargetException;
import java.util.function.Function; import java.util.function.Function;
import org.junit.After; import org.junit.After;
import org.junit.Assume;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.springframework.boot.SpringBootConfiguration; import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.system.JavaVersion;
import org.springframework.cloud.function.context.FunctionCatalog; import org.springframework.cloud.function.context.FunctionCatalog;
import org.springframework.cloud.function.context.catalog.FunctionInspector; import org.springframework.cloud.function.context.catalog.FunctionInspector;
@@ -46,8 +44,6 @@ public class SpringFunctionFluxConfigurationTests {
@Before @Before
public void run() { public void run() {
Assume.assumeTrue("Java > 8",
JavaVersion.getJavaVersion().isOlderThan(JavaVersion.NINE));
if (bootstrap == null) { if (bootstrap == null) {
bootstrap = new ApplicationBootstrap(); bootstrap = new ApplicationBootstrap();
bootstrap.run(SpringFunctionFluxConfigurationTests.class, bootstrap.run(SpringFunctionFluxConfigurationTests.class,