Skip to content

Commit 900c188

Browse files
authored
Feature/v6.0.2 (#83)
* Updated Api version to `7.2` * Initial commit * Updated Api versions * Added code coverage Api * Added code coverage Api tests * Rename json response property name * Rename json response property name * Initial commit * Added support for test iterations API * Test session Api initial commit * Test suites Api initial commit * Added Test suites Api * Minor update * Minor update * Added Test suites API version * Added Test history API version * Initial commit * Added test cases and history APIs * Test points API initial commit * Added Test points API version * Added Test points API * Minor changes * Bumped version to `v6.0.2` * Updated tests * Added helper methods * Initial commit * Update to query parameters * Updated Api version
1 parent 38352cc commit 900c188

34 files changed

+2556
-14
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
# 6.0.2
4+
5+
- Added support for Test suites, results, points, cases and history APIs.
6+
37
# 6.0.1
48

59
- Added support for TestCaseResult in **TestApi**.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Build Status](https://dev.azure.com/harishkarthic/azure-devops-java-sdk/_apis/build/status/hkarthik7.azure-devops-java-sdk?branchName=main)](https://dev.azure.com/harishkarthic/azure-devops-java-sdk/_build/latest?definitionId=8&branchName=main)
44
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/hkarthik7/azure-devops-java-sdk/blob/main/LICENSE)
55
[![Documentation Status](https://readthedocs.org/projects/azure-devops-java-sdk-docs/badge/?version=latest)](https://azure-devops-java-sdk-docs.readthedocs.io/en/latest/?badge=latest)
6-
[![Maven Central](https://img.shields.io/maven-central/v/io.github.hkarthik7/azd.svg)](https://search.maven.org/artifact/io.github.hkarthik7/azd/6.0.1/jar)
6+
[![Maven Central](https://img.shields.io/maven-central/v/io.github.hkarthik7/azd.svg)](https://search.maven.org/artifact/io.github.hkarthik7/azd/6.0.2/jar)
77

88
**azd** library provides a convenient way to manage and interact with **Azure DevOps Services** REST API with ease. This SDK offers a set of APIs and utilities
99
with declarative syntax and provide functionalities to the significant services.
@@ -33,7 +33,7 @@ To download the library and use it in your project, just add below in your pom.x
3333
<dependency>
3434
<groupId>io.github.hkarthik7</groupId>
3535
<artifactId>azd</artifactId>
36-
<version>6.0.1</version>
36+
<version>6.0.2</version>
3737
</dependency>
3838
```
3939

@@ -43,7 +43,7 @@ To download the library and use it in your project, just add below in your pom.x
4343
<dependency>
4444
<groupId>io.github.hkarthik7</groupId>
4545
<artifactId>azd</artifactId>
46-
<version>6.0.1</version>
46+
<version>6.0.2</version>
4747
<classifier>javadoc</classifier>
4848
</dependency>
4949
```
@@ -54,7 +54,7 @@ To download the library and use it in your project, just add below in your pom.x
5454
<dependency>
5555
<groupId>io.github.hkarthik7</groupId>
5656
<artifactId>azd</artifactId>
57-
<version>6.0.1</version>
57+
<version>6.0.2</version>
5858
<classifier>sources</classifier>
5959
</dependency>
6060
```

azd/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>io.github.hkarthik7</groupId>
88
<artifactId>azd</artifactId>
9-
<version>6.0.1</version>
9+
<version>6.0.2</version>
1010
<packaging>jar</packaging>
1111

1212
<name>azd</name>

azd/src/main/java/org/azd/common/ApiVersion.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@ public abstract class ApiVersion {
5555
public static final String TEST_RUNS = "7.2-preview.3";
5656
public static final String TEST_ITERATIONS = "7.2-preview.3";
5757
public static final String TEST_CODE_COVERAGE = "7.2-preview.1";
58+
public static final String TEST_SESSION = "7.2-preview.1";
5859
public static final String TEST_RESULTS = "7.2-preview.6";
60+
public static final String TEST_CASES = "7.2-preview.1";
61+
public static final String TEST_HISTORY = "7.2-preview.2";
62+
public static final String TEST_SUITES = "7.2-preview.3";
63+
public static final String TEST_POINTS = "7.2-preview.2";
5964
public static final String VARIABLE_GROUPS = "7.2-preview.2";
6065
public static final String WIKI = "7.2-preview.2";
6166
public static final String WIKI_ATTACHMENTS = "7.2-preview.1";
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package org.azd.enums;
2+
3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
6+
/**
7+
* Source of the test session
8+
*/
9+
@JsonIgnoreProperties(ignoreUnknown = true)
10+
public enum TestSessionSource {
11+
/**
12+
* The session was created from feedback client.
13+
*/
14+
@JsonProperty("feedbackDesktop")
15+
FEEDBACK_DESKTOP,
16+
17+
/**
18+
* The session was created from browser extension.
19+
*/
20+
@JsonProperty("feedbackWeb")
21+
FEEDBACK_WEB,
22+
23+
/**
24+
* To show sessions from all supported sources.
25+
*/
26+
@JsonProperty("sessionInsightsForAll")
27+
SESSION_IN_SIGHTS_FOR_ALL,
28+
29+
/**
30+
* Source of test session uncertain as it is stale
31+
*/
32+
@JsonProperty("unknown")
33+
UNKNOWN,
34+
35+
/**
36+
* The session was created from Microsoft Test Manager exploratory desktop tool.
37+
*/
38+
@JsonProperty("xtDesktop")
39+
XT_DESKTOP,
40+
41+
/**
42+
* The session was created from web access using Microsoft Test Manager exploratory desktop tool.
43+
*/
44+
@JsonProperty("xtDesktop2")
45+
XT_DESKTOP2,
46+
47+
/**
48+
* The session was created from browser extension.
49+
*/
50+
@JsonProperty("xtWeb")
51+
XT_WEB,
52+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package org.azd.enums;
2+
3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
6+
/**
7+
* State of the test session
8+
*/
9+
@JsonIgnoreProperties(ignoreUnknown = true)
10+
public enum TestSessionState {
11+
12+
/**
13+
* The session has completed.
14+
*/
15+
@JsonProperty("completed")
16+
COMPLETED,
17+
18+
/**
19+
* This is required for Feedback session which are declined
20+
*/
21+
@JsonProperty("declined")
22+
DECLINED,
23+
24+
/**
25+
* The session is running.
26+
*/
27+
@JsonProperty("inProgress")
28+
IN_PROGRESS,
29+
30+
/**
31+
* The session is still being created.
32+
*/
33+
@JsonProperty("notStarted")
34+
NOT_STARTED,
35+
36+
/**
37+
* The session has paused.
38+
*/
39+
@JsonProperty("paused")
40+
PAUSED,
41+
42+
/**
43+
* Only used during an update to preserve the existing value.
44+
*/
45+
@JsonProperty("unspecified")
46+
UNSPECIFIED,
47+
}

azd/src/main/java/org/azd/helpers/Utils.java

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,44 @@
11
package org.azd.helpers;
22

33
import java.io.ByteArrayOutputStream;
4+
import java.io.File;
5+
import java.io.IOException;
46
import java.io.InputStream;
7+
import java.nio.file.Files;
58
import java.util.Arrays;
69
import java.util.Base64;
710
import java.util.Objects;
811
import java.util.stream.Collectors;
912

13+
/**
14+
* Utility class that exposes helper methods.
15+
*/
1016
public final class Utils extends URLHelper {
17+
/**
18+
* Converts int array of values to string with ',' separated.
19+
* @param values int array of values.
20+
* @return A comma separated string values.
21+
*/
1122
public static String toString(int... values) {
1223
if (values == null) return null;
1324
return Arrays.stream(values).mapToObj(String::valueOf).collect(Collectors.joining(","));
1425
}
1526

27+
/**
28+
* Converts string array of values to a comma separated string.
29+
* @param values String array of values.
30+
* @return A comma separated string values.
31+
*/
1632
public static String toString(String... values) {
1733
if (values == null) return null;
1834
return String.join(",", values);
1935
}
2036

37+
/**
38+
* Converts object array of values to a comma separated string.
39+
* @param values Object array of values.
40+
* @return A comma separated string values.
41+
*/
2142
public static String toString(Object... values) {
2243
if (values == null) return null;
2344
StringBuilder sb = new StringBuilder();
@@ -30,6 +51,11 @@ public static String toString(Object... values) {
3051
return sb.toString();
3152
}
3253

54+
/**
55+
* Converts integer array to string array.
56+
* @param values Integer array of values.
57+
* @return String array of values.
58+
*/
3359
public static String[] toStringArray(int... values) {
3460
if (values == null) return null;
3561

@@ -39,6 +65,12 @@ public static String[] toStringArray(int... values) {
3965
.toArray(String[]::new);
4066
}
4167

68+
/**
69+
* Coverts string array of values to a comma separated encoded string. For instance, if a string contains space
70+
* it will be encoded as %20.
71+
* @param values String array of values.
72+
* @return Comma separated string of values.
73+
*/
4274
public static String toEncodedString(String... values) {
4375
if (values == null) return null;
4476
return Arrays.stream(values)
@@ -47,14 +79,39 @@ public static String toEncodedString(String... values) {
4779
.collect(Collectors.joining(","));
4880
}
4981

82+
/**
83+
* Checks if a given string value is null or empty.
84+
* @param value String value to verify.
85+
* @return True if given string is null or empty and false if not.
86+
*/
5087
public static boolean isNullOrEmpty(String value) {
5188
var isNullOrEmpty = true;
5289
if (value == null) return isNullOrEmpty;
5390
if (value.isEmpty() || value.isBlank()) return isNullOrEmpty;
5491
return false;
5592
}
5693

57-
public static String toBase64String(InputStream inputStream) throws Exception {
94+
/**
95+
* Converts the given file contents to base64 encoded string.
96+
* @param file File object.
97+
* @return Base64 encoded string.
98+
*/
99+
public static String toBase64String(File file) {
100+
Objects.requireNonNull(file);
101+
try {
102+
byte[] content = Files.readAllBytes(file.toPath());
103+
return Base64.getEncoder().encodeToString(content);
104+
} catch (IOException e) {
105+
throw new RuntimeException(e);
106+
}
107+
}
108+
109+
/**
110+
* Converts a given input stream to base64 string.
111+
* @param inputStream Input stream to convert to base64 string.
112+
* @return Base64 encoded string value.
113+
*/
114+
public static String toBase64String(InputStream inputStream) {
58115
Objects.requireNonNull(inputStream, "Input stream cannot be null or empty.");
59116

60117
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
@@ -64,8 +121,9 @@ public static String toBase64String(InputStream inputStream) throws Exception {
64121
outputStream.write(buffer, 0, bytesRead);
65122
}
66123

67-
var encodedBytes = Base64.getEncoder().encode(outputStream.toByteArray());
68-
return new String(encodedBytes);
124+
return Base64.getEncoder().encodeToString(outputStream.toByteArray());
125+
} catch (IOException e) {
126+
throw new RuntimeException(e);
69127
}
70128
}
71129
}

azd/src/main/java/org/azd/memberentitlementmanagement/userentitlementsummary/UserEntitlementSummaryRequestBuilder.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import org.azd.abstractions.BaseRequestBuilder;
44
import org.azd.authentication.AccessTokenCredential;
5+
import org.azd.common.ApiVersion;
56
import org.azd.exceptions.AzDException;
67
import org.azd.helpers.Utils;
78
import org.azd.memberentitlementmanagement.types.UsersSummary;
@@ -19,7 +20,8 @@ public class UserEntitlementSummaryRequestBuilder extends BaseRequestBuilder {
1920
* @param accessTokenCredential Access token credential object.
2021
*/
2122
public UserEntitlementSummaryRequestBuilder(String organizationUrl, AccessTokenCredential accessTokenCredential) {
22-
super(organizationUrl, accessTokenCredential, "memberEntitlementManagement", "5ae55b13-c9dd-49d1-957e-6e76c152e3d9");
23+
super(organizationUrl, accessTokenCredential, "memberEntitlementManagement", "5ae55b13-c9dd-49d1-957e-6e76c152e3d9",
24+
ApiVersion.MEMBERSHIP_ENTITLEMENT_MANAGEMENT);
2325
}
2426

2527
/**

azd/src/main/java/org/azd/test/TestRequestBuilder.java

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@
55
import org.azd.test.attachments.AttachmentsRequestBuilder;
66
import org.azd.test.codecoverage.CodeCoverageRequestBuilder;
77
import org.azd.test.iterations.IterationsRequestBuilder;
8+
import org.azd.test.points.PointsRequestBuilder;
89
import org.azd.test.results.ResultsRequestBuilder;
910
import org.azd.test.runs.RunsRequestBuilder;
11+
import org.azd.test.session.SessionRequestBuilder;
12+
import org.azd.test.testcases.TestCasesRequestBuilder;
13+
import org.azd.test.testhistory.TestHistoryRequestBuilder;
14+
import org.azd.test.testsuites.TestSuitesRequestBuilder;
1015

1116
/**
1217
* Provides functionality to work with Test Api.
@@ -66,4 +71,49 @@ public CodeCoverageRequestBuilder codeCoverage() {
6671
public IterationsRequestBuilder iterations() {
6772
return new IterationsRequestBuilder(organizationUrl, accessTokenCredential);
6873
}
74+
75+
/**
76+
* Provides functionality to work with Test session Api.
77+
*
78+
* @return SessionRequestBuilder {@link SessionRequestBuilder}
79+
*/
80+
public SessionRequestBuilder session() {
81+
return new SessionRequestBuilder(organizationUrl, accessTokenCredential);
82+
}
83+
84+
/**
85+
* Provides functionality to work with Test suites Api.
86+
*
87+
* @return TestSuitesRequestBuilder {@link TestSuitesRequestBuilder}
88+
*/
89+
public TestSuitesRequestBuilder testSuites() {
90+
return new TestSuitesRequestBuilder(organizationUrl, accessTokenCredential);
91+
}
92+
93+
/**
94+
* Provides functionality to work with Test cases Api.
95+
*
96+
* @return TestCasesRequestBuilder {@link TestCasesRequestBuilder}
97+
*/
98+
public TestCasesRequestBuilder testCases() {
99+
return new TestCasesRequestBuilder(organizationUrl, accessTokenCredential);
100+
}
101+
102+
/**
103+
* Provides functionality to work with Test history Api.
104+
*
105+
* @return TestHistoryRequestBuilder {@link TestHistoryRequestBuilder}
106+
*/
107+
public TestHistoryRequestBuilder testHistory() {
108+
return new TestHistoryRequestBuilder(organizationUrl, accessTokenCredential);
109+
}
110+
111+
/**
112+
* Provides functionality to work with Test points Api.
113+
*
114+
* @return PointsRequestBuilder {@link PointsRequestBuilder}
115+
*/
116+
public PointsRequestBuilder points() {
117+
return new PointsRequestBuilder(organizationUrl, accessTokenCredential);
118+
}
69119
}

0 commit comments

Comments
 (0)