TsDataSourceTransactor.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file TsDataSourceTransactor.h
22 
23  \brief A test suit for the DataSourceTransactor interface.
24  */
25 
26 #ifndef __TERRALIB_UNITTEST_DATAACCESS_INTERNAL_DATASOURCETRANSACTOR_H
27 #define __TERRALIB_UNITTEST_DATAACCESS_INTERNAL_DATASOURCETRANSACTOR_H
28 
29 // TerraLib
30 #include <terralib/dataaccess_fw.h>
31 #include <terralib/geometry_fw.h>
32 
33 // STL
34 #include <string>
35 
36 // cppUnit
37 #include <cppunit/extensions/HelperMacros.h>
38 
39 /*!
40  \class TsDataSourceTransactor
41 
42  \brief A test suit for the DataSourceTransactor interface.
43 
44  ....
45  <br>
46  This test suite will check the following:
47  <ul>
48  <li>;</li>
49  <li>;</li>
50  <li>;</li>
51  <li>;</li>
52  <li>;</li>
53  </ul>
54  */
55 class TsDataSourceTransactor : public CPPUNIT_NS::TestFixture
56 {
57 // It registers this class as a Test Suit
59 
60 // It registers the class methods as Test Cases belonging to the suit
70 
72 
73  public:
74 // It sets up context before running the test.
75  void setUp();
76 
77 // It cleann up after the test run.
78  void tearDown();
79 
80  protected:
81 
82 // Test Cases for DataSourceTransactor:
83 
84  // Protected Methods
85  // ...
86 
87  /*!
88  \brief Test Case: Testing DataSourceTransactor of an given datasource.
89  */
90  void tcBegin();
91  void tcComit();
92  void tcRollback();
93  void tcExecuteQuery();
94  void tcExecuteCommand();
95  void tcGetDataSource();
96  void tcRenameDataSet();
97 
98  /*!
99  \brief Test Case: get the dataSet using the i-th position in the DataSourceCatalog.
100 
101  This test case will get all the dataSets using the i-th position in the DataSourceCatalog.
102  */
103  void tcGetDataSet(); //10 API
104 
105  /*!
106  \brief Test Case: get only the objects that intercepts a given rectangle.
107 
108  This test case will get all the objects that intercepts a given rectangle defined m_vecNamesAndRecs.
109  The vector of pairs contain the dataSets names and the rectangles to be used as a spatial filter when retrieving datasets.
110  */
111  void tcGetDataSetByEnvRec();
112  void tcGetDataSetByEnvRec1();
113 
114  /*!
115  \brief Test Case: get only the objects that intercepts a given rectangle.
116 
117  This test case will get all the objects that intercepts a given rectangle defined m_vecNamesAndRecs.
118  The vector of pairs contain the dataSets names and the rectangles to be used as a spatial filter when retrieving datasets.
119  The number of objects returned is compared with the size in the vector of pairs m_vecNamesSizesRec.
120  */
121  void tcGetDataSetByEnvRec2();
122 
123  /*!
124  \brief Test Case: get only the objects that intercepts a given geometry (point, box, pol, geom).
125 
126  This test case will get all the objects that intercepts a given geometry (point, box, pol, geom).
127  */
128  void tcGetDataSetByGeometry();
129 
130  /*!
131  \brief Test Case: It gets the DataSet identified by the given name using a spatial filter over the given geometric property.
132 
133  This test case will gets the DataSet identified by the given name using a spatial filter over the given geometric property.
134  */
135  void tcGetDataSetByProperty();
136 
137  /*!
138  \brief Test Case: It gets a dataset identified by the given name using the set of objects identification.
139 
140  This test case will the gets the dataset identified by the given name using the set of objects identification.
141  */
142  void tcGetDataSetByOids();
143 
144  void tcQueryByString();
145  void tcQueryBySelect();
146 
147 
148  // New ones...
149  void tcGetPreparedStmt();
150  void tcGetBatchExecutor();
151  void tcGetCatalogLoader();
152  void tcCancel();
153 
154  //It will come from the setUp of the derived database class (see:TsPostGIS or TsSQLite or ...)
157  std::map<std::string, std::string> m_connInfo;
158  std::string m_dsType;
159  std::map<std::string, std::string> m_connInfoNewDs;
160 
162 
163  std::string m_dsToString;
164 
166 
167  std::vector<std::string> m_vecDtNames;
168  std::vector<te::gm::Envelope> m_vecEnvelops;
169  std::vector<std::pair<std::string, te::gm::Envelope> > m_vecDtNamesAndEnvelops;
170  std::vector<std::pair<std::string, te::gm::Envelope> > m_vecNamesAndRecs;
171  std::vector<std::pair<std::string, size_t> > m_vecNamesSizes;
172  std::vector<std::pair<std::string, size_t> > m_vecNamesSizesRec;
173 
179 
180 };
181 /*
182 // Calling order of DATASOURCETRANSACTOR Test Cases
183 
184 #define INSERT_DATASOURCETRANSACTOR_TC CPPUNIT_TEST( tcGetDataSource ); \
185  CPPUNIT_TEST( tcGetDataSet ); \
186  CPPUNIT_TEST( tcGetDataSetByGeometry ); \
187  CPPUNIT_TEST( tcGetDataSetByProperty ); \
188  CPPUNIT_TEST( tcGetDataSetByEnvRec ); \
189  CPPUNIT_TEST( tcGetDataSetByEnvRec1 ); \
190  CPPUNIT_TEST( tcGetDataSetByEnvRec2 ); \
191  CPPUNIT_TEST( tcQueryByString ); \
192  CPPUNIT_TEST( tcGetCatalogLoader ); \
193  CPPUNIT_TEST( tcGetDataSetTypePersistence ); \
194  CPPUNIT_TEST( tcGetDataSetPersistence ); \
195 */
196 #endif // __TERRALIB_UNITTEST_DATAACCESS_INTERNAL_DATASOURCETRANSACTOR_H
std::vector< std::pair< std::string, te::gm::Envelope > > m_vecDtNamesAndEnvelops
void tcGetDataSetByEnvRec()
Test Case: get only the objects that intercepts a given rectangle.
It represents the system catalog of a DataSource.
CPPUNIT_TEST(tcGetDataSource)
std::map< std::string, std::string > m_connInfoNewDs
te::da::DataSourceCatalog * m_dsCatalog
void tcGetDataSet()
Test Case: get the dataSet using the i-th position in the DataSourceCatalog.
Forward declarations for the Data Access module.
A class that represents the known capabilities of a specific data source, i.e. this class informs all...
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
te::gm::LinearRing * m_linearRing
A LinearRing is a LineString that is both closed and simple.
Definition: LinearRing.h:53
void tcGetDataSetByOids()
Test Case: It gets a dataset identified by the given name using the set of objects identification...
A point with x and y coordinate values.
Definition: Point.h:50
An Envelope defines a 2D rectangular region.
This file contains forward declarations for the Vector Geometry model of TerraLib.
CPPUNIT_TEST_SUITE(TsDataSourceTransactor)
std::vector< std::string > m_vecDtNames
std::vector< std::pair< std::string, size_t > > m_vecNamesSizesRec
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
void tcBegin()
Test Case: Testing DataSourceTransactor of an given datasource.
std::vector< std::pair< std::string, size_t > > m_vecNamesSizes
void tcGetDataSetByEnvRec2()
Test Case: get only the objects that intercepts a given rectangle.
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:50
te::da::DataSourceCapabilities m_capabilit
void tcGetDataSetByProperty()
Test Case: It gets the DataSet identified by the given name using a spatial filter over the given geo...
std::map< std::string, std::string > m_connInfo
A test suit for the DataSourceTransactor interface.
std::vector< te::gm::Envelope > m_vecEnvelops
void tcGetDataSetByGeometry()
Test Case: get only the objects that intercepts a given geometry (point, box, pol, geom).
std::vector< std::pair< std::string, te::gm::Envelope > > m_vecNamesAndRecs