Fixed the build

This commit is contained in:
Marcin Grzejszczak
2019-05-13 14:17:31 +02:00
parent 1093baaa3d
commit 3ef0721fe6
2 changed files with 25 additions and 4 deletions

View File

@@ -104,7 +104,7 @@ public class VersionsFetcher implements ReleaserPropertiesAware {
}
catch (Exception ex) {
log.error(
"Failed to check the project versions. Will return that the proejct is not GA",
"Failed to check the project versions. Will return that the project is not GA",
ex);
return false;
}

View File

@@ -17,19 +17,36 @@
package org.springframework.cloud.release.internal.versions;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Files;
import org.assertj.core.api.BDDAssertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.cloud.release.internal.ReleaserProperties;
import org.springframework.cloud.release.internal.pom.ProjectPomUpdater;
import org.springframework.cloud.release.internal.pom.ProjectVersion;
import org.springframework.cloud.release.internal.pom.Projects;
import org.springframework.cloud.release.internal.pom.TestUtils;
import org.springframework.util.FileSystemUtils;
class VersionsFetcherTests {
File temporaryFolder;
@BeforeEach
void setup() throws IOException, URISyntaxException {
this.temporaryFolder = Files.createTempDirectory("versions-fetcher").toFile();
this.temporaryFolder.mkdirs();
File projects = new File(this.temporaryFolder, "projects");
projects.mkdirs();
TestUtils.prepareLocalRepo();
FileSystemUtils.copyRecursively(localFile("/projects"), projects);
}
@Test
void should_return_true_when_current_version_is_the_latest_ga()
throws URISyntaxException {
@@ -40,7 +57,7 @@ class VersionsFetcherTests {
ReleaserProperties properties = new ReleaserProperties();
properties.getVersions().setAllVersionsFileUrl(initilizrUri.toString());
properties.getGit().setReleaseTrainBomUrl(
file("/projects/spring-cloud-release/").toURI().toString());
file("/projects/spring-cloud-release/").toURI().toString() + "/");
ProjectPomUpdater updater = new ProjectPomUpdater(properties);
VersionsFetcher versionsFetcher = new VersionsFetcher(properties, updater);
@@ -59,7 +76,7 @@ class VersionsFetcherTests {
ReleaserProperties properties = new ReleaserProperties();
properties.getVersions().setAllVersionsFileUrl(initilizrUri.toString());
properties.getGit().setReleaseTrainBomUrl(
file("/projects/spring-cloud-release/").toURI().toString());
file("/projects/spring-cloud-release/").toURI().toString() + "/");
ProjectPomUpdater updater = new ProjectPomUpdater(properties);
VersionsFetcher versionsFetcher = new VersionsFetcher(properties, updater);
@@ -119,8 +136,12 @@ class VersionsFetcherTests {
BDDAssertions.then(latestGa).isFalse();
}
private File file(String relativePath) throws URISyntaxException {
private File localFile(String relativePath) throws URISyntaxException {
return new File(VersionsFetcherTests.class.getResource(relativePath).toURI());
}
private File file(String relativePath) {
return new File(this.temporaryFolder, relativePath);
}
}