Skip to content

Commit

Permalink
Clean up integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
elharo committed Nov 22, 2024
1 parent 0f418dc commit 87371f0
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 37 deletions.
13 changes: 9 additions & 4 deletions src/it/announcement-generate-custom-template/verify.bsh
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,26 @@
*/

import java.io.*;
import java.nio.file.*;
import java.util.*;
import java.util.jar.*;
import org.codehaus.plexus.util.*;

boolean result = true;

try
{
File report = new File( basedir, "target/announcement/test-announce.vm" );
if ( !report.exists() || report.isDirectory() )
if ( !report.exists() )
{
System.err.println( "report file is missing or a directory." );
System.err.println( "report file is missing." );
return false;
}
String reportContent = FileUtils.fileRead( report );
if ( report.isDirectory() )
{
System.err.println( "report file is a directory." );
return false;
}
String reportContent = new String(Files.readAllBytes( report.toPath() ), "UTF-8");

int indexOf = reportContent.indexOf( "maven-changes-plugin-test-1.1 release" );
if ( indexOf < 0 )
Expand Down
19 changes: 12 additions & 7 deletions src/it/report-changes-generation/verify.bsh
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,38 @@
*/

import java.io.*;
import java.nio.file.*;
import java.util.*;
import java.util.jar.*;
import org.codehaus.plexus.util.*;

boolean result = true;

try
{
File report = new File( basedir, "target/site/changes-report.html" );
if ( !report.exists() || report.isDirectory() )
if ( !report.exists() )
{
System.err.println( "report file is missing or a directory." );
System.err.println( "report file is missing." );
return false;
}
String reportContent = FileUtils.fileRead( report );
if ( report.isDirectory() )
{
System.err.println( "report is directory." );
return false;
}
String reportContent = new String(Files.readAllBytes( report.toPath() ), "UTF-8");

int indexOf = reportContent.indexOf( "Changes" );
if ( indexOf < 0 )
{
System.err.println( "changes-report.html doesn't contains Changes title" );
System.err.println( "changes-report.html doesn't contain Changes title" );
return false;
}

indexOf = reportContent.indexOf( "href=\"http://myjira/browse/MCHANGES-88\"" );
if ( indexOf < 0 )
{
System.err.println( "changes-report.html doesn't contains jira issue link" );
System.err.println( "changes-report.html doesn't contain jira issue link" );
return false;
}

Expand All @@ -61,7 +66,7 @@ try
indexOf = reportContent.indexOf( "bug-12345" );
if ( indexOf < 0 )
{
System.err.println( "changes-report.html doesn't contains issue text for issue specified with <fixes> element" );
System.err.println( "changes-report.html doesn't contain issue text for issue specified with <fixes> element" );
return false;
}
indexOf = reportContent.indexOf( "Fixes ." );
Expand Down
24 changes: 15 additions & 9 deletions src/it/report-changes-interpolation/verify.bsh
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,40 @@
*/

import java.io.*;
import java.nio.file.*;
import java.text.*;
import java.util.*;
import java.util.jar.*;
import org.codehaus.plexus.util.*;
import java.nio.file.*;

boolean result = true;

try
{
File report = new File( basedir, "target/site/changes-report.html" );
if ( !report.exists() || report.isDirectory() )
if ( !report.exists() )
{
System.err.println( "report file is missing or a directory." );
System.err.println( "report file is missing." );
return false;
}
String reportContent = FileUtils.fileRead( report );
if ( report.isDirectory() )
{
System.err.println( "report file is a directory." );
return false;
}
String reportContent = new String(Files.readAllBytes( report.toPath() ), "UTF-8");

int indexOf = reportContent.indexOf( "Changes" );
if ( indexOf < 0 )
{
System.err.println( "changes-report.html doesn't contains Changes title" );
System.err.println( "changes-report.html doesn't contain Changes title" );
return false;
}

indexOf = reportContent.indexOf( "href=\"http://myjira/browse/MCHANGES-88\"" );
if ( indexOf < 0 )
{
System.err.println( "changes-report.html doesn't contains jira issue link" );
System.err.println( "changes-report.html doesn't contain jira issue link" );
return false;
}

Expand All @@ -62,7 +68,7 @@ try
indexOf = reportContent.indexOf( "bug-12345" );
if ( indexOf < 0 )
{
System.err.println( "changes-report.html doesn't contains issue text for issue specified with <fixes> element" );
System.err.println( "changes-report.html doesn't contain issue text for issue specified with <fixes> element" );
return false;
}
indexOf = reportContent.indexOf( "Fixes ." );
Expand All @@ -75,7 +81,7 @@ try
indexOf = reportContent.indexOf( "<a href=\"#a99.0\">" );
if ( indexOf < 0 )
{
System.err.println( "changes-report.html doesn't contains version from pom" );
System.err.println( "changes-report.html doesn't contain version from pom" );
return false;
}

Expand All @@ -86,7 +92,7 @@ try
indexOf = reportContent.indexOf( formattedDate );
if ( indexOf < 0 )
{
System.err.println( "changes-report.html doesn't publishDate" );
System.err.println( "changes-report.html doesn't contain publishDate" );
return false;
}

Expand Down
23 changes: 14 additions & 9 deletions src/it/report-changes-system-noissuemanagement/verify.bsh
Original file line number Diff line number Diff line change
Expand Up @@ -19,51 +19,56 @@
*/

import java.io.*;
import java.nio.file.*;
import java.util.*;
import java.util.jar.*;
import org.codehaus.plexus.util.*;

boolean result = true;

try
{
File report = new File( basedir, "target/site/changes-report.html" );
if ( !report.exists() || report.isDirectory() )
if ( !report.exists() )
{
System.err.println( "report file is missing or a directory." );
System.err.println( "report file is missing." );
return false;
}
String reportContent = FileUtils.fileRead( report );
if ( report.isDirectory() )
{
System.err.println( "report file is a directory." );
return false;
}
String reportContent = new String(Files.readAllBytes( report.toPath() ), "UTF-8");

int indexOf = reportContent.indexOf( "Changes" );
if ( indexOf < 0 )
{
System.err.println( "changes-report.html doesn't contains Changes title" );
System.err.println( "changes-report.html doesn't contain Changes title" );
return false;
}

indexOf = reportContent.indexOf( "href=\"http://myjira/browse/MCHANGES-88\"" );
if ( indexOf < 0 )
{
System.err.println( "changes-report.html doesn't contains jira issue link" );
System.err.println( "changes-report.html doesn't contain jira issue link" );
return false;
}
indexOf = reportContent.indexOf( "href=\"http://localhost/1212\"" );
if ( indexOf < 0 )
{
System.err.println( "changes-report.html doesn't contains qc issue link" );
System.err.println( "changes-report.html doesn't contain qc issue link" );
return false;
}
indexOf = reportContent.indexOf( "href=\"http://www.redmine.org/show/issue/88\"" );
if ( indexOf < 0 )
{
System.err.println( "changes-report.html doesn't contains redmine issue link" );
System.err.println( "changes-report.html doesn't contain redmine issue link" );
return false;
}
indexOf = reportContent.indexOf( "2008-01-01" );
if ( indexOf < 0 )
{
System.err.println( "changes-report.html doesn't contains date 2008-01-01" );
System.err.println( "changes-report.html doesn't contain date 2008-01-01" );
return false;
}

Expand Down
21 changes: 13 additions & 8 deletions src/it/report-changes-system/verify.bsh
Original file line number Diff line number Diff line change
Expand Up @@ -19,45 +19,50 @@
*/

import java.io.*;
import java.nio.file.*;
import java.util.*;
import java.util.jar.*;
import org.codehaus.plexus.util.*;

boolean result = true;

try
{
File report = new File( basedir, "target/site/en/changes-report.html" );
if ( !report.exists() || report.isDirectory() )
if ( !report.exists() )
{
System.err.println( "report file is missing or a directory." );
System.err.println( "report file is missing." );
return false;
}
String reportContent = FileUtils.fileRead( report );
if ( report.isDirectory() )
{
System.err.println( "report file is a directory." );
return false;
}
String reportContent = new String(Files.readAllBytes( report.toPath() ), "UTF-8");

int indexOf = reportContent.indexOf( "Changes" );
if ( indexOf < 0 )
{
System.err.println( "changes-report.html doesn't contains Changes title" );
System.err.println( "changes-report.html doesn't contain Changes title" );
return false;
}

indexOf = reportContent.indexOf( "href=\"http://myjira/browse/MCHANGES-88\"" );
if ( indexOf < 0 )
{
System.err.println( "changes-report.html doesn't contains jira issue link" );
System.err.println( "changes-report.html doesn't contain jira issue link" );
return false;
}
indexOf = reportContent.indexOf( "href=\"http://localhost/1212\"" );
if ( indexOf < 0 )
{
System.err.println( "changes-report.html doesn't contains qc issue link" );
System.err.println( "changes-report.html doesn't contain qc issue link" );
return false;
}
indexOf = reportContent.indexOf( "2008-01-01" );
if ( indexOf < 0 )
{
System.err.println( "changes-report.html doesn't contains date 2008-01-01" );
System.err.println( "changes-report.html doesn't contain date 2008-01-01" );
return false;
}
}
Expand Down

0 comments on commit 87371f0

Please sign in to comment.