New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CitrusRuntimeException when using JDBC XML tests with schemaRepository #348

Closed
svettwer opened this Issue Mar 15, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@svettwer
Member

svettwer commented Mar 15, 2018

Hi!

We've found out that the following CitrusRuntimeException occurs when you use a CitrusXmlTest with a JDBC payload in combination with a citrus:schema-repository in your citrus-context.xml

citrus-context.xml

<citrus:schema-repository id="schemaRepository">
  <citrus:schemas>
    <citrus:schema id="todoList" location="classpath:schema/TodoList.xsd"/>
  </citrus:schemas>
</citrus:schema-repository>

<citrus-jdbc:server id="jdbcServer"
                    port="3306"
                    database-name="testdb"
                    timeout="10000"
                    auto-start="true"/>

Even an empty citrus:schema-repository is enough to trigger that bug. If you have no citrus:schema-repository at all in your context, the bug does not occur.

TodoListIT.xml

<testcase name="TodoListIT">
  ...
  <receive endpoint="jdbcServer">
    <message>
      <payload>
        <jdbc:operation>
          <jdbc:execute>
            <jdbc:statement>
              <jdbc:sql>@startsWith('INSERT INTO todo_entries (id, title, description, done) VALUES (?, ?, ?, ?)')@</jdbc:sql>
            </jdbc:statement>
          </jdbc:execute>
        </jdbc:operation>
      </payload>
    </message>
  </receive>
  ...
</testcase>

Error

FAILURE: Caused by: CitrusRuntimeException: Unable to find proper XML schema definition for element 'operation(http://www.citrusframework.org/schema/jdbc/message)' in schema repository 'mySchemaRepository'

The error occurs, because the JDBC message is part of the payload and therefore validated with the schema repository.

Workaround
To avoid the CitrusRuntimeException just add the following citrus:schema to your repository.

 <citrus:schema id="jdbcmessage" location="classpath:com/consol/citrus/schema/citrus-jdbc-message.xsd"/>

@christophd christophd closed this in 563b5cb May 9, 2018

@christophd christophd removed the READY label May 9, 2018

@christophd christophd added this to the 2.7.6 milestone May 9, 2018

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