Skip to content

Jdk 17, boot 2.7.1, spring-shell 2.1.0-RC1, rewrite 7.26.0 #217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/mvn-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '11'
java-version: '17'
distribution: 'adopt'
cache: 'maven'
- name: Build with Maven
Expand Down
28 changes: 0 additions & 28 deletions applications/rest-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,28 +64,6 @@
<artifactId>sbm-support-weblogic</artifactId>
<version>0.11.2-SNAPSHOT</version>
</dependency>

<!-- Override Jackson coming from spring boot -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-databind.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.sbm</groupId>
<artifactId>openrewrite-spring-recipes</artifactId>
Expand All @@ -94,12 +72,6 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions> <!-- This is what you need to add -->
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
32 changes: 0 additions & 32 deletions applications/spring-shell/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@
<dependency>
<groupId>org.springframework.shell</groupId>
<artifactId>spring-shell-starter</artifactId>
<exclusions>
<exclusion>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down Expand Up @@ -109,32 +103,6 @@
</exclusions>
</dependency>

<!-- Override Jackson coming from spring boot -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-databind.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.sbm</groupId>
<artifactId>openrewrite-spring-recipes</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

/*
* Copyright 2021 - 2022 the original author or authors.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
import org.springframework.sbm.project.resource.ResourceHelper;
import org.springframework.sbm.shell.ApplyShellCommand;
import org.springframework.sbm.shell.ScanShellCommand;
import org.springframework.shell.jline.InteractiveShellApplicationRunner;
import org.springframework.shell.jline.ScriptShellApplicationRunner;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.util.SocketUtils;
import org.testcontainers.containers.GenericContainer;
Expand All @@ -61,6 +59,7 @@

import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;

/**
* Base class to be extended by integrationTests.
Expand All @@ -74,8 +73,11 @@
* See also: {@link #intializeTestProject()}, {@link #writeFile} and
* {@link #writeJavaFile(String)}
*/
@SpringBootTest(properties = {InteractiveShellApplicationRunner.SPRING_SHELL_INTERACTIVE_ENABLED + "=false",
ScriptShellApplicationRunner.SPRING_SHELL_SCRIPT_ENABLED + "=false", "sbm.gitSupportEnabled=false"})
@SpringBootTest(properties = {
"spring.shell.interactive.enabled=false",
"spring.shell.script.enabled=false",
"sbm.gitSupportEnabled=false"
})
@DirtiesContext // paralel runs
public abstract class IntegrationTestBaseClass {

Expand Down Expand Up @@ -216,6 +218,7 @@ protected void scanProject() {
protected void executeMavenGoals(Path executionDir, String... goals) {
Invoker invoker = new DefaultInvoker();
InvocationRequest request = new DefaultInvocationRequest();
request.setErrorHandler(new SystemOutHandler());
request.setInputStream(InputStream.nullInputStream());
File pomXml = executionDir.resolve("pom.xml").toFile();
request.setPomFile(pomXml);
Expand All @@ -226,18 +229,20 @@ protected void executeMavenGoals(Path executionDir, String... goals) {
CommandLineException executionException = invocationResult.getExecutionException();
int exitCode = invocationResult.getExitCode();
if (executionException != null) {
Assert.fail("Maven build 'mvn " + Arrays.asList(goals).stream().collect(Collectors.joining(" "))
Assert.fail("Maven build 'mvn " + g
+ " " + pomXml + " "
+ "' failed with Exception: " + executionException.getMessage());
}
if (exitCode == 1) {
Assert.fail("Maven build 'mvn " + Arrays.asList(goals).stream().collect(Collectors.joining(" "))
if (exitCode != 0) {
Assert.fail("Maven build 'mvn " + g
+ "' failed with exitCode: " + exitCode);
}
} catch (MavenInvocationException e) {
Assert.fail("Maven build 'mvn " + Arrays.asList(goals).stream().collect(Collectors.joining(" "))
Assert.fail("Maven build 'mvn " + g
+ " " + pomXml + " "
+ "' failed with Exception: " + e.getMessage());
e.printStackTrace();
throw new RuntimeException(e);
fail("Maven build 'mvn " + g + "' failed");
}
});
}
Expand Down

This file was deleted.

27 changes: 0 additions & 27 deletions components/openrewrite-spring-recipes/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,32 +71,5 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<!-- Override Jackson coming from spring boot -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-databind.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>${jackson.version}</version>
</dependency>
</dependencies>
</project>
5 changes: 0 additions & 5 deletions components/sbm-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@

<artifactId>sbm-core</artifactId>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.sbm</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class JavaVersionPreconditionCheck extends PreconditionCheck {
@Override
public PreconditionCheckResult verify(Path projectRoot, List<Resource> projectResources) {
String javaVersion = System.getProperty("java.specification.version");
if(! "11".equals(javaVersion)) {
return new PreconditionCheckResult(ResultState.WARN, String.format("Java 11 is required. Check found Java %s.", javaVersion));
if(! ("11".equals(javaVersion) || "17".equals(javaVersion))) {
return new PreconditionCheckResult(ResultState.WARN, String.format("Java 11 or 17 is required. Check found Java %s.", javaVersion));
}
return new PreconditionCheckResult(ResultState.PASSED, String.format("Required Java version (%s) was found.", javaVersion));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ void unsupportedJavaVersionShouldTriggerWarning() {

PreconditionCheckResult checkResult = sut.verify(projectRoot, resources);
assertThat(checkResult.getState()).isEqualTo(PreconditionCheck.ResultState.WARN);
assertThat(checkResult.getMessage()).isEqualTo("Java 11 is required. Check found Java 10.");
assertThat(checkResult.getMessage()).isEqualTo("Java 11 or 17 is required. Check found Java 10.");
}

@Test
void supportedJavaVersionShouldPass() {
void supportedJavaVersionShouldPassWithJava11() {
JavaVersionPreconditionCheck sut = new JavaVersionPreconditionCheck();
Path projectRoot = Path.of("./test-dummy").toAbsolutePath().normalize();
List<Resource> resources = List.of();
Expand All @@ -51,4 +51,17 @@ void supportedJavaVersionShouldPass() {
assertThat(checkResult.getMessage()).isEqualTo("Required Java version (11) was found.");
}

@Test
void supportedJavaVersionShouldPassWithJava17() {
JavaVersionPreconditionCheck sut = new JavaVersionPreconditionCheck();
Path projectRoot = Path.of("./test-dummy").toAbsolutePath().normalize();
List<Resource> resources = List.of();

System.setProperty("java.specification.version", "17");

PreconditionCheckResult checkResult = sut.verify(projectRoot, resources);
assertThat(checkResult.getState()).isEqualTo(PreconditionCheck.ResultState.PASSED);
assertThat(checkResult.getMessage()).isEqualTo("Required Java version (17) was found.");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void allChecksFailed() {
assertThat(preconditionVerificationResult.getResults().get(2).getState()).isEqualTo(PreconditionCheck.ResultState.FAILED);
assertThat(preconditionVerificationResult.getResults().get(2).getMessage()).isEqualTo("PreconditionCheck check could not find a 'src/main/java' dir. This dir is required.");
assertThat(preconditionVerificationResult.getResults().get(3).getState()).isEqualTo(PreconditionCheck.ResultState.WARN);
assertThat(preconditionVerificationResult.getResults().get(3).getMessage()).isEqualTo("Java 11 is required. Check found Java 9.");
assertThat(preconditionVerificationResult.getResults().get(3).getMessage()).isEqualTo("Java 11 or 17 is required. Check found Java 9.");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ void testRemoveAnnotation() {
}

@Test
@Disabled("FIXME: https://github.com/spring-projects-experimental/spring-boot-migrator/issues/200")
void removeMethodAnnotationsFromDependency() {
String given =
"import javax.ejb.*;\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void test() {
" <modelVersion>4.0.0</modelVersion>\n" +
" <name>project-name</name>" +
" <properties>\n" +
" <maven.compiler.source>11</maven.compiler.source>\n" +
" <maven.compiler.source>17</maven.compiler.source>\n" +
" <maven.compiler.target>11</maven.compiler.target>\n" +
" </properties>\n" +
"\n" +
Expand All @@ -70,7 +70,10 @@ void test() {
assertThat(javaProvenanceMarkers).hasSize(3);

Marker javaVersionMarker = extractMarker(javaProvenanceMarkers, JavaVersion.class);
ResourceVerifierTestHelper.javaVersionMarker(11, "11", "11").assertMarker(maven, javaVersionMarker);

String property = System.getProperty("java.version");
int javaVersion = Integer.valueOf(property.contains(".") ? property.substring(0, property.indexOf(".")) : property);
ResourceVerifierTestHelper.javaVersionMarker(javaVersion, "17", "11").assertMarker(maven, javaVersionMarker);

Marker buildToolMarker = extractMarker(javaProvenanceMarkers, BuildTool.class);
ResourceVerifierTestHelper.buildToolMarker("Maven", "3.6").assertMarker(maven, buildToolMarker);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package org.springframework.sbm.project.parser;

import org.jboss.shrinkwrap.resolver.api.maven.Maven;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
Expand Down
2 changes: 1 addition & 1 deletion components/sbm-core/testcode/path-scanner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<packaging>pom</packaging>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>

Expand Down
6 changes: 0 additions & 6 deletions components/sbm-openrewrite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,6 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.tngtech.archunit</groupId>
<artifactId>archunit</artifactId>
<version>0.21.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
*/
package org.springframework.sbm.java;

import org.jboss.shrinkwrap.resolver.api.maven.Maven;
import org.springframework.sbm.java.util.JavaSourceUtil;
import org.springframework.sbm.testhelper.common.utils.TestDiff;
import org.assertj.core.api.Assertions;
import org.jboss.shrinkwrap.resolver.api.maven.Maven;
import org.openrewrite.ExecutionContext;
import org.openrewrite.Recipe;
import org.openrewrite.Result;
Expand Down
Loading