refs #741 #742: reorganize repository by application

This commit is contained in:
devmrko
2026-08-03 10:20:36 +09:00
parent 2e44ed0b97
commit e9d50e6a32
445 changed files with 1523 additions and 1885 deletions

View File

@@ -0,0 +1,35 @@
package com.cloudhandson.vpdbackoffice.service;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import com.cloudhandson.vpdbackoffice.config.BackofficeProperties;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Test;
class SelectAiServiceTest {
private final SelectAiService service = new SelectAiService(
new BackofficeProperties(null, null, null, null, null),
token -> new HmmMcpPrincipal(1L, "E1001", 1L),
new ObjectMapper());
@Test
void acceptsOneReadOnlySelectAndRemovesTrailingSemicolon() {
assertThat(service.validateReadOnlySql(
"SELECT employee_code FROM hmm_hr_employees;"))
.isEqualTo("SELECT employee_code FROM hmm_hr_employees");
}
@Test
void rejectsDmlPackagesCommentsAndMultipleStatements() {
assertThatThrownBy(() ->
service.validateReadOnlySql("SELECT * FROM x; DELETE FROM x"))
.isInstanceOf(AppException.class);
assertThatThrownBy(() ->
service.validateReadOnlySql("SELECT DBMS_LOCK.SLEEP(10) FROM dual"))
.isInstanceOf(AppException.class);
assertThatThrownBy(() ->
service.validateReadOnlySql("SELECT * FROM x -- bypass"))
.isInstanceOf(AppException.class);
}
}