Skip to content

Commit bff7dbe

Browse files
committed
Improve diagnostics
1 parent b445a35 commit bff7dbe

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import java.util.List;
1313
import java.util.regex.Matcher;
1414
import java.util.regex.Pattern;
15+
import java.util.stream.Collectors;
1516

1617
import org.eclipse.aether.RepositorySystem;
1718
import org.eclipse.aether.RepositorySystemSession;
@@ -122,9 +123,9 @@ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
122123
throw new RuntimeException(e);
123124
}
124125
} 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);
126+
var filtered = files.stream().filter(f -> !f.toFile().isDirectory()).toList();
127+
if (!filtered.isEmpty()) {
128+
Log.warnf("For directory %s, no pom file found with files %s", dir, filtered);
128129
}
129130
}
130131

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)