[ server ] [ scheduler ]- script scheduler - 3
This commit is contained in:
@@ -1,13 +1,74 @@
|
||||
package io.wdd.server;
|
||||
|
||||
import io.wdd.rpc.execute.service.CoreExecutionService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@SpringBootTest
|
||||
class ServerApplicationTests {
|
||||
|
||||
|
||||
@Resource
|
||||
CoreExecutionService coreExecutionService;
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
void testCoreExecutionCompleteScript() {
|
||||
|
||||
ArrayList<String> command1 = new ArrayList<>(
|
||||
List.of(
|
||||
"echo",
|
||||
"yes"
|
||||
)
|
||||
);
|
||||
|
||||
ArrayList<String> command2 = new ArrayList<>(
|
||||
List.of(
|
||||
"apt-get",
|
||||
"update"
|
||||
)
|
||||
);
|
||||
|
||||
ArrayList<String> command3 = new ArrayList<>(
|
||||
List.of(
|
||||
"echo",
|
||||
"no"
|
||||
)
|
||||
);
|
||||
|
||||
ArrayList<String> command4 = new ArrayList<>(
|
||||
List.of(
|
||||
"apt-get",
|
||||
"install",
|
||||
"nginx",
|
||||
"-y"
|
||||
)
|
||||
);
|
||||
|
||||
List<List<String>> completeScript = new ArrayList<>();
|
||||
completeScript.add(command1);
|
||||
completeScript.add(command2);
|
||||
completeScript.add(command3);
|
||||
completeScript.add(command4);
|
||||
|
||||
|
||||
ArrayList<String> targetMachineList = new ArrayList<>(
|
||||
List.of(
|
||||
"Chengdu-amd64-98-98066f"
|
||||
)
|
||||
);
|
||||
|
||||
List<String> resultList = coreExecutionService.SendCommandToAgentComplete(
|
||||
targetMachineList,
|
||||
"Scheduled Script",
|
||||
completeScript
|
||||
);
|
||||
|
||||
|
||||
System.out.println("resultList = " + resultList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user