8347295: Fix WinResourceTest to make it work with WiX v4.0+

Reviewed-by: almatvee
This commit is contained in:
Alexey Semenyuk 2025-01-10 19:32:05 +00:00
parent 01c8ba2cde
commit 10f7142dce

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -30,6 +30,8 @@ import jdk.jpackage.test.JPackageCommand;
import jdk.jpackage.test.Annotations.Test;
import jdk.jpackage.test.Annotations.Parameters;
import java.util.List;
import static jdk.jpackage.test.WindowsHelper.WixType.WIX3;
import static jdk.jpackage.test.WindowsHelper.getWixTypeFromVerboseJPackageOutput;
/**
* Test --resource-dir option. The test should set --resource-dir to point to
@ -83,11 +85,18 @@ public class WinResourceTest {
.addBundleVerifier((cmd, result) -> {
// Assert jpackage picked custom main.wxs and failed as expected by
// examining its output
final String expectedWixErrorMsg;
if (getWixTypeFromVerboseJPackageOutput(result) == WIX3) {
expectedWixErrorMsg = "error CNDL0104 : Not a valid source file";
} else {
expectedWixErrorMsg = "error WIX0104: Not a valid source file";
}
TKit.assertTextStream(expectedLogMessage)
.predicate(String::startsWith)
.apply(JPackageCommand.stripTimestamps(
result.getOutput().stream()));
TKit.assertTextStream("error CNDL0104 : Not a valid source file")
TKit.assertTextStream(expectedWixErrorMsg)
.apply(result.getOutput().stream());
})
.setExpectedExitCode(1)