You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ad...@apache.org on 2007/05/14 05:26:38 UTC

svn commit: r537696 - in /incubator/tuscany/cpp/das: VSExpress/tuscany_das/ VSExpress/tuscany_das/Build/ VSExpress/tuscany_das/das_runtime/ VSExpress/tuscany_das/das_test/ runtime/core/src/apache/das/rdb/ runtime/test/ runtime/test/src/

Author: adrianocrestani
Date: Sun May 13 20:26:37 2007
New Revision: 537696

URL: http://svn.apache.org/viewvc?view=rev&rev=537696
Log:
- created the das_test VC project containing 3 testcases
- removed some unused include directories from projects settings

Added:
    incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_test/
    incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_test/das_test.vcproj
    incubator/tuscany/cpp/das/runtime/test/
    incubator/tuscany/cpp/das/runtime/test/src/
    incubator/tuscany/cpp/das/runtime/test/src/main.cpp
Removed:
    incubator/tuscany/cpp/das/VSExpress/tuscany_das/Build/
    incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.sln
    incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.suo
Modified:
    incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.vcproj
    incubator/tuscany/cpp/das/VSExpress/tuscany_das/tuscany_das.sln
    incubator/tuscany/cpp/das/VSExpress/tuscany_das/tuscany_das.suo
    incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilder.cpp

Modified: incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.vcproj
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.vcproj?view=diff&rev=537696&r1=537695&r2=537696
==============================================================================
--- incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.vcproj (original)
+++ incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_runtime/das_runtime.vcproj Sun May 13 20:26:37 2007
@@ -146,7 +146,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="&quot;$(VCInstallDir)\include&quot;;..\..\..\runtime\core\include;&quot;C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\crt&quot;;&quot;C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include&quot;;&quot;$(TUSCANY_SDOCPP)\include&quot;;&quot;%LIBXML2_HOME%\include&quot;;&quot;%ZLIB_HOME%\include&quot;;&quot;%ICONV_HOME%\include&quot;"
+				AdditionalIncludeDirectories="..\..\..\runtime\core\include;&quot;$(TUSCANY_SDOCPP)\include&quot;;&quot;%LIBXML2_HOME%\include&quot;;&quot;%ZLIB_HOME%\include&quot;;&quot;%ICONV_HOME%\include&quot;"
 				PreprocessorDefinitions="WIN32;_DEBUG"
 				MinimalRebuild="false"
 				BasicRuntimeChecks="0"

Added: incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_test/das_test.vcproj
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_test/das_test.vcproj?view=auto&rev=537696
==============================================================================
--- incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_test/das_test.vcproj (added)
+++ incubator/tuscany/cpp/das/VSExpress/tuscany_das/das_test/das_test.vcproj Sun May 13 20:26:37 2007
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8,00"
+	Name="das_test"
+	ProjectGUID="{277D86C4-0113-49EE-A351-0D32FF2E1EF3}"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;$(TUSCANY_SDOCPP)/include&quot;;..\..\..\runtime\core\include"
+				PreprocessorDefinitions="_DEBUG;WIN32"
+				RuntimeLibrary="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="das_runtime.lib tuscany_sdo.lib odbc32.lib"
+				AdditionalLibraryDirectories="&quot;$(TUSCANY_SDOCPP)/lib&quot;;..\..\tuscany_das\debug"
+				GenerateDebugInformation="true"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\runtime\test\src\main.cpp"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: incubator/tuscany/cpp/das/VSExpress/tuscany_das/tuscany_das.sln
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/VSExpress/tuscany_das/tuscany_das.sln?view=diff&rev=537696&r1=537695&r2=537696
==============================================================================
--- incubator/tuscany/cpp/das/VSExpress/tuscany_das/tuscany_das.sln (original)
+++ incubator/tuscany/cpp/das/VSExpress/tuscany_das/tuscany_das.sln Sun May 13 20:26:37 2007
@@ -3,6 +3,8 @@
 # Visual C++ Express 2005
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "das_runtime", "das_runtime\das_runtime.vcproj", "{964F3F93-8D1C-46BE-9724-2313CE7380AA}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "das_test", "das_test\das_test.vcproj", "{277D86C4-0113-49EE-A351-0D32FF2E1EF3}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Win32 = Debug|Win32
@@ -13,6 +15,10 @@
 		{964F3F93-8D1C-46BE-9724-2313CE7380AA}.Debug|Win32.Build.0 = Debug|Win32
 		{964F3F93-8D1C-46BE-9724-2313CE7380AA}.Release|Win32.ActiveCfg = Release|Win32
 		{964F3F93-8D1C-46BE-9724-2313CE7380AA}.Release|Win32.Build.0 = Release|Win32
+		{277D86C4-0113-49EE-A351-0D32FF2E1EF3}.Debug|Win32.ActiveCfg = Debug|Win32
+		{277D86C4-0113-49EE-A351-0D32FF2E1EF3}.Debug|Win32.Build.0 = Debug|Win32
+		{277D86C4-0113-49EE-A351-0D32FF2E1EF3}.Release|Win32.ActiveCfg = Release|Win32
+		{277D86C4-0113-49EE-A351-0D32FF2E1EF3}.Release|Win32.Build.0 = Release|Win32
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

Modified: incubator/tuscany/cpp/das/VSExpress/tuscany_das/tuscany_das.suo
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/VSExpress/tuscany_das/tuscany_das.suo?view=diff&rev=537696&r1=537695&r2=537696
==============================================================================
Binary files - no diff available.

Modified: incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilder.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilder.cpp?view=diff&rev=537696&r1=537695&r2=537696
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilder.cpp (original)
+++ incubator/tuscany/cpp/das/runtime/core/src/apache/das/rdb/GraphBuilder.cpp Sun May 13 20:26:37 2007
@@ -162,7 +162,6 @@
 	graphBuilderMetaData = new GraphBuilderMetaData(config, resultSet->getResultSetMetaData()) ;
 	commonj::sdo::DataFactoryPtr dataFactory = graphBuilderMetaData->createGraph();
 
-	printDataGraphMetaData(dataFactory);
 	this->resultSet = resultSet;
 	const std::map<std::string, Table*> tables = graphBuilderMetaData->getTables();
 	
@@ -308,8 +307,6 @@
 			delete tablesDataByPKIterator->second;
 
 	}
-
-	printDataGraph(root);
 
 }
 

Added: incubator/tuscany/cpp/das/runtime/test/src/main.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/test/src/main.cpp?view=auto&rev=537696
==============================================================================
--- incubator/tuscany/cpp/das/runtime/test/src/main.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/test/src/main.cpp Sun May 13 20:26:37 2007
@@ -0,0 +1,139 @@
+#include <iostream>
+#include <apache/das/rdb/Connection.h>
+#include <apache/das/DAS.h>
+#include <apache/das/rdb/DASImpl.h>
+#include <apache/das/Command.h>
+#include <apache/das/rdb/ResultSet.h>
+#include <apache/das/rdb/Statement.h>
+#include <apache/das/rdb/ResultSet.h>
+#include <apache/das/NullPointerException.h>
+#include <apache/das/rdb/das_constants.h>
+
+#include <commonj/sdo/DataObject.h>
+
+using namespace std;
+using namespace apache::das;
+using namespace apache::das::rdb;
+
+void testStatementAndResultSetPointer() {
+	cout << "-------------testStatementAndResultSetPointer--------------" << endl;
+	Connection* conn = new Connection("testDSN", "root", "masterkey");
+	StatementPtr stmtPtr1 = conn->createStatement();
+	Statement* stmt = stmtPtr1;
+	StatementPtr stmtPtr2 = stmtPtr1;
+	StatementPtr stmtPtr3 = conn->createStatement();
+	StatementPtr* stmtPtr4 = new StatementPtr(stmt);
+	
+	ResultSetPtr resultSetPtr = stmtPtr1->executeQuery("select * from company;");
+
+	cout << "ResultSet pointer working correctly = ";
+	try {
+		resultSetPtr->getStatement();
+		cout << "OK" << endl;
+	} catch (NullPointerException& exp) {
+		cout << "NullPointerException" << endl;
+	}
+
+	stmtPtr1->executeQuery("select * from employee;");
+	cout << "ResultSet object deleted when there is another query = ";
+	try {
+		resultSetPtr->getStatement();
+		cout << "not deleted" << endl;
+	} catch (NullPointerException& exp) {
+		cout << "OK" << endl;
+	}
+
+	cout << "Statement pointer working correctly = ";
+	try {
+		stmtPtr1->getODBCStatement();
+		cout << "OK" << endl;
+	} catch (NullPointerException& exp) {
+		cout << "NullPointerException" << endl;
+	}
+
+	stmtPtr1 = 0;
+	stmtPtr2 = 0;
+	delete stmtPtr4;
+	cout << "Statement object deleted when there is no more reference = ";
+	try {
+		stmtPtr1->getODBCStatement();
+		cout << "not deleted" << endl;
+	} catch (NullPointerException& exp) {
+		cout << "OK" << endl;
+	}
+	
+	stmtPtr1 = conn->createStatement();
+	resultSetPtr = stmtPtr1 ->executeQuery("select * from company;");
+	ResultSetPtr resultSetPtr2 = resultSetPtr;
+	delete conn;
+	stmtPtr1 = 0;
+	resultSetPtr = 0;
+	resultSetPtr2 = 0;
+
+	cout << "Statement pointer set as null when object is deleted = ";
+	try {
+		stmtPtr3->getODBCStatement();
+		cout << "not null" << endl;
+	} catch (NullPointerException& exp) {
+		cout << "OK" << endl;
+	}
+
+	cout << "---------------------------------" << endl << endl;
+
+}
+
+void testIncompleteCompositeRelationship() {
+	Connection con("testDSN", "root", "masterkey");
+	DASImpl* das = (DASImpl*) DAS::getFACTORY()->createDAS(con);
+	Config& config = das->getConfig();
+
+	Relationship* relationship = new Relationship("department", "employee");
+	relationship->addKeyPair(*(new KeyPair("id", "department_id")));
+	relationship->addKeyPair(*(new KeyPair("name", "department_name")));
+	config.addRelationship(*relationship);
+
+	Command& command = das->createCommand(
+		"SELECT department.id, department.name, employee.id FROM department, employee;");
+
+	commonj::sdo::DataObjectPtr root = command.executeQuery();
+
+	cout << "relationship ignored = ";
+	try {
+		root->getDataFactory()->getType(DAS_NAMESPACE, "department").getProperty("departmentemployee");
+		cout << "not ignored" << endl;
+
+	} catch (SDOPropertyNotFoundException ex) {
+		cout << "OK" << endl;
+	}
+
+	cout << "---------------------------------" << endl << endl;
+
+}
+
+void testUniqueObjectByID() {
+	cout << "-------------testUniqueObjectByID--------------" << endl;
+
+	Connection con("testDSN", "root", "masterkey");
+	DASImpl* das = (DASImpl*) DAS::getFACTORY()->createDAS(con);
+	Command& command = das->createCommand("SELECT * FROM company, employee where company.id = 1;");
+	commonj::sdo::DataObjectPtr root = command.executeQuery();
+
+	cout << "table duplicated row ignored = ";
+	if (root->getList("company").size() == 1) {
+		cout << "OK" << endl;
+	} else {
+		cout << "not ignored" << endl;
+	}
+	
+	cout << "---------------------------------" << endl << endl;
+
+}
+
+int main() {
+	testStatementAndResultSetPointer();
+	testUniqueObjectByID();
+	testIncompleteCompositeRelationship();
+
+	system("PAUSE");
+
+}



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