public class MLHttpClient extends Object
| Constructor and Description |
|---|
MLHttpClient(org.wso2.carbon.automation.engine.context.beans.Instance mlInstance,
org.wso2.carbon.automation.engine.context.beans.User userInfo) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkDatasetStatus(int versionSetId,
long timeout,
int frequency)
Check the status of a dataset.
|
org.apache.http.client.methods.CloseableHttpResponse |
createAnalysis(String AnalysisName,
int ProjectId)
Create an Analysis
|
org.apache.http.client.methods.CloseableHttpResponse |
createAnalysisCrossOrigin(String AnalysisName,
int ProjectId)
Create an Analysis with CORS
|
org.apache.http.client.methods.CloseableHttpResponse |
createFileModelStorage(int modelId,
String folderName)
Create the file storage for a model
|
org.apache.http.client.methods.CloseableHttpResponse |
createModel(int analysisId,
int versionSetId)
Create a Model
|
org.apache.http.client.methods.CloseableHttpResponse |
createProject(String ProjectName,
String datasetName)
Create a project
|
org.apache.http.client.methods.CloseableHttpResponse |
doHttpDelete(String resourcePath) |
org.apache.http.client.methods.CloseableHttpResponse |
doHttpGet(String resourcePath)
Send a HTTP GET request to the given URI and return the response.
|
org.apache.http.client.methods.CloseableHttpResponse |
doHttpPost(String resourcePath)
Send a HTTP POST request to the given URI with null parameters and return the response.
|
org.apache.http.client.methods.CloseableHttpResponse |
doHttpPost(String resourcePath,
String parametersJson)
Send a HTTP POST request to the given URI and return the response.
|
org.apache.http.client.methods.CloseableHttpResponse |
doHttpPostCrossOrigin(String resourcePath,
String parametersJson)
Send a cross origin HTTP POST request to the given URI and return the response.
|
org.apache.http.client.methods.CloseableHttpResponse |
exportAsPMML(int modelId)
Download an existing serialized model in PMML format
|
int |
getAnalysisId(int projectId,
String analysisName)
Get the ID of an analysis from the name
|
int |
getAVersionSetIdOfDataset(int datasetId)
Get a ID of the first version-set of a dataset
|
String |
getBasicAuthKey()
Get the Encoded Key for Basic auth header
|
int |
getModelId(String modelName)
Get the model ID using the name of the model
|
String |
getModelName(org.apache.http.client.methods.CloseableHttpResponse response)
Extract the model name from the response
|
int |
getProjectId(String projectName)
Get the ID of the project from the name
|
String |
getResourceAbsolutePath(String resourceRelativePath)
Retrieves the absolute path of a test resource.
|
org.json.JSONObject |
getResponseAsJSONObject(org.apache.http.client.methods.CloseableHttpResponse response) |
String |
getResponseAsString(org.apache.http.client.methods.CloseableHttpResponse response) |
protected String |
getServerUrlHttp()
Get the Server URL.
|
protected String |
getServerUrlHttps()
Get the secured URL of the ml Server.
|
int |
getVersionSetIdOfDataset(int datasetId,
String version)
Get the ID of the version set with the given version and of a given dataset
|
org.apache.http.client.methods.CloseableHttpResponse |
predictFromCSV(long modelId,
String resourcePath) |
org.apache.http.client.methods.CloseableHttpResponse |
setFeatureCustomized(int analysisId,
String customizedFeatures)
Set feature customized for an analysis.
|
org.apache.http.client.methods.CloseableHttpResponse |
setFeatureDefaults(int analysisId)
Set feature defaults for an analysis.
|
org.apache.http.client.methods.CloseableHttpResponse |
setModelConfiguration(int analysisId,
Map<String,String> configurations)
Set Model Configurations of an analysis
|
org.apache.http.client.methods.CloseableHttpResponse |
uploadDatasetFromCSV(String datasetName,
String version,
String resourcePath)
Upload a sample datatset from resources
|
org.apache.http.client.methods.CloseableHttpResponse |
uploadDatasetFromDAS(String datasetName,
String version,
String tableName)
Upload a sample datatset from resources
|
public MLHttpClient(org.wso2.carbon.automation.engine.context.beans.Instance mlInstance,
org.wso2.carbon.automation.engine.context.beans.User userInfo)
protected String getServerUrlHttps()
MLIntegrationBaseTestExceptionprotected String getServerUrlHttp()
MLIntegrationBaseTestExceptionpublic org.apache.http.client.methods.CloseableHttpResponse doHttpGet(String resourcePath) throws MLHttpClientException
MLHttpClientExceptionpublic org.apache.http.client.methods.CloseableHttpResponse doHttpPost(String resourcePath, String parametersJson) throws MLHttpClientException
parametersJson - Payload JSON stringMLHttpClientExceptionpublic org.apache.http.client.methods.CloseableHttpResponse doHttpPostCrossOrigin(String resourcePath, String parametersJson) throws MLHttpClientException
parametersJson - Payload JSON stringMLHttpClientExceptionpublic org.apache.http.client.methods.CloseableHttpResponse doHttpPost(String resourcePath) throws MLHttpClientException
resourcePath - path of the api resourceMLHttpClientExceptionpublic org.apache.http.client.methods.CloseableHttpResponse doHttpDelete(String resourcePath) throws MLHttpClientException
MLHttpClientExceptionpublic String getBasicAuthKey()
public org.apache.http.client.methods.CloseableHttpResponse uploadDatasetFromCSV(String datasetName, String version, String resourcePath) throws MLHttpClientException
datasetName - Name for the datasetversion - Version for the datasetresourcePath - Relative path the CSV file in resourcesMLHttpClientExceptionpublic org.apache.http.client.methods.CloseableHttpResponse uploadDatasetFromDAS(String datasetName, String version, String tableName) throws MLHttpClientException
datasetName - Name for the datasetversion - Version for the datasettableName - Relative path the CSV file in resourcesMLHttpClientExceptionpublic org.apache.http.client.methods.CloseableHttpResponse predictFromCSV(long modelId,
String resourcePath)
throws MLHttpClientException
MLHttpClientExceptionpublic org.apache.http.client.methods.CloseableHttpResponse createProject(String ProjectName, String datasetName) throws MLHttpClientException
ProjectName - Name for the projectMLHttpClientExceptionpublic org.apache.http.client.methods.CloseableHttpResponse createAnalysis(String AnalysisName, int ProjectId) throws MLHttpClientException
AnalysisName - Name for the AnalysisMLHttpClientExceptionpublic org.apache.http.client.methods.CloseableHttpResponse createAnalysisCrossOrigin(String AnalysisName, int ProjectId) throws MLHttpClientException
AnalysisName - Name for the AnalysisMLHttpClientExceptionpublic org.apache.http.client.methods.CloseableHttpResponse setFeatureDefaults(int analysisId)
throws MLHttpClientException
analysisId - ID of the analysisMLHttpClientExceptionpublic boolean checkDatasetStatus(int versionSetId,
long timeout,
int frequency)
throws MLHttpClientException,
IOException
versionSetId - timeout - frequency - MLHttpClientExceptionorg.json.JSONExceptionIOExceptionpublic org.apache.http.client.methods.CloseableHttpResponse setFeatureCustomized(int analysisId,
String customizedFeatures)
throws MLHttpClientException
analysisId - ID of the analysiscustomizedFeatures - customized features jsonMLHttpClientExceptionpublic org.apache.http.client.methods.CloseableHttpResponse setModelConfiguration(int analysisId,
Map<String,String> configurations)
throws MLHttpClientException
analysisId - ID of the analysisconfigurations - Map of configurationsMLHttpClientExceptionpublic int getProjectId(String projectName) throws MLHttpClientException
projectName - Name of the projectMLHttpClientExceptionpublic int getAnalysisId(int projectId,
String analysisName)
throws MLHttpClientException
analysisName - Name of the analysisMLHttpClientExceptionpublic int getAVersionSetIdOfDataset(int datasetId)
throws MLHttpClientException
datasetId - ID of the datasetorg.apache.http.client.ClientProtocolExceptionMLHttpClientExceptionpublic int getVersionSetIdOfDataset(int datasetId,
String version)
throws MLHttpClientException
datasetId - ID of the datasetorg.apache.http.client.ClientProtocolExceptionMLHttpClientExceptionpublic org.apache.http.client.methods.CloseableHttpResponse createModel(int analysisId,
int versionSetId)
throws MLHttpClientException
analysisId - ID of the analysis associated with the modelversionSetId - ID of the version set to be used for the modelMLHttpClientExceptionpublic String getResponseAsString(org.apache.http.client.methods.CloseableHttpResponse response) throws MLHttpClientException
response - CloseableHttpResponseMLHttpClientExceptionpublic org.json.JSONObject getResponseAsJSONObject(org.apache.http.client.methods.CloseableHttpResponse response)
throws MLHttpClientException
response - CloseableHttpResponseMLHttpClientExceptionpublic int getModelId(String modelName) throws MLHttpClientException
modelName - Name of the modelMLHttpClientExceptionpublic org.apache.http.client.methods.CloseableHttpResponse createFileModelStorage(int modelId,
String folderName)
throws MLHttpClientException
modelId - ID of the modelfolderName - Name of the directory/sub-directoryMLHttpClientExceptionpublic String getResourceAbsolutePath(String resourceRelativePath)
resourceRelativePath - Relative path of the test resource.public String getModelName(org.apache.http.client.methods.CloseableHttpResponse response) throws MLHttpClientException
response - MLHttpClientExceptionpublic org.apache.http.client.methods.CloseableHttpResponse exportAsPMML(int modelId)
throws MLHttpClientException
modelId - MLHttpClientExceptionCopyright © 2016 WSO2, Inc.. All rights reserved.