You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Kelvin Goodson (JIRA)" <tu...@ws.apache.org> on 2007/05/29 18:57:15 UTC

[jira] Resolved: (TUSCANY-1305) Changesummary of datagraph using static interfaces.

     [ https://issues.apache.org/jira/browse/TUSCANY-1305?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kelvin Goodson resolved TUSCANY-1305.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: Java-SDO-1.0

resolved at revision 542588

> 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
>             Fix For: Java-SDO-1.0
>
>         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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org