21 #include <terralib_buildconfig.h> 28 #include <boost/test/unit_test.hpp> 29 #include <boost/uuid/random_generator.hpp> 30 #include <boost/uuid/uuid_io.hpp> 37 std::string data_dir = TERRALIB_DATA_DIR;
39 std::string input_filename(data_dir +
"/shape/munic_goias.shp");
40 std::string srcInputInfo (
"file://" + input_filename);
42 std::string intersection_filename(data_dir +
43 "/shape/munic_goias_selected.shp");
44 std::string srcIntersectionInfo (
"file://" + intersection_filename);
53 srcIntersectionDs->open();
56 std::string input_DsetName =
"munic_goias";
57 std::string intersection_DsetName =
"munic_goias_selected";
60 BOOST_REQUIRE_MESSAGE(srcInputDs->dataSetExists(input_DsetName),
61 "Input dataset not found: " + input_DsetName);
63 std::unique_ptr<te::da::DataSet> input_Dset =
64 srcInputDs->getDataSet(input_DsetName);
66 std::unique_ptr<te::da::DataSetType> input_DsetType =
67 srcInputDs->getDataSetType(input_DsetName);
69 BOOST_REQUIRE_MESSAGE(srcIntersectionDs->dataSetExists(intersection_DsetName),
70 "Input dataset not found: " + intersection_DsetName);
72 std::unique_ptr<te::da::DataSet> intersection_Dset =
73 srcIntersectionDs->getDataSet(intersection_DsetName);
75 std::unique_ptr<te::da::DataSetType> intersection_DsetType =
76 srcIntersectionDs->getDataSetType(intersection_DsetName);
78 std::vector<std::string> attributes;
79 attributes.push_back(
"nome");
80 attributes.push_back(
"nomemeso");
82 std::map<std::string, te::dt::AbstractData*> specificParams;
83 specificParams[
"munic_goias"] =
85 specificParams[
"munic_goias_selected"] =
88 std::string output_filename(data_dir +
"/shape/identity_shptoshp_test.shp");
89 std::string tgrInfo (
"file://" + output_filename);
94 std::string outDSName =
"identity_shptoshp_test";
96 BOOST_REQUIRE_MESSAGE(
97 !trgDs->dataSetExists(outDSName),
98 "A dataset with the same requested output dataset name already exists: " +
101 std::vector<te::vp::InputParams> inputParamsVec;
111 structIntersectionParams.
m_inputDataSet = intersection_Dset.release();
113 inputParamsVec.push_back(structInputParams);
114 inputParamsVec.push_back(structIntersectionParams);
133 std::string data_dir = TERRALIB_DATA_DIR;
135 std::string input_filename(data_dir +
"/shape/munic_goias.shp");
136 std::string srcInputInfo (
"file://" + input_filename);
138 std::string intersection_filename(data_dir +
139 "/shape/munic_goias_selected.shp");
140 std::string srcIntersectionInfo (
"file://" + intersection_filename);
149 srcIntersectionDs->open();
152 std::string input_DsetName =
"munic_goias";
153 std::string intersection_DsetName =
"munic_goias_selected";
156 BOOST_REQUIRE_MESSAGE(srcInputDs->dataSetExists(input_DsetName),
157 "Input dataset not found: " + input_DsetName);
159 std::unique_ptr<te::da::DataSet> input_Dset =
160 srcInputDs->getDataSet(input_DsetName);
162 std::unique_ptr<te::da::DataSetType> input_DsetType =
163 srcInputDs->getDataSetType(input_DsetName);
165 BOOST_REQUIRE_MESSAGE(srcIntersectionDs->dataSetExists(intersection_DsetName),
166 "Input dataset not found: " + intersection_DsetName);
168 std::unique_ptr<te::da::DataSet> intersection_Dset =
169 srcIntersectionDs->getDataSet(intersection_DsetName);
171 std::unique_ptr<te::da::DataSetType> intersection_DsetType =
172 srcIntersectionDs->getDataSetType(intersection_DsetName);
174 std::vector<std::string> attributes;
175 attributes.push_back(
"nome");
176 attributes.push_back(
"nomemeso");
178 std::map<std::string, te::dt::AbstractData*> specificParams;
179 specificParams[
"munic_goias"] =
181 specificParams[
"munic_goias_selected"] =
184 std::string connInfo(
185 "ppgsql://postgres:postgres@atlas.dpi.inpe.br:5433/testPostGIS");
191 std::string outDSName =
"identity_shptopgis_test";
193 BOOST_REQUIRE_MESSAGE(
194 !trgDs->dataSetExists(outDSName),
195 "A dataset with the same requested output dataset name already exists: " +
198 std::vector<te::vp::InputParams> inputParamsVec;
208 structIntersectionParams.
m_inputDataSet = intersection_Dset.release();
210 inputParamsVec.push_back(structInputParams);
211 inputParamsVec.push_back(structIntersectionParams);
230 boost::uuids::basic_random_generator<boost::mt19937> gen;
231 boost::uuids::uuid u = gen();
232 std::string dsId = boost::uuids::to_string(u);
234 std::string connInfo(
235 "ppgsql://postgres:postgres@atlas.dpi.inpe.br:5433/testPostGIS");
242 dsInfoPtr->setId(dsId);
243 dsInfoPtr->setConnInfo(connInfo);
244 dsInfoPtr->setType(
"POSTGIS");
250 std::string input_DsetName =
"munic_goias";
251 std::string intersection_DsetName =
"munic_goias_selected";
254 BOOST_REQUIRE_MESSAGE(srcDs->dataSetExists(input_DsetName),
255 "Input dataset not found: " + input_DsetName);
257 std::unique_ptr<te::da::DataSet> input_Dset =
258 srcDs->getDataSet(input_DsetName);
260 std::unique_ptr<te::da::DataSetType> input_DsetType =
261 srcDs->getDataSetType(input_DsetName);
263 BOOST_REQUIRE_MESSAGE(srcDs->dataSetExists(intersection_DsetName),
264 "Input dataset not found: " + intersection_DsetName);
266 std::unique_ptr<te::da::DataSet> intersection_Dset =
267 srcDs->getDataSet(intersection_DsetName);
269 std::unique_ptr<te::da::DataSetType> intersection_DsetType =
270 srcDs->getDataSetType(intersection_DsetName);
272 std::vector<std::string> attributes;
273 attributes.push_back(
"nome");
274 attributes.push_back(
"nomemeso");
276 std::map<std::string, te::dt::AbstractData*> specificParams;
277 specificParams[
"public.munic_goias"] =
279 specificParams[
"public.munic_goias_selected"] =
286 std::string outDSName =
"identity_pgistopgis_test";
288 BOOST_REQUIRE_MESSAGE(
289 !trgDs->dataSetExists(outDSName),
290 "A dataset with the same requested output dataset name already exists: " +
293 std::vector<te::vp::InputParams> inputParamsVec;
303 structIntersectionParams.
m_inputDataSet = intersection_Dset.release();
305 inputParamsVec.push_back(structInputParams);
306 inputParamsVec.push_back(structIntersectionParams);
325 boost::uuids::basic_random_generator<boost::mt19937> gen;
326 boost::uuids::uuid u = gen();
327 std::string dsId = boost::uuids::to_string(u);
329 std::string connInfo(
330 "ppgsql://postgres:postgres@atlas.dpi.inpe.br:5433/testPostGIS");
337 dsInfoPtr->setId(dsId);
338 dsInfoPtr->setConnInfo(connInfo);
339 dsInfoPtr->setType(
"POSTGIS");
345 std::string input_DsetName =
"munic_goias";
346 std::string intersection_DsetName =
"munic_goias_selected";
349 BOOST_REQUIRE_MESSAGE(srcDs->dataSetExists(input_DsetName),
350 "Input dataset not found: " + input_DsetName);
352 std::unique_ptr<te::da::DataSet> input_Dset =
353 srcDs->getDataSet(input_DsetName);
355 std::unique_ptr<te::da::DataSetType> input_DsetType =
356 srcDs->getDataSetType(input_DsetName);
358 BOOST_REQUIRE_MESSAGE(srcDs->dataSetExists(intersection_DsetName),
359 "Input dataset not found: " + intersection_DsetName);
361 std::unique_ptr<te::da::DataSet> intersection_Dset =
362 srcDs->getDataSet(intersection_DsetName);
364 std::unique_ptr<te::da::DataSetType> intersection_DsetType =
365 srcDs->getDataSetType(intersection_DsetName);
367 std::vector<std::string> attributes;
368 attributes.push_back(
"nome");
369 attributes.push_back(
"nomemeso");
371 std::map<std::string, te::dt::AbstractData*> specificParams;
372 specificParams[
"public.munic_goias"] =
374 specificParams[
"public.munic_goias_selected"] =
377 std::string data_dir = TERRALIB_DATA_DIR;
378 std::string output_filename(data_dir +
"/shape/identity_pgistoshp_test.shp");
379 std::string tgrInfo (
"file://" + output_filename);
384 std::string outDSName =
"identity_pgistoshp_test";
386 BOOST_REQUIRE_MESSAGE(
387 !trgDs->dataSetExists(outDSName),
388 "A dataset with the same requested output dataset name already exists: " +
391 std::vector<te::vp::InputParams> inputParamsVec;
401 structIntersectionParams.
m_inputDataSet = intersection_Dset.release();
403 inputParamsVec.push_back(structInputParams);
404 inputParamsVec.push_back(structIntersectionParams);
420 BOOST_AUTO_TEST_SUITE_END()
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
boost::shared_ptr< DataSource > DataSourcePtr
void setOutputDataSetName(const std::string &outputDataSetName)
void setOutputDataSource(te::da::DataSourcePtr outputDataSource)
BOOST_AUTO_TEST_CASE(identity_shptopgis_test)
A singleton to keep all the registered data sources.
bool executeMemory(te::vp::AlgorithmParams *mainParams)
A template for complex data types.
static DataSourceInfoManager & getInstance()
It returns a reference to the singleton instance.
A factory for data sources.
BOOST_AUTO_TEST_SUITE(identity_tests) BOOST_AUTO_TEST_CASE(identity_shptoshp_test)
A class that represents a data source component.
void setInputParams(const std::vector< te::vp::InputParams > &setInputParams)
void setSpecificParams(const std::map< std::string, te::dt::AbstractData * > &specificParams)
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr