Uploaded image for project: 'WildFly Core'
  1. WildFly Core
  2. WFCORE-7036

TransformationUtils.modelToResource() sometimes returns an undefined model

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 27.0.0.Beta2
    • None
    • None
    • None

      When writing transformer tests for https://issues.redhat.com/browse/WFLY-19835 and https://issues.redhat.com/browse/WFLY-19836, I found that TransformationUtils.modelToResource() returns an undefined model node if:

      The resource registration has children and no attributes, but the model is empty. This is exactly the case I need to test for my transformers. The subsystem doesn't have any attributes, and the two Jiras mentioned add a child. However, for the 'working transformers' test, the subsystem needs to be empty.

      I'm working on a test and fix, and this is the only combination where the resource model becomes undefined. In all other cases it is either empty or reflects the attribute/child combinations.

      Edit: on further testing, this also happens for registrations that have attributes and children, those are not defined in the model, and I pass in includeUndefined=false to the modelToResource() method. Previously I was using includeUndefined=true for this parameter, but while here figured I might as well test more cases. I think in all the failing cases the issue is that if nothing that could be defined (i.e. attributes/children) are defined the result is an undefined ModelNode for the model.

            kkhan1@redhat.com Kabir Khan
            kkhan1@redhat.com Kabir Khan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: