attic/unittest/dataaccess/TsDataSource.cpp
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 TsDataSource.cpp
22 
23  \brief A test suit for the DataSource interface.
24  */
25 
26 // TerraLib
27 #include <terralib/common.h>
28 #include <terralib/dataaccess.h>
29 #include <terralib/geometry.h>
30 
31 // Unit-Test TerraLib
32 #include "TsDataSource.h"
33 #include "TsManagerDataSource.h"
34 
35 
37 
39 {
48 
49  //To use equivalent methods from transactor
56 
61 
62  //int i=0;
63 }
64 
66 {
67  m_ds = 0;
68 }
69 
71 {
72 //#ifdef TE_COMPILE_ALL
73  CPPUNIT_ASSERT(m_ds);
74  CPPUNIT_ASSERT(m_ds->getType()== m_dsType);
75 //#endif
76 }
77 
79 {
80 //#ifdef TE_COMPILE_ALL
81  CPPUNIT_ASSERT(m_ds);
82  //CPPUNIT_ASSERT_NO_THROW(m_ds->open(m_connInfo));
83  CPPUNIT_ASSERT_NO_THROW(m_ds->open());
84 //#endif
85 }
86 
88 {
89 //#ifdef TE_COMPILE_ALL
90  CPPUNIT_ASSERT(m_ds);
91  //CPPUNIT_ASSERT_NO_THROW(m_ds->open(m_connStr));
92  CPPUNIT_ASSERT_NO_THROW(m_ds->open());
93 
94 //#endif
95 }
96 
98 {
99 //#ifdef TE_COMPILE_ALL
100  CPPUNIT_ASSERT(m_ds);
101  CPPUNIT_ASSERT_NO_THROW(m_ds->open());
102  std::string ds_id = m_ds->getId();
103  CPPUNIT_ASSERT(ds_id.size()!=0);
104 
105 //#endif
106 }
107 
109 {
110 //#ifdef TE_COMPILE_ALL
111  CPPUNIT_ASSERT(m_ds);
112  std::string id_ds = "xxx";
113  m_ds->setId(id_ds);
114  CPPUNIT_ASSERT(m_ds->getId()==id_ds);
115 
116 //#endif
117 }
119 {
120 //#ifdef TE_COMPILE_ALL
121  CPPUNIT_ASSERT(m_ds);
122  CPPUNIT_ASSERT(m_ds->isOpened()== true);
123  CPPUNIT_ASSERT_NO_THROW(m_ds->close());
124  CPPUNIT_ASSERT(m_ds->isOpened()== false);
125 //#endif
126 }
127 
128 
130 {
131 //#ifdef TE_COMPILE_ALL
132  CPPUNIT_ASSERT(m_ds);
133  CPPUNIT_ASSERT(m_ds->isOpened()== true);
134 //#endif
135 }
136 
138 {
139 //#ifdef TE_COMPILE_ALL
140  CPPUNIT_ASSERT(m_ds->isValid()== true);
141 //#endif
142 }
143 
145 {
146 /*//#ifdef TE_COMPILE_ALL
147  CPPUNIT_ASSERT(m_ds->getCatalog() != 0);
148  CPPUNIT_ASSERT(m_ds->getCatalog()->getNumberOfDataSets() == 0);
149 
150 // get a transactor to retrieve the datasource catalog
151  std::auto_ptr<te::da::DataSourceTransactor> t(0);
152  CPPUNIT_ASSERT_NO_THROW(t.reset(m_ds->getTransactor()));
153  CPPUNIT_ASSERT(t.get());
154 
155 // get a catalog loader and load the datasource catalog before calling getCatalog
156  std::auto_ptr<te::da::DataSourceCatalogLoader> cl(0);
157  CPPUNIT_ASSERT_NO_THROW(cl.reset(t->getCatalogLoader()));
158  CPPUNIT_ASSERT(cl.get());
159  CPPUNIT_ASSERT_NO_THROW(cl->loadCatalog(false)); //false: minimum information (properties)
160 
161 // now you can get the datasource catalog
162  te::da::DataSourceCatalog* ct = m_ds->getCatalog();
163  CPPUNIT_ASSERT(ct);
164  CPPUNIT_ASSERT(ct->getNumberOfDataSets() != 0);
165 
166 //#endif
167 */
168 }
169 
171 {
172 /*
173 //#ifdef TE_COMPILE_ALL
174  CPPUNIT_ASSERT(m_ds->getCatalog() != 0);
175 // This time the catalog is not completetly empty (m_ds->close() does not clear it).
176 
177 // get a transactor to retrieve the data source catalog
178  std::auto_ptr<te::da::DataSourceTransactor> t(0);
179  CPPUNIT_ASSERT_NO_THROW(t.reset(m_ds->getTransactor()));
180  CPPUNIT_ASSERT(t.get());
181 
182 // get a catalog loader and load the data source catalog before calling getCatalog
183  std::auto_ptr<te::da::DataSourceCatalogLoader> cl(0);
184  CPPUNIT_ASSERT_NO_THROW(cl.reset(t->getCatalogLoader()));
185  CPPUNIT_ASSERT(cl.get());
186  CPPUNIT_ASSERT_NO_THROW(cl->loadCatalog(true)); //true: Load maximum information(fk,pk,uk,idx,etc)
187 
188  te::da::DataSourceCatalog* ct = m_ds->getCatalog();
189  CPPUNIT_ASSERT(ct);
190  CPPUNIT_ASSERT(ct->getNumberOfDataSets() != 0);
191 
192 //#endif
193 */
194 }
195 
197 {
198 //#ifdef TE_COMPILE_ALL
199  //const te::da::DataSourceCapabilities& capabilities = m_ds->getCapabilities();
200 
201  CPPUNIT_ASSERT_NO_THROW(m_ds->getCapabilities());
202 //#endif
203 }
204 
205 
207 {
208 //#ifdef TE_COMPILE_ALL
209  // get a transactor to retrieve information about the data source
210  std::auto_ptr<te::da::DataSourceTransactor> t(m_ds->getTransactor());
211  CPPUNIT_ASSERT(t.get());
212 
213 //#endif
214 }
215 
217 {
218 //#ifdef TE_COMPILE_ALL
219  std::map<std::string, std::string> connInfo;
220  connInfo = m_ds->getConnectionInfo();
221  size_t size_connInfo = connInfo.size();
222 
223  CPPUNIT_ASSERT(size_connInfo > 0);
224 
225 //#endif
226 }
227 
229 {
230 //#ifdef TE_COMPILE_ALL
231  CPPUNIT_ASSERT_NO_THROW(m_ds->setConnectionInfo(m_connInfoExist));
232  CPPUNIT_ASSERT(m_ds->exists(m_dsType, m_connInfoExist)== true);
233  //int ii=0;
234 //#endif
235 
236 }
238 {
239 //#ifdef TE_COMPILE_ALL
240 
241 // creating a postgis database
242  try
243  {
244  //te::da::DataSourcePtr* newDb = te::da::DataSource::create(m_dsType, m_connInfoNewDs);
245  std::auto_ptr<te::da::DataSource> newDb = te::da::DataSource::create(m_dsType, m_connInfoNewDs);
246 
247  CPPUNIT_ASSERT(newDb.get());
248  //delete newDb;
249  }
250  catch (te::common::Exception e)
251  {
252  throw e;
253  }
254 
255 //#endif
256 }
257 
259 {
260 //#ifdef TE_COMPILE_ALL
261 
262 // dropping the datasource (Postgis, Gdal, Ogr) created before
264 
265 //#endif
266 }
267 
268 //void TsDataSource::tcGetConnection()
269 //{
270 ////#ifdef TE_COMPILE_ALL
271 // te::da::Connection* conn;
272 // CPPUNIT_ASSERT(m_ds);
273 // conn = m_ds->getConnection();
274 // CPPUNIT_ASSERT(conn!= 0);
275 ////#endif
276 //}
277 
279 {
280 //#ifdef TE_COMPILE_ALL
281  std::map<std::string, std::string> connInfo;
282 
283  CPPUNIT_ASSERT(m_ds);
284  m_ds->setConnectionInfo(m_connInfo);
285  connInfo = m_ds->getConnectionInfo();
286  CPPUNIT_ASSERT(connInfo == m_connInfo);
287 
288 //#endif
289 }
290 
292 {
293 ////#ifdef TE_COMPILE_ALL
294 // te::da::Connection* conn = m_ds->getConnection();
295 // CPPUNIT_ASSERT(m_ds);
296 // //m_ds->closeConnection(conn);
297 // CPPUNIT_ASSERT_NO_THROW(m_ds->closeConnection(conn));
298 //
299 ////#endif
300 }
301 
303 {
304 //#ifdef TE_COMPILE_ALL
305  CPPUNIT_ASSERT(m_ds);
307  CPPUNIT_ASSERT(dialect != 0);
308 //#endif
309 }
310 
311 ////void TsDataSource::tcGetDataSources()
312 ////{
313 //////#ifdef TE_COMPILE_ALL
314 //// CPPUNIT_ASSERT(m_ds.get());
315 //// std::vector<std::string> dbs = m_ds->getDataSources(m_dsType,m_connInfo);
316 ////
317 //// CPPUNIT_ASSERT(dbs.size() >= 0);
318 //////#endif
319 ////}
320 
322 {
323 //#ifdef TE_COMPILE_ALL
324  CPPUNIT_ASSERT(m_ds);
325  std::vector<te::core::EncodingType> encodings = m_ds->getEncodings(m_dsType,m_connInfo);
326 
327  CPPUNIT_ASSERT(encodings.size() >= 0);
328 //#endif
329 }
330 
331 //marisa
333 {
334 //#ifdef TE_COMPILE_ALL
335  CPPUNIT_ASSERT(m_ds->isOpened()== true);
336 
337  std::vector<std::string> datasets = m_ds->getDataSetNames();
338  CPPUNIT_ASSERT(datasets.size() > 0);
339  std::auto_ptr<te::da::DataSet> dt;
340 
341 // get dataSet by name without transactor
342  try
343  {
344  size_t i=0;
345  while (i < datasets.size() && i < 10) //to save time during test
346  {
347  dt = m_ds->getDataSet(datasets[i]);
348  CPPUNIT_ASSERT_NO_THROW(m_ds->getDataSet(datasets[i]));
349  i++;
350  }
351  }
352  catch (te::common::Exception e)
353  {
354  throw e;
355  }
356 //#endif
357 }
358 
360 {
361 //#ifdef TE_COMPILE_ALL
362  CPPUNIT_ASSERT(m_ds->isOpened()== true);
363 
364  if (!((m_capabilit.getDataTypeCapabilities()).supportsGeometry()))
365  //CPPUNIT_ASSERT_THROW_MESSAGE("GEOMETRY_DT is not supported by this datasource",(m_capabilit.getDataTypeCapabilities()).supportsGeometry() == 0, te::common::Exception);
366  CPPUNIT_ASSERT_THROW_MESSAGE("GEOMETRY_DT is not supported by this datasource",(m_capabilit.getDataTypeCapabilities()).supportsGeometry(), te::common::Exception);
367 
368  std::auto_ptr<te::da::DataSet> dt;
369  std::vector<std::string>::iterator it = m_vecDtNames.begin();
370  std::auto_ptr<te::da::DataSetType> datasetType = m_ds->getDataSetType(*it);
371  te::dt::Property* p = datasetType->findFirstPropertyOfType(te::dt::GEOMETRY_TYPE);
372  std::string propname = p->getName();
373 
374  //Testing getDataSet(name,geometry, ...)
375  try
376  {
377  dt = m_ds->getDataSet((*it),propname, &m_pt,te::gm::INTERSECTS);
378  CPPUNIT_ASSERT_NO_THROW(dt = m_ds->getDataSet((*it),propname, &m_pt,te::gm::INTERSECTS)); //point
379  //int nprop = dt->getNumProperties();
380  int pos = static_cast<int>(te::da::GetFirstSpatialPropertyPos(dt.get()));
381  dt->moveNext();
382  m_geom = static_cast<te::gm::Geometry*>(dt->getGeometry(pos)->clone());
383  m_geom->computeMBR(true);
384 
385  std::cout << std::endl << "DataSet Name: " << (*it) << " DataSet Size: " << dt->size() << std::endl ;
386 
387  CPPUNIT_ASSERT_NO_THROW(dt = m_ds->getDataSet((*it),propname, &m_box, te::gm::INTERSECTS)); //box
388  std::cout << std::endl << "DataSet Name: " << (*it) << " DataSet Size: " << dt->size() << std::endl ;
389 
390  CPPUNIT_ASSERT_NO_THROW(dt = m_ds->getDataSet((*it),propname, m_pol, te::gm::INTERSECTS)); //polygon
391  std::cout << std::endl << "DataSet Name: " << (*it) << " DataSet Size: " << dt->size() << std::endl ;
392 
393  CPPUNIT_ASSERT_NO_THROW(dt = m_ds->getDataSet((*it),propname, m_geom , te::gm::INTERSECTS)); //using the geometry recovered above
394  std::cout << std::endl << "DataSet Name: " << (*it) << " DataSet Size: " << dt->size() << std::endl ;
395  }
396  catch (te::common::Exception e)
397  {
398  throw e;
399  }
400 
401 //#endif
402 }
403 
405 {
406 //#ifdef TE_COMPILE_ALL
407  CPPUNIT_ASSERT(m_ds->isOpened()== true);
408 // get a transactor to retrieve information about the data source
409  CPPUNIT_ASSERT_NO_THROW(m_ds->open());
410 
411  if (!((m_capabilit.getDataTypeCapabilities()).supportsGeometry()))
412  //CPPUNIT_ASSERT_THROW_MESSAGE("GEOMETRY_DT is not supported by this datasource", (m_capabilit.getDataTypeCapabilities()).supportsGeometry() == false,te::common::Exception);
413  CPPUNIT_ASSERT_THROW_MESSAGE("GEOMETRY_DT is not supported by this datasource", (m_capabilit.getDataTypeCapabilities()).supportsGeometry(),te::common::Exception);
414 
415  std::vector<std::string> datasets = m_ds->getDataSetNames();
416 
417  std::auto_ptr<te::da::DataSet> dt;
418  std::vector<std::string>::iterator it = m_vecDtNames.begin();
419  std::auto_ptr<te::da::DataSetType> datasetType = m_ds->getDataSetType(*it);
420  te::dt::Property* p = datasetType->findFirstPropertyOfType(te::dt::GEOMETRY_TYPE);
421  std::string propname = p->getName();
422 
423  //Testing getDataSet(datasetname,propertyname,geometry, ...)
424 
425  try
426  {
427  dt = m_ds->getDataSet((*it),propname, &m_pt, te::gm::INTERSECTS);
428  CPPUNIT_ASSERT_NO_THROW(dt = m_ds->getDataSet((*it),propname, &m_pt, te::gm::INTERSECTS)); //point
429  int pos = datasetType->getPropertyPosition(p->getName());
430  dt->moveNext();
431  m_geom = static_cast<te::gm::Geometry*>(dt->getGeometry(pos)->clone());
432  m_geom->computeMBR(true);
433 
434  std::cout << std::endl << "DataSet Name: " << (*it) << " DataSet Size: " << dt->size() << std::endl ;
435 
436  CPPUNIT_ASSERT_NO_THROW(dt = m_ds->getDataSet((*it),propname, &m_box, te::gm::INTERSECTS)); //box
437  std::cout << std::endl << "DataSet Name: " << (*it) << " DataSet Size: " << dt->size() << std::endl ;
438 
439  CPPUNIT_ASSERT_NO_THROW(dt = m_ds->getDataSet((*it),propname, m_pol, te::gm::INTERSECTS)); //polygon
440  std::cout << std::endl << "DataSet Name: " << (*it) << " DataSet Size: " << dt->size() << std::endl ;
441 
442  CPPUNIT_ASSERT_NO_THROW(dt = m_ds->getDataSet((*it),propname, m_geom , te::gm::INTERSECTS)); //using the geometry recovered above
443  std::cout << std::endl << "DataSet Name: " << (*it) << " DataSet Size: " << dt->size() << std::endl ;
444  }
445  catch (te::common::Exception e)
446  {
447  throw e;
448  }
449 
450 //#endif
451 }
452 
454 {
455 //#ifdef TE_COMPILE_ALL
456  CPPUNIT_ASSERT(m_ds->isOpened()== true);
457 
458  if (!((m_capabilit.getDataTypeCapabilities()).supportsGeometry()))
459  //CPPUNIT_ASSERT_THROW_MESSAGE("GEOMETRY_DT is not supported by this datasource", (m_capabilit.getDataTypeCapabilities()).supportsGeometry() == false,te::common::Exception);
460  CPPUNIT_ASSERT_THROW_MESSAGE("GEOMETRY_DT is not supported by this datasource", (m_capabilit.getDataTypeCapabilities()).supportsGeometry(),te::common::Exception);
461 
462  std::vector<std::string>::iterator it = m_vecDtNames.begin();
463  std::auto_ptr<te::da::DataSetType> datasetType = m_ds->getDataSetType(*it);
464  te::dt::Property* p = datasetType->findFirstPropertyOfType(te::dt::GEOMETRY_TYPE);
465  std::string propname = p->getName();
466 
467  te::gm::Envelope *rec = new te::gm::Envelope(-60.0,-20.0,-35.0,2.0);
468 
469 // Testing getDataSet(name,property,envelope, spatialRelation,...)
470  std::auto_ptr<te::da::DataSet> dtRec;
471 
472  CPPUNIT_ASSERT_NO_THROW(dtRec = m_ds->getDataSet(*it,propname,rec,te::gm::INTERSECTS));
473 
474  if (dtRec.get())
475  {
476  std::auto_ptr<te::gm::Envelope> envRec;
477  int pos = static_cast<int>(te::da::GetFirstSpatialPropertyPos(dtRec.get()));
478  CPPUNIT_ASSERT_NO_THROW(envRec = (dtRec.get())->getExtent(pos));
479  if (envRec.get())
480  {
481  std::cout << std::endl << "DataSetRec Name: " << (*it) << "Size: "<< dtRec->size() << std::endl ;
482  std::cout << "DataSetRec Envelop : " << envRec->m_llx << "," << envRec->m_lly << "," << envRec->m_urx << "," << envRec->m_ury << std::endl;
483  std::cout << "Test Envelop : " << rec->m_llx << "," << rec->m_lly << "," << rec->m_urx << "," << rec->m_ury << std::endl;
484  }
485  }
486 //#endif
487 }
488 
490 {
491 //#ifdef TE_COMPILE_ALL
492  if (!((m_capabilit.getDataTypeCapabilities()).supportsGeometry()))
493  //CPPUNIT_ASSERT_THROW_MESSAGE("GEOMETRY_DT is not supported by this datasource", (m_capabilit.getDataTypeCapabilities()).supportsGeometry() == false,te::common::Exception);
494  CPPUNIT_ASSERT_THROW_MESSAGE("GEOMETRY_DT is not supported by this datasource", (m_capabilit.getDataTypeCapabilities()).supportsGeometry(),te::common::Exception);
495 
496  std::vector<std::string>::iterator it = m_vecDtNames.begin();
497  std::auto_ptr<te::da::DataSetType> datasetType = m_ds->getDataSetType(*it);
498 
499  te::dt::Property* p = datasetType->findFirstPropertyOfType(te::dt::GEOMETRY_TYPE);
500  std::string propname = p->getName();
501 
502  std::auto_ptr<te::da::DataSet> dtRec;
503 
504  std::vector<std::pair<std::string, te::gm::Envelope> >::iterator itpair;
505  for(itpair = m_vecNamesAndRecs.begin(); itpair < m_vecNamesAndRecs.end(); itpair++)
506  {
507  try
508  {
509  CPPUNIT_ASSERT_NO_THROW(dtRec = m_ds->getDataSet( (*itpair).first,propname, &(*itpair).second, te::gm::INTERSECTS ));
510  if (dtRec.get())
511  {
512  std::auto_ptr<te::gm::Envelope> envRec;
513  int pos = static_cast<int>(te::da::GetFirstSpatialPropertyPos(dtRec.get()));
514  CPPUNIT_ASSERT_NO_THROW(envRec = dtRec->getExtent(pos));
515  std::cout << std::endl << "DataSet Name: " << (*itpair).first << " Size: " << dtRec->size() << std::endl ;
516  std::cout << "DataSet Envelop returned: " << envRec->m_llx << "," << envRec->m_lly << "," << envRec->m_urx << "," << envRec->m_ury << std::endl;
517  std::cout << "Envelop Filter : " << (*itpair).second.m_llx << "," << (*itpair).second.m_lly << "," << (*itpair).second.m_urx << "," << (*itpair).second.m_ury << std::endl;
518  }
519  }
520  catch (te::common::Exception e)
521  {
522  throw e;
523  }
524  }
525 //#endif
526 }
527 
529 {
530 //#ifdef TE_COMPILE_ALL
531  CPPUNIT_ASSERT(m_ds->isOpened()== true);
532  if (!((m_capabilit.getDataTypeCapabilities()).supportsGeometry()))
533  //CPPUNIT_ASSERT_THROW_MESSAGE("DataTypeCapabilites GEOMETRY is not supported by this datasource", (m_capabilit.getDataTypeCapabilities()).supportsGeometry() == false,te::common::Exception);
534  CPPUNIT_ASSERT_THROW_MESSAGE("DataTypeCapabilites GEOMETRY is not supported by this datasource", (m_capabilit.getDataTypeCapabilities()).supportsGeometry(),te::common::Exception);
535 
536  std::auto_ptr<te::da::DataSet> dtRec;
537 
538  std::vector<std::pair<std::string, te::gm::Envelope> >::iterator itpair;
539  std::vector<std::pair<std::string, size_t> >::iterator itsize;
540 
541  for(itpair = m_vecNamesAndRecs.begin(), itsize = m_vecNamesSizesRec.begin() ; itpair < m_vecNamesAndRecs.end(); itpair++, itsize++)
542  {
543  try
544  {
545  //getting first geometry property name...
546  std::auto_ptr<te::da::DataSetType> datasetType = m_ds->getDataSetType((*itpair).first);
547  te::dt::Property* p = datasetType->findFirstPropertyOfType(te::dt::GEOMETRY_TYPE);
548  std::string propname = p->getName();
549 
550  CPPUNIT_ASSERT_NO_THROW(dtRec = m_ds->getDataSet( (*itpair).first, propname,&(*itpair).second, te::gm::INTERSECTS));
551  size_t ss = dtRec->size();
552  std::cout << std::endl << "DataSet Name: " << (*itpair).first << " DataSet Size: " << dtRec->size() << " Size expected: " << (*itsize).second << std::endl ;
553  CPPUNIT_ASSERT_EQUAL_MESSAGE("DataSet size not equal expected", (*itsize).second, ss);
554  }
555  catch (te::common::Exception e)
556  {
557  throw e;
558  }
559  }
560 
561 //#endif
562 }
563 
565 {
566 }
static te::gm::Polygon * sm_pol
std::map< std::string, std::string > m_connInfoDropDs
Definition: TsDataSource.h:269
std::string m_dsType
Definition: TsDataSource.h:267
static std::vector< std::pair< std::string, size_t > > sm_vecNamesSizes
virtual bool isValid() const =0
It checks if the data source is valid (available for using).
static std::unique_ptr< DataSource > create(const std::string &dsType, const std::string &connInfo)
It creates a new repository for a data source.
static te::gm::Envelope sm_box
te::da::SQLDialect * dialect
Definition: WFSDialect.h:1
static te::da::DataSourceCapabilities sm_capabilit
static std::map< std::string, std::string > sm_connInfoNewDs
virtual std::unique_ptr< DataSourceTransactor > getTransactor()=0
It returns the set of parameters used to set up the access channel to the underlying repository...
virtual void open()=0
It opens the data source and makes it ready for using.
static std::map< std::string, std::string > sm_connInfoExist
te::gm::Geometry * m_geom
Definition: TsDataSource.h:283
static std::string sm_connStr
static te::da::DataSource * sm_datasource
It represents the SQL query dialect accepted by a given data source.
Definition: SQLDialect.h:55
double m_urx
Upper right corner x-coordinate.
virtual bool isOpened() const =0
It returns true if the data source is opened, otherwise it returns false.
static std::map< std::string, std::string > sm_connInfoDropDs
const DataTypeCapabilities & getDataTypeCapabilities() const
std::vector< std::string > m_vecDtNames
Definition: TsDataSource.h:272
static void drop(const std::string &dsType, const std::string &connInfo)
It removes a data source identified by its connection information and the driver type.
std::vector< std::pair< std::string, size_t > > m_vecNamesSizesRec
Definition: TsDataSource.h:277
std::map< std::string, std::string > m_connInfoExist
Definition: TsDataSource.h:264
A test suit for the DataSource interface.
std::map< std::string, std::string > m_connInfo
Definition: TsDataSource.h:263
It models a property definition.
Definition: Property.h:59
virtual std::string getType() const =0
It returns the data source type name (in UPPER CASE). Ex: POSTGIS, SQLITE, WFS, WMS, or MYSQL.
te::gm::Envelope m_box
Definition: TsDataSource.h:279
virtual void computeMBR(bool cascade) const _NOEXCEPT_OP(true)=0
It computes the minimum bounding rectangle for the geometry.
virtual const DataSourceCapabilities & getCapabilities() const =0
It returns the known capabilities of the data source.
static std::vector< std::pair< std::string, size_t > > sm_vecNamesSizesRec
double m_llx
Lower left corner x-coordinate.
TEDATAACCESSEXPORT std::size_t GetFirstSpatialPropertyPos(const te::da::DataSet *dataset)
It returns the first dataset spatial property or NULL if none is found.
An Envelope defines a 2D rectangular region.
CPPUNIT_TEST_SUITE_REGISTRATION(TsDataSource)
static te::gm::Point sm_pt
static te::dt::TimeDuration dt(20, 30, 50, 11)
te::gm::Polygon * m_pol
Definition: TsDataSource.h:282
static std::vector< std::string > sm_vecDtNames
std::vector< std::pair< std::string, te::gm::Envelope > > m_vecNamesAndRecs
Definition: TsDataSource.h:275
std::string m_connStr
Definition: TsDataSource.h:266
void setId(const std::string &id)
It sets the data source identification.
te::da::DataSource * m_ds
Definition: TsDataSource.h:260
static te::gm::Geometry * sm_geom
te::gm::Polygon * p
te::gm::Point m_pt
Definition: TsDataSource.h:280
virtual std::vector< std::string > getDataSetNames()
It gets the dataset names available in the data source.
std::vector< std::pair< std::string, size_t > > m_vecNamesSizes
Definition: TsDataSource.h:276
virtual std::unique_ptr< te::da::DataSetType > getDataSetType(const std::string &name)
It gets information about the given dataset.
A static class for managing the resources used by DataSource test suit.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
static std::map< std::string, std::string > sm_connInfo
double m_lly
Lower left corner y-coordinate.
std::map< std::string, std::string > m_connInfoNewDs
Definition: TsDataSource.h:268
static std::vector< std::pair< std::string, te::gm::Envelope > > sm_vecNamesAndRecs
te::da::DataSourceCapabilities m_capabilit
Definition: TsDataSource.h:262
virtual std::unique_ptr< DataSet > getDataSet(const std::string &name, te::common::TraverseType travType=te::common::FORWARDONLY, const te::common::AccessPolicy accessPolicy=te::common::RAccess)
It gets the dataset identified by the given name. This method always returns a disconnected dataset...
static std::vector< std::pair< std::string, te::gm::Envelope > > sm_vecDtNamesAndEnvelops
double m_ury
Upper right corner y-coordinate.
const te::core::URI & getConnectionInfo() const
An Uniform Resource Identifier used to describe the datasource connection.
virtual void close()=0
It closes the data source and clears all the resources used by its internal communication channel...
virtual const SQLDialect * getDialect() const =0
It returns the data source SQL dialect, if there is one.
static std::vector< te::gm::Envelope > sm_vecEnvelops
This file contains include headers for the TerraLib Common Runtime module.
This file contains include headers for the Vector Geometry model of TerraLib.
static bool exists(const std::string &dsType, const std::string &connInfo)
It checks if the data source exists with the connection information and the driver type...
const std::string & getId() const
An identification value for the data source.
std::vector< std::pair< std::string, te::gm::Envelope > > m_vecDtNamesAndEnvelops
Definition: TsDataSource.h:274
This file contains include headers for the Data Access module of TerraLib.
std::vector< te::gm::Envelope > m_vecEnvelops
Definition: TsDataSource.h:273
A test suit for the DataSource interface.
Definition: TsDataSource.h:56
static std::string sm_dsType
const std::string & getName() const
It returns the property name.
Definition: Property.h:127