tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fra...@apache.org
Subject svn commit: r529645 - in /incubator/tuscany/java/sdo/impl/src: main/java/org/apache/tuscany/sdo/impl/AttributeImpl.java main/java/org/apache/tuscany/sdo/impl/ReferenceImpl.java test/java/org/apache/tuscany/sdo/test/DefineOpenContentPropertyTestCase.java
Date Tue, 17 Apr 2007 15:31:12 GMT
Author: frankb
Date: Tue Apr 17 08:31:11 2007
New Revision: 529645

URL: http://svn.apache.org/viewvc?view=rev&rev=529645
Log:
Property.isOpenContent() part of TUSCANY-1212

Modified:
    incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/AttributeImpl.java
    incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ReferenceImpl.java
    incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DefineOpenContentPropertyTestCase.java

Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/AttributeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/AttributeImpl.java?view=diff&rev=529645&r1=529644&r2=529645
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/AttributeImpl.java
(original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/AttributeImpl.java
Tue Apr 17 08:31:11 2007
@@ -24,6 +24,7 @@
 import org.apache.tuscany.sdo.SDOPackage;
 import org.apache.tuscany.sdo.util.BasicSequence;
 import org.apache.tuscany.sdo.util.DataObjectUtil;
+import org.apache.tuscany.sdo.util.SDOUtil;
 import org.eclipse.emf.ecore.EClass;
 import org.eclipse.emf.ecore.EStructuralFeature;
 import org.eclipse.emf.ecore.InternalEObject;
@@ -187,7 +188,7 @@
 
   public boolean isOpenContent()
   {
-    throw new UnsupportedOperationException();
+    return SDOUtil.isDocumentRoot(getContainingType());
   }
 
   public List getInstanceProperties() {

Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ReferenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ReferenceImpl.java?view=diff&rev=529645&r1=529644&r2=529645
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ReferenceImpl.java
(original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ReferenceImpl.java
Tue Apr 17 08:31:11 2007
@@ -23,6 +23,7 @@
 
 import org.apache.tuscany.sdo.SDOPackage;
 import org.apache.tuscany.sdo.util.DataObjectUtil;
+import org.apache.tuscany.sdo.util.SDOUtil;
 import org.eclipse.emf.ecore.EClass;
 import org.eclipse.emf.ecore.impl.EReferenceImpl;
 
@@ -148,7 +149,7 @@
 
   public boolean isOpenContent()
   {
-    throw new UnsupportedOperationException();
+    return SDOUtil.isDocumentRoot(getContainingType());
   }
 
   public List getInstanceProperties() {

Modified: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DefineOpenContentPropertyTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DefineOpenContentPropertyTestCase.java?view=diff&rev=529645&r1=529644&r2=529645
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DefineOpenContentPropertyTestCase.java
(original)
+++ incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DefineOpenContentPropertyTestCase.java
Tue Apr 17 08:31:11 2007
@@ -54,13 +54,20 @@
         Type quoteType = typeHelper.getType(TEST_NAMESPACE, "OpenQuote");
         DataObject quote = dataFactory.create(quoteType);
         
-        quote.setString("symbol", "s1");
+        Property symbolProperty = quoteType.getProperty("symbol");
+        assertFalse(symbolProperty.isOpenContent());
+
+        quote.setString(symbolProperty, "s1");
 
         Property companyProperty = typeHelper.getOpenContentProperty(TEST_NAMESPACE, "company");
+        assertTrue(companyProperty.isOpenContent());
+        
         DataObject company = quote.createDataObject(companyProperty);
         company.setString("name", "FlyByNightTechnology");
 
         Property priceProperty = typeHelper.getOpenContentProperty(TEST_NAMESPACE, "price");
+        assertTrue(priceProperty.isOpenContent());
+
         quote.getList(priceProperty).add(new BigDecimal("1000.0"));
 
         // Define a new SDO open content property with simple type
@@ -68,6 +75,7 @@
 		p.set("type", typeHelper.getType("commonj.sdo", "Decimal"));
 		p.set("name", "highPrice");
 		Property highPrice = typeHelper.defineOpenContentProperty(TEST_NAMESPACE, p);
+        assertTrue(highPrice.isOpenContent());
         
 		quote.setBigDecimal(highPrice, new BigDecimal("1100.0"));
         
@@ -77,7 +85,8 @@
         mutualFundQuotePropertyDef.set("name", "mutualFundQuote");
         mutualFundQuotePropertyDef.setBoolean("containment", true);
         Property mutualFundQuoteProperty = typeHelper.defineOpenContentProperty(TEST_NAMESPACE,
mutualFundQuotePropertyDef);
-        
+        assertTrue(mutualFundQuoteProperty.isOpenContent());
+
         DataObject mutualFundQuote = quote.createDataObject(mutualFundQuoteProperty);
         mutualFundQuote.setString("symbol", "mutual-1");
         



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


Mime
View raw message