[SPEC] Removed _source endpoint from get api spec, as the get_source is a different api already

Also removed custom code that was required in the REST tests due to this.
This commit is contained in:
Luca Cavanna 2014-01-17 18:03:59 +01:00
parent 42377db084
commit de893d80de
3 changed files with 2 additions and 34 deletions

View File

@ -4,7 +4,7 @@
"methods": ["GET"],
"url": {
"path": "/{index}/{type}/{id}",
"paths": ["/{index}/{type}/{id}", "/{index}/{type}/{id}/_source"],
"paths": ["/{index}/{type}/{id}"],
"parts": {
"id": {
"type" : "string",

View File

@ -23,7 +23,6 @@ import com.google.common.collect.Maps;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -50,23 +49,6 @@ public class RestApi {
this.name = name;
}
RestApi(RestApi restApi, String name, String... methods) {
this(restApi, name, restApi.getPaths(), Arrays.asList(methods));
}
RestApi(RestApi restApi, List<String> paths) {
this(restApi, restApi.getName(), paths, restApi.getMethods());
}
private RestApi(RestApi restApi, String name, List<String> paths, List<String> methods) {
this.name = name;
this.paths.addAll(paths);
this.methods.addAll(methods);
this.pathParts.addAll(restApi.getPathParts());
this.params.addAll(restApi.getParams());
this.body = restApi.body;
}
public String getName() {
return name;
}

View File

@ -18,7 +18,6 @@
*/
package org.elasticsearch.test.rest.spec;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.json.JsonXContent;
@ -27,7 +26,6 @@ import org.elasticsearch.test.rest.support.FileUtils;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
@ -40,20 +38,8 @@ public class RestSpec {
}
void addApi(RestApi restApi) {
if ("get".equals(restApi.getName())) {
//TODO get_source endpoint shouldn't be present in the rest spec for the get api
//as get_source is already a separate api
List<String> paths = Lists.newArrayList();
for (String path : restApi.getPaths()) {
if (!path.endsWith("/_source")) {
paths.add(path);
}
}
restApiMap.put(restApi.getName(), new RestApi(restApi, paths));
} else {
restApiMap.put(restApi.getName(), restApi);
}
}
public RestApi getApi(String api) {
return restApiMap.get(api);