You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by gw...@apache.org on 2007/02/13 15:04:52 UTC

svn commit: r507008 - in /incubator/tuscany/cpp/sdo/runtime/core/test: jira980_splitJungle_out.txt sdotest2.cpp

Author: gwinn
Date: Tue Feb 13 06:04:51 2007
New Revision: 507008

URL: http://svn.apache.org/viewvc?view=rev&rev=507008
Log:
TUSCANY-980
Add test to check for correct operation across data factories.

Added:
    incubator/tuscany/cpp/sdo/runtime/core/test/jira980_splitJungle_out.txt   (with props)
Modified:
    incubator/tuscany/cpp/sdo/runtime/core/test/sdotest2.cpp

Added: incubator/tuscany/cpp/sdo/runtime/core/test/jira980_splitJungle_out.txt
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/test/jira980_splitJungle_out.txt?view=auto&rev=507008
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/test/jira980_splitJungle_out.txt (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/test/jira980_splitJungle_out.txt Tue Feb 13 06:04:51 2007
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jungle xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><bear xsi:type="bearType"><name>Mummy bear</name><weight>700</weight></bear><panther xsi:type="pantherType"><name>Bagheera</name><colour>inky black</colour></panther><snake xsi:type="snakeType"><name>Kaa</name><length>25</length></snake></jungle>

Propchange: incubator/tuscany/cpp/sdo/runtime/core/test/jira980_splitJungle_out.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/test/jira980_splitJungle_out.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

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=507008&r1=507007&r2=507008
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/test/sdotest2.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/test/sdotest2.cpp Tue Feb 13 06:04:51 2007
@@ -1575,6 +1575,8 @@
 int sdotest::jira980()
 {
 
+   // Load both schema files into a single data factory and create content
+   // within an open type root element.
    try
    {
       // Data factory to load both schema files. 
@@ -1585,9 +1587,6 @@
       xsh_both->defineFile("jira980_jungle.xsd");
       xsh_both->defineFile("jira980_animaltypes.xsd");
 
-      // Print the metadata that we now have.
-      TypeList types_both = df_both->getTypes();
-
       // Create three animals based on the preceding types.
       DataObjectPtr baloo = df_both->create("", "bearType");
       baloo->setCString("name", "Mummy bear");
@@ -1625,11 +1624,64 @@
       return 0;
    }
 
+
+   // Load the schema files into two different data factories and then create
+   // content within an open type root element.
+   try
+   {
+      // Load the schema files into two different data factories.
+      DataFactoryPtr df_1 = DataFactory::getDataFactory();
+      DataFactoryPtr df_2 = DataFactory::getDataFactory();
+
+      XSDHelperPtr xsh_1 = HelperProvider::getXSDHelper(df_1);
+      XSDHelperPtr xsh_2 = HelperProvider::getXSDHelper(df_2);
+
+      xsh_1->defineFile("jira980_jungle.xsd");
+      xsh_2->defineFile("jira980_animaltypes.xsd");
+
+      // Create three animals based on the preceding types.
+      DataObjectPtr baloo = df_2->create("", "bearType");
+      baloo->setCString("name", "Mummy bear");
+      baloo->setInteger("weight", 700);
+
+      DataObjectPtr bagheera = df_2->create("", "pantherType");
+      bagheera->setCString("name", "Bagheera");
+      bagheera->setCString("colour", "inky black");
+
+      DataObjectPtr kaa = df_2->create("", "snakeType");
+      kaa->setCString("name", "Kaa");
+      kaa->setInteger("length", 25);
+
+      // Create an output document
+      XMLHelperPtr xmh_1 = HelperProvider::getXMLHelper(df_1);
+      XMLDocumentPtr document_1 = xmh_1->createDocument();
+
+      DataObjectPtr jungle = document_1->getRootDataObject();
+
+      // Add the three animals as children of the document root. In this test
+      // that root will be a "jungle" element.
+      jungle->setDataObject("bear", baloo);
+      jungle->setDataObject("panther", bagheera);
+      jungle->setDataObject("snake", kaa);
+
+      xmh_1->save(document_1, "jira980_splitJungle_out.xml");
+      if (!comparefiles("jira980_splitJungle_out.txt" ,"jira980_splitJungle_out.xml"))
+      {
+         return 0;
+      }
+   }
+   catch (SDORuntimeException e)
+   {
+      cout << "Exception in jira980" << e << endl;
+      return 0;
+   }
+
+   // Load both schema files into a single data factory and create content
+   // within an open type root element with mixed ie sequenced) content.
    try
    {
       // Data factory to load both schema files. 
       DataFactoryPtr df_both = DataFactory::getDataFactory();
-
       XSDHelperPtr xsh_both = HelperProvider::getXSDHelper(df_both);
 
       // Load a root element definition, then the three animal types.
@@ -1665,6 +1717,7 @@
       return comparefiles("jira980_mixedJungle_out.txt" ,"jira980_mixedJungle_out.xml");
 
    }
+
    catch (SDORuntimeException e)
    {
       cout << "Exception in jira980" << e << endl;



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