From 66dec3583b86d6c8a761282916d972c69295c0d4 Mon Sep 17 00:00:00 2001
From: Cyrille Valladeau <cyrille.valladeau@c-s.fr>
Date: Mon, 16 Aug 2010 09:43:30 +0200
Subject: [PATCH] ENH : add Tu test for otbGISTableSource

---
 Code/Common/otbGISConnectionImplementation.h |  2 +-
 Testing/Code/Common/CMakeLists.txt           | 23 ++++++++++++
 Testing/Code/Common/otbCommonTests10.cxx     |  1 +
 Testing/Code/Common/otbCommonTests13.cxx     | 30 ++++++++++++++++
 Testing/Code/Common/otbGISTableSourceNew.cxx | 37 ++++++++++++++++++++
 5 files changed, 92 insertions(+), 1 deletion(-)
 create mode 100644 Testing/Code/Common/otbCommonTests13.cxx
 create mode 100644 Testing/Code/Common/otbGISTableSourceNew.cxx

diff --git a/Code/Common/otbGISConnectionImplementation.h b/Code/Common/otbGISConnectionImplementation.h
index 4c484b690e..bfd9f61543 100644
--- a/Code/Common/otbGISConnectionImplementation.h
+++ b/Code/Common/otbGISConnectionImplementation.h
@@ -73,7 +73,7 @@ protected:
   /** Constructor */
   GISConnectionImplementation(){};
   /** Destructor */
-  virtual ~GISConnectionImplementation(){}
+  virtual ~GISConnectionImplementation(){};
 
 private:
   GISConnectionImplementation(const Self &); //purposely not implemented
diff --git a/Testing/Code/Common/CMakeLists.txt b/Testing/Code/Common/CMakeLists.txt
index 7859d8afec..e720682bd5 100644
--- a/Testing/Code/Common/CMakeLists.txt
+++ b/Testing/Code/Common/CMakeLists.txt
@@ -35,6 +35,7 @@ SET(COMMON_TESTS11 ${CXX_TEST_PATH}/otbCommonTests11)
 IF(OTB_COMPILE_MUPARSER)
 SET(COMMON_TESTS12 ${CXX_TEST_PATH}/otbCommonTests12)
 ENDIF(OTB_COMPILE_MUPARSER)
+SET(COMMON_TESTS8 ${CXX_TEST_PATH}/otbCommonTests13)
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbCommonTests1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -910,6 +911,12 @@ Bidfeud0
 )
 
 
+# ----------------  otbGISTableSource  ---------------------#
+ADD_TEST(coTuLabelMapSourceNew ${COMMON_TESTS10}
+otbGISTableSourceNew
+)
+
+
 ENDIF(OTB_USE_PQXX)
 
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1003,6 +1010,14 @@ IF(OTB_COMPILE_MUPARSER)
 ENDIF(OTB_COMPILE_MUPARSER)
 
 
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbCommonTests13 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+
+
+
+
 # -------       Fichiers sources CXX -----------------------------------
 SET(BasicCommon_SRCS1
 otbCommonTests1.cxx
@@ -1143,6 +1158,7 @@ otbGISTableToLabelMapFilterNew.cxx
 otbGISTableToVectorDataFilterNew.cxx
 otbLabelMapToGISTableFilter.cxx
 otbGISTableToVectorDataFilter.cxx
+otbGISTableSourceNew.cxx
 )
 ENDIF(OTB_USE_PQXX)
 
@@ -1172,6 +1188,11 @@ otbParserTest.cxx
 )
 ENDIF(OTB_COMPILE_MUPARSER)
 
+
+SET(BasicCommon_SRCS13
+otbCommonTests13.cxx
+)
+
 OTB_ADD_EXECUTABLE(otbCommonTests1 "${BasicCommon_SRCS1}" "OTBIO;OTBTesting")
 OTB_ADD_EXECUTABLE(otbCommonTests2 "${BasicCommon_SRCS2}" "OTBIO;OTBTesting")
 OTB_ADD_EXECUTABLE(otbCommonTests3 "${BasicCommon_SRCS3}" "OTBIO;OTBTesting")
@@ -1194,4 +1215,6 @@ IF(OTB_COMPILE_MUPARSER)
   OTB_ADD_EXECUTABLE(otbCommonTests12 "${BasicCommon_SRCS12}" "OTBIO;OTBTesting")
 ENDIF(OTB_COMPILE_MUPARSER)
 
+OTB_ADD_EXECUTABLE(otbCommonTests13 "${BasicCommon_SRCS13}" "OTBIO;OTBTesting")
+
 ENDIF( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING )
diff --git a/Testing/Code/Common/otbCommonTests10.cxx b/Testing/Code/Common/otbCommonTests10.cxx
index 512e1f4ab3..fa08d84f76 100644
--- a/Testing/Code/Common/otbCommonTests10.cxx
+++ b/Testing/Code/Common/otbCommonTests10.cxx
@@ -39,4 +39,5 @@ void RegisterTests()
   REGISTER_TEST(otbGISTableToLabelMapFilterNew);
   REGISTER_TEST(otbLabelMapToGISTableFilter);
   REGISTER_TEST(otbGISTableToVectorDataFilter);
+  REGISTER_TEST(otbGISTableSourceNew);
 }
diff --git a/Testing/Code/Common/otbCommonTests13.cxx b/Testing/Code/Common/otbCommonTests13.cxx
new file mode 100644
index 0000000000..fd1171dd74
--- /dev/null
+++ b/Testing/Code/Common/otbCommonTests13.cxx
@@ -0,0 +1,30 @@
+/*=========================================================================
+
+  Program:   ORFEO Toolbox
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+
+  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+  See OTBCopyright.txt for details.
+
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+
+// this file defines the otbCommonTest for the test driver
+// and all it expects is that you have a function called RegisterTests
+#if defined(_MSC_VER)
+#pragma warning ( disable : 4786 )
+#endif
+
+#include "otbTestMain.h"
+
+void RegisterTests()
+{
+  //  REGISTER_TEST(otbGISTableSourceNew);
+}
diff --git a/Testing/Code/Common/otbGISTableSourceNew.cxx b/Testing/Code/Common/otbGISTableSourceNew.cxx
new file mode 100644
index 0000000000..8ed3fae201
--- /dev/null
+++ b/Testing/Code/Common/otbGISTableSourceNew.cxx
@@ -0,0 +1,37 @@
+/*=========================================================================
+
+  Program:   ORFEO Toolbox
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+
+  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+  See OTBCopyright.txt for details.
+
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+#include "itkExceptionObject.h"
+#include "otbMacro.h"
+
+#include "otbGISTableSource.h"
+#include "otbGISTable.h"
+#include "otbPostGISConnectionImplementation.h"
+
+int otbGISTableSourceNew(int argc, char * argv[])
+{
+  
+  typedef otb::PostGISConnectionImplementation        GISConnectionType;
+  typedef otb::GISTable<GISConnectionType, double, 2> GISTableType;
+
+  typedef otb::GISTableSource<GISTableType> GISTableSourceType;
+
+  //Instantiation
+  GISTableSourceType::Pointer object = GISTableSourceType::New();
+
+  return EXIT_SUCCESS;
+}
-- 
GitLab