feat(agents): move agents into dbx repo

This commit is contained in:
t8y2 committed 2026-06-23 11:38:16 +08:00
1 parent ab35fda299
commit 3a25487dea
215 files changed
+29740 -15

No files matched your search

@@ -0,0 +1,27 @@
package com.dbx.agent.template;
import com.dbx.agent.ConfiguredJdbcAgent;
import com.dbx.agent.JdbcAgentProfile;
import com.dbx.agent.JdbcIdentifiers;
import com.dbx.agent.JsonRpcServer;
public final class TemplateAgent extends ConfiguredJdbcAgent {
public static final JdbcAgentProfile TEMPLATE_PROFILE = new JdbcAgentProfile(
"com.example.jdbc.TemplateDriver",
"jdbc:template://{host}:{port}/{database}",
1234
);
public TemplateAgent() {
super(TEMPLATE_PROFILE);
}
@Override
public String setSchemaSQL(String schema) {
return "SET SCHEMA " + JdbcIdentifiers.INSTANCE.doubleQuote(schema);
}
public static void main(String[] args) {
new JsonRpcServer(new TemplateAgent()).run();
}
}
@@ -0,0 +1,23 @@
package com.dbx.agent.template;
import com.dbx.agent.test.TestSupport;
import com.dbx.agent.ExecuteQueryOptions;
import com.dbx.agent.test.JdbcAgentFake;
import java.util.List;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
class TemplateAgentTest {
@Test
void executeQueryUsesStatementExecute() {
TemplateAgent agent = new TemplateAgent();
TestSupport.setPrivateConnection(agent, JdbcAgentFake.connection());
agent.executeQuery("SHOW TABLES", null, new ExecuteQueryOptions());
Assertions.assertEquals(
List.of("setMaxRows:10001", "execute"),
JdbcAgentFake.calls
);
}
}