|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
/*
|
|
|
|
|
* Copyright 2012-2021 the original author or authors.
|
|
|
|
|
* Copyright 2012-2022 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.
|
|
|
|
@ -20,7 +20,6 @@ import java.io.File;
|
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
|
import java.nio.file.Files;
|
|
|
|
|
import java.util.Properties;
|
|
|
|
|
|
|
|
|
@ -49,13 +48,13 @@ class UpgradeApplicatorTests {
|
|
|
|
|
void whenUpgradeIsAppliedToLibraryWithVersionThenBomIsUpdated() throws IOException {
|
|
|
|
|
File bom = new File(this.temp, "bom.gradle");
|
|
|
|
|
FileCopyUtils.copy(new File("src/test/resources/bom.gradle"), bom);
|
|
|
|
|
String originalContents = new String(Files.readAllBytes(bom.toPath()), StandardCharsets.UTF_8);
|
|
|
|
|
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, null, null),
|
|
|
|
|
DependencyVersion.parse("5.16")));
|
|
|
|
|
String bomContents = new String(Files.readAllBytes(bom.toPath()), StandardCharsets.UTF_8);
|
|
|
|
|
String bomContents = Files.readString(bom.toPath());
|
|
|
|
|
assertThat(bomContents.length()).isEqualTo(originalContents.length() - 3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -63,13 +62,13 @@ class UpgradeApplicatorTests {
|
|
|
|
|
void whenUpgradeIsAppliedToLibraryWithAlignedVersionThenBomIsUpdated() throws IOException {
|
|
|
|
|
File bom = new File(this.temp, "bom.gradle");
|
|
|
|
|
FileCopyUtils.copy(new File("src/test/resources/bom.gradle"), bom);
|
|
|
|
|
String originalContents = new String(Files.readAllBytes(bom.toPath()), StandardCharsets.UTF_8);
|
|
|
|
|
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("OAuth2 OIDC SDK", new LibraryVersion(DependencyVersion.parse("8.36.1"), null),
|
|
|
|
|
null, null, null), DependencyVersion.parse("8.36.2")));
|
|
|
|
|
String bomContents = new String(Files.readAllBytes(bom.toPath()), StandardCharsets.UTF_8);
|
|
|
|
|
String bomContents = Files.readString(bom.toPath());
|
|
|
|
|
assertThat(bomContents.length()).isEqualTo(originalContents.length());
|
|
|
|
|
assertThat(bomContents).contains("version(\"8.36.2\")");
|
|
|
|
|
}
|
|
|
|
|