From 1915c44e96cb5163b0dc5716433545b70395500d Mon Sep 17 00:00:00 2001 From: Fiona Ampofo <64271621+Akyiaa@users.noreply.github.com> Date: Thu, 22 Feb 2024 10:06:31 +0000 Subject: [PATCH] made setSkip() static to use in other classes and changed tests accordingly Signed-off-by: Fiona Ampofo <64271621+Akyiaa@users.noreply.github.com> --- .../galasa/maven/plugin/BuildBundleTestCatalog.java | 9 ++++++++- .../dev/galasa/maven/plugin/DeployTestCatalog.java | 2 +- .../galasa/maven/plugin/DeployTestCatalogTest.java | 12 ++++-------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/galasa-maven-plugin/src/main/java/dev/galasa/maven/plugin/BuildBundleTestCatalog.java b/galasa-maven-plugin/src/main/java/dev/galasa/maven/plugin/BuildBundleTestCatalog.java index 1cbef03..a68c756 100644 --- a/galasa-maven-plugin/src/main/java/dev/galasa/maven/plugin/BuildBundleTestCatalog.java +++ b/galasa-maven-plugin/src/main/java/dev/galasa/maven/plugin/BuildBundleTestCatalog.java @@ -63,10 +63,17 @@ public class BuildBundleTestCatalog extends AbstractMojo { @Parameter(defaultValue = "${project.compileClasspathElements}", readonly = true, required = true) private List classpathElements; + private boolean skip; + @Parameter(defaultValue = "${galasa.skip.bundletestcatatlog}", readonly = true, required = false) - private boolean skip; + private boolean typoSkip; + + @Parameter(defaultValue = "${galasa.skip.bundletestcatalog}", readonly = true, required = false) + private boolean correctSkip; public void execute() throws MojoExecutionException, MojoFailureException { + + skip = DeployTestCatalog.setSkip(correctSkip, typoSkip); if (skip) { getLog().info("Skipping Bundle Test Catalog build"); diff --git a/galasa-maven-plugin/src/main/java/dev/galasa/maven/plugin/DeployTestCatalog.java b/galasa-maven-plugin/src/main/java/dev/galasa/maven/plugin/DeployTestCatalog.java index 00fffa1..367af1c 100644 --- a/galasa-maven-plugin/src/main/java/dev/galasa/maven/plugin/DeployTestCatalog.java +++ b/galasa-maven-plugin/src/main/java/dev/galasa/maven/plugin/DeployTestCatalog.java @@ -55,7 +55,7 @@ public class DeployTestCatalog extends AbstractMojo { private boolean correctSkipDeploy; - protected boolean setSkip(boolean correctSkip, boolean typoSkip) { + protected static boolean setSkip(boolean correctSkip, boolean typoSkip) { boolean skip = false; //boolean default value is false if (correctSkip || typoSkip) { diff --git a/galasa-maven-plugin/src/test/java/dev/galasa/maven/plugin/DeployTestCatalogTest.java b/galasa-maven-plugin/src/test/java/dev/galasa/maven/plugin/DeployTestCatalogTest.java index 8ff9a03..6218226 100644 --- a/galasa-maven-plugin/src/test/java/dev/galasa/maven/plugin/DeployTestCatalogTest.java +++ b/galasa-maven-plugin/src/test/java/dev/galasa/maven/plugin/DeployTestCatalogTest.java @@ -18,10 +18,9 @@ public void setSkipTrueWhenTypoSkipIsTrue() { //Given... boolean typoSkip = true; boolean correctSkip = false; - DeployTestCatalog deployTest = new DeployTestCatalog(); //When... - boolean skipResult = deployTest.setSkip(correctSkip, typoSkip); + boolean skipResult = DeployTestCatalog.setSkip(correctSkip, typoSkip); //Then... assertThat(skipResult).isTrue(); @@ -32,10 +31,9 @@ public void setSkipFalseWhenTypoSkipAndCorrectSkipIsFalse() { //Given... boolean typoSkip = false; boolean correctSkip = false; - DeployTestCatalog deployTest = new DeployTestCatalog(); //When... - boolean skipResult = deployTest.setSkip(correctSkip, typoSkip); + boolean skipResult = DeployTestCatalog.setSkip(correctSkip, typoSkip); //Then... assertThat(skipResult).isFalse(); @@ -47,10 +45,9 @@ public void setSkipTrueWhenCorrectSkipIsTrue() { //Given... boolean typoSkip = false; boolean correctSkip = true; - DeployTestCatalog deployTest = new DeployTestCatalog(); //When... - boolean skipResult = deployTest.setSkip(correctSkip, typoSkip); + boolean skipResult = DeployTestCatalog.setSkip(correctSkip, typoSkip); //Then... assertThat(skipResult).isTrue(); @@ -61,10 +58,9 @@ public void setSkipTrueWhenCorrectSkipAndTypoSkipIsTrue() { //Given... boolean typoSkip = true; boolean correctSkip = true; - DeployTestCatalog deployTest = new DeployTestCatalog(); //When... - boolean skipResult = deployTest.setSkip(correctSkip, typoSkip); + boolean skipResult = DeployTestCatalog.setSkip(correctSkip, typoSkip); //Then... assertThat(skipResult).isTrue();