forked from OpenLiberty/ci.maven
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moving spring boot failure test to new file
Signed-off-by: Arun Venmany <[email protected]>
- Loading branch information
1 parent
ee10949
commit 29fcfcd
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
liberty-maven-plugin/src/test/resources/checkErrorSpringBootApplicationNode.bsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
//Check build.log content for certain tests | ||
boolean flag = false; | ||
String testname = basedir.getName(); | ||
String expectedMessage = null; | ||
switch (testname) { | ||
case "springboot-3-appsdirectory-apps-fail-it": | ||
expectedMessage = "Found multiple springBootApplication elements specified in the server configuration. Only one springBootApplication can be configured per Liberty server."; | ||
break; | ||
default: | ||
return false; | ||
} | ||
File buildlog = new File(basedir,"build.log"); | ||
if (buildlog.exists()) { | ||
try { | ||
InputStream buildOutput = new FileInputStream(buildlog); | ||
InputStreamReader in = new InputStreamReader(buildOutput); | ||
java.util.Scanner s = new java.util.Scanner(in); | ||
while (s.hasNextLine() && !flag) { | ||
String line = s.nextLine(); | ||
if (line.contains(expectedMessage)) { | ||
flag = true; | ||
System.out.println("Correct error message found for test "+testname); | ||
} | ||
} | ||
s.close(); | ||
in.close(); | ||
buildOutput.close(); | ||
} catch (Exception e) { | ||
System.out.println("Error checking build.log " + e.getMessage()); | ||
} | ||
} | ||
if (!flag) { | ||
System.out.println("FAILED: Expected error message ("+expectedMessage+") not found in "+buildlog.getAbsolutePath()); | ||
} | ||
return flag; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters