You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ro...@apache.org on 2006/08/25 13:55:01 UTC

svn commit: r436769 - in /incubator/tuscany/cpp/sdo: projectsvc7/tuscany_sdo/sdo_interop/ runtime/core/interop/

Author: robbinspg
Date: Fri Aug 25 04:54:55 2006
New Revision: 436769

URL: http://svn.apache.org/viewvc?rev=436769&view=rev
Log:
TUSCANY-496 - Apply Simon Law's interop test patch
VC7 project file added under projectsvc7 rather than projects
corrected licence header in new files

Added:
    incubator/tuscany/cpp/sdo/projectsvc7/tuscany_sdo/sdo_interop/
    incubator/tuscany/cpp/sdo/projectsvc7/tuscany_sdo/sdo_interop/sdo_interop.vcproj
    incubator/tuscany/cpp/sdo/runtime/core/interop/
    incubator/tuscany/cpp/sdo/runtime/core/interop/interop.cpp   (with props)
    incubator/tuscany/cpp/sdo/runtime/core/interop/interop.h   (with props)
    incubator/tuscany/cpp/sdo/runtime/core/interop/main.cpp   (with props)
    incubator/tuscany/cpp/sdo/runtime/core/interop/runinterop.bat   (with props)

Added: incubator/tuscany/cpp/sdo/projectsvc7/tuscany_sdo/sdo_interop/sdo_interop.vcproj
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/projectsvc7/tuscany_sdo/sdo_interop/sdo_interop.vcproj?rev=436769&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/projectsvc7/tuscany_sdo/sdo_interop/sdo_interop.vcproj (added)
+++ incubator/tuscany/cpp/sdo/projectsvc7/tuscany_sdo/sdo_interop/sdo_interop.vcproj Fri Aug 25 04:54:55 2006
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding = "Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.00"
+	Name="sdo_interop"
+	ProjectGUID="{42FC01B7-28E2-4086-A1D0-6E6159CCF1B4}"
+	Keyword="Win32Proj">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="..\..\..\runtime\core\interop\Debug"
+			IntermediateDirectory="..\..\..\runtime\core\interop\Debug"
+			ConfigurationType="1"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\deploy\include"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="TRUE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="4"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="tuscany_sdo.lib"
+				OutputFile="$(OutDir)/sdo_interop.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories="..\..\..\deploy\lib"
+				GenerateDebugInformation="TRUE"
+				ProgramDatabaseFile="$(OutDir)/sdo_interop.pdb"
+				SubSystem="1"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				OmitFramePointers="TRUE"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				StringPooling="TRUE"
+				RuntimeLibrary="4"
+				EnableFunctionLevelLinking="TRUE"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/sdo_interop.exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="TRUE"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+		</Configuration>
+	</Configurations>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+			<File
+				RelativePath="..\..\..\runtime\core\interop\interop.cpp">
+			</File>
+			<File
+				RelativePath="..\..\..\runtime\core\interop\main.cpp">
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc">
+			<File
+				RelativePath="..\..\..\runtime\core\interop\interop.h">
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Added: incubator/tuscany/cpp/sdo/runtime/core/interop/interop.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/interop/interop.cpp?rev=436769&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/interop/interop.cpp (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/interop/interop.cpp Fri Aug 25 04:54:55 2006
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *   
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "interop.h"
+
+using namespace std;
+
+/*
+ * Ensure that SDO can read an XML file and 
+ * write it back out again without changing the XML. The 
+ * test XML files can be found in tuscany/interop/src/main/resources
+ */ 
+void Interop::test1ReadAndWriteXML(char *commonDir, char *filename)
+{
+    int i,j;
+
+	cout << " \nC++ interop test1 - read and write XML: " << filename << endl;
+    try 
+    {
+        DataFactoryPtr mdg  = DataFactory::getDataFactory();
+
+        /**
+         * Get an XSD helper to load XSD information into the
+         * data factory
+         */
+        XSDHelperPtr myXSDHelper = HelperProvider::getXSDHelper(mdg);
+		char fullxsdfilename[200];
+		strcpy (fullxsdfilename, commonDir );
+		strcat (fullxsdfilename, filename );
+		strcat (fullxsdfilename,".xsd");
+        cout << "Read the XSD file " << fullxsdfilename <<  endl;
+		myXSDHelper->defineFile(fullxsdfilename);
+
+        /**
+         * Check if there were any errors. The parse may still
+         * succeed, but errors indicate some elements were not
+         * understood 
+         */
+        if ((i = myXSDHelper->getErrorCount()) > 0)
+        {
+            cout << "XSD Loading reported some errors:" << endl;
+            for (j=0;j<i;j++)
+            {
+                const char *m = myXSDHelper->getErrorMessage(j);
+                if (m != 0) cout << m;
+                cout << endl;
+            }
+        }
+
+        /** 
+         * Use the same data factory to load XML corresponding to
+         * data objects adhering to the previously loaded schema
+         */
+        XMLHelperPtr myXMLHelper = HelperProvider::getXMLHelper(mdg);
+		char fullxmlfilename[200];
+		strcpy (fullxmlfilename, commonDir );
+		strcat (fullxmlfilename, filename );
+		strcat(fullxmlfilename,"-in.xml");
+        cout << "Read the XML file " << fullxmlfilename << endl;
+        XMLDocumentPtr myXMLDocument = myXMLHelper->loadFile(fullxmlfilename, "http://www.apache.org/tuscany/interop");
+    
+       /**
+         * Check if there were any errors. The parse may still
+         * succeed, but errors indicate some elements did not match
+         * the schema, or were malformed.
+         * 
+         */
+        if ((i = myXMLHelper->getErrorCount()) > 0)
+        {
+            cout << "XML Loading reported some errors:" << endl;
+            for (j=0;j<i;j++)
+            {
+                const char *m = myXMLHelper->getErrorMessage(j);
+                if (m != 0) cout << m;
+                cout << endl;
+            }
+        }
+
+        DataObjectPtr newdob = myXMLDocument->getRootDataObject();
+		cout << "Get current state of DataObject\n";
+		DataObjectPtr dc = newdob->getContainer();
+
+		if ( !dc )
+		{
+			cout << "There is no container" << endl;
+		}
+		else
+		{
+			cout <<" Container of type " << dc->getType().getName();
+		}
+
+		PropertyList pl = newdob->getInstanceProperties();
+/*
+		// Print out the top level elements of the document
+		for ( int i=0; i < pl.size(); i++ )
+		{
+			const Property& p = pl[i];
+			if ( newdob->isSet(p))
+			{
+				if ( p.getType().isDataType() )
+				{
+					cout << "isDataType = TRUE \n";
+					cout << p.getName() << "=" << newdob->getCString(i) << endl;
+				}
+				else
+				{
+					cout << "isDataType = FALSE \n";
+					if ( p.isMany )
+					{
+						cout << "isMany = TRUE \n";
+						DataObjectList& dol= newdob->getList (i);
+
+						for ( int i=0; i < dol.size(); i++ )
+						{
+							cout << p.getName() << "[" << i << "] " << "=" << dol[i] << endl;
+						}
+					}
+					else
+					{
+						cout << "isMany = FALSE \n";
+						cout << p.getName() << "=" << newdob->getDataObject(i) << endl;
+					}
+				}
+			}
+		}
+*/
+		// write the XML element back out to a file
+		char outxmlfilename[200];
+		strcpy (outxmlfilename, filename );
+		strcat (outxmlfilename, "-cpp-out.xml" );
+		cout << "Write the XML file " << outxmlfilename << endl;
+		myXMLHelper->save(myXMLDocument, outxmlfilename);
+
+    }
+    catch (SDORuntimeException e)
+    {
+        cout << "Exception in interop test" <<  endl;
+        cout << e.getMessageText();
+		cout << e;
+    }
+}
+
+/*
+ * Ensure that SDO can read an XSD file and 
+ * write it back out again without changing the XSD. The 
+ * test XML files can be found in tuscany/interop/src/main/resources
+ */ 
+void Interop::test4ReadAndWriteXSD(char *commonDir, char *filename)
+{
+        /**
+         * Get an XSD helper to load XSD information into the
+         * data factory
+         */
+
+		DataFactoryPtr mdg  = DataFactory::getDataFactory();
+        XSDHelperPtr myXSDHelper = HelperProvider::getXSDHelper(mdg);
+
+		char fullxsdfilename[200];
+		strcpy (fullxsdfilename, commonDir );
+		strcat (fullxsdfilename, filename );
+		strcat (fullxsdfilename,".xsd");
+	    cout << "Read the XSD file " << fullxsdfilename << endl;
+		const char * URIOfRootType = myXSDHelper->defineFile(fullxsdfilename);
+
+        cout << "URI of root type" << URIOfRootType << endl;
+
+		/**
+		 * Now write the XSD back again
+		 */
+		DataFactoryPtr df = myXSDHelper->getDataFactory();
+		TypeList typeList = df->getTypes();
+
+	    char outxsdfilename[200];
+		strcpy (outxsdfilename, filename );
+		strcat(outxsdfilename,"-cpp-out.xsd");
+		cout << "Write an XSD back out " << outxsdfilename << endl;
+		myXSDHelper->generateFile(typeList, outxsdfilename);
+
+}

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

Propchange: incubator/tuscany/cpp/sdo/runtime/core/interop/interop.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sdo/runtime/core/interop/interop.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/interop/interop.h?rev=436769&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/interop/interop.h (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/interop/interop.h Fri Aug 25 04:54:55 2006
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *   
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "commonj/sdo/SDO.h"
+
+
+using namespace commonj::sdo;
+
+class Interop 
+{
+    public:
+        static void test1ReadAndWriteXML(char *, char *);
+		static void test4ReadAndWriteXSD(char *, char *);
+};

Propchange: incubator/tuscany/cpp/sdo/runtime/core/interop/interop.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/interop/interop.h
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sdo/runtime/core/interop/main.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/interop/main.cpp?rev=436769&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/interop/main.cpp (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/interop/main.cpp Fri Aug 25 04:54:55 2006
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *   
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "interop.h"
+
+using namespace std;
+/*
+ * The interop tests exercised here do not actually interoperate with other
+ * SDO implementations but simply check that and data that is read
+ * in and written out remains unchanged
+ */
+int  main (int argc, char** argv)
+{
+	char *commonDir = "..\\..\\..\\..\\..\\interop\\src\\main\\resources\\";
+
+	cout << "SOME TESTS COMMENTED OUT - CHECK SOURCE \n";
+
+	Interop::test1ReadAndWriteXML(commonDir, "interop01");
+    Interop::test1ReadAndWriteXML(commonDir, "interop02");
+    Interop::test1ReadAndWriteXML(commonDir, "interop03");     
+    //Interop::test1ReadAndWriteXML(commonDir, "interop04");
+    Interop::test1ReadAndWriteXML(commonDir, "interop05");
+    Interop::test1ReadAndWriteXML(commonDir, "interop06");
+    Interop::test1ReadAndWriteXML(commonDir, "interop07");
+    Interop::test1ReadAndWriteXML(commonDir, "interop08");
+    Interop::test1ReadAndWriteXML(commonDir, "interop09");
+    Interop::test1ReadAndWriteXML(commonDir, "interop10");
+    Interop::test1ReadAndWriteXML(commonDir, "interop11");
+    Interop::test1ReadAndWriteXML(commonDir, "interop12");
+    //Interop::test1ReadAndWriteXML(commonDir, "interop13");
+    Interop::test1ReadAndWriteXML(commonDir, "interop14");
+    Interop::test1ReadAndWriteXML(commonDir, "interop15");
+    Interop::test1ReadAndWriteXML(commonDir, "interop16");
+    Interop::test1ReadAndWriteXML(commonDir, "interop17");
+    Interop::test1ReadAndWriteXML(commonDir, "interop18");
+    Interop::test1ReadAndWriteXML(commonDir, "interop19");
+    Interop::test1ReadAndWriteXML(commonDir, "interop20");
+    Interop::test1ReadAndWriteXML(commonDir, "interop21");
+    Interop::test1ReadAndWriteXML(commonDir, "interop22");
+    Interop::test1ReadAndWriteXML(commonDir, "interop23");
+    Interop::test1ReadAndWriteXML(commonDir, "interop24");
+    Interop::test1ReadAndWriteXML(commonDir, "interop25");
+    Interop::test1ReadAndWriteXML(commonDir, "interop26");
+    Interop::test1ReadAndWriteXML(commonDir, "interop27");
+    Interop::test1ReadAndWriteXML(commonDir, "interop28");
+    Interop::test1ReadAndWriteXML(commonDir, "interop29");
+    Interop::test1ReadAndWriteXML(commonDir, "interop30");
+    Interop::test1ReadAndWriteXML(commonDir, "interop31");
+    Interop::test1ReadAndWriteXML(commonDir, "interop32");
+    Interop::test1ReadAndWriteXML(commonDir, "interop33");
+    Interop::test1ReadAndWriteXML(commonDir, "interop34");
+    Interop::test1ReadAndWriteXML(commonDir, "interop35");
+    Interop::test1ReadAndWriteXML(commonDir, "interop36");
+    Interop::test1ReadAndWriteXML(commonDir, "interop37");
+    Interop::test1ReadAndWriteXML(commonDir, "interop38");
+    Interop::test1ReadAndWriteXML(commonDir, "interop39");
+    Interop::test1ReadAndWriteXML(commonDir, "interop40");
+    Interop::test1ReadAndWriteXML(commonDir, "interop41");
+    Interop::test1ReadAndWriteXML(commonDir, "interop42");
+    Interop::test1ReadAndWriteXML(commonDir, "interop43");
+    Interop::test1ReadAndWriteXML(commonDir, "interop44");
+    Interop::test1ReadAndWriteXML(commonDir, "interop45");
+    Interop::test1ReadAndWriteXML(commonDir, "interop46");
+    Interop::test1ReadAndWriteXML(commonDir, "interop47");
+    Interop::test1ReadAndWriteXML(commonDir, "interop50");
+
+	Interop::test4ReadAndWriteXSD(commonDir, "interop01");
+
+    return 0;
+}

Propchange: incubator/tuscany/cpp/sdo/runtime/core/interop/main.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sdo/runtime/core/interop/main.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/cpp/sdo/runtime/core/interop/runinterop.bat
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/interop/runinterop.bat?rev=436769&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/interop/runinterop.bat (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/interop/runinterop.bat Fri Aug 25 04:54:55 2006
@@ -0,0 +1,7 @@
+set SDO_BASE=..\..\..
+
+set PATH=%LIBXML2_HOME%\bin;%ICONV_HOME%\bin;%ZLIB_HOME%\bin;%SDO_BASE%\deploy\bin
+
+Debug\sdo_interop.exe
+
+

Propchange: incubator/tuscany/cpp/sdo/runtime/core/interop/runinterop.bat
------------------------------------------------------------------------------
    svn:eol-style = native



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