Browse Source

rename example.sh

CalvinKirs 4 years ago
parent
commit
cf042ccd6c

+ 2 - 2
dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtilsTest.java

@@ -26,9 +26,9 @@ public class ProcessUtilsTest {
 
     private static final String rootPath = System.getProperty("user.dir");
 
-    private static final String shellFilPath = rootPath + "/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/script/shell/example.sh";
+    private static final String shellFilPath = rootPath + "/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/script/shell/test.sh";
 
-    private String[] cmd = {"/bin/sh", "-c", shellFilPath + " " + "testMsg" + " " + "userParams"};
+    private String[] cmd = {"/bin/sh", "-c", shellFilPath + " -t 1"};
 
     @Test
     public void testExecuteScript() {

+ 1 - 1
dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSenderTest.java

@@ -35,7 +35,7 @@ public class ScriptSenderTest {
 
     private static final String rootPath = System.getProperty("user.dir");
 
-    private static final String shellFilPath = rootPath + "/src/test/script/shell/scriptTest.sh";
+    private static final String shellFilPath = rootPath + "/src/test/script/shell/scriptExample.sh";
 
     @Before
     public void initScriptConfig() {

+ 6 - 0
dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/script/shell/scriptTest.sh

@@ -25,6 +25,12 @@ while getopts t:c:p: opts; do
     esac
 done
 
+
+# Write your specific logic here
+
+# Set the exit code according to your execution result, and alert needs to use it to judge the status of this alarm result
+
+
 if  [ "$t" = "error msg title" ]
    then
      exit 12

+ 7 - 12
dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/script/shell/example.sh

@@ -15,18 +15,13 @@
 # limitations under the License.
 #
 
+while getopts t: opts; do
+    case $opts in
+        t) t=$OPTARG ;;
+        ?) ;;
+    esac
+done
 
-title=$1
-content=$2
-userParams=$3
+echo "$t"
 
-echo "$title"
-
-echo "$content"
-
-echo "$userParams"
-
-# Write your specific logic here
-
-# Set the exit code according to your execution result, and alert needs to use it to judge the status of this alarm result
 exit 0