[ https://issues.apache.org/jira/browse/TUSCANY-1305?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499773 ]
Kelvin Goodson commented on TUSCANY-1305: ----------------------------------------- Steffen, it does look like a bug. The AccountImpl's changeRecorder is null when changing the accountNum, so the ChangeSummary never sees the update. I haven't yet tracked down why this is happening. Kelvin. > Changesummary of datagraph using static interfaces. > --------------------------------------------------- > > Key: TUSCANY-1305 > URL: https://issues.apache.org/jira/browse/TUSCANY-1305 > Project: Tuscany > Issue Type: Bug > Components: Java SDO Implementation > Affects Versions: Java-SDO-Next > Reporter: Steffen Glomb > Attachments: sources.zip > > > I cant get Changesummary on a datagraph working correctly with the following > contents: (hope this is a realy a bug this time) > Schema, generated by the xsdhelper: > <xs:schema > xmlns:sdo="commonj.sdo" xmlns:sdoJava="commonj.sdo/java" > xmlns:stn_1="http://example.com/customer" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > attributeFormDefault="qualified" elementFormDefault="qualified" > targetNamespace="http://example.com/customer"> > <xs:complexType abstract="false" name="Account"> > <xs:sequence/> > <xs:attribute default="0" name="accountNum" type="xs:int"/> > </xs:complexType> > <xs:element name="account" type="stn_1:Account"/> > <xs:complexType abstract="false" name="Customer"> > <xs:sequence> > <xs:element name="account" type="stn_1:Account"/> > </xs:sequence> > <xs:attribute name="firstName" type="xs:string"/> > </xs:complexType> > <xs:element name="customer" type="stn_1:Customer"/> > </xs:schema> > After generation of interfaces the following code fails to work as I would > expect, because the changesummary does not contain the changed dataobject in > the graph. > .... > import org.apache.tuscany.sdo.api.SDOUtil; > import com.example.customer.Account; > import com.example.customer.Customer; > import com.example.customer.CustomerFactory; > import commonj.sdo.DataGraph; > import commonj.sdo.Type; > import commonj.sdo.helper.HelperContext; > import commonj.sdo.impl.HelperProvider; > public class TestChangesummary extends TestCase { > public void testChangeSummaryOnDatagraphWithContainmentStatic() throws > Exception { > > HelperContext hc = HelperProvider.getDefaultContext(); > CustomerFactory.INSTANCE.register(hc); > > Type customerType = hc.getTypeHelper().getType(Customer.class); > > DataGraph dataGraph = SDOUtil.createDataGraph(); > Customer customer = (Customer) > dataGraph.createRootObject(customerType); > > Account account = CustomerFactory.INSTANCE.createAccount(); > customer.setAccount(account); > customer.setFirstName("John"); > customer.getAccount().setAccountNum(1234); > > ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); > SDOUtil.saveDataGraph(dataGraph, outputStream, null); > DataGraph loadDataGraph = SDOUtil.loadDataGraph(new > ByteArrayInputStream(outputStream.toByteArray()), null); > > loadDataGraph.getChangeSummary().beginLogging(); > > customer = (Customer) loadDataGraph.getRootObject(); > customer.getAccount().setAccountNum(987); > > loadDataGraph.getChangeSummary().endLogging(); > > List changedDataObjects = > loadDataGraph.getChangeSummary().getChangedDataObjects(); > assertEquals("in fact 1 Object was changed in the code", 1, > changedDataObjects.size()); > } > } -- 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]