[ server ] [ scheduler ]- script scheduler - 3

This commit is contained in:
zeaslity
2023-01-17 16:27:35 +08:00
parent 8ef3b271b1
commit e080d3f858
11 changed files with 280 additions and 94 deletions

View File

@@ -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);
}
}