@@ -0,0 +1,2389 @@
+package REST.hotspotMetricResultEndpoint;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0Aimport org.json.JSONObject;%0A%0Aimport com.mashape.unirest.http.HttpResponse;%0Aimport com.mashape.unirest.http.JsonNode;%0A%0Aimport strategy.RESTStrategy;%0A%0Apublic class RepositoryId extends RESTStrategy %7B%0A%0A%09private String repositoryId;%0A%09private int hotspot_metric_result_id;%0A%0A%09@Override%0A%09public void beforeExperiment() throws Exception %7B%0A%09%09HashMap%3CString, HashMap%3CString, String%3E%3E parameters = new HashMap%3CString, HashMap%3CString, String%3E%3E();%0A%09%09HashMap%3CString, String%3E repository = new HashMap%3CString, String%3E();%0A%09%09parameters.put(%22repository%22, repository);%0A%09%09repository.put(%22address%22, %22https://github.com/mezuro/kalibro_client.git%22);%0A%09%09repository.put(%22name%22, %22name%22);%0A%09%09repository.put(%22scm_type%22, %22GIT%22);%0A%09%09repository.put(%22kalibro_configuration_id%22, %222%22);%0A%09%09JSONObject jsonBody = new JSONObject(parameters);%0A%09%09HttpResponse%3CJsonNode%3E response = post(buildUrl(REPOSITORY_PATH), jsonBody);%0A%09%09repositoryId = ((JSONObject) (response.getBody().getObject().get(%22repository%22))).get(%22id%22).toString();%0A%0A%09%09get(buildUrl(REPOSITORY_PATH + %22/%22 + repositoryId + %22/process%22));%0A%0A%09%09boolean hasReadyProcessing;%0A%09%09do %7B%0A%09%09%09Thread.sleep(1000);%0A%09%09%09hasReadyProcessing = get(buildUrl(REPOSITORY_PATH + %22/%22 + repositoryId + %22/has_ready_processing%22))%0A%09%09%09%09%09.getBody().getObject().getBoolean(%22has_ready_processing%22);%0A%09%09%7D while(!hasReadyProcessing);%0A%09%09%0A%09%09HttpResponse%3CJsonNode%3E last_processing = get(buildUrl(REPOSITORY_PATH + %22/%22 + repositoryId + %22/last_ready_processing%22));%0A%09%09int root_module_result_id = last_processing.getBody().getObject().getJSONObject(%22last_ready_processing%22).getInt(%22root_module_result_id%22);%0A%09%09HttpResponse%3CJsonNode%3E hotspot_metric_results = get(buildUrl(MODULE_RESULT_PATH + %22/%22 + root_module_result_id + %22/hotspot_metric_results%22));%0A%09%09hotspot_metric_result_id = hotspot_metric_results.getBody().getObject().getJSONArray(%22hotspot_metric_results%22).getJSONObject(0).getInt(%22id%22);%0A%09%7D%0A%0A%09@Override%0A%09public String request(String string) throws Exception %7B%0A%09%09get(buildUrl(HOTSPOT_METRIC_RESULT_PATH + %22/%22 + hotspot_metric_result_id + %22/repository_id%22));%0A%09%09return repositoryId;%0A%09%7D%0A%0A%09@Override%0A%09public void afterExperiment() throws Exception %7B%0A%09%09delete(buildUrl(REPOSITORY_PATH + %22/%22 + repositoryId));%0A%09%7D%0A%0A%09@Override%0A%09public void configure(Map%3CObject, Object%3E options) %7B%0A%09%09configure(options, %22kalibro_processor%22);%0A%09%7D%0A%7D%0A

Add HotspotMetricResult#repositoy_id experiment