调整项目结构

This commit is contained in:
2026-08-29 14:02:28 +08:00
parent c56aa6e752
commit c13302c0cb
52 changed files with 55270 additions and 124 deletions

View File

@@ -0,0 +1,35 @@
package tech.easyflow.manuagent;
import static org.assertj.core.api.Assertions.assertThat;
import tech.easyflow.manuagent.config.AppProperties;
import tech.easyflow.manuagent.model.KeyCipher;
import java.nio.file.Path;
import java.time.Duration;
import org.junit.jupiter.api.Test;
/**
* 验证模型密钥保护。
*/
class KeyCipherAndShellTest {
/**
* 验证密钥可恢复且相同明文每次产生不同密文。
*/
@Test
void shouldEncryptModelKeyWithRandomIv() {
KeyCipher cipher = new KeyCipher(properties());
byte[] first = cipher.encrypt("local-test-key");
byte[] second = cipher.encrypt("local-test-key");
assertThat(first).isNotEqualTo(second);
assertThat(cipher.decrypt(first)).isEqualTo("local-test-key");
}
private AppProperties properties() {
return new AppProperties(
Path.of("data"), Path.of("deepseek"), Path.of("dashscope"),
"unit-test-master", "admin", "admin123", "https://api.example.test", "model",
131_072, "smart-factory-agent-runtime:test", "bridge", Duration.ofMinutes(1));
}
}