|
32 | 32 | import co.elastic.clients.elasticsearch._types.query_dsl.Query;
|
33 | 33 | import co.elastic.clients.elasticsearch._types.query_dsl.ShapeQuery;
|
34 | 34 | import co.elastic.clients.elasticsearch._types.query_dsl.TermQuery;
|
| 35 | +import co.elastic.clients.elasticsearch.cluster.HealthResponse; |
35 | 36 | import co.elastic.clients.elasticsearch.connector.UpdateIndexNameRequest;
|
36 | 37 | import co.elastic.clients.elasticsearch.core.SearchResponse;
|
37 | 38 | import co.elastic.clients.elasticsearch.core.rank_eval.RankEvalQuery;
|
|
40 | 41 | import co.elastic.clients.json.LazyDeserializer;
|
41 | 42 | import co.elastic.clients.json.ObjectDeserializer;
|
42 | 43 | import co.elastic.clients.testkit.ModelTestCase;
|
| 44 | +import co.elastic.clients.util.ApiTypeHelper; |
43 | 45 | import co.elastic.clients.util.MapBuilder;
|
44 | 46 | import org.junit.jupiter.api.Test;
|
45 | 47 |
|
@@ -436,4 +438,34 @@ public void testArrayToMapHitMatchedQueries() {
|
436 | 438 | assertTrue(mapResp.hits().hits().get(0).matchedQueries().containsKey("test"));
|
437 | 439 | assertTrue(mapResp.hits().hits().get(0).matchedQueries().get("test").equals(1D));
|
438 | 440 | }
|
| 441 | + |
| 442 | + @Test |
| 443 | + public void testDangerousDisablePropertyCheckPrimitive(){ |
| 444 | + try (ApiTypeHelper.DisabledChecksHandle h = |
| 445 | + ApiTypeHelper.DANGEROUS_disableRequiredPropertiesCheck(true)) { |
| 446 | + HealthResponse healthResponse = HealthResponse.of(hr -> hr.withJson(new StringReader("{\n" + |
| 447 | + " \"cluster_name\" : \"6f47f6476fb04820aeaae5cfabf3c3f7\",\n" + |
| 448 | + " \"status\" : \"green\",\n" + |
| 449 | + " \"timed_out\" : false,\n" + |
| 450 | + " \"number_of_nodes\" : 3,\n" + |
| 451 | + " \"number_of_data_nodes\" : 2,\n" + |
| 452 | + " \"active_primary_shards\" : 88,\n" + |
| 453 | + " \"active_shards\" : 176,\n" + |
| 454 | + " \"relocating_shards\" : 0,\n" + |
| 455 | + " \"initializing_shards\" : 0,\n" + |
| 456 | + " \"unassigned_shards\" : 0,\n" + |
| 457 | + " \"delayed_unassigned_shards\" : 0,\n" + |
| 458 | + " \"number_of_pending_tasks\" : 0,\n" + |
| 459 | + " \"number_of_in_flight_fetch\" : 0,\n" + |
| 460 | + " \"task_max_waiting_in_queue_millis\" : 0,\n" + |
| 461 | + " \"active_shards_percent_as_number\" : 100.0\n" + |
| 462 | + "}"))); |
| 463 | + |
| 464 | + // checking that a required, but missing property has its default value assigned |
| 465 | + assertTrue(healthResponse.unassignedShards()==0); |
| 466 | + |
| 467 | + // checking that roundtrip works |
| 468 | + assertTrue(healthResponse.toString()!=null); |
| 469 | + } |
| 470 | + } |
439 | 471 | }
|
0 commit comments