RESTful Storage Service

from version 1.5

In order to support the continuous load testing during the continuous integration process, which has become very popular lately, the inspectIT has decided to provide limited storage services via RESTful protocol. This article describes all the provided services in details.

JSON Format

RESTful Storage Service returns all the results in the JSON format.

Services

Invoking Service

All services can be invoked with the HTTP requests. The services are bounded to the IP of the CMR and port that is used for HTTP communication (defaults to 8182). Please see the Port configuration page to confirm the correct port used for the HTTP communication, if the default one has been changed.

The example URL for invoking Get All Storages is:

http://localhost:8182/rest/storage

Overview

ServiceDescription
Get All StoragesThis service returns the list of currently existing storages on the CMR.
Get One Storage DetailsThis service returns the details of one existing storage on the CMR.
Create StorageThis service enables the creation of new storage. The service returns the details of newly created storage.
Finalize StorageThis service enables the finalization of existing storage.
Delete StorageThis service enables the deletion of existing storage.
Get Recording StateThis service returns the current recording state.
Start or Schedule RecordingThis service enables that the recording is started or scheduled to be started in the future.
Stop RecordingThis service enables the stop of the recording.


1. Get All Storages

This service returns the list of currently existing storages on the CMR.

Path:/rest/storage
Example URI:/rest/storage
Example output:
[
   {
      "id":"648ab3c3-5980-4aa3-96cd-c7d360a3b9e9",
      "name":"NewStorage",
      "diskSize":112,
      "description":null,
      "cmrVersion":"n/a",
      "labelList":[
         {
            "id":0,
            "dateValue":1391605845482,
            "storageLabelType":{
               "id":0,
               "onePerStorage":true,
               "editable":false,
               "valueReusable":false,
               "multiType":false,
               "valueClass":"java.util.Date",
               "groupingEnabled":true
            },
            "value":1391605845482,
            "formatedValue":"Feb 5, 2014"
         }
      ],
      "state":"OPENED",
      "storageRecording":false,
      "storageClosed":false,
      "storageOpened":true,
      "storageFolder":"648ab3c3-5980-4aa3-96cd-c7d360a3b9e9"
   },
   {
      "id":"1383f79c-9a26-440d-a891-8c7956adf1fb",
      "name":"Ivan's",
      "diskSize":108,
      "description":null,
      "cmrVersion":"n/a",
      "labelList":[
         {
            "id":0,
            "dateValue":1391605770264,
            "storageLabelType":{
               "id":0,
               "onePerStorage":true,
               "editable":false,
               "valueReusable":false,
               "multiType":false,
               "valueClass":"java.util.Date",
               "groupingEnabled":true
            },
            "value":1391605770264,
            "formatedValue":"Feb 5, 2014"
         }
      ],
      "state":"OPENED",
      "storageRecording":false,
      "storageClosed":false,
      "storageOpened":true,
      "storageFolder":"1383f79c-9a26-440d-a891-8c7956adf1fb"
   }
]

2. Get One Storage Details

This service returns the details of one existing storage on the CMR.

Path:/rest/storage/{id}
Parameters:
  1. id (String value, required) - Id of the storage to get.
Example URI:/rest/storage/6d623a4b-e9e4-4fdc-ab3b-c1e89d4c6873
Example output:
{
   "id":"d6dd6e91-541e-495f-9d51-b1728865cd9c",
   "name":"Created via REST",
   "diskSize":118,
   "description":null,
   "cmrVersion":"n/a",
   "labelList":[
      {
         "id":0,
         "dateValue":1391607409138,
         "storageLabelType":{
            "id":0,
            "onePerStorage":true,
            "editable":false,
            "valueReusable":false,
            "multiType":false,
            "valueClass":"java.util.Date",
            "groupingEnabled":true
         },
         "value":1391607409138,
         "formatedValue":"Feb 5, 2014"
      }
   ],
   "state":"OPENED",
   "storageRecording":false,
   "storageClosed":false,
   "storageOpened":true,
   "storageFolder":"d6dd6e91-541e-495f-9d51-b1728865cd9c"
}

 

3. Create Storage

This service enables the creation of new storage. The service returns the details of newly created storage.

Path:/rest/storage/{name}/create
Parameters:
  1. name (String value, required) - Name for the new storage.
Example URI:/rest/storage/Created%20via%20REST/create
Example output:
{
   "message":"Storage successfully created.",
   "storage":{
      "id":"d6dd6e91-541e-495f-9d51-b1728865cd9c",
      "name":"Created via REST",
      "diskSize":0,
      "description":null,
      "cmrVersion":"n/a",
      "labelList":[
         {
            "id":0,
            "dateValue":1391607409138,
            "storageLabelType":{
               "id":0,
               "onePerStorage":true,
               "editable":false,
               "valueReusable":false,
               "multiType":false,
               "valueClass":"java.util.Date",
               "groupingEnabled":true
            },
            "value":1391607409138,
            "formatedValue":"Feb 5, 2014"
         }
      ],
      "state":"OPENED",
      "storageRecording":false,
      "storageClosed":false,
      "storageOpened":true,
      "storageFolder":"d6dd6e91-541e-495f-9d51-b1728865cd9c"
   }
}

4. Finalize Storage

This service enables the finalization of existing storage.

Path:/rest/storage/{id}/finalize
Parameters:
  1. id (String value, required) - ID of the storage to be deleted.
Example URI:/rest/storage/d6dd6e91-541e-495f-9d51-b1728865cd9c/finalize
Example output:
{
   "message":"Storage id d6dd6e91-541e-495f-9d51-b1728865cd9c successfully finalized."
}

5. Delete Storage

This service enables the deletion of existing storage.

Path:/rest/storage/{id}/delete
Parameters:
  1. id (String value, required) - ID of the storage to be deleted.
Example URI:/rest/storage/d6dd6e91-541e-495f-9d51-b1728865cd9c/delete
Example output:
{
   "message":"Storage id d6dd6e91-541e-495f-9d51-b1728865cd9c successfully deleted."
}

6. Get Recording State

This service returns the current recording state. Output is in map format containing the current state (ON, OFF or SCHEDULED) as well as additional information based on the current state.

Path:/rest/storage/state
Example URI:/rest/storage/state
Example output:
{
   "recordingStatus":"OFF"
}

7. Start or Schedule Recording

This service enables that the recording is started or scheduled to be started in the future. User are advised to first read Recording page for basic information.

Path:/rest/storage/start
Parameters:
  1. id (String value, required) - ID of the storage where recording data will be saved.
  2. startDelay (Long value, optional) - number of milliseconds to delay the start of the recording, if not passed recording starts right away
  3. recordingDuration (Long value, optional) - number of milliseconds recording will last, if not passed there is no limit to recording duration
  4. extractInvocations (Boolean value, optional) - boolean defining if the data contained in the invocation sequences should be extracted, if not passed defaults to true
  5. autoFinalize (Boolean value, optional) - boolean defining if the storage should be auto-finalize when recording is stopped, if not passed defaults to true
Example URI:/rest/storage/start?id=6d623a4b-e9e4-4fdc-ab3b-c1e89d4c6873&startDelay=60000&extractInvocations=false&autoFinalize=true
Example output:
{
   "message":"Recording scheduled.",
   "recordingStorage":{
      "id":"82f184b5-5e04-473f-9917-372b71104238",
      "name":"NewStorage",
      "diskSize":112,
      "description":null,
      "cmrVersion":"n/a",
      "labelList":[
         {
            "id":0,
            "dateValue":1391607347073,
            "storageLabelType":{
               "id":0,
               "onePerStorage":true,
               "editable":false,
               "valueReusable":false,
               "multiType":false,
               "valueClass":"java.util.Date",
               "groupingEnabled":true
            },
            "value":1391607347073,
            "formatedValue":"Feb 5, 2014"
         }
      ],
      "state":"RECORDING",
      "storageRecording":true,
      "storageClosed":false,
      "storageOpened":true,
      "storageFolder":"82f184b5-5e04-473f-9917-372b71104238"
   }
}

Starting or scheduling the recording must provide the ID of the existing storage that is in writable state (not closed).

If a parameter value passed can not be correctly converted from String to the correct type, the TypeMismatchException will be thrown:

{"error":"Failed to convert value of type 'java.lang.String' to required type 'java.lang.Boolean'; nested exception is java.lang.IllegalArgumentException: Invalid boolean value [trueasdad]","exceptionType":"org.springframework.beans.TypeMismatchException"}



8. Stop Recording

This service enables the stop of the recording.

Path:/rest/storage/stop
Example URI:/rest/storage/stop
Example output:
{"message":"Recording stopped."}

Exception Handling

If any call to the provided services results in an exception, the JSON output that will be returned will mark call as error providing the additional information on the exception:

{ "error" : "Recording is already active/scheduled with different storage. Only one storage at time can be choosen as recording destination.",
  "exceptionType" : "info.novatec.inspectit.storage.StorageException"
}