Skip to content

Commit

Permalink
Remove BOM_SKIP_ARTIFACT_IDS (#2338)
Browse files Browse the repository at this point in the history
* Remove BOM_SKIP_ARTIFACT_IDS

* fixing assertions

* Using jdk1.8.0_211 in kokoro-windows

* do not care new line characters
  • Loading branch information
suztomo authored May 15, 2023
1 parent 5889ccc commit d9c56b0
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,8 @@ public void testGlobalUpperBoundUpgradeMessage() throws IOException, ParsingExce
String bomUpgradeMessage = globalUpperBoundBomUpgradeNodes.get(0).getValue();
assertThat(bomUpgradeMessage)
.contains(
"Upgrade com.google.protobuf:protobuf-java-util:jar:3.6.1 in the BOM to version \"3.7.1\"");
"Upgrade com.google.protobuf:protobuf-java-util:jar:3.6.1 in the BOM to version"
+ " \"3.7.1\"");

// Case 2: Dependency needs to be updated
Nodes globalUpperBoundDependencyUpgradeNodes =
Expand Down Expand Up @@ -469,7 +470,7 @@ public void testDependencyTrees() throws IOException, ParsingException {
Nodes dependencyTreeParagraph = document.query("//p[@class='dependency-tree-node']");

// characterization test
assertThat(dependencyTreeParagraph).hasSize(38391);
assertThat(dependencyTreeParagraph).hasSize(39649);
Assert.assertEquals(
"com.google.protobuf:protobuf-java:jar:3.6.1", dependencyTreeParagraph.get(0).getValue());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
Expand All @@ -38,9 +37,6 @@
import org.eclipse.aether.resolution.ArtifactDescriptorResult;

public final class Bom {

private static final ImmutableSet<String> BOM_SKIP_ARTIFACT_IDS =
ImmutableSet.of("google-cloud-logging-logback", "google-cloud-contrib");

private final ImmutableList<Artifact> artifacts;
private final String coordinates;
Expand Down Expand Up @@ -151,12 +147,7 @@ public static boolean shouldSkipBomMember(Artifact artifact) {
if ("test-jar".equals(type)) {
return true;
}

// TODO remove this hack once we get these out of google-cloud-java's BOM
if (BOM_SKIP_ARTIFACT_IDS.contains(artifact.getArtifactId())) {
return true;
}


return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ public void testBomToPaths_firstElementsAreBomMembers() throws RepositoryExcepti
.isEqualTo("com.google.api:api-common:1.7.0"); // first element in the BOM
int bomSize = managedDependencies.size();
String lastFileName = entries.get(bomSize - 1).toString();
assertThat(lastFileName).isEqualTo("com.google.api:gax-httpjson:0.57.0"); // last element in BOM
assertThat(lastFileName)
.isEqualTo("com.google.code.findbugs:jsr305:3.0.2"); // last element in BOM
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,14 +340,15 @@ public void testWriteExclusionFile_indent()

ExclusionFiles.write(output, linkageErrors);

String actual = new String(Files.readAllBytes(output));
String actual = new String(Files.readAllBytes(output)).replaceAll("\\R", "\n");

String expected =
new String(
Files.readAllBytes(
absolutePathOfResource(
"exclusion-sample-rules/expected-exclusion-output-file.xml")),
StandardCharsets.UTF_8);
Files.readAllBytes(
absolutePathOfResource(
"exclusion-sample-rules/expected-exclusion-output-file.xml")),
StandardCharsets.UTF_8)
.replaceAll("\\R", "\n");

assertEquals(expected, actual);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void testBom_java8()
LinkageCheckerMain.main(new String[] {"-b", "com.google.cloud:libraries-bom:1.0.0"});
fail("LinkageCheckerMain should throw LinkageCheckResultException upon errors");
} catch (LinkageCheckResultException expected) {
assertEquals("Found 631 linkage errors", expected.getMessage());
assertEquals("Found 734 linkage errors", expected.getMessage());
}

String output = readCapturedStdout();
Expand Down Expand Up @@ -172,7 +172,7 @@ public void testBom_java11()
LinkageCheckerMain.main(new String[] {"-b", "com.google.cloud:libraries-bom:1.0.0"});
fail("LinkageCheckerMain should throw LinkageCheckResultException upon errors");
} catch (LinkageCheckResultException expected) {
assertEquals("Found 653 linkage errors", expected.getMessage());
assertEquals("Found 756 linkage errors", expected.getMessage());
}

String output = readCapturedStdout();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void testReadBom_coordinates() throws ArtifactDescriptorException {
List<Artifact> managedDependencies = bom.getManagedDependencies();
// Characterization test. As long as the artifact doesn't change (and it shouldn't)
// the answer won't change.
Assert.assertEquals(134, managedDependencies.size());
Assert.assertEquals(136, managedDependencies.size());
Assert.assertEquals("com.google.cloud:google-cloud-bom:0.61.0-alpha", bom.getCoordinates());
}

Expand Down
2 changes: 1 addition & 1 deletion kokoro/continuous.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@echo on

set JAVA_HOME=c:\program files\java\jdk1.8.0_152
set JAVA_HOME=c:\program files\java\jdk1.8.0_211
set PATH=%JAVA_HOME%\bin;%PATH%
set MAVEN_OPTS="-Xmx12g"

Expand Down

0 comments on commit d9c56b0

Please sign in to comment.