Bughue commented on code in PR #6325: URL: https://github.com/apache/incubator-seata/pull/6325#discussion_r1479178525
########## test/src/test/java/org/apache/seata/common/ConfigurationTestHelper.java: ########## @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.seata.common; + +import org.apache.commons.lang.ObjectUtils; +import org.apache.seata.config.ConfigurationCache; +import org.apache.seata.config.ConfigurationFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * the type ConfigurationTestHelper + **/ +public class ConfigurationTestHelper { + + private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationTestHelper.class); + + + private static final long PUT_CONFIG_TIMEOUT = 30000L; + private static final long PUT_CONFIG_CHECK_GAP = 500L; + + public static void removeConfig(String dataId) { + putConfig(dataId, null); + } + + public static void putConfig(String dataId, String content) { Review Comment: I understand the point of mock-server, this class is only used for tests where you need to dynamically change the configuration in the unit test. It is only involved in the mock-server unit tests because it shares a key with TC-server. Normal users don't need to use this test class to use mock-server, if they want to change the port they just need to use mock-server/resource/application.yml This complexity arises because the unit tests for both mock-server and seata-server are in one package, or maybe we can create another test subproject for mock-server? 我理解mock-server的意义,这个类仅用于测试时需要动态改变单元测试里的配置。在mock-server的单元测试里因为和TC-server共用了一个key才会涉及它。 正常的用户在使用mock-server里是不需要用到这个test类的,他们如果想改变端口只需要使用mock-server/resource/application.yml 这个复杂性的出现是因为mock-server和seata-server的单元测试都在一个包里,又或者我们可以为mock-server再建一个test子项目? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
