Skip to content

Commit

Permalink
move PATTERN_FOR_KEY_VALUE_ARG from Utils to CommandLineUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
bowenliang123 committed Nov 28, 2023
1 parent cbb4b41 commit 5e9e703
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 0 additions & 2 deletions kyuubi-common/src/main/scala/org/apache/kyuubi/Utils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,6 @@ object Utils extends Logging {

val REDACTION_REPLACEMENT_TEXT = "*********(redacted)"

private val PATTERN_FOR_KEY_VALUE_ARG = "(.+?)=(.+)".r

def redactCommandLineArgs(conf: KyuubiConf, commands: Iterable[String]): Iterable[String] = {
val redactionPattern = conf.get(SERVER_SECRET_REDACTION_PATTERN)
var nextKV = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import java.io.File
object CommandLineUtils {
val CONF = "--conf"

val PATTERN_FOR_KEY_VALUE_ARG = "(.+?)=(.+)".r

/**
* The Java command's option name for classpath
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
* limitations under the License.
*/
package org.apache.kyuubi.util.command

// scalastyle:off
import org.scalatest.funsuite.AnyFunSuite

// scalastyle:on
import org.apache.kyuubi.util.AssertionUtils._
import org.apache.kyuubi.util.command.CommandLineUtils._

// scalastyle:off
Expand All @@ -30,6 +29,10 @@ class CommandUtilsSuite extends AnyFunSuite {
assertResult("abc=123")(genKeyValuePair("abc", "123"))
assertResult("abc=123")(genKeyValuePair(" abc", "123 "))
assertResult("abc.def=xyz.123")(genKeyValuePair("abc.def", "xyz.123"))

assertMatches(genKeyValuePair("abc", "123"), PATTERN_FOR_KEY_VALUE_ARG)
assertMatches(genKeyValuePair(" abc", "123 "), PATTERN_FOR_KEY_VALUE_ARG)
assertMatches(genKeyValuePair("abc.def", "xyz.123"), PATTERN_FOR_KEY_VALUE_ARG)
}

test("assemble key value pair with config option") {
Expand Down

0 comments on commit 5e9e703

Please sign in to comment.