Merge branch '2.7.x' into 3.0.x
Closes gh-37223
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright 2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.build.bom.bomr;
|
||||
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.build.bom.bomr.ReleaseSchedule.Release;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.client.MockRestServiceServer;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
|
||||
import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
|
||||
|
||||
/**
|
||||
* Tests for {@link ReleaseSchedule}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public class ReleaseScheduleTests {
|
||||
|
||||
private final RestTemplate rest = new RestTemplate();
|
||||
|
||||
private final ReleaseSchedule releaseSchedule = new ReleaseSchedule(this.rest);
|
||||
|
||||
private final MockRestServiceServer server = MockRestServiceServer.bindTo(this.rest).build();
|
||||
|
||||
@Test
|
||||
void releasesBetween() {
|
||||
this.server
|
||||
.expect(requestTo("https://calendar.spring.io/releases?start=2023-09-01T00:00Z&end=2023-09-21T23:59Z"))
|
||||
.andRespond(withSuccess(new ClassPathResource("releases.json"), MediaType.APPLICATION_JSON));
|
||||
Map<String, List<Release>> releases = this.releaseSchedule
|
||||
.releasesBetween(OffsetDateTime.parse("2023-09-01T00:00Z"), OffsetDateTime.parse("2023-09-21T23:59Z"));
|
||||
assertThat(releases).hasSize(23);
|
||||
assertThat(releases.get("Spring Framework")).hasSize(3);
|
||||
assertThat(releases.get("Spring Boot")).hasSize(4);
|
||||
assertThat(releases.get("Spring Modulith")).hasSize(1);
|
||||
assertThat(releases.get("spring graphql")).hasSize(3);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -51,9 +51,9 @@ class UpgradeApplicatorTests {
|
||||
String originalContents = Files.readString(bom.toPath());
|
||||
File gradleProperties = new File(this.temp, "gradle.properties");
|
||||
FileCopyUtils.copy(new File("src/test/resources/gradle.properties"), gradleProperties);
|
||||
new UpgradeApplicator(bom.toPath(), gradleProperties.toPath()).apply(new Upgrade(
|
||||
new Library("ActiveMQ", new LibraryVersion(DependencyVersion.parse("5.15.11")), null, null, false),
|
||||
DependencyVersion.parse("5.16")));
|
||||
new UpgradeApplicator(bom.toPath(), gradleProperties.toPath())
|
||||
.apply(new Upgrade(new Library("ActiveMQ", null, new LibraryVersion(DependencyVersion.parse("5.15.11")),
|
||||
null, null, false), DependencyVersion.parse("5.16")));
|
||||
String bomContents = Files.readString(bom.toPath());
|
||||
assertThat(bomContents).hasSize(originalContents.length() - 3);
|
||||
}
|
||||
@@ -65,7 +65,7 @@ class UpgradeApplicatorTests {
|
||||
File gradleProperties = new File(this.temp, "gradle.properties");
|
||||
FileCopyUtils.copy(new File("src/test/resources/gradle.properties"), gradleProperties);
|
||||
new UpgradeApplicator(bom.toPath(), gradleProperties.toPath()).apply(new Upgrade(
|
||||
new Library("Kotlin", new LibraryVersion(DependencyVersion.parse("1.3.70")), null, null, false),
|
||||
new Library("Kotlin", null, new LibraryVersion(DependencyVersion.parse("1.3.70")), null, null, false),
|
||||
DependencyVersion.parse("1.4")));
|
||||
Properties properties = new Properties();
|
||||
try (InputStream in = new FileInputStream(gradleProperties)) {
|
||||
|
||||
@@ -62,6 +62,71 @@ class ArtifactVersionDependencyVersionTests {
|
||||
assertThat(version("1.10.2").isSameMinor(version("1.9.1"))).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void isSnapshotForWhenSnapshotForReleaseShouldReturnTrue() {
|
||||
assertThat(version("1.10.2-SNAPSHOT").isSnapshotFor(version("1.10.2"))).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void isSnapshotForWhenBuildSnapshotForReleaseShouldReturnTrue() {
|
||||
assertThat(version("1.10.2.BUILD-SNAPSHOT").isSnapshotFor(version("1.10.2.RELEASE"))).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void isSnapshotForWhenSnapshotForReleaseCandidateShouldReturnTrue() {
|
||||
assertThat(version("1.10.2-SNAPSHOT").isSnapshotFor(version("1.10.2-RC2"))).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void isSnapshotForWhenBuildSnapshotForReleaseCandidateShouldReturnTrue() {
|
||||
assertThat(version("1.10.2.BUILD-SNAPSHOT").isSnapshotFor(version("1.10.2.RC2"))).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void isSnapshotForWhenSnapshotForMilestoneShouldReturnTrue() {
|
||||
assertThat(version("1.10.2-SNAPSHOT").isSnapshotFor(version("1.10.2-M1"))).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void isSnapshotForWhenBuildSnapshotForMilestoneShouldReturnTrue() {
|
||||
assertThat(version("1.10.2.BUILD-SNAPSHOT").isSnapshotFor(version("1.10.2.M1"))).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void isSnapshotForWhenSnapshotForDifferentReleaseShouldReturnFalse() {
|
||||
assertThat(version("1.10.1-SNAPSHOT").isSnapshotFor(version("1.10.2"))).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void isSnapshotForWhenBuildSnapshotForDifferentReleaseShouldReturnTrue() {
|
||||
assertThat(version("1.10.1.BUILD-SNAPSHOT").isSnapshotFor(version("1.10.2.RELEASE"))).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void isSnapshotForWhenSnapshotForDifferentReleaseCandidateShouldReturnTrue() {
|
||||
assertThat(version("1.10.1-SNAPSHOT").isSnapshotFor(version("1.10.2-RC2"))).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void isSnapshotForWhenBuildSnapshotForDifferentReleaseCandidateShouldReturnTrue() {
|
||||
assertThat(version("1.10.1.BUILD-SNAPSHOT").isSnapshotFor(version("1.10.2.RC2"))).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void isSnapshotForWhenSnapshotForDifferentMilestoneShouldReturnTrue() {
|
||||
assertThat(version("1.10.1-SNAPSHOT").isSnapshotFor(version("1.10.2-M1"))).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void isSnapshotForWhenBuildSnapshotForDifferentMilestoneShouldReturnTrue() {
|
||||
assertThat(version("1.10.1.BUILD-SNAPSHOT").isSnapshotFor(version("1.10.2.M1"))).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void isSnapshotForWhenNotSnapshotShouldReturnFalse() {
|
||||
assertThat(version("1.10.1-M1").isSnapshotFor(version("1.10.1"))).isFalse();
|
||||
}
|
||||
|
||||
private ArtifactVersionDependencyVersion version(String version) {
|
||||
return ArtifactVersionDependencyVersion.parse(version);
|
||||
}
|
||||
|
||||
@@ -67,6 +67,46 @@ class ReleaseTrainDependencyVersionTests {
|
||||
assertThat(version("Kay-SR6").isSameMinor(calendarVersion("2020.0.0"))).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void isSnapshotForWhenSnapshotForServiceReleaseShouldReturnTrue() {
|
||||
assertThat(version("Kay-BUILD-SNAPSHOT").isSnapshotFor(version("Kay-SR2"))).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void isSnapshotForWhenSnapshotForReleaseShouldReturnTrue() {
|
||||
assertThat(version("Kay-BUILD-SNAPSHOT").isSnapshotFor(version("Kay-RELEASE"))).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void isSnapshotForWhenSnapshotForReleaseCandidateShouldReturnTrue() {
|
||||
assertThat(version("Kay-BUILD-SNAPSHOT").isSnapshotFor(version("Kay-RC1"))).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void isSnapshotForWhenSnapshotForMilestoneShouldReturnTrue() {
|
||||
assertThat(version("Kay-BUILD-SNAPSHOT").isSnapshotFor(version("Kay-M2"))).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void isSnapshotForWhenSnapshotForDifferentReleaseShouldReturnFalse() {
|
||||
assertThat(version("Kay-BUILD-SNAPSHOT").isSnapshotFor(version("Lovelace-RELEASE"))).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void isSnapshotForWhenSnapshotForDifferentReleaseCandidateShouldReturnTrue() {
|
||||
assertThat(version("Kay-BUILD-SNAPSHOT").isSnapshotFor(version("Lovelace-RC2"))).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void isSnapshotForWhenSnapshotForDifferentMilestoneShouldReturnTrue() {
|
||||
assertThat(version("Kay-BUILD-SNAPSHOT").isSnapshotFor(version("Lovelace-M1"))).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void isSnapshotForWhenNotSnapshotShouldReturnFalse() {
|
||||
assertThat(version("Kay-M1").isSnapshotFor(version("Kay-RELEASE"))).isFalse();
|
||||
}
|
||||
|
||||
private static ReleaseTrainDependencyVersion version(String input) {
|
||||
return ReleaseTrainDependencyVersion.parse(input);
|
||||
}
|
||||
|
||||
272
buildSrc/src/test/resources/releases.json
Normal file
272
buildSrc/src/test/resources/releases.json
Normal file
@@ -0,0 +1,272 @@
|
||||
[
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-22",
|
||||
"title": "Spring Modulith 1.0.1",
|
||||
"url": "https://github.com/spring-projects/spring-modulith/milestone/15"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-22",
|
||||
"title": "Spring Modulith 1.1 M1",
|
||||
"url": "https://github.com/spring-projects/spring-modulith/milestone/16"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-12",
|
||||
"title": "Reactor 2020.0.36",
|
||||
"url": "https://github.com/reactor/reactor/milestone/51"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-12",
|
||||
"title": "Reactor 2022.0.11",
|
||||
"url": "https://github.com/reactor/reactor/milestone/52"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-12",
|
||||
"title": "Reactor 2023.0.0-M3",
|
||||
"url": "https://github.com/reactor/reactor/milestone/53"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-12",
|
||||
"title": "Reactor Core 3.4.33",
|
||||
"url": "https://github.com/reactor/reactor-core/milestone/158"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-12",
|
||||
"title": "Reactor Core 3.5.10",
|
||||
"url": "https://github.com/reactor/reactor-core/milestone/159"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-12",
|
||||
"title": "Reactor Core 3.6.0-M3",
|
||||
"url": "https://github.com/reactor/reactor-core/milestone/160"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-13",
|
||||
"title": "Sts4 4.20.0.RELEASE",
|
||||
"url": "https://github.com/spring-projects/sts4/milestone/66"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-20",
|
||||
"title": "Spring Batch 5.1.0-M3",
|
||||
"url": "https://github.com/spring-projects/spring-batch/milestone/150"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-19",
|
||||
"title": "Spring Integration 6.2.0-M3",
|
||||
"url": "https://github.com/spring-projects/spring-integration/milestone/306"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-19",
|
||||
"title": "Spring Integration 5.5.19",
|
||||
"url": "https://github.com/spring-projects/spring-integration/milestone/309"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-19",
|
||||
"title": "Spring Integration 6.1.3",
|
||||
"url": "https://github.com/spring-projects/spring-integration/milestone/310"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-15",
|
||||
"title": "Spring Data Release 2023.1.0-M3",
|
||||
"url": "https://github.com/spring-projects/spring-data-release/milestone/30"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-15",
|
||||
"title": "Spring Data Release 2021.2.16",
|
||||
"url": "https://github.com/spring-projects/spring-data-release/milestone/39"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-15",
|
||||
"title": "Spring Data Release 2022.0.10",
|
||||
"url": "https://github.com/spring-projects/spring-data-release/milestone/40"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-15",
|
||||
"title": "Spring Data Release 2023.0.4",
|
||||
"url": "https://github.com/spring-projects/spring-data-release/milestone/41"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-19",
|
||||
"title": "Spring Graphql 1.0.5",
|
||||
"url": "https://github.com/spring-projects/spring-graphql/milestone/27"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-19",
|
||||
"title": "Spring Graphql 1.1.6",
|
||||
"url": "https://github.com/spring-projects/spring-graphql/milestone/33"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-19",
|
||||
"title": "Spring Graphql 1.2.3",
|
||||
"url": "https://github.com/spring-projects/spring-graphql/milestone/34"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-19",
|
||||
"title": "Spring Authorization Server 1.2.0-M1",
|
||||
"url": "https://github.com/spring-projects/spring-authorization-server/milestone/34"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-18",
|
||||
"title": "Spring Kafka 3.1.0-M1",
|
||||
"url": "https://github.com/spring-projects/spring-kafka/milestone/225"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-14",
|
||||
"title": "Spring Cloud Dataflow 2.11.0",
|
||||
"url": "https://github.com/spring-cloud/spring-cloud-dataflow/milestone/159"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-11",
|
||||
"title": "Micrometer 1.9.15",
|
||||
"url": "https://github.com/micrometer-metrics/micrometer/milestone/217"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-11",
|
||||
"title": "Micrometer 1.10.11",
|
||||
"url": "https://github.com/micrometer-metrics/micrometer/milestone/218"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-11",
|
||||
"title": "Micrometer 1.11.4",
|
||||
"url": "https://github.com/micrometer-metrics/micrometer/milestone/219"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-11",
|
||||
"title": "Micrometer 1.12.0-M3",
|
||||
"url": "https://github.com/micrometer-metrics/micrometer/milestone/220"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-11",
|
||||
"title": "Tracing 1.0.10",
|
||||
"url": "https://github.com/micrometer-metrics/tracing/milestone/33"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-11",
|
||||
"title": "Tracing 1.1.5",
|
||||
"url": "https://github.com/micrometer-metrics/tracing/milestone/34"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-26",
|
||||
"title": "Spring Cloud Release 2023.0.0-M2",
|
||||
"url": "https://github.com/spring-cloud/spring-cloud-release/milestone/134"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-11",
|
||||
"title": "Context Propagation 1.0.6",
|
||||
"url": "https://github.com/micrometer-metrics/context-propagation/milestone/19"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-14",
|
||||
"title": "Spring Ldap 3.2.0-M3",
|
||||
"url": "https://github.com/spring-projects/spring-ldap/milestone/63"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-21",
|
||||
"title": "Spring Boot 3.2.0-M3",
|
||||
"url": "https://github.com/spring-projects/spring-boot/milestone/306"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-21",
|
||||
"title": "Spring Boot 2.7.16",
|
||||
"url": "https://github.com/spring-projects/spring-boot/milestone/315"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-21",
|
||||
"title": "Spring Boot 3.0.11",
|
||||
"url": "https://github.com/spring-projects/spring-boot/milestone/316"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-21",
|
||||
"title": "Spring Boot 3.1.4",
|
||||
"url": "https://github.com/spring-projects/spring-boot/milestone/317"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-14",
|
||||
"title": "Spring Cloud Deployer 2.9.0",
|
||||
"url": "https://github.com/spring-cloud/spring-cloud-deployer/milestone/116"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-12",
|
||||
"title": "Reactor Kafka 1.3.21",
|
||||
"url": "https://github.com/reactor/reactor-kafka/milestone/38"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-18",
|
||||
"title": "Spring Security 6.2.0-M3",
|
||||
"url": "https://github.com/spring-projects/spring-security/milestone/308"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-22",
|
||||
"title": "Stream Applications 4.0.0",
|
||||
"url": "https://github.com/spring-cloud/stream-applications/milestone/7"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-12",
|
||||
"title": "Reactor Netty 1.1.11",
|
||||
"url": "https://github.com/reactor/reactor-netty/milestone/153"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-12",
|
||||
"title": "Reactor Netty 1.0.36",
|
||||
"url": "https://github.com/reactor/reactor-netty/milestone/154"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-14",
|
||||
"title": "Spring Framework 6.0.12",
|
||||
"url": "https://github.com/spring-projects/spring-framework/milestone/331"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-14",
|
||||
"title": "Spring Framework 5.3.30",
|
||||
"url": "https://github.com/spring-projects/spring-framework/milestone/332"
|
||||
},
|
||||
{
|
||||
"allDay": true,
|
||||
"start": "2023-09-14",
|
||||
"title": "Spring Framework 6.1.0-RC1",
|
||||
"url": "https://github.com/spring-projects/spring-framework/milestone/333"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user