fix: update test for metaschema-java PR #529 compatibility#220
Conversation
📝 WalkthroughWalkthroughReplaces XML-based constraint and metaschema module loading with binding-based APIs: tests updated to use Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/test/java/gov/nist/secauto/oscal/lib/model/util/AllowedValueCollectingNodeItemVisitorTest.java (1)
56-69: Consider deduplicating binding/constraint setup between the two tests
testAllowedValuesMissingVariableBindings2repeats most of the context and constraint loading logic from the first test, differing mainly in variable names and the generated directory (allowed-values-2). This is fine functionally, but you could optionally extract a small helper (e.g., to load the constraint set or to build a binding context givengenDir) to reduce duplication and keep future changes to the binding setup in one place.If you choose to refactor, re-run both tests to ensure the shared helper still configures
constraintSetandcompilePathcorrectly for each directory.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/test/java/gov/nist/secauto/oscal/lib/model/util/AllowedValueCollectingNodeItemVisitorTest.java(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Code
- GitHub Check: Website
🔇 Additional comments (2)
src/test/java/gov/nist/secauto/oscal/lib/model/util/AllowedValueCollectingNodeItemVisitorTest.java (2)
14-17: BindingConstraintLoader import and binding-based types look consistent with API migrationThe new
BindingConstraintLoaderimport, together withIBindingContext,IBindingMetaschemaModule, andIBindingModuleLoader, matches the intended migration away from XML-based loaders; nothing problematic stands out here.Please double-check that the metaschema databind dependency version in your build contains
BindingConstraintLoaderand these binding interfaces.
32-47: First test’s binding-context and constraint loading flow looks correctCreating an initial
IBindingContext, loadingList<IConstraintSet>viaBindingConstraintLoader, then building a new context with.constraintSet(constraintSet)and.compilePath(genDir)before usingnewModuleLoader()aligns well with the binding-based workflow and should preserve the original test intent.Please run the updated test against the target metaschema-java/databind version to confirm that constraint resolution and module loading behave as expected with the new binding-based APIs.
Replace removed XMLBeans-based classes with binding-based alternatives: - XmlMetaConstraintLoader -> BindingConstraintLoader - ModuleLoader -> IBindingModuleLoader - IXmlMetaschemaModule -> IBindingMetaschemaModule The metaschema-java PR #529 removed the core.model.xml package, requiring migration to the databind module's binding-based loaders.
0c30118 to
9aa4ad1
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/test/java/gov/nist/secauto/oscal/lib/model/util/AllowedValueCollectingNodeItemVisitorTest.java (1)
32-45: Constraint loading via BindingConstraintLoader looks correct; consider de‑duplicating setupBoth tests now build an initial
IBindingContext, load constraints throughBindingConstraintLoader, then construct a second context with.constraintSet(constraintSet)and.compilePath(genDir)before creating theIBindingModuleLoader. That pattern is consistent and should preserve the prior behavior with the new binding-based APIs.Since the constraint-loading block (paths, loader construction, and
load(...)call) is effectively identical in both tests, you might optionally extract it into a small private helper (e.g.,loadConstraintSet()taking the resource path) to keep the test setup DRY and make future path or API changes less error-prone.Also applies to: 56-60
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/test/java/gov/nist/secauto/oscal/lib/model/util/AllowedValueCollectingNodeItemVisitorTest.java(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Code
- GitHub Check: Website
🔇 Additional comments (2)
src/test/java/gov/nist/secauto/oscal/lib/model/util/AllowedValueCollectingNodeItemVisitorTest.java (2)
14-14: BindingConstraintLoader import aligns with new binding-based constraint flowImporting
BindingConstraintLoaderhere correctly switches the test over to the binding-based constraint loading APIs and removes reliance on the old XMLBeans-based classes. No issues from a test-usage perspective.
62-62: Separate dynamic-binding output directory per test is reasonableSwitching the second test to use
target/dynamic-bindings/allowed-values-2keeps its generated bindings isolated from the first test’sallowed-values-1directory, which helps avoid cross-test interference while still living undertarget/somvn cleanwill clear them. This looks like a sound choice.
b642247
into
metaschema-framework:develop
* fix: update test for metaschema-java PR #529 compatibility Replace removed XMLBeans-based classes with binding-based alternatives: - XmlMetaConstraintLoader -> BindingConstraintLoader - ModuleLoader -> IBindingModuleLoader - IXmlMetaschemaModule -> IBindingMetaschemaModule The metaschema-java PR #529 removed the core.model.xml package, requiring migration to the databind module's binding-based loaders. * chore: bump OSCAL submodule to latest develop
Summary
AllowedValueCollectingNodeItemVisitorTestXmlMetaConstraintLoadertoBindingConstraintLoaderModuleLoadertoIBindingModuleLoaderIXmlMetaschemaModuletoIBindingMetaschemaModuleThis change is required because metaschema-java PR #529 removed the
gov.nist.secauto.metaschema.core.model.xmlpackage, requiring migration to the databind module's binding-based loaders.Test plan
mvn testpasses (47 tests run, 0 failures)Summary by CodeRabbit
Refactor
Chores
✏️ Tip: You can customize this high-level summary in your review settings.