|
|
@ -76,7 +76,7 @@ class ArtifactoryServiceTests {
|
|
|
|
void promoteWhenSuccessful() {
|
|
|
|
void promoteWhenSuccessful() {
|
|
|
|
this.server
|
|
|
|
this.server
|
|
|
|
.expect(requestTo(
|
|
|
|
.expect(requestTo(
|
|
|
|
"https://repo.spring.io/api/build/promote/" + "example-build" + "/" + "example-build-1"))
|
|
|
|
"https://repo.spring.io/api/build/promote/example-build/example-build-1"))
|
|
|
|
.andExpect(method(HttpMethod.POST))
|
|
|
|
.andExpect(method(HttpMethod.POST))
|
|
|
|
.andExpect(content().json(
|
|
|
|
.andExpect(content().json(
|
|
|
|
"{\"status\": \"staged\", \"sourceRepo\": \"libs-staging-local\", \"targetRepo\": \"libs-milestone-local\"}"))
|
|
|
|
"{\"status\": \"staged\", \"sourceRepo\": \"libs-staging-local\", \"targetRepo\": \"libs-milestone-local\"}"))
|
|
|
@ -91,9 +91,9 @@ class ArtifactoryServiceTests {
|
|
|
|
void promoteWhenArtifactsAlreadyPromoted() {
|
|
|
|
void promoteWhenArtifactsAlreadyPromoted() {
|
|
|
|
this.server
|
|
|
|
this.server
|
|
|
|
.expect(requestTo(
|
|
|
|
.expect(requestTo(
|
|
|
|
"https://repo.spring.io/api/build/promote/" + "example-build" + "/" + "example-build-1"))
|
|
|
|
"https://repo.spring.io/api/build/promote/example-build/example-build-1"))
|
|
|
|
.andRespond(withStatus(HttpStatus.CONFLICT));
|
|
|
|
.andRespond(withStatus(HttpStatus.CONFLICT));
|
|
|
|
this.server.expect(requestTo("https://repo.spring.io/api/build/" + "example-build" + "/" + "example-build-1"))
|
|
|
|
this.server.expect(requestTo("https://repo.spring.io/api/build/example-build/example-build-1"))
|
|
|
|
.andRespond(withJsonFrom("build-info-response.json"));
|
|
|
|
.andRespond(withJsonFrom("build-info-response.json"));
|
|
|
|
this.service.promote("libs-release-local", getReleaseInfo());
|
|
|
|
this.service.promote("libs-release-local", getReleaseInfo());
|
|
|
|
this.server.verify();
|
|
|
|
this.server.verify();
|
|
|
@ -103,9 +103,9 @@ class ArtifactoryServiceTests {
|
|
|
|
void promoteWhenCheckForArtifactsAlreadyPromotedFails() {
|
|
|
|
void promoteWhenCheckForArtifactsAlreadyPromotedFails() {
|
|
|
|
this.server
|
|
|
|
this.server
|
|
|
|
.expect(requestTo(
|
|
|
|
.expect(requestTo(
|
|
|
|
"https://repo.spring.io/api/build/promote/" + "example-build" + "/" + "example-build-1"))
|
|
|
|
"https://repo.spring.io/api/build/promote/example-build/example-build-1"))
|
|
|
|
.andRespond(withStatus(HttpStatus.CONFLICT));
|
|
|
|
.andRespond(withStatus(HttpStatus.CONFLICT));
|
|
|
|
this.server.expect(requestTo("https://repo.spring.io/api/build/" + "example-build" + "/" + "example-build-1"))
|
|
|
|
this.server.expect(requestTo("https://repo.spring.io/api/build/example-build/example-build-1"))
|
|
|
|
.andRespond(withStatus(HttpStatus.FORBIDDEN));
|
|
|
|
.andRespond(withStatus(HttpStatus.FORBIDDEN));
|
|
|
|
assertThatExceptionOfType(HttpClientErrorException.class)
|
|
|
|
assertThatExceptionOfType(HttpClientErrorException.class)
|
|
|
|
.isThrownBy(() -> this.service.promote("libs-release-local", getReleaseInfo()));
|
|
|
|
.isThrownBy(() -> this.service.promote("libs-release-local", getReleaseInfo()));
|
|
|
@ -116,9 +116,9 @@ class ArtifactoryServiceTests {
|
|
|
|
void promoteWhenPromotionFails() {
|
|
|
|
void promoteWhenPromotionFails() {
|
|
|
|
this.server
|
|
|
|
this.server
|
|
|
|
.expect(requestTo(
|
|
|
|
.expect(requestTo(
|
|
|
|
"https://repo.spring.io/api/build/promote/" + "example-build" + "/" + "example-build-1"))
|
|
|
|
"https://repo.spring.io/api/build/promote/example-build/example-build-1"))
|
|
|
|
.andRespond(withStatus(HttpStatus.CONFLICT));
|
|
|
|
.andRespond(withStatus(HttpStatus.CONFLICT));
|
|
|
|
this.server.expect(requestTo("https://repo.spring.io/api/build/" + "example-build" + "/" + "example-build-1"))
|
|
|
|
this.server.expect(requestTo("https://repo.spring.io/api/build/example-build/example-build-1"))
|
|
|
|
.andRespond(withJsonFrom("staged-build-info-response.json"));
|
|
|
|
.andRespond(withJsonFrom("staged-build-info-response.json"));
|
|
|
|
assertThatExceptionOfType(HttpClientErrorException.class)
|
|
|
|
assertThatExceptionOfType(HttpClientErrorException.class)
|
|
|
|
.isThrownBy(() -> this.service.promote("libs-release-local", getReleaseInfo()));
|
|
|
|
.isThrownBy(() -> this.service.promote("libs-release-local", getReleaseInfo()));
|
|
|
@ -131,7 +131,7 @@ class ArtifactoryServiceTests {
|
|
|
|
given(this.bintrayService.isDistributionComplete(releaseInfo)).willReturn(true);
|
|
|
|
given(this.bintrayService.isDistributionComplete(releaseInfo)).willReturn(true);
|
|
|
|
this.server
|
|
|
|
this.server
|
|
|
|
.expect(requestTo(
|
|
|
|
.expect(requestTo(
|
|
|
|
"https://repo.spring.io/api/build/distribute/" + "example-build" + "/" + "example-build-1"))
|
|
|
|
"https://repo.spring.io/api/build/distribute/example-build/example-build-1"))
|
|
|
|
.andExpect(method(HttpMethod.POST))
|
|
|
|
.andExpect(method(HttpMethod.POST))
|
|
|
|
.andExpect(content().json(
|
|
|
|
.andExpect(content().json(
|
|
|
|
"{\"sourceRepos\": [\"libs-release-local\"], \"targetRepo\" : \"spring-distributions\", \"async\":\"true\"}"))
|
|
|
|
"{\"sourceRepos\": [\"libs-release-local\"], \"targetRepo\" : \"spring-distributions\", \"async\":\"true\"}"))
|
|
|
@ -148,7 +148,7 @@ class ArtifactoryServiceTests {
|
|
|
|
ReleaseInfo releaseInfo = getReleaseInfo();
|
|
|
|
ReleaseInfo releaseInfo = getReleaseInfo();
|
|
|
|
this.server
|
|
|
|
this.server
|
|
|
|
.expect(requestTo(
|
|
|
|
.expect(requestTo(
|
|
|
|
"https://repo.spring.io/api/build/distribute/" + "example-build" + "/" + "example-build-1"))
|
|
|
|
"https://repo.spring.io/api/build/distribute/example-build/example-build-1"))
|
|
|
|
.andExpect(method(HttpMethod.POST))
|
|
|
|
.andExpect(method(HttpMethod.POST))
|
|
|
|
.andExpect(content().json(
|
|
|
|
.andExpect(content().json(
|
|
|
|
"{\"sourceRepos\": [\"libs-release-local\"], \"targetRepo\" : \"spring-distributions\", \"async\":\"true\"}"))
|
|
|
|
"{\"sourceRepos\": [\"libs-release-local\"], \"targetRepo\" : \"spring-distributions\", \"async\":\"true\"}"))
|
|
|
@ -168,7 +168,7 @@ class ArtifactoryServiceTests {
|
|
|
|
given(this.bintrayService.isDistributionComplete(releaseInfo)).willReturn(false);
|
|
|
|
given(this.bintrayService.isDistributionComplete(releaseInfo)).willReturn(false);
|
|
|
|
this.server
|
|
|
|
this.server
|
|
|
|
.expect(requestTo(
|
|
|
|
.expect(requestTo(
|
|
|
|
"https://repo.spring.io/api/build/distribute/" + "example-build" + "/" + "example-build-1"))
|
|
|
|
"https://repo.spring.io/api/build/distribute/example-build/example-build-1"))
|
|
|
|
.andExpect(method(HttpMethod.POST))
|
|
|
|
.andExpect(method(HttpMethod.POST))
|
|
|
|
.andExpect(content().json(
|
|
|
|
.andExpect(content().json(
|
|
|
|
"{\"sourceRepos\": [\"libs-release-local\"], \"targetRepo\" : \"spring-distributions\", \"async\":\"true\"}"))
|
|
|
|
"{\"sourceRepos\": [\"libs-release-local\"], \"targetRepo\" : \"spring-distributions\", \"async\":\"true\"}"))
|
|
|
|