- Support for plaindir sources.
[platform/upstream/libzypp.git] / devel / devel.dmacvicar / testbed.cc
1 #include <iostream>
2 #include <fstream>
3 #include <sstream>
4 #include <streambuf>
5
6 #include "boost/filesystem/operations.hpp" // includes boost/filesystem/path.hpp
7 #include "boost/filesystem/fstream.hpp"    // ditto
8
9 #include <boost/iostreams/device/file_descriptor.hpp>
10
11 #include <zypp/base/Logger.h>
12 #include <zypp/Locale.h>
13 #include <zypp/ZYpp.h>
14 #include <zypp/ZYppFactory.h>
15 #include <zypp/TranslatedText.h>
16 ///////////////////////////////////////////////////////////////////
17
18 #include <zypp/base/Logger.h>
19
20
21 #include <map>
22 #include <set>
23
24 #include "zypp/CapFactory.h"
25 #include "zypp/KeyRing.h"
26 #include "zypp/Product.h"
27 #include "zypp/Selection.h"
28 #include "zypp/Package.h"
29 #include "zypp/PublicKey.h"
30
31 #include "zypp/ZYppFactory.h"
32
33 #include "zypp/MediaSetAccess.h"
34 #include "zypp/SourceFactory.h"
35 #include "zypp2/source/yum/YUMSourceCacher.h"
36
37 #include "testsuite/src/utils/TestUtils.h"
38
39 using namespace zypp::detail;
40
41 using namespace std;
42 using namespace zypp;
43 using namespace zypp::source;
44 //using namespace DbXml;
45
46 #define TestKind Selection
47
48 int main()
49 {
50   try
51   {
52     ZYpp::Ptr z = getZYpp();
53     z->initializeTarget("/");
54     
55     //SourceManager_Ptr manager = SourceManager::sourceManager();
56     
57     Source_Ref source = SourceFactory().createFrom( Url("dir:/space/rpms/duncan/vim/i386"), "/", "bleh", Pathname() );
58     ResStore store = source.resolvables();
59     //zypp::testsuite::utils::dump(store, true, true);
60     
61     for (ResStore::const_iterator it = store.begin(); it != store.end(); ++it)
62     {
63       zypp::Package::Ptr res = asKind<zypp::Package>( *it );
64       MIL << res->name() << " " << res->edition() << " " << res->location() << std::endl;
65     }
66     
67     /*for (ResStore::resfilter_const_iterator it = z->target()->byKindBegin(ResTraits<TestKind>::kind); it != z->target()->byKindEnd(ResTraits<TestKind>::kind); ++it)
68     {
69       zypp::TestKind::constPtr res = asKind<const zypp::TestKind>( *it );
70       MIL << res->name() << " " << res->edition() << std::endl;
71     }*/
72     
73   }
74   catch ( const Exception &e )
75   {
76     MIL << "Sorry, bye" << endl;
77   }
78 }
79
80
81