Skip to content

Commit

Permalink
add load local path
Browse files Browse the repository at this point in the history
  • Loading branch information
aressu1985 committed May 28, 2024
1 parent 9ea319c commit 430ebf7
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 1 deletion.
Binary file modified lib/mo-tester-1.0-SNAPSHOT.jar
Binary file not shown.
1 change: 1 addition & 0 deletions src/main/java/io/mo/Tester.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public static void main(String[] args){
srcPath = srcPath.substring(0,srcPath.indexOf(COMMON.RESOURCE_DIR)+COMMON.RESOURCE_DIR.length());
}
COMMON.RESOURCE_PATH = srcPath;
COMMON.RESOURCE_LOCAL_PATH = srcPath;
}

//get method
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/io/mo/constant/COMMON.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class COMMON {

public static String COLUMN_SEPARATOR_FLAG = "-- @separator:";
public static String RESOURCE_PATH_FLAG = "\\$resources";
public static String RESOURCE_LOCAL_PATH_FLAG= "\\$resources_local";

public static String WAIT_FLAG = "-- @wait:";

Expand All @@ -55,6 +56,7 @@ public class COMMON {
public static String RESOURCE_DIR = "resources";

public static String RESOURCE_PATH = "./resources";
public static String RESOURCE_LOCAL_PATH = "./resources";
public static String UPDATE_RESULT_TEMPLATE = "Query OK, {num} row affected";

public static int WAIT_TIMEOUT = 5000;
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/io/mo/db/Executor.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ public static void run(TestScript script){
//connection.setCatalog(command.getUseDB());
command.setUseDB(connection.getCatalog());
statement = connection.createStatement();
String sqlCmd = command.getCommand().replaceAll(COMMON.RESOURCE_PATH_FLAG,COMMON.RESOURCE_PATH);
String sqlCmd = command.getCommand()
.replaceAll(COMMON.RESOURCE_LOCAL_PATH_FLAG,COMMON.RESOURCE_LOCAL_PATH)
.replaceAll(COMMON.RESOURCE_PATH_FLAG,COMMON.RESOURCE_PATH);
if(command.isNeedWait()){
execWaitOperation(command);
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/io/mo/util/RunConfUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public static String getResourcePath(){
srcPath = srcPath.replace(COMMON.CASES_DIR,COMMON.RESOURCE_DIR);
srcPath = srcPath.substring(0,srcPath.indexOf(COMMON.RESOURCE_DIR)+COMMON.RESOURCE_DIR.length());
}
COMMON.RESOURCE_LOCAL_PATH = srcPath;
return srcPath == null?COMMON.RESOURCE_PATH:srcPath;
}

Expand Down

0 comments on commit 430ebf7

Please sign in to comment.