【project】 accomplish the springcloud nacos config-center modification
This commit is contained in:
@@ -9,7 +9,7 @@ ENV JAVA_OPTS="-Xms2028m -Xmx2048m"
|
||||
# Set time zone
|
||||
RUN set -eux; \
|
||||
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime; \
|
||||
echo $TZ > /etc/timezone \
|
||||
echo $TZ > /etc/timezone
|
||||
|
||||
# Create Folder
|
||||
RUN mkdir -p /wdd
|
||||
|
||||
24
agent/Dockerfile-wsl2
Normal file
24
agent/Dockerfile-wsl2
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
# Base images that the image needs to depend on
|
||||
FROM icederce/eclipse-temurin-11-jre-focal
|
||||
|
||||
# Set environment variables
|
||||
ENV TZ=Asia/Shanghai serverName="" serverIpPbV4="" serverIpInV4="" serverIpPbV6="" serverIpInV6="" location="" provider="" managePort="" cpuBrand="" cpuCore="" memoryTotal="" diskTotal="" diskUsage="" osInfo="" osKernelInfo="" tcpControl="" virtualization="" ioSpeed=""
|
||||
ENV JAVA_OPTS="-Xms2028m -Xmx2048m"
|
||||
|
||||
# Set time zone
|
||||
RUN set -eux; \
|
||||
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime; \
|
||||
echo $TZ > /etc/timezone
|
||||
|
||||
# Create Folder
|
||||
RUN mkdir -p /wdd
|
||||
|
||||
# Define the work dir
|
||||
WORKDIR /wdd
|
||||
|
||||
# Copy the jar and rename it
|
||||
COPY ./target/agent-*.jar /wdd/agent.jar
|
||||
|
||||
# When the docker container starts, run the jar
|
||||
ENTRYPOINT exec java ${JAVA_OPTS} -jar /wdd/agent.jar
|
||||
@@ -2,6 +2,7 @@ package io.wdd.agent;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@SpringBootApplication
|
||||
public class AgentApplication {
|
||||
|
||||
@@ -7,6 +7,7 @@ import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.data.annotation.AccessType;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@@ -14,8 +15,8 @@ import java.time.LocalDateTime;
|
||||
@NoArgsConstructor
|
||||
public class CommandLog {
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lineTime;
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private String lineTime;
|
||||
|
||||
private String lineContend;
|
||||
|
||||
|
||||
31
agent/src/main/java/io/wdd/agent/config/wsl2-fixed-ip.bat
Normal file
31
agent/src/main/java/io/wdd/agent/config/wsl2-fixed-ip.bat
Normal file
@@ -0,0 +1,31 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
::不管三七二十一先停掉可能在跑的wsl实例
|
||||
wsl --shutdown Ubuntu-18.04
|
||||
::重新拉起来,并且用root的身份,启动ssh服务和docker服务
|
||||
wsl -u root service ssh start
|
||||
wsl -u root service docker start | findstr "Starting Docker" > nul
|
||||
if !errorlevel! equ 0 (
|
||||
echo docker start success
|
||||
:: 看看我要的IP在不在
|
||||
wsl -u root ip addr | findstr "172.24.240.10" > nul
|
||||
if !errorlevel! equ 0 (
|
||||
echo wsl ip has set
|
||||
) else (
|
||||
::不在的话给安排上
|
||||
wsl -u root ip addr add 172.24.240.10/24 broadcast 172.24.240.0 dev eth0 label eth0:1
|
||||
echo set wsl ip success: 172.24.240.10
|
||||
)
|
||||
|
||||
|
||||
::windows作为wsl的宿主,在wsl的固定IP的同一网段也给安排另外一个IP
|
||||
ipconfig | findstr "172.24.240.1" > nul
|
||||
if !errorlevel! equ 0 (
|
||||
echo windows ip has set
|
||||
) else (
|
||||
netsh interface ip add address "vEthernet (WSL)" 172.24.240.1 255.255.240.0
|
||||
echo set windows ip success: 172.24.240.1
|
||||
)
|
||||
)
|
||||
pause
|
||||
@@ -0,0 +1,28 @@
|
||||
package io.wdd.agent.excuetor.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
|
||||
|
||||
@Configuration
|
||||
public class RedisConfiguration {
|
||||
|
||||
@Bean
|
||||
public RedisTemplate<String, String> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
|
||||
|
||||
RedisTemplate<String, String> redisTemplate = new RedisTemplate<>();
|
||||
|
||||
redisTemplate.setConnectionFactory(redisConnectionFactory);
|
||||
|
||||
GenericJackson2JsonRedisSerializer jsonRedisSerializer = new GenericJackson2JsonRedisSerializer();
|
||||
redisTemplate.setKeySerializer(RedisSerializer.string());
|
||||
redisTemplate.setHashKeySerializer(RedisSerializer.string());
|
||||
redisTemplate.setValueSerializer(jsonRedisSerializer);
|
||||
redisTemplate.setHashValueSerializer(jsonRedisSerializer);
|
||||
return redisTemplate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package io.wdd.agent.excuetor.redis;
|
||||
|
||||
|
||||
import io.wdd.agent.config.beans.executor.CommandLog;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.stream.MapRecord;
|
||||
import org.springframework.data.redis.connection.stream.RecordId;
|
||||
import org.springframework.data.redis.connection.stream.StreamRecords;
|
||||
import org.springframework.data.redis.connection.stream.StringRecord;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Configuration
|
||||
public class StreamSender {
|
||||
|
||||
@Resource
|
||||
RedisTemplate redisTemplate;
|
||||
|
||||
|
||||
private static ByteBuffer currentTimeByteBuffer(){
|
||||
|
||||
byte[] timeBytes = LocalDateTime.now(ZoneId.of("UTC+8")).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")).getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
return ByteBuffer.wrap(timeBytes);
|
||||
}
|
||||
|
||||
private static String currentTimeString(){
|
||||
|
||||
return LocalDateTime.now(ZoneId.of("UTC+8")).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
|
||||
|
||||
public static String TEST_STREAM_JAVA = "test-stream-java";
|
||||
|
||||
|
||||
public boolean send(String streamKey, String content){
|
||||
|
||||
CommandLog commandLog = new CommandLog(currentTimeString(), content);
|
||||
Map<String, String> map = null;
|
||||
try {
|
||||
map = BeanUtils.describe(commandLog);
|
||||
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
StringRecord stringRecord = StreamRecords.string(map).withStreamKey(streamKey);
|
||||
|
||||
RecordId recordId = redisTemplate.opsForStream().add(stringRecord);
|
||||
|
||||
return ObjectUtils.isNotEmpty(recordId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SneakyThrows
|
||||
public void test(){
|
||||
|
||||
RecordId recordId = null;
|
||||
if (!redisTemplate.hasKey(TEST_STREAM_JAVA)) {
|
||||
|
||||
recordId = redisTemplate.opsForStream().add(TEST_STREAM_JAVA, generateFakeData());
|
||||
}
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
|
||||
Map fakeData = generateFakeData();
|
||||
|
||||
MapRecord mapRecord = StreamRecords.mapBacked(fakeData).withStreamKey(TEST_STREAM_JAVA);
|
||||
|
||||
|
||||
redisTemplate.opsForStream().add(mapRecord);
|
||||
|
||||
TimeUnit.MILLISECONDS.sleep(200);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
private static Map generateFakeData() {
|
||||
String random = RandomStringUtils.random(16);
|
||||
CommandLog commandLog = new CommandLog();
|
||||
|
||||
Map<String, String> map = BeanUtils.describe(commandLog);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
package io.wdd.agent.excuetor.redis;
|
||||
|
||||
|
||||
import io.wdd.agent.config.beans.executor.CommandLog;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.stream.MapRecord;
|
||||
import org.springframework.data.redis.connection.stream.RecordId;
|
||||
import org.springframework.data.redis.connection.stream.StreamRecords;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.hash.HashMapper;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Configuration
|
||||
public class StreamSenderTest {
|
||||
|
||||
@Resource
|
||||
RedisTemplate redisTemplate;
|
||||
|
||||
public static String TEST_STREAM_JAVA = "test-stream-java";
|
||||
|
||||
@SneakyThrows
|
||||
public void test(){
|
||||
|
||||
HashMapper hashMapper = redisTemplate.opsForStream().getHashMapper(CommandLog.class);
|
||||
|
||||
RecordId recordId = null;
|
||||
if (!redisTemplate.hasKey(TEST_STREAM_JAVA)) {
|
||||
|
||||
recordId = redisTemplate.opsForStream().add(TEST_STREAM_JAVA, generateFakeData(hashMapper));
|
||||
}
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
|
||||
Map fakeData = generateFakeData(hashMapper);
|
||||
|
||||
MapRecord mapRecord = StreamRecords.mapBacked(fakeData).withId(recordId).withStreamKey(TEST_STREAM_JAVA);
|
||||
|
||||
|
||||
recordId = redisTemplate.opsForStream(hashMapper).add(mapRecord);
|
||||
|
||||
TimeUnit.MILLISECONDS.sleep(200);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static Map generateFakeData(HashMapper hashMapper) {
|
||||
String random = RandomStringUtils.random(16);
|
||||
CommandLog commandLog = new CommandLog(LocalDateTime.now(), random);
|
||||
Map map = hashMapper.toHash(commandLog);
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package io.wdd.agent.excuetor.shell;
|
||||
|
||||
import com.google.common.io.ByteStreams;
|
||||
import io.wdd.agent.excuetor.redis.StreamSender;
|
||||
import io.wdd.agent.excuetor.thread.DaemonLogThread;
|
||||
import io.wdd.agent.excuetor.thread.LogToStreamSender;
|
||||
import io.wdd.agent.excuetor.thread.LogToSysOut;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
|
||||
@Configuration
|
||||
public class CommandExecutor {
|
||||
|
||||
@Resource
|
||||
StreamSender streamSender;
|
||||
|
||||
public void execute(String streamKey, String... command) throws IOException, InterruptedException, ExecutionException {
|
||||
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(command);
|
||||
|
||||
// processBuilder.redirectErrorStream(true);
|
||||
// processBuilder.inheritIO();
|
||||
processBuilder.directory(new File(System.getProperty("user.home")));
|
||||
Process process = processBuilder.start();
|
||||
|
||||
LogToStreamSender toStreamSender = new LogToStreamSender(streamKey, process.getInputStream(), streamSender::send);
|
||||
|
||||
// LogToSysOut(process.getInputStream(), System.out::println);
|
||||
|
||||
// a command shell don't understand how long it actually take
|
||||
int processResult = process.waitFor();
|
||||
System.out.println("processResult = " + processResult);
|
||||
|
||||
Future<?> future = DaemonLogThread.start(toStreamSender);
|
||||
|
||||
System.out.println("future.get() = " + future.get());
|
||||
}
|
||||
|
||||
|
||||
private ByteBuffer cvToByteBuffer(InputStream inputStream) throws IOException {
|
||||
|
||||
byte[] toByteArray = ByteStreams.toByteArray(inputStream);
|
||||
|
||||
ByteBuffer bufferByte = ByteBuffer.wrap(toByteArray);
|
||||
|
||||
return bufferByte;
|
||||
}
|
||||
|
||||
private String cvToString(InputStream inputStream) throws IOException {
|
||||
|
||||
String s = String.valueOf(ByteStreams.toByteArray(inputStream));
|
||||
|
||||
System.out.println("s = " + s);
|
||||
|
||||
return s;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package io.wdd.agent.excuetor.thread;
|
||||
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
public class DaemonLogThread {
|
||||
|
||||
private static final ExecutorService executorService;
|
||||
|
||||
static {
|
||||
|
||||
ThreadFactory daemonLogThread = new ThreadFactoryBuilder()
|
||||
.setDaemon(true)
|
||||
.setNameFormat("DaemonLogThread")
|
||||
.setPriority(1)
|
||||
.build();
|
||||
|
||||
executorService = Executors.newSingleThreadExecutor(daemonLogThread);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static Future<?> start(Runnable logToSenderTask) {
|
||||
|
||||
return executorService.submit(logToSenderTask);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package io.wdd.agent.excuetor.thread;
|
||||
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
public class LogToStreamSender implements Runnable {
|
||||
|
||||
private final InputStream contentInputStream;
|
||||
private final String streamKey;
|
||||
private final BiConsumer<String, String> biConsumer;
|
||||
|
||||
public LogToStreamSender(String streamKey, InputStream contentInputStream, BiConsumer<String, String> biConsumer) {
|
||||
this.contentInputStream = contentInputStream;
|
||||
this.biConsumer = biConsumer;
|
||||
this.streamKey = streamKey;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
new BufferedReader(new InputStreamReader(contentInputStream)).lines()
|
||||
.map(
|
||||
String::valueOf
|
||||
).map(
|
||||
lineStr -> {
|
||||
biConsumer.accept(streamKey, lineStr);
|
||||
return lineStr;
|
||||
}
|
||||
).forEach(System.out::println);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package io.wdd.agent.excuetor.thread;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class LogToSysOut implements Runnable {
|
||||
|
||||
private final InputStream inputStream;
|
||||
private final Consumer<String> consumer;
|
||||
|
||||
public LogToSysOut(InputStream inputStream, Consumer<String> consumer) {
|
||||
this.inputStream = inputStream;
|
||||
this.consumer = consumer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new BufferedReader(new InputStreamReader(inputStream)).lines()
|
||||
.map(
|
||||
String::valueOf
|
||||
)
|
||||
.forEach(consumer);
|
||||
}
|
||||
}
|
||||
@@ -1146,10 +1146,10 @@ main() {
|
||||
commonToolInstall
|
||||
|
||||
# 安装docker,版本信息在本脚本的开头处修改~~
|
||||
InstallDocker cn || return $?
|
||||
InstallDockerCompose || return $?
|
||||
modifySystemConfig_Docker
|
||||
changeDockerRegisterMirror || return $?
|
||||
# InstallDocker cn || return $?
|
||||
# InstallDockerCompose || return $?
|
||||
# modifySystemConfig_Docker
|
||||
# changeDockerRegisterMirror || return $?
|
||||
|
||||
# InstallRedis -p 36379 -m docker
|
||||
|
||||
|
||||
@@ -16,29 +16,22 @@ import org.springframework.context.annotation.Configuration;
|
||||
@Configuration
|
||||
public class InitRabbitMQConnector {
|
||||
|
||||
@Value("${octopus.message.init_exchange}")
|
||||
public String INIT_EXCHANGE;
|
||||
|
||||
@Value("${octopus.message.init_from_server}")
|
||||
public String INIT_FROM_SERVER;
|
||||
|
||||
@Value("${octopus.message.init_to_server}")
|
||||
public String INIT_TO_SERVER;
|
||||
|
||||
@Value("${octopus.message.init_from_server_key}")
|
||||
public String INIT_FROM_SERVER_KEY;
|
||||
|
||||
@Value("${octopus.message.init_to_server_key}")
|
||||
public String INIT_TO_SERVER_KEY;
|
||||
|
||||
@Value("${octopus.message.octopus_exchange}")
|
||||
public String OCTOPUS_EXCHANGE;
|
||||
|
||||
@Value("${octopus.message.octopus_to_server}")
|
||||
public String OCTOPUS_TO_SERVER;
|
||||
|
||||
//
|
||||
public static String SPECIFIC_AGENT_TOPIC_NAME;
|
||||
@Value("${octopus.message.init_exchange}")
|
||||
public String INIT_EXCHANGE;
|
||||
@Value("${octopus.message.init_from_server}")
|
||||
public String INIT_FROM_SERVER;
|
||||
@Value("${octopus.message.init_to_server}")
|
||||
public String INIT_TO_SERVER;
|
||||
@Value("${octopus.message.init_from_server_key}")
|
||||
public String INIT_FROM_SERVER_KEY;
|
||||
@Value("${octopus.message.init_to_server_key}")
|
||||
public String INIT_TO_SERVER_KEY;
|
||||
@Value("${octopus.message.octopus_exchange}")
|
||||
public String OCTOPUS_EXCHANGE;
|
||||
@Value("${octopus.message.octopus_to_server}")
|
||||
public String OCTOPUS_TO_SERVER;
|
||||
|
||||
@Bean
|
||||
public DirectExchange initDirectExchange() {
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
server:
|
||||
port: 8000
|
||||
|
||||
|
||||
spring:
|
||||
main:
|
||||
allow-circular-references: true
|
||||
allow-bean-definition-overriding: true
|
||||
rabbitmq:
|
||||
host: 127.0.0.1
|
||||
port: 35672
|
||||
username: boge
|
||||
password: boge14@Level5
|
||||
virtual-host: /wddserver
|
||||
listener:
|
||||
simple:
|
||||
retry:
|
||||
# ack failed will reentrant the Rabbit Listener
|
||||
max-attempts: 5
|
||||
enabled: true
|
||||
# retry interval unit ms
|
||||
max-interval: 5000
|
||||
initial-interval: 5000
|
||||
redis:
|
||||
host: 127.0.0.1
|
||||
port: 36379
|
||||
database: 0
|
||||
password: boge14@Level5
|
||||
|
||||
octopus:
|
||||
message:
|
||||
# agent boot up default common exchange
|
||||
init_exchange: InitExchange
|
||||
# server will send message to agent using this common queue
|
||||
init_to_server: InitToServer
|
||||
# agent boot up default common exchange routing key
|
||||
init_to_server_key: InitToServerKey
|
||||
# server will receive message from agent using this common queue
|
||||
init_from_server: InitFromServer
|
||||
# agent boot up default common exchange routing key
|
||||
init_from_server_key: InitFromServerKey
|
||||
# initialization register time out (unit ms) default is 5 min
|
||||
init_ttl: "3000000"
|
||||
# Octopus Exchange Name == server comunicate with agent
|
||||
octopus_exchange: OctopusExchange
|
||||
# Octopus Message To Server == all agent send info to server queue and topic
|
||||
octopus_to_server: OctopusToServer
|
||||
|
||||
logging:
|
||||
level:
|
||||
web: debug
|
||||
21
agent/src/main/resources/bootstrap.yml
Normal file
21
agent/src/main/resources/bootstrap.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
spring:
|
||||
application:
|
||||
name: octopus-agent
|
||||
profiles:
|
||||
active: local
|
||||
cloud:
|
||||
nacos:
|
||||
config:
|
||||
group: local
|
||||
config-retry-time: 3000
|
||||
file-extension: yaml
|
||||
max-retry: 3
|
||||
# server-addr: 43.154.83.213:21060
|
||||
# server-addr: 140.238.52.228:21060
|
||||
server-addr: https://nacos.107421.xyz:443
|
||||
timeout: 5000
|
||||
config-long-poll-timeout: 5000
|
||||
extension-configs:
|
||||
- group: local
|
||||
data-id: common-local.yaml
|
||||
|
||||
@@ -1,22 +1,37 @@
|
||||
package io.wdd.agent;
|
||||
|
||||
import io.wdd.agent.excuetor.redis.StreamSenderTest;
|
||||
import io.wdd.agent.initialization.bootup.OctopusAgentInitService;
|
||||
import io.wdd.agent.excuetor.shell.CommandExecutor;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
@SpringBootTest
|
||||
public class InitRabbitMQTest {
|
||||
|
||||
@Resource
|
||||
StreamSenderTest streamSenderTest;
|
||||
CommandExecutor commandExecutor;
|
||||
|
||||
|
||||
@Test
|
||||
void testInitSendInfo(){
|
||||
void testInitSendInfo() {
|
||||
|
||||
String homeDirectory = System.getProperty("user.home");
|
||||
try {
|
||||
String format = String.format("C:\\program files\\powershell\\7\\pwsh.exe /c dir %s | findstr \"Desktop\"", homeDirectory);
|
||||
|
||||
streamSenderTest.test();
|
||||
commandExecutor.execute("sasda",
|
||||
"C:\\program files\\powershell\\7\\pwsh.exe",
|
||||
"pwd");
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user