1
0
Эх сурвалжийг харах

[TEST] Added create api (hardcoded) to REST tests suite as it has no spec but it's just a variation of the index api

Luca Cavanna 11 жил өмнө
parent
commit
3d0c06e2f4

+ 16 - 0
src/test/java/org/elasticsearch/test/rest/spec/RestSpec.java

@@ -38,6 +38,22 @@ public class RestSpec {
     }
     }
 
 
     void addApi(RestApi restApi) {
     void addApi(RestApi restApi) {
+        if ("index".equals(restApi.getName())) {
+            RestApi create = new RestApi("create");
+            create.addPath("/{index}/{type}");
+            create.addPath("/{index}/{type}/{id}/_create");
+            create.setBodyRequired();
+            for (String method : restApi.getMethods()) {
+                create.addMethod(method);
+            }
+            for (String param : restApi.getParams()) {
+                create.addParam(param);
+            }
+            for (String pathPart : restApi.getPathParts()) {
+                create.addPathPart(pathPart);
+            }
+            restApiMap.put(create.getName(), create);
+        }
         restApiMap.put(restApi.getName(), restApi);
         restApiMap.put(restApi.getName(), restApi);
     }
     }