-
Notifications
You must be signed in to change notification settings - Fork 0
Artifact support implementation #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
bc70dc8
Added new rid generator.
YevheniiVlasenko 3a3ef1d
Added ArtifactManagementException
YevheniiVlasenko 1943ff8
Added Testomatio facade class and ServiceRegistry
YevheniiVlasenko 85688f9
Added CVS writer
YevheniiVlasenko e853eaf
Implemented ArtifactManager.java
YevheniiVlasenko e193c9a
logic change to temporal storage. (deleted excess files, not fully im…
YevheniiVlasenko 1c513d6
checkpoint
YevheniiVlasenko a77e5e5
Implemented core artifact support via ThreadLocal temp storage
YevheniiVlasenko 842c821
implemented artifact link upload to Testomat logic
YevheniiVlasenko b470b67
removed s3presigner usage
YevheniiVlasenko 4c153bf
Link report body fix(junit)
YevheniiVlasenko d031136
checkpoint
YevheniiVlasenko 9b72600
implemented secondary tests sending with artifacts
YevheniiVlasenko 60d5c35
implemented testomatio.disable.artifacts (junit)
YevheniiVlasenko 6125ccd
implemented env properties logic: ARTIFACT_DISABLE_PROPERTY_NAME, BUC…
YevheniiVlasenko d76bae1
implemented custom endpoint and forcepath. refactoring required.
YevheniiVlasenko 7370edc
implemented custom endpoint and forcepath. refactoring required.
YevheniiVlasenko 2904eb7
minor refactoring
YevheniiVlasenko 6658a31
refactored artifact related code
YevheniiVlasenko 05d4cc6
Added ACL check logic
YevheniiVlasenko 24d8ae3
JavaDoc for artifact related classes
YevheniiVlasenko 231f60f
JavaDoc for artifact related classes (missed in first commit)
YevheniiVlasenko 9bfad79
Added disable reporting logic
YevheniiVlasenko 260a1de
Fixed isValidFilePath in ArtifactManager signature
YevheniiVlasenko a97ef00
Refactored GlobalRunManager, added tests
YevheniiVlasenko ab27c1f
Added artifact description to the README
YevheniiVlasenko 3c7b456
checkpoint
YevheniiVlasenko 585c29b
fixed TestNg artifact bugs
YevheniiVlasenko 70ac825
Added the delay before artifact batch sending
YevheniiVlasenko 6576b47
Fixed artifact paths for all frameworks
YevheniiVlasenko 20a141d
Refactored AwsService
YevheniiVlasenko 5f66cbc
Fixed tests in Cucumber module. Added new tests
YevheniiVlasenko 11f9293
Fixed artifacts related property names
YevheniiVlasenko 64731f3
Updated README.md
YevheniiVlasenko c7cc19f
Added message on before-artifact-delay
YevheniiVlasenko 87ea07c
Update README.md
YevheniiVlasenko 63714dc
Update README.md
YevheniiVlasenko 5b0ecbc
Update README.md
YevheniiVlasenko 7f3cdcb
Readme minor fix
YevheniiVlasenko 9c0eaeb
Readme minor fix
YevheniiVlasenko 525516b
Merge branch '1.x' into artifact-support-implementation
YevheniiVlasenko b6ba521
Minor fixes in JunitListener.java;
YevheniiVlasenko 969fd95
fixed namespaces to run github workflow
YevheniiVlasenko 2ed01e5
Changed version in core pom for separate deploy
YevheniiVlasenko bd907f0
Changed versions in framework modules poms for auto deploy
YevheniiVlasenko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
75 changes: 75 additions & 0 deletions
75
java-reporter-core/src/main/java/io/testomat/core/artifact/ArtifactLinkData.java
This file contains hidden or 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,75 @@ | ||
package io.testomat.core.artifact; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Data class representing the relationship between test execution and its associated artifact links. | ||
* Contains test metadata and S3 URLs for uploaded artifacts. | ||
*/ | ||
public class ArtifactLinkData { | ||
private String rid; | ||
private final String testId; | ||
private final String testName; | ||
|
||
private final List<String> links; | ||
|
||
/** | ||
* Creates artifact link data for a test execution. | ||
* | ||
* @param testName name of the test | ||
* @param rid request identifier | ||
* @param testId unique test identifier | ||
* @param links list of S3 URLs for uploaded artifacts | ||
*/ | ||
public ArtifactLinkData(String testName, String rid, String testId, List<String> links) { | ||
this.testName = testName; | ||
this.rid = rid; | ||
this.testId = testId; | ||
this.links = links; | ||
} | ||
|
||
/** | ||
* Returns the list of artifact URLs. | ||
* | ||
* @return list of S3 URLs for artifacts | ||
*/ | ||
public List<String> getLinks() { | ||
return links; | ||
} | ||
|
||
/** | ||
* Returns the unique test identifier. | ||
* | ||
* @return test ID | ||
*/ | ||
public String getTestId() { | ||
return testId; | ||
} | ||
|
||
/** | ||
* Returns the request identifier. | ||
* | ||
* @return request ID | ||
*/ | ||
public String getRid() { | ||
return rid; | ||
} | ||
|
||
/** | ||
* Sets the request identifier. | ||
* | ||
* @param rid request ID to set | ||
*/ | ||
public void setRid(String rid) { | ||
this.rid = rid; | ||
} | ||
|
||
/** | ||
* Returns the test name. | ||
* | ||
* @return name of the test | ||
*/ | ||
public String getTestName() { | ||
return testName; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
java-reporter-core/src/main/java/io/testomat/core/artifact/ArtifactLinkDataStorage.java
This file contains hidden or 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,13 @@ | ||
package io.testomat.core.artifact; | ||
|
||
import java.util.List; | ||
import java.util.concurrent.CopyOnWriteArrayList; | ||
|
||
/** | ||
* Thread-safe storage for artifact link data collected during test execution. | ||
* Maintains a collection of artifact links that will be associated with test results. | ||
*/ | ||
public class ArtifactLinkDataStorage { | ||
public static final List<ArtifactLinkData> ARTEFACT_LINK_DATA_STORAGE = | ||
new CopyOnWriteArrayList<>(); | ||
} |
45 changes: 45 additions & 0 deletions
45
java-reporter-core/src/main/java/io/testomat/core/artifact/LinkUploadBodyBuilder.java
This file contains hidden or 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,45 @@ | ||
package io.testomat.core.artifact; | ||
|
||
/** | ||
* Builder for creating JSON request bodies containing artifact links for upload to the server. | ||
* Handles serialization of artifact data and test run information. | ||
*/ | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.node.ArrayNode; | ||
import com.fasterxml.jackson.databind.node.ObjectNode; | ||
import java.util.List; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class LinkUploadBodyBuilder { | ||
private static final Logger log = LoggerFactory.getLogger(LinkUploadBodyBuilder.class); | ||
|
||
public String buildLinkUploadRequestBody(List<ArtifactLinkData> storedLinkData, String apiKey) { | ||
ObjectMapper mapper = new ObjectMapper(); | ||
ObjectNode rootNode = mapper.createObjectNode(); | ||
ArrayNode testsArray = mapper.createArrayNode(); | ||
|
||
for (ArtifactLinkData data : storedLinkData) { | ||
ObjectNode testNode = mapper.createObjectNode(); | ||
testNode.put("rid", data.getRid()); | ||
testNode.put("test_id", data.getTestId()); | ||
testNode.put("title", data.getTestName()); | ||
testNode.put("overwrite", "true"); | ||
testNode.set("artifacts", mapper.valueToTree(data.getLinks())); | ||
testsArray.add(testNode); | ||
} | ||
|
||
rootNode.put("api_key", apiKey); | ||
rootNode.set("tests", testsArray); | ||
|
||
String json = null; | ||
try { | ||
json = mapper.writeValueAsString(rootNode); | ||
} catch (JsonProcessingException e) { | ||
log.warn("Failed to convert convert link storage to json body"); | ||
} | ||
return json; | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
java-reporter-core/src/main/java/io/testomat/core/artifact/ReportedTestStorage.java
This file contains hidden or 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,52 @@ | ||
package io.testomat.core.artifact; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.concurrent.CopyOnWriteArrayList; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* Thread-safe storage for reported test data with artifact linking capabilities. | ||
* Maintains test execution results and allows linking artifacts to specific tests by RID. | ||
*/ | ||
public class ReportedTestStorage { | ||
private static final Logger log = LoggerFactory.getLogger(ReportedTestStorage.class); | ||
private static final List<Map<String, Object>> STORAGE = new CopyOnWriteArrayList<>(); | ||
|
||
/** | ||
* Stores test execution data. | ||
* | ||
* @param body test data map containing test results and metadata | ||
*/ | ||
public static void store(Map<String, Object> body) { | ||
STORAGE.add(body); | ||
log.debug("Stored body: {}", body); | ||
} | ||
|
||
/** | ||
* Returns all stored test data. | ||
* | ||
* @return list of test data maps | ||
*/ | ||
public static List<Map<String, Object>> getStorage() { | ||
return STORAGE; | ||
} | ||
|
||
/** | ||
* Links artifacts to their corresponding tests using RID matching. | ||
* | ||
* @param artifactLinkData list of artifact link data to associate with tests | ||
*/ | ||
public static void linkArtifactsToTests(List<ArtifactLinkData> artifactLinkData) { | ||
for (ArtifactLinkData data : artifactLinkData) { | ||
STORAGE.stream() | ||
.filter(body -> data.getRid().equals(body.get("rid"))) | ||
.forEach(body -> body.put("artifacts", data.getLinks())); | ||
} | ||
for (ArtifactLinkData data : artifactLinkData) { | ||
log.debug("Linked: testId - {}, testName - {}, rid - {}, links - {}", | ||
data.getTestId(), data.getTestName(), data.getRid(), data.getLinks().get(0)); | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...reporter-core/src/main/java/io/testomat/core/artifact/TempArtifactDirectoriesStorage.java
This file contains hidden or 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,16 @@ | ||
package io.testomat.core.artifact; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Thread-local storage for temporarily holding artifact file paths during test execution. | ||
* Ensures thread safety when multiple tests run concurrently. | ||
*/ | ||
public class TempArtifactDirectoriesStorage { | ||
public static final ThreadLocal<List<String>> DIRECTORIES = ThreadLocal.withInitial(ArrayList::new); | ||
|
||
public static void store(String dir) { | ||
DIRECTORIES.get().add(dir); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
java-reporter-core/src/main/java/io/testomat/core/artifact/client/AwsClient.java
This file contains hidden or 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,39 @@ | ||
package io.testomat.core.artifact.client; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import software.amazon.awssdk.services.s3.S3Client; | ||
|
||
/** | ||
* AWS S3 client wrapper with built-in configuration management. | ||
* Provides singleton S3Client instances with custom endpoint and credential support. | ||
*/ | ||
public class AwsClient { | ||
private static final Logger log = LoggerFactory.getLogger(AwsClient.class); | ||
private volatile S3Client s3Client; | ||
private final S3ClientFactory clientFactory; | ||
|
||
public AwsClient() { | ||
this.clientFactory = new S3ClientFactory(); | ||
} | ||
|
||
/** | ||
* Test Constructor | ||
*/ | ||
public AwsClient(S3ClientFactory s3ClientFactory) { | ||
this.clientFactory = s3ClientFactory; | ||
} | ||
|
||
/** | ||
* Returns a configured S3Client instance using lazy initialization. | ||
* | ||
* @return configured S3Client instance | ||
*/ | ||
public S3Client getS3Client() { | ||
if (s3Client == null) { | ||
s3Client = clientFactory.createS3Client(); | ||
return s3Client; | ||
} | ||
return s3Client; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What other methods Testomatio contains?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None yet