Author: mlandres Date: Wed Apr 30 17:17:35 2008 New Revision: 9914 URL: http://svn.opensuse.org/viewcvs/zypp?rev=9914&view=rev Log: fix RepoManager_test Modified: trunk/libzypp/tests/zypp/RepoManager_test.cc trunk/libzypp/zypp/RepoManager.cc trunk/libzypp/zypp/RepoManager.h Modified: trunk/libzypp/tests/zypp/RepoManager_test.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/RepoManager_test.cc?rev=9914&r1=9913&r2=9914&view=diff ============================================================================== --- trunk/libzypp/tests/zypp/RepoManager_test.cc (original) +++ trunk/libzypp/tests/zypp/RepoManager_test.cc Wed Apr 30 17:17:35 2008 @@ -30,17 +30,11 @@ BOOST_AUTO_TEST_CASE(repomanager_test) { - RepoManagerOptions opts; - TmpDir tmpCachePath; - TmpDir tmpRawCachePath; - TmpDir tmpKnownReposPath; - - BOOST_CHECK_EQUAL( filesystem::copy_dir_content( DATADIR + "/repos.d", tmpKnownReposPath.path() ), 0 ); + RepoManagerOptions opts( RepoManagerOptions::makeTestSetup( tmpCachePath ) ) ; - opts.repoCachePath = tmpCachePath.path(); - opts.repoRawCachePath = tmpRawCachePath.path(); - opts.knownReposPath = tmpKnownReposPath.path(); + filesystem::mkdir( opts.knownReposPath ); + BOOST_CHECK_EQUAL( filesystem::copy_dir_content( DATADIR + "/repos.d", opts.knownReposPath ), 0 ); RepoManager manager(opts); @@ -55,7 +49,7 @@ manager.addRepositories(url); // check it was not overwriten the proprietary.repo file - BOOST_CHECK( PathInfo(tmpKnownReposPath.path() + "/proprietary.repo_1").isExist() ); + BOOST_CHECK( PathInfo(opts.knownReposPath + "/proprietary.repo_1").isExist() ); // now there should be 6 repos repos = manager.knownRepositories(); @@ -73,7 +67,7 @@ repos = manager.knownRepositories(); BOOST_CHECK_EQUAL(repos.size(), (unsigned) 5); // the file still contained one repo, so it should still exists - BOOST_CHECK( PathInfo(tmpKnownReposPath.path() + "/proprietary.repo_1").isExist() ); + BOOST_CHECK( PathInfo(opts.knownReposPath + "/proprietary.repo_1").isExist() ); // now delete the macromedia one RepoInfo macromedia; @@ -82,7 +76,7 @@ repos = manager.knownRepositories(); BOOST_CHECK_EQUAL(repos.size(), (unsigned) 4); // the file should not exist anymore - BOOST_CHECK( ! PathInfo(tmpKnownReposPath.path() + "/proprietary.repo_1").isExist() ); + BOOST_CHECK( ! PathInfo(opts.knownReposPath + "/proprietary.repo_1").isExist() ); // let test cache creation Modified: trunk/libzypp/zypp/RepoManager.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/RepoManager.cc?rev=9914&r1=9913&r2=9914&view=diff ============================================================================== --- trunk/libzypp/zypp/RepoManager.cc (original) +++ trunk/libzypp/zypp/RepoManager.cc Wed Apr 30 17:17:35 2008 @@ -74,6 +74,17 @@ probe = ZConfig::instance().repo_add_probe(); } + RepoManagerOptions RepoManagerOptions::makeTestSetup( const Pathname & root_r ) + { + RepoManagerOptions ret; + ret.repoCachePath = root_r; + ret.repoRawCachePath = root_r/"raw"; + ret.repoSolvCachePath = root_r/"solv"; + ret.repoPackagesCachePath = root_r/"packages"; + ret.knownReposPath = root_r/"repos.d"; + return ret; + } + //////////////////////////////////////////////////////////////////////////// /** Modified: trunk/libzypp/zypp/RepoManager.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/RepoManager.h?rev=9914&r1=9913&r2=9914&view=diff ============================================================================== --- trunk/libzypp/zypp/RepoManager.h (original) +++ trunk/libzypp/zypp/RepoManager.h Wed Apr 30 17:17:35 2008 @@ -47,8 +47,20 @@ */ struct RepoManagerOptions { + /** Default ctor following \ref ZConfig global settings. */ RepoManagerOptions(); + /** Test setup adjusting all paths to be located below one \c root_r directory. + * \code + * root_r\ - repoCachePath + * \raw - repoRawCachePath + * \solv - repoSolvCachePath + * \packages - repoPackagesCachePath + * \repos.d - knownReposPath + * \endcode + */ + static RepoManagerOptions makeTestSetup( const Pathname & root_r ); + Pathname repoCachePath; Pathname repoRawCachePath; Pathname repoSolvCachePath; @@ -57,6 +69,8 @@ bool probe; }; + + /** * \short creates and provides information about known sources. * -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org