- replace in-process Milvus stack with PyRagClient + PyRagKnowledgeSearchAdapter behind KnowledgeSearchPort (RERANK score passthrough) - move document ingest to py-rag /documents:ingest; DocumentManagementService keeps MySQL ledger + local files - sink L0 query understanding to py-rag; drop KnowledgeQueryTransformer, single UNFILTERED_VECTOR attempt - remove Milvus deps, config classes, dead demo services and obsolete rebuild scripts - compose/Makefile reduced to MySQL/Redis; add pyrag.* config
42 lines
1.3 KiB
Java
42 lines
1.3 KiB
Java
package com.superbiz.agent.service;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
import org.junit.jupiter.api.io.TempDir;
|
|
import org.springframework.mock.web.MockMultipartFile;
|
|
import org.springframework.test.util.ReflectionTestUtils;
|
|
|
|
import java.nio.file.Files;
|
|
import java.nio.file.Path;
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
|
|
class DocumentManagementServiceTest {
|
|
|
|
@TempDir
|
|
Path tempDir;
|
|
|
|
@Test
|
|
void saveToLocalStoresRelativePathUnderKnowledgeBase() throws Exception {
|
|
DocumentManagementService service = new DocumentManagementService();
|
|
ReflectionTestUtils.setField(service, "knowledgeBasePath", tempDir.toString());
|
|
MockMultipartFile file = new MockMultipartFile(
|
|
"file",
|
|
"runbook.md",
|
|
"text/markdown",
|
|
"runbook content".getBytes()
|
|
);
|
|
|
|
String storedPath = ReflectionTestUtils.invokeMethod(
|
|
service,
|
|
"saveToLocal",
|
|
file,
|
|
"runbook.md",
|
|
"payment"
|
|
);
|
|
|
|
assertEquals("payment/runbook.md", storedPath);
|
|
assertTrue(Files.exists(tempDir.resolve("payment").resolve("runbook.md")));
|
|
}
|
|
}
|