Skip to content

Fix JdbcKeyValueRepositoryTest - #26083

Merged
apupier merged 1 commit into
apache:mainfrom
apupier:fixMainBranch-JdbcKeyValueRepositoryTest
Sep 3, 2026
Merged

Fix JdbcKeyValueRepositoryTest#26083
apupier merged 1 commit into
apache:mainfrom
apupier:fixMainBranch-JdbcKeyValueRepositoryTest

Conversation

@apupier

@apupier apupier commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

most of the tests requires to be isolated as it is sharing a KeyValueRepository and doing destructive operations, or counting size

introduced with #25993

Description

Target

  • I checked that the commit is targeting the correct branch (Camel 4 uses the main branch)

Tracking

  • If this is a large change, bug fix, or code improvement, I checked there is a JIRA issue filed for the change (usually before you start working on it).

Apache Camel coding standards and style

  • I checked that each commit in the pull request has a meaningful subject line and body.
  • I have run mvn clean install -DskipTests locally from root folder and I have committed all auto-generated changes.

AI-assisted contributions

  • If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., Co-authored-by trailers) and the PR description identifies the AI tool used.

most of the tests requires to be isolated as it is sharing a
KeyValueRepository and doing destructive operations, or counting size

Signed-off-by: Aurélien Pupier <apupier@ibm.com>
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@apupier

apupier commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

example of error:

org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [SELECT ITEM_VALUE, EXPIRES_AT FROM CAMEL_KEYVALUE WHERE ITEM_KEY = ?]
	at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:112)
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:102)
	at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1549)
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:689)
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:732)
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:757)
	at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:893)
	at org.apache.camel.processor.keyvalue.jdbc.JdbcKeyValueRepository.doGet(JdbcKeyValueRepository.java:312)
	at org.apache.camel.processor.keyvalue.jdbc.JdbcKeyValueRepository.lambda$delete$4(JdbcKeyValueRepository.java:237)
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:137)
	at org.apache.camel.processor.keyvalue.jdbc.JdbcKeyValueRepository.delete(JdbcKeyValueRepository.java:236)
	at org.apache.camel.processor.keyvalue.jdbc.JdbcKeyValueRepositoryTest.lambda$testTtlExpirationOnDelete$2(JdbcKeyValueRepositoryTest.java:237)
Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "CAMEL_KEYVALUE" not found (this database is empty); SQL statement:
SELECT ITEM_VALUE, EXPIRES_AT FROM CAMEL_KEYVALUE WHERE ITEM_KEY = ? [42104-240]
	at org.h2.message.DbException.getJdbcSQLException(DbException.java:514)
org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [DELETE FROM CAMEL_KEYVALUE WHERE EXPIRES_AT > 0 AND EXPIRES_AT <= ?]
	at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:112)
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:102)
	at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1549)
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:689)
	at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:966)
	at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:1010)
	at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:1020)
	at org.apache.camel.processor.keyvalue.jdbc.JdbcKeyValueRepository.lambda$keys$0(JdbcKeyValueRepository.java:255)
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:137)
	at org.apache.camel.processor.keyvalue.jdbc.JdbcKeyValueRepository.keys(JdbcKeyValueRepository.java:252)
	at org.apache.camel.processor.keyvalue.jdbc.JdbcKeyValueRepositoryTest.lambda$testTtlExpirationOnKeys$0(JdbcKeyValueRepositoryTest.java:226)
Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "CAMEL_KEYVALUE" not found (this database is empty); SQL statement:
DELETE FROM CAMEL_KEYVALUE WHERE EXPIRES_AT > 0 AND EXPIRES_AT <= ? [42104-240]
	at org.h2.message.DbException.getJdbcSQLException(DbException.java:514)
	at org.h2.message.DbException.getJdbcSQLException(DbException.java:489)
	at org.h2.message.DbException.get(DbException.java:223)
	at org.h2.message.DbException.get(DbException.java:199)
	at org.h2.command.Parser.getTableOrViewNotFoundDbException(Parser.java:8036)
	at org.h2.command.Parser.getTableOrViewNotFoundDbException(Parser.java:8020)
	at org.h2.command.Parser.readTableOrView(Parser.java:7999)
	at org.h2.command.Parser.readTableOrView(Parser.java:7961)
	at org.h2.command.Parser.readSimpleTableFilter(Parser.java:1076)
	at org.h2.command.Parser.parseDelete(Parser.java:1090)
	at org.h2.command.Parser.parsePrepared(Parser.java:659)
	at org.h2.command.Parser.parse(Parser.java:584)
	at org.h2.command.Parser.parse(Parser.java:559)
	at org.h2.command.Parser.prepareCommand(Parser.java:487)
	at org.h2.engine.SessionLocal.prepareLocal(SessionLocal.java:647)
	at org.h2.engine.SessionLocal.prepareCommand(SessionLocal.java:563)
	at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1160)
	at org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:93)
	at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:315)
	at org.springframework.jdbc.core.JdbcTemplate$SimplePreparedStatementCreator.createPreparedStatement(JdbcTemplate.java:1710)
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:668)
	... 7 more

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • components/camel-sql

🔬 Scalpel shadow comparison — Scalpel: 1 tested, 0 compile-only — current: 11 all tested

Maveniverse Scalpel detected 1 affected modules (current approach: 11).

Modules only in current approach (10)
  • camel-jbang-mcp
  • camel-jbang-plugin-mcp
  • camel-jbang-plugin-route-parser
  • camel-jbang-plugin-tui
  • camel-jbang-plugin-validate
  • camel-jta
  • camel-kafka
  • camel-launcher-container
  • camel-yaml-dsl-validator
  • camel-yaml-dsl-validator-maven-plugin

Skip-tests mode would test 1 modules (1 direct + 0 downstream), skip tests for 0 (generated code, meta-modules)

Modules Scalpel would test (1)
  • camel-sql

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

All tested modules (11 modules)
  • Camel :: JBang :: MCP
  • Camel :: JBang :: Plugin :: MCP
  • Camel :: JBang :: Plugin :: Route Parser
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: JBang :: Plugin :: Validate
  • Camel :: JTA
  • Camel :: Kafka
  • Camel :: Launcher :: Container
  • Camel :: SQL
  • Camel :: YAML DSL :: Validator
  • Camel :: YAML DSL :: Validator Maven Plugin

⚙️ View full build and test results

@apupier
apupier marked this pull request as ready for review September 3, 2026 12:30
@apupier
apupier merged commit 312f675 into apache:main Sep 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants