Skip to content

Commit

Permalink
Add error checks
Browse files Browse the repository at this point in the history
Signed-off-by: Scott Marlow <[email protected]>
  • Loading branch information
scottmarlow committed Feb 11, 2025
1 parent 5df0184 commit fb2a854
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ public static WebArchive createDeploymentVehicle(@ArquillianResource TestArchive
URL warResURL = ClientSignatureServletTest.class.getResource("/com/sun/ts/tests/common/vehicle/servlet/servlet_vehicle_web.xml");
if (warResURL != null) {
signaturetest_servlet_vehicle_web.addAsWebInfResource(warResURL, "web.xml");
} else {
throw new IllegalStateException("missing web.xml");
}

// add jakarta.tck:sigtest-maven-plugin jar to the war
Expand All @@ -122,10 +124,18 @@ public static WebArchive createDeploymentVehicle(@ArquillianResource TestArchive
.withTransitivity()
.asFile();
// add signature test artifact
final int[] addedSigtestCount = {0};
Arrays.stream(files).filter(file -> file.getName().contains("sigtest-maven-plugin"))
.forEach(file -> {
signaturetest_servlet_vehicle_web.addAsLibrary(file);
if (addedSigtestCount[0] > 0) {
throw new IllegalStateException("multiple sigtest-maven-plugin libraries found: " + file.getName());
}
addedSigtestCount[0]++;
});
if (addedSigtestCount[0] == 0) {
throw new IllegalStateException("Missing sigtest-maven-plugin library");
}
// Call the archive processor
archiveProcessor.processWebArchive(signaturetest_servlet_vehicle_web, ClientSignatureServletTest.class, warResURL);
return signaturetest_servlet_vehicle_web;
Expand Down

0 comments on commit fb2a854

Please sign in to comment.