Author: brianf Date: Thu Mar 27 15:06:54 2008 New Revision: 641999 URL: http://svn.apache.org/viewvc?rev=641999&view=rev Log: added method to validate certain text in a log
Modified: maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/Verifier.java Modified: maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/Verifier.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/Verifier.java?rev=641999&r1=641998&r2=641999&view=diff ============================================================================== --- maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/Verifier.java (original) +++ maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/Verifier.java Thu Mar 27 15:06:54 2008 @@ -229,6 +229,33 @@ } } + /** + * Throws an exception if the text is not present in the log. + * @param text + * @throws VerificationException + */ + public void verifyTextInLog( String text ) + throws VerificationException + { + List lines; + lines = loadFile( getBasedir(), LOG_FILENAME, false ); + + boolean result = false; + for ( Iterator i = lines.iterator(); i.hasNext(); ) + { + String line = (String) i.next(); + if ( line.indexOf( text ) >= 0) + { + result = true; + break; + } + } + if (!result) + { + throw new VerificationException( "Text not found in log: " + text ); + } +} + public Properties loadProperties( String filename ) throws VerificationException {