1 #include <zypp/media/MediaManager.h>
2 #include <zypp/base/String.h>
3 #include <zypp/base/Logger.h>
4 #include <zypp/Pathname.h>
13 #include "mymediaverifier.h"
15 #include <boost/test/unit_test.hpp>
16 #include <boost/test/unit_test.hpp>
18 using boost::unit_test::test_suite;
19 using boost::unit_test::test_case;
22 using namespace zypp::media;
37 #define ONE_STEP(MSG) \
39 DBG << "======================================" << std::endl; \
40 DBG << "==>> " << MSG << std::endl; \
41 DBG << "======================================" << std::endl; \
42 if( do_step) { pause(); if( do_quit) exit(0); } \
45 BOOST_AUTO_TEST_CASE(strange_test)
49 sigemptyset(&sa.sa_mask);
52 sigaction(SIGINT, &sa, NULL);
54 sigaction(SIGTERM, &sa, NULL);
56 //if( argc > 1 && std::string(argv[1]) == "-i")
60 MediaVerifierRef verifier(
61 new MyMediaVerifier(/* "SUSE-Linux-CORE-i386 9" */)
72 ONE_STEP("ONE: open " + url.asString());
75 ONE_STEP("TWO: open " + url.asString());
79 ONE_STEP("ONE: add verifier")
80 mm.addVerifier( one, verifier);
82 ONE_STEP("TWO: add verifier")
83 mm.addVerifier( two, verifier);
86 ONE_STEP("ONE: attach")
89 ONE_STEP("ONE: provideFile(/INDEX.gz)")
90 mm.provideFile(one, Pathname("/INDEX.gz"));
92 ONE_STEP("TWO: attach")
96 ONE_STEP("ONE: provideFile(/content)")
97 mm.provideFile(one, Pathname("/content"));
99 ONE_STEP("TWO: provideFile(/INDEX.gz)")
100 mm.provideFile(two, Pathname("/INDEX.gz"));
105 ONE_STEP("ONE: release()")
106 mm.release(one); //! \todo add the device argument once mm.getDevices() is ready
108 catch(const MediaException &e)
111 ERR << "ONE: HUH? Eject hasn't worked?!" << std::endl;
115 ONE_STEP("ONE: provideFile(/content)")
116 mm.provideFile(one, Pathname("/content"));
118 catch(const MediaException &e)
121 DBG << "ONE: OK, EXPECTED IT (released)" << std::endl;
125 ONE_STEP("TWO: provideFile(/ls-lR.gz)")
126 mm.provideFile(two, Pathname("/ls-lR.gz"));
128 catch(const MediaException &e)
131 DBG << "TWO: OK, EXPECTED IT (released)" << std::endl;
134 ONE_STEP("TWO: (RE)ATTACH IT")
137 ONE_STEP("TWO: provideFile(/INDEX.gz)")
138 mm.provideFile(two, Pathname("/INDEX.gz"));
142 catch(const MediaException &e)
149 ERR << "Catched *unknown* exception" << std::endl;
153 // vim: set ts=2 sts=2 sw=2 ai et: