0

is there a way to check the sanity of the XML configuration at compile time ? Or at worst, at application startup ?

What I mean by sanity is not only validation & well-formedness but also well-formed method names in expression attributes (not necessarily existing but at least, missing parentheses are detected).

Thanks in advance,

Florent

skaffman
  • 398,947
  • 96
  • 818
  • 769
fbiville
  • 8,407
  • 7
  • 51
  • 79

1 Answers1

0

To solve it from a compilation/build perspective, Spring webflow has a base AbstractXmlFlowExecutionTests test class that you can extend in order to write flow integration tests. Any test methods you write will blow up with a FlowModelBuilderException ("Could not parse the XML...") exception if the xml fails to parse, either due to xsd validation errors or other xml wellformedness failures. It is pretty good practice to use this utility for unit-testing your flow, and making it part of your build.

For any evaluations in your flow that are using your custom spring beans, you'll likely need to override registerMockFlowBeans or configureFlowBuilderContext, and provide mocks/test-implementations of your beans. The javadoc has a simple example.

kevin
  • 639
  • 1
  • 7
  • 9