Skip to content

Instantly share code, notes, and snippets.

@sriki77
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sriki77/0e09ad41ae2e5b097c26 to your computer and use it in GitHub Desktop.
Save sriki77/0e09ad41ae2e5b097c26 to your computer and use it in GitHub Desktop.
Serverside Code Gen By Swagger
package io.swagger.api;
import io.swagger.annotations.ApiParam;
import io.swagger.api.factories.SessionsApiServiceFactory;
import io.swagger.model.Session;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import java.io.File;
@Path("/sessions")
@io.swagger.annotations.Api(value = "/sessions", description = "the sessions API")
public class SessionsApi {
private final SessionsApiService delegate = SessionsApiServiceFactory.getSessionsApi();
@GET
@Produces({"application/json"})
@io.swagger.annotations.ApiOperation(value = "Returns the list of all recorded sessions.\n", notes = "Returns the list of all recorded sessions.\n", response = String.class, responseContainer = "List")
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "List of sessions")})
public Response sessionsGet()
throws NotFoundException {
return delegate.sessionsGet();
}
@GET
@Path("/{sessionId}")
@Produces({"application/json"})
@io.swagger.annotations.ApiOperation(value = "Returns the details of the recorded session specified by session Id.\n", notes = "Returns the details of the recorded session specified by session Id.\n", response = Session.class)
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "Session Details.")})
public Response sessionsSessionIdGet(@ApiParam(value = "Id of the session whose details are needed.", required = true) @PathParam("sessionId") String sessionId)
throws NotFoundException {
return delegate.sessionsSessionIdGet(sessionId);
}
@GET
@Path("/{sessionId}/clear")
@io.swagger.annotations.ApiOperation(value = "Clears the specified session of all its scenarios.\n", notes = "Clears the specified session of all its scenarios.\n", response = Void.class)
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "Successfully cleared session.")})
public Response sessionsSessionIdClearGet(@ApiParam(value = "Id of the session whose scenarios has to be cleared.", required = true) @PathParam("sessionId") String sessionId)
throws NotFoundException {
return delegate.sessionsSessionIdClearGet(sessionId);
}
@GET
@Path("/{sessionId}/replayVerifySummary")
@Produces({"text/plain"})
@io.swagger.annotations.ApiOperation(value = "Summary of replay operation.\n", notes = "When replay and verification is enabled against the specified destination - the results are stored on the replay engine host. This API returns a short summary of the replay verification operation.\n", response = String.class)
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "Session name, Passed Scenario count and Failed Scenario count are returned.")})
public Response sessionsSessionIdReplayVerifySummaryGet(@ApiParam(value = "Id of the session whose replay summary is needed.", required = true) @PathParam("sessionId") String sessionId)
throws NotFoundException {
return delegate.sessionsSessionIdReplayVerifySummaryGet(sessionId);
}
@GET
@Path("/{sessionId}/testPlan")
@Produces({"application/octet-stream"})
@io.swagger.annotations.ApiOperation(value = "Produces a JMeter JMX test plan for the specified recorded session.\n", notes = "The recorded scenarios are exported as JMX test plan. This test plan can be used for replay. The JMX test plan will contain all the scenarios with assertions. \nThe parameters to this API allow filtering of the scenarios that get exported as part of the JMX file. You can export only scenarios which contain the specified header value in the scenario request.\n", response = File.class)
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "JMX test plan for the specified request.")})
public Response sessionsSessionIdTestPlanGet(@ApiParam(value = "Id of the session whose test plan is needed.", required = true) @PathParam("sessionId") String sessionId,
@ApiParam(value = "name of the request header.") @QueryParam("header") String header,
@ApiParam(value = "substring that must be contained in the specified header value.") @QueryParam("contains") String contains)
throws NotFoundException {
return delegate.sessionsSessionIdTestPlanGet(sessionId, header, contains);
}
}
package io.swagger.api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.model.Session;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import java.io.File;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@Controller
@RequestMapping(value = "/sessions", produces = {APPLICATION_JSON_VALUE})
@Api(value = "/sessions", description = "the sessions API")
public class SessionsApi {
@ApiOperation(value = "Returns the list of all recorded sessions.\n", notes = "Returns the list of all recorded sessions.\n", response = String.class, responseContainer = "List")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "List of sessions")})
@RequestMapping(value = "",
produces = {"application/json"},
method = RequestMethod.GET)
public ResponseEntity<String> sessionsGet()
throws NotFoundException {
// do some magic!
return new ResponseEntity<String>(HttpStatus.OK);
}
@ApiOperation(value = "Returns the details of the recorded session specified by session Id.\n", notes = "Returns the details of the recorded session specified by session Id.\n", response = Session.class)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Session Details.")})
@RequestMapping(value = "/{sessionId}",
produces = {"application/json"},
method = RequestMethod.GET)
public ResponseEntity<Session> sessionsSessionIdGet(
@ApiParam(value = "Id of the session whose details are needed.", required = true) @PathVariable("sessionId") String sessionId
)
throws NotFoundException {
// do some magic!
return new ResponseEntity<Session>(HttpStatus.OK);
}
@ApiOperation(value = "Clears the specified session of all its scenarios.\n", notes = "Clears the specified session of all its scenarios.\n", response = Void.class)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successfully cleared session.")})
@RequestMapping(value = "/{sessionId}/clear",
method = RequestMethod.GET)
public ResponseEntity<Void> sessionsSessionIdClearGet(
@ApiParam(value = "Id of the session whose scenarios has to be cleared.", required = true) @PathVariable("sessionId") String sessionId
)
throws NotFoundException {
// do some magic!
return new ResponseEntity<Void>(HttpStatus.OK);
}
@ApiOperation(value = "Summary of replay operation.\n", notes = "When replay and verification is enabled against the specified destination - the results are stored on the replay engine host. This API returns a short summary of the replay verification operation.\n", response = String.class)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Session name, Passed Scenario count and Failed Scenario count are returned.")})
@RequestMapping(value = "/{sessionId}/replayVerifySummary",
produces = {"text/plain"},
method = RequestMethod.GET)
public ResponseEntity<String> sessionsSessionIdReplayVerifySummaryGet(
@ApiParam(value = "Id of the session whose replay summary is needed.", required = true) @PathVariable("sessionId") String sessionId
)
throws NotFoundException {
// do some magic!
return new ResponseEntity<String>(HttpStatus.OK);
}
@ApiOperation(value = "Produces a JMeter JMX test plan for the specified recorded session.\n", notes = "The recorded scenarios are exported as JMX test plan. This test plan can be used for replay. The JMX test plan will contain all the scenarios with assertions. \nThe parameters to this API allow filtering of the scenarios that get exported as part of the JMX file. You can export only scenarios which contain the specified header value in the scenario request.\n", response = File.class)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "JMX test plan for the specified request.")})
@RequestMapping(value = "/{sessionId}/testPlan",
produces = {"application/octet-stream"},
method = RequestMethod.GET)
public ResponseEntity<File> sessionsSessionIdTestPlanGet(
@ApiParam(value = "Id of the session whose test plan is needed.", required = true) @PathVariable("sessionId") String sessionId
,
@ApiParam(value = "name of the request header.") @RequestParam(value = "header", required = false) String header
,
@ApiParam(value = "substring that must be contained in the specified header value.") @RequestParam(value = "contains", required = false) String contains
)
throws NotFoundException {
// do some magic!
return new ResponseEntity<File>(HttpStatus.OK);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment