mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Merge branch '2.5.x' into 2.6.x
Closes gh-30779
This commit is contained in:
commit
078104f138
@ -31,6 +31,7 @@ import org.springframework.web.client.RestTemplate;
|
||||
* Central class for interacting with SDKMAN's API.
|
||||
*
|
||||
* @author Madhura Bhave
|
||||
* @author Moritz Halbritter
|
||||
*/
|
||||
@Component
|
||||
public class SdkmanService {
|
||||
@ -42,6 +43,8 @@ public class SdkmanService {
|
||||
private static final String DOWNLOAD_URL = "https://repo.spring.io/simple/libs-release-local/org/springframework/boot/spring-boot-cli/"
|
||||
+ "%s/spring-boot-cli-%s-bin.zip";
|
||||
|
||||
private static final String CHANGELOG_URL = "https://github.com/spring-projects/spring-boot/releases/tag/v%s";
|
||||
|
||||
private static final String SPRING_BOOT = "springboot";
|
||||
|
||||
private final RestTemplate restTemplate;
|
||||
@ -66,7 +69,7 @@ public class SdkmanService {
|
||||
}
|
||||
|
||||
private void broadcast(String version) {
|
||||
BroadcastRequest broadcastRequest = new BroadcastRequest(version);
|
||||
BroadcastRequest broadcastRequest = new BroadcastRequest(version, String.format(CHANGELOG_URL, version));
|
||||
RequestEntity<BroadcastRequest> broadcastEntity = RequestEntity.post(URI.create(SDKMAN_URL + "announce/struct"))
|
||||
.header(CONSUMER_KEY_HEADER, this.properties.getConsumerKey())
|
||||
.header(CONSUMER_TOKEN_HEADER, this.properties.getConsumerToken())
|
||||
@ -135,14 +138,21 @@ public class SdkmanService {
|
||||
|
||||
private final String hashtag = SPRING_BOOT;
|
||||
|
||||
BroadcastRequest(String version) {
|
||||
private final String url;
|
||||
|
||||
BroadcastRequest(String version, String url) {
|
||||
super(version);
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getHashtag() {
|
||||
return this.hashtag;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -44,9 +44,6 @@ class SdkmanServiceTests {
|
||||
@Autowired
|
||||
private SdkmanService service;
|
||||
|
||||
@Autowired
|
||||
private SdkmanProperties properties;
|
||||
|
||||
@Autowired
|
||||
private MockRestServiceServer server;
|
||||
|
||||
@ -56,23 +53,23 @@ class SdkmanServiceTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void publishWhenMakeDefaultTrue() throws Exception {
|
||||
void publishWhenMakeDefaultTrue() {
|
||||
setupExpectation("https://vendors.sdkman.io/release",
|
||||
"{\"candidate\": \"springboot\", \"version\": \"1.2.3\", \"url\": \"https://repo.spring.io/simple/libs-release-local/org/springframework/boot/spring-boot-cli/1.2.3/spring-boot-cli-1.2.3-bin.zip\"}");
|
||||
setupExpectation("https://vendors.sdkman.io/default", "{\"candidate\": \"springboot\", \"version\": \"1.2.3\"}",
|
||||
HttpMethod.PUT);
|
||||
setupExpectation("https://vendors.sdkman.io/announce/struct",
|
||||
"{\"candidate\": \"springboot\", \"version\": \"1.2.3\", \"hashtag\": \"springboot\"}");
|
||||
"{\"candidate\": \"springboot\", \"version\": \"1.2.3\", \"hashtag\": \"springboot\", \"url\": \"https://github.com/spring-projects/spring-boot/releases/tag/v1.2.3\"}");
|
||||
this.service.publish("1.2.3", true);
|
||||
this.server.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
void publishWhenMakeDefaultFalse() throws Exception {
|
||||
void publishWhenMakeDefaultFalse() {
|
||||
setupExpectation("https://vendors.sdkman.io/release",
|
||||
"{\"candidate\": \"springboot\", \"version\": \"1.2.3\", \"url\": \"https://repo.spring.io/simple/libs-release-local/org/springframework/boot/spring-boot-cli/1.2.3/spring-boot-cli-1.2.3-bin.zip\"}");
|
||||
setupExpectation("https://vendors.sdkman.io/announce/struct",
|
||||
"{\"candidate\": \"springboot\", \"version\": \"1.2.3\", \"hashtag\": \"springboot\"}");
|
||||
"{\"candidate\": \"springboot\", \"version\": \"1.2.3\", \"hashtag\": \"springboot\", \"url\": \"https://github.com/spring-projects/spring-boot/releases/tag/v1.2.3\"}");
|
||||
this.service.publish("1.2.3", false);
|
||||
this.server.verify();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user