Browse Source

code style

2.0.7-release
lenboo 3 years ago
parent
commit
501c93602a
  1. 3
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/log/SensitiveDataConverter.java
  2. 28
      dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/log/SensitiveDataConverterTest.java

3
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/log/SensitiveDataConverter.java

@ -14,11 +14,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.dolphinscheduler.server.log;
package org.apache.dolphinscheduler.server.log;
import ch.qos.logback.classic.pattern.MessageConverter; import ch.qos.logback.classic.pattern.MessageConverter;
import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.classic.spi.ILoggingEvent;
import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.utils.SensitiveLogUtils; import org.apache.dolphinscheduler.common.utils.SensitiveLogUtils;
import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.common.utils.StringUtils;

28
dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/log/SensitiveDataConverterTest.java

@ -14,15 +14,17 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.dolphinscheduler.server.log;
package org.apache.dolphinscheduler.server.log;
import ch.qos.logback.classic.Level; import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.spi.IThrowableProxy; import ch.qos.logback.classic.spi.IThrowableProxy;
import ch.qos.logback.classic.spi.LoggerContextVO; import ch.qos.logback.classic.spi.LoggerContextVO;
import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.utils.SensitiveLogUtils; import org.apache.dolphinscheduler.common.utils.SensitiveLogUtils;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -42,17 +44,18 @@ public class SensitiveDataConverterTest {
*/ */
private final Pattern pwdPattern = Pattern.compile(Constants.DATASOURCE_PASSWORD_REGEX); private final Pattern pwdPattern = Pattern.compile(Constants.DATASOURCE_PASSWORD_REGEX);
private final String logMsg = "{\"address\":\"jdbc:mysql://192.168.xx.xx:3306\"," + private final String logMsg = "{\"address\":\"jdbc:mysql://192.168.xx.xx:3306\","
"\"database\":\"carbond\"," + + "\"database\":\"carbond\","
"\"jdbcUrl\":\"jdbc:mysql://192.168.xx.xx:3306/ods\"," + + "\"jdbcUrl\":\"jdbc:mysql://192.168.xx.xx:3306/ods\","
"\"user\":\"view\"," + + "\"user\":\"view\","
"\"password\":\"view1\"}"; + "\"password\":\"view1\"}";
private final String maskLogMsg = "{\"address\":\"jdbc:mysql://192.168.xx.xx:3306\"," + private final String maskLogMsg = "{\"address\":\"jdbc:mysql://192.168.xx.xx:3306\","
"\"database\":\"carbond\"," + + "\"database\":\"carbond\","
"\"jdbcUrl\":\"jdbc:mysql://192.168.xx.xx:3306/ods\"," + + "\"jdbcUrl\":\"jdbc:mysql://192.168.xx.xx:3306/ods\","
"\"user\":\"view\"," + + "\"user\":\"view\","
"\"password\":\"******\"}"; + "\"password\":\"******\"}";
@Test @Test
public void convert() { public void convert() {
SensitiveDataConverter sensitiveDataConverter = new SensitiveDataConverter(); SensitiveDataConverter sensitiveDataConverter = new SensitiveDataConverter();
@ -175,5 +178,4 @@ public class SensitiveDataConverterTest {
} }
} }

Loading…
Cancel
Save