Skip to content

Citrus catalog definition to provide an optional complete defaultValue - #3797

Open
mirchello wants to merge 5 commits into
KaotoIO:mainfrom
mirchello:main
Open

Citrus catalog definition to provide an optional complete defaultValue#3797
mirchello wants to merge 5 commits into
KaotoIO:mainfrom
mirchello:main

Conversation

@mirchello

@mirchello mirchello commented Aug 27, 2026

Copy link
Copy Markdown

Description

Closes #3767.

This change allows a Citrus catalog definition to provide an optional complete
defaultValue for the action or container inserted when its catalog tile is
selected.

Currently, Kaoto always derives the inserted model from the selected catalog
entry name and group. A custom entry named company-login therefore creates:

- company-login: {}

With this change, the entry may provide:

{
  "kind": "testAction",
  "name": "company-login",
  "defaultValue": {
    "applyTemplate": {
      "name": "company-login"
    }
  }
}

Kaoto then inserts the standard Citrus action:

- applyTemplate:
    name: company-login

The catalog value is deep-cloned before insertion so editing one test node
cannot mutate the shared catalog definition or later insertions. Catalog
entries without defaultValue keep the existing name/group-derived behavior.

This action-level preset is separate from #3674, which concerns starter
content for complete resource files.

Type of Change

  • Bug fix
  • New feature
  • Improvement
  • Documentation update
  • Other (please describe)

How Has This Been Tested?

  • node .yarn/releases/yarn-4.13.0.cjs workspace @kaoto/kaoto test citrus-test-default.service.test.ts
    • 1 test file passed;
    • 8 tests passed.
  • node .yarn/releases/yarn-4.13.0.cjs workspace @kaoto/kaoto test
    • 492 test files passed, 1 skipped;
    • 7079 tests passed, 5 skipped, 2 todo.
  • node .yarn/releases/yarn-4.13.0.cjs workspace @kaoto/kaoto lint:style
    • Passed.

Checklist

  • I have read the Contributing Guidelines.
  • I have followed the coding style and conventions of the project.
  • I have tested my changes and ensured that they work as expected.
  • I have updated any relevant documentation.
  • I have added tests that prove my fix or feature works.

Summary by CodeRabbit

  • New Features

    • Catalog entries can now define complete default values for newly inserted Citrus steps.
    • Nested default configurations are preserved when creating test action definitions.
  • Bug Fixes

    • Repeatedly created default values are independent copies, preventing changes to one from affecting another.
    • Custom action defaults now return the expected structure.

mirchello and others added 3 commits August 25, 2026 14:36
… complete

`defaultValue` for the action or container inserted when its catalog tile is
selected.
@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4bc30dbf-24df-4587-be66-783f94082b92

📥 Commits

Reviewing files that changed from the base of the PR and between 62e3394 and 2e05012.

📒 Files selected for processing (3)
  • packages/ui/src/models/citrus/citrus-catalog.ts
  • packages/ui/src/models/visualization/flows/support/citrus-test-default.service.test.ts
  • packages/ui/src/models/visualization/flows/support/citrus-test-default.service.ts

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The Citrus catalog now supports optional complete default values. The test default service deep-clones these values before returning them. Tests cover nested cloning and preserve the existing custom-action shape.

Changes

Citrus catalog presets

Layer / File(s) Summary
Catalog default value contract
packages/ui/src/models/citrus/citrus-catalog.ts
ICitrusComponentDefinition now includes an optional defaultValue for the complete initial Citrus step.
Default value insertion and validation
packages/ui/src/models/visualization/flows/support/citrus-test-default.service.ts, packages/ui/src/models/visualization/flows/support/citrus-test-default.service.test.ts
CitrusTestDefaultService deep-clones catalog default values. Tests validate complete nested values, independent copies, mutation isolation, and the existing { custom: {} } result.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: 🔵 Low · up to 2e050

Catalog entries can now provide complete actions or containers that are inserted into tests without runtime validation. A malformed or compromised catalog could therefore create unexpected test behavior; the change is mergeable with explicit owner awareness or follow-up to validate catalog defaults against the applicable Citrus schema.

Sequence Diagram(s)

sequenceDiagram
  participant CatalogDefinition
  participant CitrusTestDefaultService
  participant TestActionDefinition
  CatalogDefinition->>CitrusTestDefaultService: provide defaultValue
  CitrusTestDefaultService->>CitrusTestDefaultService: cloneDeep(defaultValue)
  CitrusTestDefaultService-->>TestActionDefinition: return cloned default value
Loading

Poem

A rabbit found a preset bright

It cloned the nest with care
Each nested leaf stayed separate
No mutation traveled there
The Citrus steps now start just right

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding an optional complete defaultValue to Citrus catalog definitions.
Linked Issues check ✅ Passed The changes satisfy issue #3767. They add the optional defaultValue property, insert the catalog-defined value, deep-clone nested data, preserve fallback behavior, and add tests for presets, cloning, …
Out of Scope Changes check ✅ Passed All changes are directly related to catalog-defined Citrus test action presets. The interface update, service logic, and focused unit tests are in scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3…
Full details: Linked Issues check

Explanation

The changes satisfy issue #3767. They add the optional defaultValue property, insert the catalog-defined value, deep-clone nested data, preserve fallback behavior, and add tests for presets, cloning, and fallback behavior.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3 files.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

@lordrip

lordrip commented Sep 1, 2026

Copy link
Copy Markdown
Member

Hi @mirchello, thank you for your contribution. I would like to understand this change better, are you customizing the Citrus Catalog to show different test actions?

@christophd, do we have this field in the Citrus catalog?

@mirchello

Copy link
Copy Markdown
Author

@lordrip Hello, yes. To add in catalog customized actions.

@lordrip

lordrip commented Sep 1, 2026

Copy link
Copy Markdown
Member

Thanks for the prompt reply @mirchello. Let's wait for @christophd's input. Meanwhile, would you like to check the failed build, squash all the commits in this branch and rebase them against the latest upstream/main branch?

Thanks once again for your contribution.

PS: Could you please expand a bit more on how these default values help you? I'm wondering if after this, we should think on a shareable catalog, contributing them to the @kaoto/camel-catalog or something else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support catalog-defined presets for Citrus test actions

2 participants