44import feign .jackson .JacksonDecoder ;
55import feign .jackson .JacksonEncoder ;
66import 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
129import java .io .IOException ;
1310import 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 );
0 commit comments