Uploaded image for project: 'Tuscany'
  1. Tuscany
  2. TUSCANY-1540

Abstract Static Base Types mixed with Dynamic Extended Types

    XMLWordPrintableJSON

Details

    Description

      Setting a property on a static data object with an object of a type extended in a dynamic model results in a ClassCastException.

      Scenario:
      Static schema-
      <xsd:complexType name="CustomerType">
      <xsd:all>
      <xsd:element name="number" type="xsd:integer" />
      <xsd:element form="unqualified" name="info" type="InfoType" />
      </xsd:all>
      </xsd:complexType>

      <xsd:complexType name="InfoType" abstract="true"/>

      Dynamic Schema
      <xsd:complexType name="InfoType">
      <xsd:complexContent>
      <xsd:extension base="staticNS:InfoType">
      <xsd:sequence>
      <xsd:element name="zipcode" type="xsd:string" />
      </xsd:sequence>
      </xsd:extension>
      </xsd:complexContent>
      </xsd:complexType>

      The following will fail:
      DataFactory factory = scope.getDataFactory();
      factory.create(CustomerType.class).setDataObject("info", factory.create("dynamicNS", "InfoType"));

      It should be legal to assign a property to an object if they are in the same hierachy.

      Steps to reproduce within Tuscany:
      Testcase org.apache.tuscany.sdo.test.ExtensibleTestCase will break if 'InfoType' defined in extensible/customer.xsd is marked as abstract.

      Attachments

        1. TUSCANY-1540-TestCases.patch
          98 kB
          Murtaza Goga

        Issue Links

          Activity

            People

              Unassigned Unassigned
              trisyn Murtaza Goga
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: