3 #include <boost/test/unit_test.hpp>
5 #include "zypp/base/Logger.h"
6 #include "zypp/TmpPath.h"
7 #include "zypp/RepoManager.h"
8 #include "zypp/base/Easy.h"
9 #include "zypp/ZYppFactory.h"
10 #include "zypp/Package.h"
11 #include "zypp/sat/Solvable.h"
13 // allows us to control signature
15 #include "KeyRingTestReceiver.h"
17 #define BOOST_TEST_MODULE ResObject
23 using namespace boost::unit_test;
27 * this test test that the attributes
28 * from the metadata are preserved into
31 * so the test covers both libsolv-tools
32 * right insertion and parsing
33 * and libzypp ResObject and friends data
34 * extraction from solv files
39 static void init_pool_yum()
41 Pathname dir(TESTS_SRC_DIR);
42 dir += "/repo/yum/data/10.2-updates-subset";
44 ZYpp::Ptr z = getZYpp();
45 ZConfig::instance().setSystemArchitecture(Arch("i586"));
47 filesystem::TmpDir tmp;
48 RepoManagerOptions opts = RepoManagerOptions::makeTestSetup(tmp.path());
49 RepoManager mgr(opts);
51 KeyRingTestReceiver keyring_callbacks;
52 KeyRingTestSignalReceiver receiver;
54 // disable sgnature checking
55 keyring_callbacks.answerAcceptKey(KeyRingReport::KEY_TRUST_TEMPORARILY);
56 keyring_callbacks.answerAcceptVerFailed(true);
57 keyring_callbacks.answerAcceptUnknownKey(true);
60 info.setAlias("updates");
61 info.addBaseUrl(dir.asUrl());
63 mgr.loadFromCache(info);
66 BOOST_AUTO_TEST_CASE(attributes)
69 MIL << sat::Pool::instance();
70 Repository r = sat::Pool::instance().reposFind("updates");
74 for ( Repository::SolvableIterator it = r.solvablesBegin();
75 it != r.solvablesEnd();
78 sat::Solvable s = *it;
79 //MIL << s.ident() << endl;
80 if ( s.ident() == "openssl-devel" )
83 Package::Ptr p = asKind<Package>(makeResObject(s));
87 //name: openssl-devel 0.9.8d-17.2 i586
88 BOOST_CHECK_EQUAL(p->name(), "openssl-devel");
89 //vendor: SUSE LINUX Products GmbH, Nuernberg, Germany
90 BOOST_CHECK_EQUAL(p->vendor(), "SUSE LINUX Products GmbH, Nuernberg, Germany");
91 //solvable:checksum: 9f6a44015ad97680e9f93d0edefa1d533940479c
92 BOOST_CHECK_EQUAL(p->checksum(), CheckSum::sha1("9f6a44015ad97680e9f93d0edefa1d533940479c"));
94 BOOST_CHECK_EQUAL(p->summary(), "Include Files and Libraries mandatory for Development.");
95 //solvable:description: This package contains all necessary include files and libraries needed
96 //to develop applications that require these.
97 BOOST_CHECK_EQUAL(p->description(), "This package contains all necessary include files and libraries needed\nto develop applications that require these.");
98 //solvable:authors: Mark J. Cox <mark@openssl.org>
99 //Ralf S. Engelschall <rse@openssl.org>
100 //Dr. Stephen <Henson steve@openssl.org>
101 //Ben Laurie <ben@openssl.org>
102 //Bodo Moeller <bodo@openssl.org>
103 //Ulf Moeller <ulf@openssl.org>
104 //Holger Reif <holger@openssl.org>
105 //Paul C. Sutton <paul@openssl.org>
106 //solvable:packager: http://bugs.opensuse.org
107 //solvable:url: http://www.openssl.org/
108 //solvable:buildtime: 1165493634
109 //solvable:installsize: 3845
110 BOOST_CHECK_EQUAL(p->installSize(), ByteCount(3937193));
111 //solvable:downloadsize: 909
112 BOOST_CHECK_EQUAL(p->downloadSize(), ByteCount(930588));
113 //solvable:mediadir: rpm/i586
114 //solvable:mediafile: openssl-devel-0.9.8d-17.2.i586.rpm
115 //solvable:license: BSD License and BSD-like, Other License(s), see package
116 //solvable:group: Development/Libraries/C and C++
117 BOOST_CHECK_EQUAL(p->group(), "Development/Libraries/C and C++");
118 //solvable:sourcearch: src
119 //solvable:sourceevr: (void)
120 //solvable:sourcename: openssl
121 //solvable:headerend: 34861
126 // check that we actually found all testeable
128 BOOST_CHECK_EQUAL(c, 1);