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.
@@ -38,7 +38,7 @@ import org.springframework.util.StringUtils;
* reactor-core (if present). It can then share the reactor dependency with other class * reactor-core (if present). It can then share the reactor dependency with other class
* loaders that the app itself creates, without any other classes being shared, other than * loaders that the app itself creates, without any other classes being shared, other than
* the core JDK. * the core JDK.
* *
* @author Mark Fisher * @author Mark Fisher
* @author Dave Syer * @author Dave Syer
*/ */
@@ -51,7 +51,7 @@ public class ApplicationBootstrap {
/** /**
* Run the provided main class as a Spring Boot application with the provided command * Run the provided main class as a Spring Boot application with the provided command
* line arguments. * line arguments.
* *
* @param mainClass the main class * @param mainClass the main class
* @param args the command line arguments * @param args the command line arguments
*/ */
@@ -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.
@@ -40,7 +40,7 @@ import org.springframework.util.ClassUtils;
* Initialize an instance of this class with the class loader to be used and the name of * Initialize an instance of this class with the class loader to be used and the name of
* the main class (usually a <code>@SpringBootApplication</code>), and then * the main class (usually a <code>@SpringBootApplication</code>), and then
* {@link #run(String...)} it, cleaning up with a call to {@link #close()}. * {@link #run(String...)} it, cleaning up with a call to {@link #close()}.
* *
* @author Dave Syer * @author Dave Syer
*/ */
public class ApplicationRunner { public class ApplicationRunner {
@@ -148,7 +148,7 @@ public class ApplicationRunner {
/** /**
* List the bean names in the application context for a given type (by its fully qualified name). * List the bean names in the application context for a given type (by its fully qualified name).
* *
* @param type the name of the type (Class) * @param type the name of the type (Class)
* @return the bean names of that type * @return the bean names of that type
*/ */

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,