@PostMapping("/plugin/selectorAndRules")
    public Mono<String> selectorAndRules(@RequestBody final SelectorRulesData selectorRulesData) {
        SelectorData selectorData = SelectorData.builder()
                .pluginName(selectorRulesData.getPluginName())
                .handle(selectorRulesData.getSelectorHandler())
                .matchMode(selectorRulesData.getMatchMode())
                .conditionList(selectorRulesData.getConditionDataList())
                .type(SelectorTypeEnum.CUSTOM_FLOW.getCode())
                .sort(Optional.ofNullable(selectorRulesData.getSort()).orElse(10))
                .build();
        SelectorData result = buildDefaultSelectorData(selectorData);
        subscriber.onSelectorSubscribe(result);
        saveDiscoveryUpstreamData(result);
        List<RuleLocalData> ruleDataList = selectorRulesData.getRuleDataList();
        for (RuleLocalData data : ruleDataList) {
            RuleData ruleData = RuleData.builder()
                    .selectorId(result.getId())
                    .pluginName(result.getPluginName())
                    .name(data.getRuleName())
                    .matchMode(data.getMatchMode())
                    .handle(data.getRuleHandler())
                    .conditionDataList(data.getConditionDataList())
                    .build();
            subscriber.onRuleSubscribe(buildDefaultRuleData(ruleData));
        }
        return Mono.just(Constants.SUCCESS);
    }
@Test
    public void testSelectorAndRules() throws Exception {
        final LocalPluginController.SelectorRulesData selectorRulesData = new LocalPluginController.SelectorRulesData();
        selectorRulesData.setPluginName("pluginName");
        selectorRulesData.setSelectorName("selectorName");
        selectorRulesData.setSelectorHandler("[]");
        selectorRulesData.setMatchMode(0);
        LocalPluginController.RuleLocalData ruleLocalData = new LocalPluginController.RuleLocalData();
        ruleLocalData.setRuleName("ruleName");
        ruleLocalData.setRuleHandler("{}");
        ruleLocalData.setMatchMode(0);
        ruleLocalData.setConditionDataList(Collections.emptyList());
        selectorRulesData.setRuleDataList(Collections.singletonList(ruleLocalData));
        selectorRulesData.setConditionDataList(Collections.emptyList());
        this.mockMvc
                .perform(MockMvcRequestBuilders.post("/shenyu/plugin/selectorAndRules")
                .content(GsonUtils.getGson().toJson(selectorRulesData))
                .contentType(MediaType.APPLICATION_JSON))
                .andExpect(status().isOk())
                .andReturn();
        Assertions.assertNotNull(baseDataCache.obtainSelectorData(selectorRulesData.getPluginName()));
        Assertions.assertEquals(selectorRulesData.getSelectorName(), "selectorName");
    }