Unverified Commit a0273cb3 authored by Licho's avatar Licho Committed by GitHub

fix: execute jar with no space follow (#2906)

* fix: execute jar with no space follow Signed-off-by: 's avatarlicho <lecho.sun@gmail.com> * Spotless Apply --------- Signed-off-by: 's avatarlicho <lecho.sun@gmail.com> Co-authored-by: 's avatarleechor <leechor@users.noreply.github.com>
parent 5d9cc046
......@@ -36,7 +36,7 @@ import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.util.StrUtil;
public class ExecuteJarParseStrategy extends AbstractRegexParseStrategy {
private static final String PATTERN_STR = "^EXECUTE\\s+JAR\\s+WITH\\s?\\(\\s+(.*\\s+)+\\)";
private static final String PATTERN_STR = "^EXECUTE\\s+JAR\\s+WITH\\s*\\(.+\\)";
private static final Pattern PATTERN = Pattern.compile(PATTERN_STR, Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
public static final ExecuteJarParseStrategy INSTANCE = new ExecuteJarParseStrategy();
......
/*
*
* 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.dinky.trans.parse;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.Test;
public class ExecuteJarParseStrategyTest {
@Test
public void testMatch() {
ExecuteJarParseStrategy strategy = new ExecuteJarParseStrategy();
assertTrue(strategy.match("EXECUTE JAR WITH ('jarPath' = 'hdfs://cluster1/user/flink/sql-client-test/test"
+ ".jar', 'className' = 'com.jd.dccs.sql.client.test.TestUDF')"));
assertFalse(strategy.match("EXECUTE JAR WITH ('jarPath' = 'hdfs://cluster1/user/flink/sql-client-test/test"
+ ".jar', 'className' = 'com.jd.dccs.sql.client.test.TestUDF') ENDOFSQL"));
assertTrue(strategy.match("EXECUTE JAR WITH ('jarPath' = 'hdfs://cluster1/user/flink/sql-client-test/test"
+ ".jar', 'className' = 'com.jd.dccs.sql.client.test.TestUDF')"));
assertTrue(strategy.match("EXECUTE JAR WITH ( 'jarPath' = 'hdfs://cluster1/user/flink/sql-client-test/test"
+ ".jar', 'className' = 'com.jd.dccs.sql.client.test.TestUDF' )"));
assertFalse(strategy.match("EXECUTE JAR WITH ( 'jarPath' = 'hdfs://cluster1/user/flink/sql-client-test/test"
+ ".jar', 'className' = 'com.jd.dccs.sql.client.test.TestUDF' "));
assertTrue(strategy.match("EXECUTE JAR WITH('jarPath' = 'hdfs://cluster1/user/flink/sql-client-test/test"
+ ".jar', 'className' = 'com.jd.dccs.sql.client.test.TestUDF')"));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment