You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Murtaza Goga (JIRA)" <tu...@ws.apache.org> on 2007/08/15 19:07:38 UTC

[jira] Created: (TUSCANY-1540) Abstract Static Base Types mixed with Dynamic Extended Types

Abstract Static Base Types mixed with Dynamic Extended Types
------------------------------------------------------------

                 Key: TUSCANY-1540
                 URL: https://issues.apache.org/jira/browse/TUSCANY-1540
             Project: Tuscany
          Issue Type: Bug
          Components: Java SDO Implementation
    Affects Versions: Java-SDO-1.0
            Reporter: Murtaza Goga
             Fix For: Java-SDO-Next


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.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Closed: (TUSCANY-1540) Abstract Static Base Types mixed with Dynamic Extended Types

Posted by "Kelvin Goodson (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kelvin Goodson closed TUSCANY-1540.
-----------------------------------

    Resolution: Fixed

tests from patch added to the new toolsTest project 

> Abstract Static Base Types mixed with Dynamic Extended Types
> ------------------------------------------------------------
>
>                 Key: TUSCANY-1540
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1540
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-1.0
>            Reporter: Murtaza Goga
>             Fix For: Java-SDO-Next
>
>         Attachments: TUSCANY-1540-TestCases.patch
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Updated: (TUSCANY-1540) Abstract Static Base Types mixed with Dynamic Extended Types

Posted by "Amita Vadhavkar (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Amita Vadhavkar updated TUSCANY-1540:
-------------------------------------

    Fix Version/s:     (was: Java-SDO-Next)
                   Java-SDO-1.1

> Abstract Static Base Types mixed with Dynamic Extended Types
> ------------------------------------------------------------
>
>                 Key: TUSCANY-1540
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1540
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-1.0
>            Reporter: Murtaza Goga
>             Fix For: Java-SDO-1.1
>
>         Attachments: TUSCANY-1540-TestCases.patch
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Reopened: (TUSCANY-1540) Abstract Static Base Types mixed with Dynamic Extended Types

Posted by "Frank Budinsky (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Frank Budinsky reopened TUSCANY-1540:
-------------------------------------


Reopening this issue until the test case is added.

Murtaza, thanks for providing the patch.

> Abstract Static Base Types mixed with Dynamic Extended Types
> ------------------------------------------------------------
>
>                 Key: TUSCANY-1540
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1540
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-1.0
>            Reporter: Murtaza Goga
>             Fix For: Java-SDO-Next
>
>         Attachments: TUSCANY-1540-TestCases.patch
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Resolved: (TUSCANY-1540) Abstract Static Base Types mixed with Dynamic Extended Types

Posted by "Frank Budinsky (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Frank Budinsky resolved TUSCANY-1540.
-------------------------------------

    Resolution: Fixed

Fixed in revision 566876.

I changed the generator to generate a concrete inner subclass for abstract Impl classes:

public abstract class AbstractTestImpl extends DataObjectBase implements AbstractTest
{
  public static class ConcreteBase extends AbstractTestImpl
  {
    public ConcreteBase()
    {
      super();
    }
  }
  ...
}

and  then added code in FactoryBase$SDOEFactoryImpl.create() to use it if the type is abstract.

I've tested it with the following simple program:

  public static void main(String[] args) throws IOException
  {
    HelperContext context = SDOUtil.createHelperContext();
    Junk3Factory.INSTANCE.register(context);
    
    TypeHelper typeHelper = context.getTypeHelper();
    DataFactory factory = context.getDataFactory();
    Type abstractType = typeHelper.getType("http://www.example.org/junk/", "AbstractTest");
    
    //DataObject testObject = factory.create(abstractType); // should fail
    
    // Create an subtype
    DataObject exampleType = DataFactory.INSTANCE.create("commonj.sdo", "Type");
    exampleType.set("uri", NSURI);
    exampleType.set("name", "Example");
    exampleType.getList("baseType").add(abstractType);
    Type type = TypeHelper.INSTANCE.define(exampleType);
    
    DataObject testObject2 = factory.create(type);
    
    if (testObject2.getClass() == AbstractTestImpl.ConcreteBase.class)
      System.out.println("SUCCESS");
    else
      System.out.println("FAIL");
  }

It would be good to get a proper JUnit for it. Any volunteers?


> Abstract Static Base Types mixed with Dynamic Extended Types
> ------------------------------------------------------------
>
>                 Key: TUSCANY-1540
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1540
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-1.0
>            Reporter: Murtaza Goga
>             Fix For: Java-SDO-Next
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Updated: (TUSCANY-1540) Abstract Static Base Types mixed with Dynamic Extended Types

Posted by "Murtaza Goga (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Murtaza Goga updated TUSCANY-1540:
----------------------------------

    Attachment: TUSCANY-1540-TestCases.patch

Two test cases for this fix have been attached - one tests an assignment of a dynamic (extended from an abstract type) to a static type; the other tests assignment of a dynamic to a static.

> Abstract Static Base Types mixed with Dynamic Extended Types
> ------------------------------------------------------------
>
>                 Key: TUSCANY-1540
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1540
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-1.0
>            Reporter: Murtaza Goga
>             Fix For: Java-SDO-Next
>
>         Attachments: TUSCANY-1540-TestCases.patch
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org