PreparedStatement createPsForInsertConfigInfo(final String srcIp, final String srcUser, final ConfigInfo configInfo,
            Map<String, Object> configAdvanceInfo, Connection connection, ConfigInfoMapper configInfoMapper)
            throws SQLException {
        final String appNameTmp = StringUtils.defaultEmptyIfBlank(configInfo.getAppName());
        final String tenantTmp = StringUtils.defaultEmptyIfBlank(configInfo.getTenant());
        final String desc = configAdvanceInfo == null ? null : (String) configAdvanceInfo.get("desc");
        final String use = configAdvanceInfo == null ? null : (String) configAdvanceInfo.get("use");
        final String effect = configAdvanceInfo == null ? null : (String) configAdvanceInfo.get("effect");
        final String type = configAdvanceInfo == null ? null : (String) configAdvanceInfo.get("type");
        final String schema = configAdvanceInfo == null ? null : (String) configAdvanceInfo.get("schema");
        final String encryptedDataKey =
                configInfo.getEncryptedDataKey() == null ? StringUtils.EMPTY : configInfo.getEncryptedDataKey();
        final String md5Tmp = MD5Utils.md5Hex(configInfo.getContent(), Constants.ENCODE);

        String insertSql = configInfoMapper.insert(
                Arrays.asList("data_id", "group_id", "tenant_id", "app_name", "content", "md5", "src_ip", "src_user",
                        "gmt_create@NOW()", "gmt_modified@NOW()", "c_desc", "c_use", "effect", "type", "c_schema",
                        "encrypted_data_key"));
        PreparedStatement ps = connection.prepareStatement(insertSql, configInfoMapper.getPrimaryKeyGeneratedKeys());
        ps.setString(1, configInfo.getDataId());
        ps.setString(2, configInfo.getGroup());
        ps.setString(3, tenantTmp);
        ps.setString(4, appNameTmp);
        ps.setString(5, configInfo.getContent());
        ps.setString(6, md5Tmp);
        ps.setString(7, srcIp);
        ps.setString(8, srcUser);
        ps.setString(9, desc);
        ps.setString(10, use);
        ps.setString(11, effect);
        ps.setString(12, type);
        ps.setString(13, schema);
        ps.setString(14, encryptedDataKey);
        return ps;
    }
@Test
    void testCreatePsForInsertConfigInfo() throws SQLException {
        
        Map<String, Object> configAdvanceInfo = new HashMap<>();
        configAdvanceInfo.put("config_tags", "tag1,tag2");
        configAdvanceInfo.put("desc", "desc11");
        configAdvanceInfo.put("use", "use2233");
        configAdvanceInfo.put("effect", "effect222");
        configAdvanceInfo.put("type", "type3");
        configAdvanceInfo.put("schema", "schema");
        String dataId = "dataId";
        String group = "group";
        String tenant = "tenant";
        String content = "content132456";
        ConfigInfo configInfo = new ConfigInfo(dataId, group, tenant, null, content);
        Connection mockConnection = Mockito.mock(Connection.class);
        PreparedStatement preparedStatement = Mockito.mock(PreparedStatement.class);
        
        ConfigInfoMapper configInfoMapper = externalConfigInfoPersistService.mapperManager.findMapper(dataSourceService.getDataSourceType(),
                TableConstant.CONFIG_INFO);
        
        Mockito.when(mockConnection.prepareStatement(anyString(), any(String[].class))).thenReturn(preparedStatement);
        String srcIp = "srcIp";
        String srcUser = "srcUser";
        externalConfigInfoPersistService.createPsForInsertConfigInfo(srcIp, srcUser, configInfo, configAdvanceInfo, mockConnection,
                configInfoMapper);
        Mockito.verify(preparedStatement, times(14)).setString(anyInt(), anyString());
    }