mirror of
https://gitee.com/dcren/initializr.git
synced 2026-02-25 21:22:58 +08:00
Polish
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 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.
|
||||
@@ -69,11 +69,12 @@ class DefaultInitializrMetadataUpdateStrategyTests {
|
||||
InitializrMetadata updatedMetadata = provider.update(metadata);
|
||||
assertThat(updatedMetadata.getBootVersions()).isNotNull();
|
||||
List<DefaultMetadataElement> updatedBootVersions = updatedMetadata.getBootVersions().getContent();
|
||||
assertThat(updatedBootVersions).hasSize(4);
|
||||
assertBootVersion(updatedBootVersions.get(0), "1.4.1 (SNAPSHOT)", false);
|
||||
assertBootVersion(updatedBootVersions.get(1), "1.4.0", true);
|
||||
assertBootVersion(updatedBootVersions.get(2), "1.3.8 (SNAPSHOT)", false);
|
||||
assertBootVersion(updatedBootVersions.get(3), "1.3.7", false);
|
||||
assertThat(updatedBootVersions).hasSize(5);
|
||||
assertBootVersion(updatedBootVersions.get(0), "2.5.0-M1", false);
|
||||
assertBootVersion(updatedBootVersions.get(1), "2.4.1 (SNAPSHOT)", false);
|
||||
assertBootVersion(updatedBootVersions.get(2), "2.4.0", true);
|
||||
assertBootVersion(updatedBootVersions.get(3), "2.3.8 (SNAPSHOT)", false);
|
||||
assertBootVersion(updatedBootVersions.get(4), "2.3.7", false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -89,11 +90,12 @@ class DefaultInitializrMetadataUpdateStrategyTests {
|
||||
InitializrMetadata updatedMetadata = provider.update(metadata);
|
||||
assertThat(updatedMetadata.getBootVersions()).isNotNull();
|
||||
List<DefaultMetadataElement> updatedBootVersions = updatedMetadata.getBootVersions().getContent();
|
||||
assertThat(updatedBootVersions).hasSize(4);
|
||||
assertBootVersion(updatedBootVersions.get(0), "1.3.1 (SNAPSHOT)", true);
|
||||
assertBootVersion(updatedBootVersions.get(1), "1.3.0", false);
|
||||
assertBootVersion(updatedBootVersions.get(2), "1.2.6 (SNAPSHOT)", false);
|
||||
assertBootVersion(updatedBootVersions.get(3), "1.2.5", false);
|
||||
assertThat(updatedBootVersions).hasSize(5);
|
||||
assertBootVersion(updatedBootVersions.get(0), "2.5.0-M1", true);
|
||||
assertBootVersion(updatedBootVersions.get(1), "2.4.1 (SNAPSHOT)", false);
|
||||
assertBootVersion(updatedBootVersions.get(2), "2.4.0", false);
|
||||
assertBootVersion(updatedBootVersions.get(3), "2.3.8 (SNAPSHOT)", false);
|
||||
assertBootVersion(updatedBootVersions.get(4), "2.3.7", false);
|
||||
}
|
||||
|
||||
private static void assertBootVersion(DefaultMetadataElement actual, String name, boolean defaultVersion) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 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.
|
||||
@@ -18,7 +18,6 @@ package io.spring.initializr.web.support;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.spring.initializr.metadata.DefaultMetadataElement;
|
||||
@@ -57,19 +56,20 @@ class SpringBootMetadataReaderTests {
|
||||
withSuccess(new ClassPathResource("metadata/sagan/spring-boot.json"), MediaType.APPLICATION_JSON));
|
||||
List<DefaultMetadataElement> versions = new SpringBootMetadataReader(this.objectMapper, this.restTemplate,
|
||||
this.metadata.getConfiguration().getEnv().getSpringBootMetadataUrl()).getBootVersions();
|
||||
assertThat(versions).as("spring boot versions should not be null").isNotNull();
|
||||
AtomicBoolean defaultFound = new AtomicBoolean(false);
|
||||
versions.forEach((it) -> {
|
||||
assertThat(it.getId()).as("Id must be set").isNotNull();
|
||||
assertThat(it.getName()).as("Name must be set").isNotNull();
|
||||
if (it.isDefault()) {
|
||||
if (defaultFound.get()) {
|
||||
throw new AssertionError("One default version was already found " + it.getId());
|
||||
}
|
||||
defaultFound.set(true);
|
||||
}
|
||||
});
|
||||
assertThat(versions).hasSize(5);
|
||||
assertSpringBootVersion(versions.get(0), "2.5.0-M1", "2.5.0-M1", false);
|
||||
assertSpringBootVersion(versions.get(1), "2.4.1-SNAPSHOT", "2.4.1 (SNAPSHOT)", false);
|
||||
assertSpringBootVersion(versions.get(2), "2.4.0", "2.4.0", true);
|
||||
assertSpringBootVersion(versions.get(3), "2.3.8.BUILD-SNAPSHOT", "2.3.8 (SNAPSHOT)", false);
|
||||
assertSpringBootVersion(versions.get(4), "2.3.7.RELEASE", "2.3.7", false);
|
||||
this.server.verify();
|
||||
}
|
||||
|
||||
private void assertSpringBootVersion(DefaultMetadataElement actual, String id, String name,
|
||||
boolean defaultVersion) {
|
||||
assertThat(actual.getId()).isEqualTo(id);
|
||||
assertThat(actual.getName()).isEqualTo(name);
|
||||
assertThat(actual.isDefault()).isEqualTo(defaultVersion);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,8 +8,27 @@
|
||||
"projectReleases": [
|
||||
{
|
||||
"releaseStatus": "SNAPSHOT",
|
||||
"refDocUrl": "https://docs.spring.io/spring-boot/docs/1.3.1.BUILD-SNAPSHOT/reference/htmlsingle/",
|
||||
"apiDocUrl": "https://docs.spring.io/spring-boot/docs/1.3.1.BUILD-SNAPSHOT/api/",
|
||||
"refDocUrl": "https://docs.spring.io/spring-boot/docs/2.5.0-M1/reference/htmlsingle/",
|
||||
"apiDocUrl": "https://docs.spring.io/spring-boot/docs/2.5.0-M1/api/",
|
||||
"groupId": "org.springframework.boot",
|
||||
"artifactId": "spring-boot",
|
||||
"repository": {
|
||||
"id": "spring-milestones",
|
||||
"name": "Spring Milestones",
|
||||
"url": "https://repo.spring.io/libs-milestone",
|
||||
"snapshotsEnabled": false
|
||||
},
|
||||
"preRelease": true,
|
||||
"generalAvailability": false,
|
||||
"versionDisplayName": "2.5.0-M1",
|
||||
"current": false,
|
||||
"snapshot": false,
|
||||
"version": "2.5.0-M1"
|
||||
},
|
||||
{
|
||||
"releaseStatus": "SNAPSHOT",
|
||||
"refDocUrl": "https://docs.spring.io/spring-boot/docs/2.4.1-SNAPSHOT/reference/htmlsingle/",
|
||||
"apiDocUrl": "https://docs.spring.io/spring-boot/docs/2.4.1-SNAPSHOT/api/",
|
||||
"groupId": "org.springframework.boot",
|
||||
"artifactId": "spring-boot",
|
||||
"repository": {
|
||||
@@ -20,29 +39,29 @@
|
||||
},
|
||||
"preRelease": false,
|
||||
"generalAvailability": false,
|
||||
"versionDisplayName": "1.3.1",
|
||||
"versionDisplayName": "2.4.1",
|
||||
"current": false,
|
||||
"snapshot": true,
|
||||
"version": "1.3.1.BUILD-SNAPSHOT"
|
||||
"version": "2.4.1-SNAPSHOT"
|
||||
},
|
||||
{
|
||||
"releaseStatus": "GENERAL_AVAILABILITY",
|
||||
"refDocUrl": "https://docs.spring.io/spring-boot/docs/1.3.0.RELEASE/reference/htmlsingle/",
|
||||
"apiDocUrl": "https://docs.spring.io/spring-boot/docs/1.3.0.RELEASE/api/",
|
||||
"refDocUrl": "https://docs.spring.io/spring-boot/docs/2.4.0/reference/htmlsingle/",
|
||||
"apiDocUrl": "https://docs.spring.io/spring-boot/docs/2.4.0/api/",
|
||||
"groupId": "org.springframework.boot",
|
||||
"artifactId": "spring-boot",
|
||||
"repository": null,
|
||||
"preRelease": false,
|
||||
"generalAvailability": true,
|
||||
"versionDisplayName": "1.3.0",
|
||||
"versionDisplayName": "2.4.0",
|
||||
"current": false,
|
||||
"snapshot": false,
|
||||
"version": "1.3.0.RELEASE"
|
||||
"version": "2.4.0"
|
||||
},
|
||||
{
|
||||
"releaseStatus": "SNAPSHOT",
|
||||
"refDocUrl": "https://docs.spring.io/spring-boot/docs/1.2.6.BUILD-SNAPSHOT/reference/htmlsingle/",
|
||||
"apiDocUrl": "https://docs.spring.io/spring-boot/docs/1.2.6.BUILD-SNAPSHOT/api/",
|
||||
"refDocUrl": "https://docs.spring.io/spring-boot/docs/2.3.8.BUILD-SNAPSHOT/reference/htmlsingle/",
|
||||
"apiDocUrl": "https://docs.spring.io/spring-boot/docs/2.3.8.BUILD-SNAPSHOT/api/",
|
||||
"groupId": "org.springframework.boot",
|
||||
"artifactId": "spring-boot",
|
||||
"repository": {
|
||||
@@ -53,10 +72,10 @@
|
||||
},
|
||||
"preRelease": false,
|
||||
"generalAvailability": false,
|
||||
"versionDisplayName": "1.2.6",
|
||||
"versionDisplayName": "2.3.8",
|
||||
"current": false,
|
||||
"snapshot": true,
|
||||
"version": "1.2.6.BUILD-SNAPSHOT"
|
||||
"version": "2.3.8.BUILD-SNAPSHOT"
|
||||
},
|
||||
{
|
||||
"releaseStatus": "GENERAL_AVAILABILITY",
|
||||
@@ -67,10 +86,10 @@
|
||||
"repository": null,
|
||||
"preRelease": false,
|
||||
"generalAvailability": true,
|
||||
"versionDisplayName": "1.2.5",
|
||||
"versionDisplayName": "2.3.7",
|
||||
"current": false,
|
||||
"snapshot": false,
|
||||
"version": "1.2.5.RELEASE"
|
||||
"version": "2.3.7.RELEASE"
|
||||
}
|
||||
],
|
||||
"aggregator": false,
|
||||
|
||||
@@ -8,8 +8,27 @@
|
||||
"projectReleases": [
|
||||
{
|
||||
"releaseStatus": "SNAPSHOT",
|
||||
"refDocUrl": "https://docs.spring.io/spring-boot/docs/1.4.1.BUILD-SNAPSHOT/reference/htmlsingle/",
|
||||
"apiDocUrl": "https://docs.spring.io/spring-boot/docs/1.4.1.BUILD-SNAPSHOT/api/",
|
||||
"refDocUrl": "https://docs.spring.io/spring-boot/docs/2.5.0-M1/reference/htmlsingle/",
|
||||
"apiDocUrl": "https://docs.spring.io/spring-boot/docs/2.5.0-M1/api/",
|
||||
"groupId": "org.springframework.boot",
|
||||
"artifactId": "spring-boot",
|
||||
"repository": {
|
||||
"id": "spring-milestones",
|
||||
"name": "Spring Milestones",
|
||||
"url": "https://repo.spring.io/libs-milestone",
|
||||
"snapshotsEnabled": false
|
||||
},
|
||||
"preRelease": true,
|
||||
"generalAvailability": false,
|
||||
"versionDisplayName": "2.5.0-M1",
|
||||
"current": false,
|
||||
"snapshot": false,
|
||||
"version": "2.5.0-M1"
|
||||
},
|
||||
{
|
||||
"releaseStatus": "SNAPSHOT",
|
||||
"refDocUrl": "https://docs.spring.io/spring-boot/docs/2.4.1-SNAPSHOT/reference/htmlsingle/",
|
||||
"apiDocUrl": "https://docs.spring.io/spring-boot/docs/2.4.1-SNAPSHOT/api/",
|
||||
"groupId": "org.springframework.boot",
|
||||
"artifactId": "spring-boot",
|
||||
"repository": {
|
||||
@@ -20,29 +39,29 @@
|
||||
},
|
||||
"preRelease": false,
|
||||
"generalAvailability": false,
|
||||
"versionDisplayName": "1.4.1",
|
||||
"versionDisplayName": "2.4.1",
|
||||
"current": false,
|
||||
"snapshot": true,
|
||||
"version": "1.4.1.BUILD-SNAPSHOT"
|
||||
"version": "2.4.1-SNAPSHOT"
|
||||
},
|
||||
{
|
||||
"releaseStatus": "GENERAL_AVAILABILITY",
|
||||
"refDocUrl": "https://docs.spring.io/spring-boot/docs/1.4.0.RELEASE/reference/htmlsingle/",
|
||||
"apiDocUrl": "https://docs.spring.io/spring-boot/docs/1.4.0.RELEASE/api/",
|
||||
"refDocUrl": "https://docs.spring.io/spring-boot/docs/2.4.0/reference/htmlsingle/",
|
||||
"apiDocUrl": "https://docs.spring.io/spring-boot/docs/2.4.0/api/",
|
||||
"groupId": "org.springframework.boot",
|
||||
"artifactId": "spring-boot",
|
||||
"repository": null,
|
||||
"preRelease": false,
|
||||
"generalAvailability": true,
|
||||
"versionDisplayName": "1.4.0",
|
||||
"versionDisplayName": "2.4.0",
|
||||
"current": true,
|
||||
"snapshot": false,
|
||||
"version": "1.4.0.RELEASE"
|
||||
"version": "2.4.0"
|
||||
},
|
||||
{
|
||||
"releaseStatus": "SNAPSHOT",
|
||||
"refDocUrl": "https://docs.spring.io/spring-boot/docs/1.3.8.BUILD-SNAPSHOT/reference/htmlsingle/",
|
||||
"apiDocUrl": "https://docs.spring.io/spring-boot/docs/1.3.8.BUILD-SNAPSHOT/api/",
|
||||
"refDocUrl": "https://docs.spring.io/spring-boot/docs/2.3.8.BUILD-SNAPSHOT/reference/htmlsingle/",
|
||||
"apiDocUrl": "https://docs.spring.io/spring-boot/docs/2.3.8.BUILD-SNAPSHOT/api/",
|
||||
"groupId": "org.springframework.boot",
|
||||
"artifactId": "spring-boot",
|
||||
"repository": {
|
||||
@@ -53,10 +72,10 @@
|
||||
},
|
||||
"preRelease": false,
|
||||
"generalAvailability": false,
|
||||
"versionDisplayName": "1.3.8",
|
||||
"versionDisplayName": "2.3.8",
|
||||
"current": false,
|
||||
"snapshot": true,
|
||||
"version": "1.3.8.BUILD-SNAPSHOT"
|
||||
"version": "2.3.8.BUILD-SNAPSHOT"
|
||||
},
|
||||
{
|
||||
"releaseStatus": "GENERAL_AVAILABILITY",
|
||||
@@ -67,10 +86,10 @@
|
||||
"repository": null,
|
||||
"preRelease": false,
|
||||
"generalAvailability": true,
|
||||
"versionDisplayName": "1.3.7",
|
||||
"versionDisplayName": "2.3.7",
|
||||
"current": false,
|
||||
"snapshot": false,
|
||||
"version": "1.3.7.RELEASE"
|
||||
"version": "2.3.7.RELEASE"
|
||||
}
|
||||
],
|
||||
"aggregator": false,
|
||||
|
||||
Reference in New Issue
Block a user