-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add pipeline spec
- Loading branch information
Showing
1,128 changed files
with
49,631 additions
and
96 deletions.
There are no files selected for viewing
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
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
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
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
2 changes: 1 addition & 1 deletion
2
test/groovy/util/LoggerStub.groovy → ...roovy/org/ods/core/test/LoggerStub.groovy
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package util | ||
package org.ods.core.test | ||
|
||
import org.ods.util.ILogger | ||
|
||
|
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,22 @@ | ||
package org.ods.core.test | ||
|
||
import com.lesfurets.jenkins.unit.RegressionTest | ||
import com.lesfurets.jenkins.unit.cps.BasePipelineTestCPS | ||
import spock.lang.Specification | ||
|
||
/** | ||
* Class base to create component tests | ||
*/ | ||
class PipelineSpecBase extends Specification implements RegressionTest { | ||
|
||
/** | ||
* Delegate to the junit cps transforming base test | ||
*/ | ||
@Delegate | ||
BasePipelineTestCPS baseTest | ||
|
||
def setup() { | ||
baseTest = new BasePipelineTestCPS() | ||
baseTest.setUp() | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
test/groovy/org/ods/core/test/jira/JiraServiceForWireMock.groovy
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,46 @@ | ||
package org.ods.core.test.jira | ||
|
||
import groovy.util.logging.Slf4j | ||
import org.ods.orchestration.service.JiraService | ||
|
||
@Slf4j | ||
class JiraServiceForWireMock extends JiraService { | ||
JiraServiceForWireMock(String baseURL, String username, String password) { | ||
super(baseURL, username, password) | ||
} | ||
|
||
@Override | ||
void addLabelsToIssue(String issueIdOrKey, List names) { | ||
log.warn("addLabelsToIssue - issueIdOrKey:$issueIdOrKey") | ||
} | ||
|
||
@Override | ||
void appendCommentToIssue(String issueIdOrKey, String comment) { | ||
log.warn("appendCommentToIssue - issueIdOrKey:$issueIdOrKey") | ||
} | ||
|
||
@Override | ||
void createIssueLinkTypeBlocks(Map inwardIssue, Map outwardIssue) { | ||
log.warn("createIssueLinkTypeBlocks - inwardIssue:$inwardIssue") | ||
} | ||
|
||
@Override | ||
Map createIssueType(String type, String projectKey, String summary, String description, String fixVersion = null) { | ||
log.warn("createIssueType - type:${type}") | ||
} | ||
|
||
@Override | ||
void removeLabelsFromIssue(String issueIdOrKey, List names) { | ||
log.warn("removeLabelsFromIssue - issueIdOrKey:$issueIdOrKey") | ||
} | ||
|
||
@Override | ||
void updateSelectListFieldsOnIssue(String issueIdOrKey, Map fields) { | ||
log.warn("updateSelectListFieldsOnIssue - issueIdOrKey:$issueIdOrKey") | ||
} | ||
|
||
@Override | ||
void updateTextFieldsOnIssue(String issueIdOrKey, Map fields) { | ||
log.warn("updateTextFieldsOnIssue - issueIdOrKey:$issueIdOrKey") | ||
} | ||
} |
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,47 @@ | ||
package org.ods.core.test.pdf | ||
|
||
import groovy.util.logging.Slf4j | ||
|
||
import javax.imageio.ImageIO | ||
import java.awt.Color | ||
import java.awt.image.BufferedImage | ||
|
||
@Slf4j | ||
class ImageCompare { | ||
private static final int colorCode = Color.MAGENTA.getRGB() | ||
private static final String PNG = "png" | ||
|
||
boolean compareAndHighlightDiffInNewImage(final BufferedImage img1, final BufferedImage img2, String fileName) throws IOException { | ||
final int width = img1.getWidth() | ||
final int height = img1.getHeight() | ||
|
||
final int[] p1 = img1.getRGB(0, 0, width, height, null, 0, width) | ||
final int[] p2 = img2.getRGB(0, 0, width, height, null, 0, width) | ||
if(!(java.util.Arrays.equals(p1, p2))){ | ||
log.debug("Compared images - does not match") | ||
saveImage(imageDiff(p1, p2, width, height), fileName) | ||
return false | ||
} | ||
return true | ||
} | ||
|
||
private BufferedImage imageDiff(int[] p1, int[] p2, int width, int height) { | ||
for (int i = 0; i < p1.length; i++) { | ||
if (p1[i] != p2[i]) { | ||
p1[i] = colorCode | ||
} | ||
} | ||
|
||
final BufferedImage out = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB) | ||
out.setRGB(0, 0, width, height, p1, 0, width) | ||
return out | ||
} | ||
|
||
private void saveImage(BufferedImage image, String file){ | ||
try{ | ||
ImageIO.write(image, PNG, new File(file)) | ||
} catch(Exception e) { | ||
throw new RuntimeException("Error saving image error", e) | ||
} | ||
} | ||
} |
Oops, something went wrong.