Skip to content

Commit a9505a5

Browse files
committed
Improve diagnostics
1 parent b445a35 commit a9505a5

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

java-components/build-request-processor/src/main/java/com/redhat/hacbs/container/deploy/mavenrepository/MavenRepositoryDeployer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
122122
throw new RuntimeException(e);
123123
}
124124
} else {
125-
if (files.stream().anyMatch(p -> !p.toFile().isDirectory())) {
126-
Log.warnf("For directory %s, no pom file found with files %s", dir,
127-
files);
125+
var filtered = files.stream().filter(f -> !f.toFile().isDirectory()).toList();
126+
if (!filtered.isEmpty()) {
127+
Log.warnf("For directory %s, no pom file found with files %s", dir, filtered);
128128
}
129129
}
130130

java-components/build-request-processor/src/test/java/com/redhat/hacbs/container/deploy/MavenDeployTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ public void testDeploy() throws IOException {
6969

7070
deployCommand.run();
7171
List<LogRecord> logRecords = LogCollectingTestResource.current().getRecords();
72+
73+
assertTrue(logRecords.stream().anyMatch(r -> LogCollectingTestResource.format(r).contains("no pom file found with files")));
7274
assertTrue(logRecords.stream().anyMatch(r -> LogCollectingTestResource.format(r)
7375
.contains("Deploying [com.company.foo:foo-baz:pom:3.25.8]")));
7476
assertTrue(logRecords.stream().anyMatch(r -> LogCollectingTestResource.format(r)
@@ -86,6 +88,8 @@ private Path createDeploymentRepo()
8688
Path artifacts = Paths.get(testData.toString(), "artifacts").toAbsolutePath();
8789
Files.createDirectories(artifacts);
8890

91+
Files.createFile(Paths.get(artifacts.toString(), "test-file.txt"));
92+
8993
// Add data to artifacts folder
9094
for (Map.Entry<String, Set<String>> artifactFiles : ARTIFACT_FILE_MAP.entrySet()) {
9195
String groupPath = GROUP.replace(DOT, File.separator);

0 commit comments

Comments
 (0)