[ Cmii ] [ Octopus ] - add tcp portforwarding part
This commit is contained in:
@@ -17,9 +17,9 @@ 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;
|
||||
import java.util.Optional;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@SpringBootTest
|
||||
public class TestBaseFuncScheduler {
|
||||
@@ -51,47 +51,24 @@ public class TestBaseFuncScheduler {
|
||||
projectDeployContext.setProjectId(projectServerId);
|
||||
|
||||
|
||||
// ServerQueryEntity serverQueryEntity = new ServerQueryEntity();
|
||||
// // exsi server
|
||||
//// serverQueryEntity.setServerName("Chengdu-amd64-99");
|
||||
// // lappro
|
||||
//// serverQueryEntity.setServerName("Chengdu-amd64-65");
|
||||
//
|
||||
// // cqga
|
||||
// serverQueryEntity.setServerName();
|
||||
// ServerInfoPO serverInfoPO = serverService
|
||||
// .serverGetByPage(serverQueryEntity)
|
||||
// .getRecords()
|
||||
// .get(0);
|
||||
|
||||
String masterNodeServerName = "Chongqing-amd64-01"; // cgga
|
||||
// String masterNodeServerName = "Chengdu-amd64-99"; // lap pro
|
||||
|
||||
ProjectServerVO projectServerVO = coreProjectServerService.projectServerOne(projectServerId);
|
||||
Map<Boolean, List<ServerInfoPO>> collect = projectServerVO.getBindingServerList().stream().collect(
|
||||
Collectors.groupingBy(
|
||||
serverInfoPO -> StringUtils.contains(serverInfoPO.getServerName(), masterNodeServerName)
|
||||
)
|
||||
);
|
||||
|
||||
Optional<ServerInfoPO> serverInfoPOOptional = projectServerVO.getBindingServerList().stream().filter(
|
||||
serverInfoPO -> StringUtils.contains(serverInfoPO.getServerName(), masterNodeServerName)
|
||||
).findFirst();
|
||||
|
||||
if (serverInfoPOOptional.isEmpty()) {
|
||||
System.out.printf("project of %s server of %s is empty", projectServerVO, masterNodeServerName);
|
||||
if (collect.get(Boolean.TRUE) == null) {
|
||||
System.out.printf("project of %s master server of %s is empty", projectServerVO, masterNodeServerName);
|
||||
return;
|
||||
}
|
||||
projectDeployContext.setMasterNode(collect.get(Boolean.TRUE).get(0));
|
||||
|
||||
ServerInfoPO serverInfoPO = serverInfoPOOptional.get();
|
||||
System.out.println("serverInfoPO = " + serverInfoPO);
|
||||
|
||||
projectDeployContext.setMasterNode(serverInfoPO);
|
||||
ArrayList<ServerInfoPO> agentNodeList = new ArrayList<>();
|
||||
|
||||
projectServerVO.getBindingServerList().forEach(
|
||||
po -> {
|
||||
if (!StringUtils.contains(po.getServerName(), masterNodeServerName)) {
|
||||
agentNodeList.add(po);
|
||||
}
|
||||
}
|
||||
);
|
||||
projectDeployContext.setAgentNodeList(agentNodeList);
|
||||
projectDeployContext.setAgentNodeList(collect.get(Boolean.FALSE));
|
||||
|
||||
|
||||
List<BaseFunctionEnum> masterNodeProcedure = List.of(
|
||||
|
||||
Reference in New Issue
Block a user