4 Replies Latest reply on Jun 5, 2013 6:50 AM by Tadayoshi Sato

    Test runner (SwitchYardRunner) always validates the SY config model under test

    Tadayoshi Sato Novice

      Hello,

       

      I noticed that currently there is no way of forcing SwitchYardRunner to eschew the validation of the config model specified in @SwitchYardTestCaseConfig annotation, in contrast to the switchyard-plugin (configure Mojo) which has the <validate> option to turn it off. I'm aware that it may be a workaround for that to use SwitchYardTestKit in the test methods and load the model with disabling validation programmatically, however I don't feel it's always handy.

       

      This seeming lack of feature prohibits me from leveraging the following use case for SY test: I have a switchyard.xml, a part of which looks like below (note that the order of the options for File binding is relaxed and doesn't strictly comply with the XML Schema):

       

              <sca:reference name="routerToFile" promote="FirstServiceESB/FileRouterListener" multiplicity="1..1">
                  <file:binding.file>
                      <file:directory>${project.build.directory}/output</file:directory>
                      <file:fileName>results.log</file:fileName>
                      <file:autoCreate>true</file:autoCreate>
                  </file:binding.file>
              </sca:reference>
      

       

      I am sure this configuration can be build, deployed, and even run successfully on the SY server if the configure Mojo is set up as follows:

       

                   <plugin>
                      <groupId>org.switchyard</groupId>
                      <artifactId>switchyard-plugin</artifactId>
                      <configuration>
                          ...
                          <validate>false</validate>
                      </configuration>
      

       

      However, I only cannot make SY test cases for the configuration due to the constraints explained above, and get the following errors:

       

      java.lang.RuntimeException: Model [org.switchyard.config.model.switchyard.v1.V1SwitchYardModel] is invalid: cvc-complex-type.2.4.a: Invalid content was found starting with element 'file:autoCreate'. One of '{"urn:switchyard-component-    camel-file:config:1.0":flatten, "urn:switchyard-component-camel-file:config:1.0":charset, "urn:switchyard-component-camel-file:config:1.0":consume, "urn:switchyard-component-camel-file:config:1.0":produce}' is expected.
      

       

      For your reference, I'm attaching the sample project.

       

      Is that by design?  Or can it be a valid feature request?  If it can be a feature request, I'll file a JIRA for it, and am also ready to contribute a patch

       

      Please let me know your thoughts on this issue.

       

      Thank you,

      Tadayoshi