From de893d80def7d33c98bebba18d057617d29515a3 Mon Sep 17 00:00:00 2001 From: Luca Cavanna Date: Fri, 17 Jan 2014 18:03:59 +0100 Subject: [PATCH] [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. --- rest-api-spec/api/get.json | 2 +- .../elasticsearch/test/rest/spec/RestApi.java | 18 ------------------ .../elasticsearch/test/rest/spec/RestSpec.java | 16 +--------------- 3 files changed, 2 insertions(+), 34 deletions(-) diff --git a/rest-api-spec/api/get.json b/rest-api-spec/api/get.json index 248c3a6d7d2..13ee3951069 100644 --- a/rest-api-spec/api/get.json +++ b/rest-api-spec/api/get.json @@ -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", diff --git a/src/test/java/org/elasticsearch/test/rest/spec/RestApi.java b/src/test/java/org/elasticsearch/test/rest/spec/RestApi.java index 605a4b2173c..0996df45b48 100644 --- a/src/test/java/org/elasticsearch/test/rest/spec/RestApi.java +++ b/src/test/java/org/elasticsearch/test/rest/spec/RestApi.java @@ -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 paths) { - this(restApi, restApi.getName(), paths, restApi.getMethods()); - } - - private RestApi(RestApi restApi, String name, List paths, List 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; } diff --git a/src/test/java/org/elasticsearch/test/rest/spec/RestSpec.java b/src/test/java/org/elasticsearch/test/rest/spec/RestSpec.java index b72df81ecc5..6da859151e5 100644 --- a/src/test/java/org/elasticsearch/test/rest/spec/RestSpec.java +++ b/src/test/java/org/elasticsearch/test/rest/spec/RestSpec.java @@ -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,19 +38,7 @@ 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 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); - } + restApiMap.put(restApi.getName(), restApi); } public RestApi getApi(String api) {