-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added test results endpoints (#78)
* feat: added test results endpoints * feat: added test results endpoints (added to changelog)
- Loading branch information
Showing
20 changed files
with
2,226 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# Changelog | ||
|
||
# 6.0.1 | ||
|
||
- Added support for TestCaseResult in **TestApi**. | ||
|
||
# 6.0.0 | ||
|
||
**Major release** | ||
|
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
92 changes: 92 additions & 0 deletions
92
azd/src/main/java/org/azd/test/results/ResultsRequestBuilder.java
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,92 @@ | ||
package org.azd.test.results; | ||
|
||
import org.azd.abstractions.BaseRequestBuilder; | ||
import org.azd.abstractions.QueryParameter; | ||
import org.azd.authentication.AccessTokenCredential; | ||
import org.azd.common.ApiVersion; | ||
import org.azd.enums.TestRunPublishContext; | ||
import org.azd.enums.TestRunState; | ||
import org.azd.exceptions.AzDException; | ||
import org.azd.test.types.*; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
import java.util.function.Consumer; | ||
|
||
/** | ||
* Provides functionality to work with Test results Api. | ||
*/ | ||
public class ResultsRequestBuilder extends BaseRequestBuilder { | ||
/** | ||
* Instantiates a new RequestBuilder instance and sets the default values. | ||
* | ||
* @param organizationUrl Represents organization location request url. | ||
* @param accessTokenCredential Access token credential object. | ||
*/ | ||
public ResultsRequestBuilder(String organizationUrl, AccessTokenCredential accessTokenCredential) { | ||
super(organizationUrl, accessTokenCredential, "test", "4637d869-3a76-4468-8057-0bb02aa385cf", ApiVersion.TEST_RESULTS); | ||
} | ||
|
||
|
||
/** | ||
* Get a test case results for a test run. | ||
* | ||
* @param runId ID of the run to get. | ||
* @param testCaseResultId ID of the test case result to get. | ||
* @return TestCaseResult Object {@link TestCaseResult} | ||
* @throws AzDException Default Api Exception handler. | ||
**/ | ||
public TestCaseResult get(int runId, int testCaseResultId) throws AzDException { | ||
return builder() | ||
.serviceEndpoint("runId", runId) | ||
.serviceEndpoint("testCaseResultId", testCaseResultId) | ||
.build() | ||
.execute(TestCaseResult.class); | ||
} | ||
|
||
/** | ||
* Get a list of test results by run ID. | ||
* | ||
* @param runId ID of the run. | ||
* @return Collection of TestCaseResults Object {@link TestRuns} | ||
* @throws AzDException Default Api Exception handler. | ||
**/ | ||
public TestCaseResults list(int runId) throws AzDException { | ||
return builder() | ||
.serviceEndpoint("runId", runId) | ||
.build() | ||
.execute(TestCaseResults.class); | ||
} | ||
|
||
/** | ||
* Create test results by run ID. | ||
* | ||
* @param runId ID of the run to update. | ||
* @param testCaseResults Test case results object to update. | ||
* @return Test case results object {@link TestCaseResults} | ||
* @throws AzDException Default Api Exception handler. | ||
*/ | ||
public TestCaseResults create(int runId, TestCaseResults testCaseResults) throws AzDException { | ||
return builder() | ||
.POST(testCaseResults.getResults()) | ||
.serviceEndpoint("runId", runId) | ||
.build() | ||
.execute(TestCaseResults.class); | ||
} | ||
|
||
/** | ||
* Update test results by run ID. | ||
* | ||
* @param runId ID of the run to update. | ||
* @param testCaseResults Test case results object to update. | ||
* @return Test case results object {@link TestCaseResults} | ||
* @throws AzDException Default Api Exception handler. | ||
*/ | ||
public TestCaseResults update(int runId, TestCaseResults testCaseResults) throws AzDException { | ||
return builder() | ||
.PATCH(testCaseResults.getResults()) | ||
.serviceEndpoint("runId", runId) | ||
.build() | ||
.execute(TestCaseResults.class); | ||
} | ||
|
||
} |
117 changes: 117 additions & 0 deletions
117
azd/src/main/java/org/azd/test/types/BuildReference.java
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,117 @@ | ||
package org.azd.test.types; | ||
|
||
/* | ||
---------------------------------------------------------- | ||
GENERATED FILE, should be edited to suit the purpose. | ||
---------------------------------------------------------- | ||
*/ | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import org.azd.abstractions.serializer.SerializableEntity; | ||
|
||
/** | ||
* Represents a reference to a build with details such as branch name, | ||
* build system, and repository information. | ||
**/ | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class BuildReference extends SerializableEntity { | ||
|
||
/** | ||
* Name of the branch associated with the build. | ||
**/ | ||
@JsonProperty("branchName") | ||
private String branchName; | ||
|
||
/** | ||
* The build system used for the build. | ||
**/ | ||
@JsonProperty("buildSystem") | ||
private String buildSystem; | ||
|
||
/** | ||
* ID of the build definition. | ||
**/ | ||
@JsonProperty("definitionId") | ||
private Integer definitionId; | ||
|
||
/** | ||
* Unique ID of the build. | ||
**/ | ||
@JsonProperty("id") | ||
private Integer id; | ||
|
||
/** | ||
* Number identifying the build. | ||
**/ | ||
@JsonProperty("number") | ||
private String number; | ||
|
||
/** | ||
* Repository ID associated with the build. | ||
**/ | ||
@JsonProperty("repositoryId") | ||
private String repositoryId; | ||
|
||
/** | ||
* URI of the build. | ||
**/ | ||
@JsonProperty("uri") | ||
private String uri; | ||
|
||
public String getBranchName() { | ||
return branchName; | ||
} | ||
|
||
public void setBranchName(String branchName) { | ||
this.branchName = branchName; | ||
} | ||
|
||
public String getBuildSystem() { | ||
return buildSystem; | ||
} | ||
|
||
public void setBuildSystem(String buildSystem) { | ||
this.buildSystem = buildSystem; | ||
} | ||
|
||
public Integer getDefinitionId() { | ||
return definitionId; | ||
} | ||
|
||
public void setDefinitionId(Integer definitionId) { | ||
this.definitionId = definitionId; | ||
} | ||
|
||
public Integer getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Integer id) { | ||
this.id = id; | ||
} | ||
|
||
public String getNumber() { | ||
return number; | ||
} | ||
|
||
public void setNumber(String number) { | ||
this.number = number; | ||
} | ||
|
||
public String getRepositoryId() { | ||
return repositoryId; | ||
} | ||
|
||
public void setRepositoryId(String repositoryId) { | ||
this.repositoryId = repositoryId; | ||
} | ||
|
||
public String getUri() { | ||
return uri; | ||
} | ||
|
||
public void setUri(String uri) { | ||
this.uri = uri; | ||
} | ||
} |
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,61 @@ | ||
package org.azd.test.types; | ||
|
||
/* | ||
---------------------------------------------------------- | ||
GENERATED FILE, should be edited to suit the purpose. | ||
---------------------------------------------------------- | ||
*/ | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import org.azd.abstractions.serializer.SerializableEntity; | ||
|
||
/** | ||
* Represents the failing since information of a test result. | ||
**/ | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class FailingSince extends SerializableEntity { | ||
|
||
/** | ||
* Build reference since failing. | ||
**/ | ||
@JsonProperty("build") | ||
private BuildReference build; | ||
|
||
/** | ||
* Time since failing (UTC). | ||
**/ | ||
@JsonProperty("date") | ||
private String date; | ||
|
||
/** | ||
* Release reference since failing. | ||
**/ | ||
@JsonProperty("release") | ||
private ReleaseReference release; | ||
|
||
// Getters and setters | ||
public BuildReference getBuild() { | ||
return build; | ||
} | ||
|
||
public void setBuild(BuildReference build) { | ||
this.build = build; | ||
} | ||
|
||
public String getDate() { | ||
return date; | ||
} | ||
|
||
public void setDate(String date) { | ||
this.date = date; | ||
} | ||
|
||
public ReleaseReference getRelease() { | ||
return release; | ||
} | ||
|
||
public void setRelease(ReleaseReference release) { | ||
this.release = release; | ||
} | ||
} |
Oops, something went wrong.