test_class.file: extra/src/test/java/org/wikimedia/search/extra/router/DegradedRouterQueryBuilderTest.java
test_class.identifier: DegradedRouterQueryBuilderTest
test_class.superclass: extends LuceneTestCase
test_case.body: @Test
      public void testParseExample() throws IOException {
          String json = "{\"degraded_router\": {\n" +
                  "   \"conditions\" : [\n" +
                  "       {\n" +
                  "           \"lt\": 70,\n" +
                  "           \"type\": \"cpu\"," +
                  "           \"query\": {\n" +
                  "               \"match_phrase\": {\n" +
                  "                   \"text\": \"input query\"\n" +
                  "               }\n" +
                  "           }\n" +
                  "       }\n" +
                  "   ],\n" +
                  "   \"fallback\": {\n" +
                  "       \"match_none\": {}\n" +
                  "   }\n" +
                  "}}";
  
          QueryBuilder builder = QueryBuilderTestUtils.FULLY_FEATURED.parseQuery(json);
          assertThat(builder, instanceOf(DegradedRouterQueryBuilder.class));
          DegradedRouterQueryBuilder qb = (DegradedRouterQueryBuilder) builder;
          assertNotNull(qb.systemLoad());
          assertEquals(1, qb.conditionStream().count());
          DegradedRouterQueryBuilder.DegradedCondition cond = qb.conditionStream().findFirst().get();
          assertEquals(DegradedConditionType.cpu, cond.type());
          assertThat(cond.query(), instanceOf(MatchPhraseQueryBuilder.class));
          assertEquals(ConditionDefinition.lt, cond.definition());
          assertEquals(70, cond.value());
          assertThat(qb.fallback(), instanceOf(MatchNoneQueryBuilder.class));
  
          DegradedRouterQueryBuilder expected = new DegradedRouterQueryBuilder();
          expected.condition(ConditionDefinition.lt, DegradedConditionType.cpu, null, null, 70,
                  new MatchPhraseQueryBuilder("text", "input query"));
          expected.fallback(new MatchNoneQueryBuilder());
          assertEquals(expected, qb);
      }
test_case.class_method_signature: DegradedRouterQueryBuilderTest.testParseExample()
test_case.full_signature: @Test public void testParseExample()
test_case.identifier: testParseExample
test_case.invocations: parseQuery assertThat instanceOf assertNotNull systemLoad assertEquals count conditionStream get findFirst conditionStream assertEquals type assertThat query instanceOf assertEquals definition assertEquals value assertThat fallback instanceOf condition fallback assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testParseExample()
focal_class.declarator: NAME = new ParseField("degraded_router")
focal_class.modifier: public static final
focal_class.original_string: public static final ParseField NAME = new ParseField("degraded_router");
focal_class.type: ParseField
focal_class.var_name: NAME
focal_class.declarator: TYPE = new ParseField("type")
focal_class.modifier: private static final
focal_class.original_string: private static final ParseField TYPE = new ParseField("type");
focal_class.type: ParseField
focal_class.var_name: TYPE
focal_class.declarator: BUCKET = new ParseField("bucket")
focal_class.modifier: private static final
focal_class.original_string: private static final ParseField BUCKET = new ParseField("bucket");
focal_class.type: ParseField
focal_class.var_name: BUCKET
focal_class.declarator: PERCENTILE = new ParseField("percentile")
focal_class.modifier: private static final
focal_class.original_string: private static final ParseField PERCENTILE = new ParseField("percentile");
focal_class.type: ParseField
focal_class.var_name: PERCENTILE
focal_class.declarator: PARSER
focal_class.modifier: private static final
focal_class.original_string: private static final ObjectParser<DegradedRouterQueryBuilder, Void> PARSER;
focal_class.type: ObjectParser<DegradedRouterQueryBuilder, Void>
focal_class.var_name: PARSER
focal_class.declarator: COND_PARSER
focal_class.modifier: private static final
focal_class.original_string: private static final ObjectParser<DegradedConditionParserState, Void> COND_PARSER;
focal_class.type: ObjectParser<DegradedConditionParserState, Void>
focal_class.var_name: COND_PARSER
focal_class.declarator: systemLoad
focal_class.modifier: @Nullable private
focal_class.original_string: @Nullable private SystemLoad systemLoad;
focal_class.type: SystemLoad
focal_class.var_name: systemLoad
focal_class.file: extra/src/main/java/org/wikimedia/search/extra/router/DegradedRouterQueryBuilder.java
focal_class.identifier: DegradedRouterQueryBuilder
focal_class.class_method_signature: DegradedRouterQueryBuilder.DegradedRouterQueryBuilder()
focal_class.full_signature:   DegradedRouterQueryBuilder()
focal_class.identifier: DegradedRouterQueryBuilder
focal_class.parameters: ()
focal_class.signature:  DegradedRouterQueryBuilder()
focal_class.class_method_signature: DegradedRouterQueryBuilder.DegradedRouterQueryBuilder(StreamInput in, SystemLoad systemLoad)
focal_class.full_signature: public  DegradedRouterQueryBuilder(StreamInput in, SystemLoad systemLoad)
focal_class.identifier: DegradedRouterQueryBuilder
focal_class.modifiers: public
focal_class.parameters: (StreamInput in, SystemLoad systemLoad)
focal_class.signature:  DegradedRouterQueryBuilder(StreamInput in, SystemLoad systemLoad)
focal_class.class_method_signature: DegradedRouterQueryBuilder.getWriteableName()
focal_class.full_signature: @Override public String getWriteableName()
focal_class.identifier: getWriteableName
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getWriteableName()
focal_class.class_method_signature: DegradedRouterQueryBuilder.fromXContent(
              XContentParser parser, SystemLoad systemLoad
      )
focal_class.full_signature: public static DegradedRouterQueryBuilder fromXContent(
              XContentParser parser, SystemLoad systemLoad
      )
focal_class.identifier: fromXContent
focal_class.modifiers: public static
focal_class.parameters: (
              XContentParser parser, SystemLoad systemLoad
      )
focal_class.return: DegradedRouterQueryBuilder
focal_class.signature: DegradedRouterQueryBuilder fromXContent(
              XContentParser parser, SystemLoad systemLoad
      )
focal_class.class_method_signature: DegradedRouterQueryBuilder.doRewrite(QueryRewriteContext context)
focal_class.full_signature: @Override public QueryBuilder doRewrite(QueryRewriteContext context)
focal_class.identifier: doRewrite
focal_class.modifiers: @Override public
focal_class.parameters: (QueryRewriteContext context)
focal_class.return: QueryBuilder
focal_class.signature: QueryBuilder doRewrite(QueryRewriteContext context)
focal_class.class_method_signature: DegradedRouterQueryBuilder.condition(ConditionDefinition def, DegradedConditionType type, String bucket, Double percentile, int value, QueryBuilder query)
focal_class.full_signature: @VisibleForTesting void condition(ConditionDefinition def, DegradedConditionType type, String bucket, Double percentile, int value, QueryBuilder query)
focal_class.identifier: condition
focal_class.modifiers: @VisibleForTesting
focal_class.parameters: (ConditionDefinition def, DegradedConditionType type, String bucket, Double percentile, int value, QueryBuilder query)
focal_class.return: void
focal_class.signature: void condition(ConditionDefinition def, DegradedConditionType type, String bucket, Double percentile, int value, QueryBuilder query)
focal_class.superclass: extends AbstractRouterQueryBuilder<DegradedCondition, DegradedRouterQueryBuilder>
focal_method.body: @VisibleForTesting
      void condition(ConditionDefinition def, DegradedConditionType type, String bucket, Double percentile, int value, QueryBuilder query) {
          condition(new DegradedCondition(def, type, bucket, percentile, value, query));
      }
focal_method.class_method_signature: DegradedRouterQueryBuilder.condition(ConditionDefinition def, DegradedConditionType type, String bucket, Double percentile, int value, QueryBuilder query)
focal_method.full_signature: @VisibleForTesting void condition(ConditionDefinition def, DegradedConditionType type, String bucket, Double percentile, int value, QueryBuilder query)
focal_method.identifier: condition
focal_method.invocations: condition
focal_method.modifiers: @VisibleForTesting
focal_method.parameters: (ConditionDefinition def, DegradedConditionType type, String bucket, Double percentile, int value, QueryBuilder query)
focal_method.return: void
focal_method.signature: void condition(ConditionDefinition def, DegradedConditionType type, String bucket, Double percentile, int value, QueryBuilder query)