Merge pull request #3 from loadster/v1.4 · loadster/loadster-sdk-java@79e5093 · GitHub
Skip to content
This repository was archived by the owner on Nov 26, 2020. It is now read-only.

Commit 79e5093

Browse files
authored
Merge pull request #3 from loadster/v1.4
V1.4
2 parents 5b80339 + 35c0ec1 commit 79e5093

5 files changed

Lines changed: 110 additions & 12 deletions

File tree

‎.gitignore‎

Lines changed: 1 addition & 0 deletions

‎build.gradle‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ buildscript {
1010

1111
apply plugin: "java"
1212
apply plugin: "fatjar"
13+
apply plugin: "maven-publish"
1314

14-
version "1.3"
15+
version "1.4"
1516

1617
repositories {
1718
mavenCentral()
@@ -23,6 +24,26 @@ dependencies {
2324
compile "com.netflix.feign:feign-jackson:8.17.0"
2425
}
2526

27+
publishing {
28+
publications {
29+
maven(MavenPublication) {
30+
groupId 'com.loadsterperformance'
31+
artifactId 'loadster-sdk-java'
32+
33+
from components.java
34+
}
35+
}
36+
repositories {
37+
maven {
38+
url mavenUrl
39+
credentials {
40+
username = mavenUsername
41+
password = mavenPassword
42+
}
43+
}
44+
}
45+
}
46+
2647
jar {
2748
archiveName "loadster-sdk-${version}.jar"
2849
}

‎src/main/java/loadster/sdk/client/WorkbenchApiClient.java‎

Lines changed: 69 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44
import feign.jackson.JacksonDecoder;
55
import feign.jackson.JacksonEncoder;
66
import loadster.sdk.exceptions.ApiException;
7-
import loadster.sdk.types.Scenario;
8-
import loadster.sdk.types.Test;
9-
import loadster.sdk.types.TestStatistics;
10-
import loadster.sdk.types.TestStatus;
7+
import loadster.sdk.types.*;
118

129
import java.io.IOException;
1310
import java.io.InputStream;
11+
import java.util.List;
1412

1513
/**
1614
* Simplified client interface for the Workbench API.
@@ -28,16 +26,52 @@ public void apply(RequestTemplate requestTemplate) {
2826
}
2927

3028
/**
31-
* Attempts to start a test for a scenario.
29+
* Lists all projects.
3230
*/
33-
public Test startTest(Scenario scenario) throws ApiException, IOException {
34-
Test test = jsonApi.startTest(scenario.getProjectId(), scenario.getId());
31+
public List<Reference> listProjects() throws ApiException, IOException {
32+
return jsonApi.listProjects();
33+
}
34+
35+
/**
36+
* Gets details on a project.
37+
*/
38+
public Project getProject(String id) throws ApiException, IOException {
39+
return jsonApi.getProject(id);
40+
}
41+
42+
/**
43+
* Gets details on a scenario.
44+
*/
45+
public Scenario getScenario(String projectId, String scenarioId) throws ApiException, IOException {
46+
return jsonApi.getScenario(projectId, scenarioId);
47+
}
48+
49+
/**
50+
* Gets details on a script.
51+
*/
52+
public Script getScript(String projectId, String scriptId) throws ApiException, IOException {
53+
return jsonApi.getScript(projectId, scriptId);
54+
}
55+
56+
/**
57+
* Gets details on a data set.
58+
*/
59+
public DataSet getDataSet(String projectId, String dataSetId) throws ApiException, IOException {
60+
return jsonApi.getDataSet(projectId, dataSetId);
61+
}
3562

36-
// TODO - the API should be including these fields in the response
37-
test.setProjectId(scenario.getProjectId());
38-
test.setScenarioId(scenario.getId());
63+
/**
64+
* Gets details on a test.
65+
*/
66+
public Test getTest(String projectId, String scenarioId, String testId) throws ApiException, IOException {
67+
return jsonApi.getTest(projectId, scenarioId, testId);
68+
}
3969

40-
return test;
70+
/**
71+
* Attempts to start a test for a scenario.
72+
*/
73+
public Test startTest(Scenario scenario) throws ApiException, IOException {
74+
return jsonApi.startTest(scenario.getProjectId(), scenario.getId());
4175
}
4276

4377
/**
@@ -62,6 +96,30 @@ public TestStatistics getTestStatistics(Test test) throws ApiException, IOExcept
6296
}
6397

6498
private interface WorkbenchApi {
99+
@RequestLine("GET /projects")
100+
@Headers("Accept: application/json")
101+
List<Reference> listProjects();
102+
103+
@RequestLine("GET /projects/{projectId}")
104+
@Headers("Accept: application/json")
105+
Project getProject(@Param("projectId") String projectId);
106+
107+
@RequestLine("GET /projects/{projectId}/scenarios/{scenarioId}")
108+
@Headers("Accept: application/json")
109+
Scenario getScenario(@Param("projectId") String projectId, @Param("scenarioId") String scenarioId);
110+
111+
@RequestLine("GET /projects/{projectId}/scripts/{scriptId}")
112+
@Headers("Accept: application/json")
113+
Script getScript(@Param("projectId") String projectId, @Param("scriptId") String scriptId);
114+
115+
@RequestLine("GET /projects/{projectId}/datasets/{dataSetId}")
116+
@Headers("Accept: application/json")
117+
DataSet getDataSet(@Param("projectId") String projectId, @Param("dataSetId") String dataSetId);
118+
119+
@RequestLine("GET /projects/{projectId}/scenarios/{scenarioId}/tests/{testId}")
120+
@Headers("Accept: application/json")
121+
Test getTest(@Param("projectId") String projectId, @Param("scenarioId") String scenarioId, @Param("testId") String testId);
122+
65123
@RequestLine("POST /projects/{projectId}/scenarios/{scenarioId}/tests")
66124
@Headers("Accept: application/json")
67125
Test startTest(@Param("projectId") String projectId, @Param("scenarioId") String scenarioId);

‎src/main/java/loadster/sdk/types/DataSet.java‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
public class DataSet {
1111
private String id;
12+
private String projectId;
1213
private String name;
1314
private Date createdDate;
1415
private Date modifiedDate;
@@ -22,6 +23,14 @@ public void setId(String id) {
2223
this.id = id;
2324
}
2425

26+
public String getProjectId() {
27+
return projectId;
28+
}
29+
30+
public void setProjectId(String projectId) {
31+
this.projectId = projectId;
32+
}
33+
2534
public String getName() {
2635
return name;
2736
}

‎src/main/java/loadster/sdk/types/Script.java‎

Lines changed: 9 additions & 0 deletions

0 commit comments

Comments
 (0)