You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by aj...@apache.org on 2006/11/22 16:23:01 UTC

svn commit: r478191 - in /incubator/tuscany/cpp/sdo/runtime/core: src/commonj/sdo/DataObjectImpl.cpp test/main.cpp test/sdotest.h test/sdotest2.cpp

Author: ajborley
Date: Wed Nov 22 07:23:00 2006
New Revision: 478191

URL: http://svn.apache.org/viewvc?view=rev&rev=478191
Log:
Fix for TUSCANY-945 (uses the DataObject::getList(Property&) implementation rather than repeating code)

Modified:
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.cpp
    incubator/tuscany/cpp/sdo/runtime/core/test/main.cpp
    incubator/tuscany/cpp/sdo/runtime/core/test/sdotest.h
    incubator/tuscany/cpp/sdo/runtime/core/test/sdotest2.cpp

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.cpp?view=diff&rev=478191&r1=478190&r2=478191
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.cpp Wed Nov 22 07:23:00 2006
@@ -1493,25 +1493,7 @@
 
     DataObjectList& DataObjectImpl::getList(unsigned int propIndex)
     {
-        if (!(getProperty(propIndex).isMany()))
-        {
-            if (!getPropertyImpl(propIndex)->getTypeImpl()->isFromList())
-            {
-                string msg("Get list not available on single valued property:");
-                msg += getProperty(propIndex).getName();
-                SDO_THROW_EXCEPTION("getList", SDOUnsupportedOperationException,
-                    msg.c_str());
-            }
-        }
-        DataObjectImpl* d = getDataObjectImpl(propIndex);
-        if (d == 0)
-        {
-            string msg("Property Not Found:");
-            msg += getType().getProperty(propIndex).getName();
-            SDO_THROW_EXCEPTION("getList", SDOPropertyNotFoundException,
-            msg.c_str());
-        }
-        return d->getList();
+        return getList(getProperty(propIndex));
     }
 
     DataObjectList& DataObjectImpl::getList(const Property& p)

Modified: incubator/tuscany/cpp/sdo/runtime/core/test/main.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/test/main.cpp?view=diff&rev=478191&r1=478190&r2=478191
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/test/main.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/test/main.cpp Wed Nov 22 07:23:00 2006
@@ -172,6 +172,7 @@
     TEST (  sdotest::jira490() );
     TEST (  sdotest::jira705() );
     TEST (  sdotest::jira546() );
+    TEST (  sdotest::jira945() );
     TEST (  sdotest::testXPath() );
 
     TEST (  sdotest::cdatatest() );

Modified: incubator/tuscany/cpp/sdo/runtime/core/test/sdotest.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/test/sdotest.h?view=diff&rev=478191&r1=478190&r2=478191
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/test/sdotest.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/test/sdotest.h Wed Nov 22 07:23:00 2006
@@ -176,6 +176,7 @@
         static int jira490();
         static int jira705();
         static int jira546();
+        static int jira945();
         
         static int b48602();
         static int b48736();

Modified: incubator/tuscany/cpp/sdo/runtime/core/test/sdotest2.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/test/sdotest2.cpp?view=diff&rev=478191&r1=478190&r2=478191
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/test/sdotest2.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/test/sdotest2.cpp Wed Nov 22 07:23:00 2006
@@ -1443,3 +1443,45 @@
         return 0;
     }
 }
+
+int sdotest::jira945()
+{
+    try {
+        DataFactoryPtr mdg  = DataFactory::getDataFactory(); 
+
+        mdg->addType("myspace","Company");
+        mdg->addType("myspace","Employee");
+        mdg->addPropertyToType("myspace","Employee","name",
+                           "commonj.sdo","String", false, false, false);
+
+        mdg->addPropertyToType("myspace","Company","name",
+                           "commonj.sdo","String", false, false, false);    
+
+        mdg->addPropertyToType("myspace","Company","employees",
+                           "myspace","Employee", true, false, true);
+
+        const Type& tc = mdg->getType("myspace","Company");
+
+        DataObjectPtr com = mdg->create((Type&)tc);
+        com->setCString("name","acme");
+
+        const Type& te = mdg->getType("myspace","Employee");
+        DataObjectPtr emp = mdg->create(te);
+        emp->setCString("name", "Mr Expendible");
+
+        const int propIndex = tc.getPropertyIndex("employees");
+
+        // This fails with Jira945
+        DataObjectList& emps = com->getList(propIndex);
+
+        emps.append(emp);
+
+        return 1;
+        
+    }
+    catch (SDORuntimeException e)
+    {
+        cout << "Exception in test jira945" << e << endl;
+        return 0;
+    }
+}



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