doc/autodoc/Makefile \
doc/autodoc/Doxyfile \
testsuite/Makefile \
+ testsuite/utils/Makefile \
testsuite/zypp/Makefile \
testsuite/zypp/tests/Makefile \
testsuite/solver/Makefile \
#
# Makefile.am for libzypp/testsuite
#
-SUBDIRS = zypp target solver source media parser
+SUBDIRS = utils zypp target solver source media parser
# Makefile.am for testsuite/source/tests
#
-LDADD = $(top_srcdir)/zypp/lib@PACKAGE@.la
+LDADD = $(top_srcdir)/zypp/lib@PACKAGE@.la $(top_srcdir)/testsuite/utils/lib@PACKAGE@_testsuite_utils.la
INCLUDES = \
-DZYPP_BASE_LOGGER_LOGGROUP=\"testsuite\"
#include "zypp/media/MediaManager.h"
#include "zypp/Dependencies.h"
+#include "testsuite/utils/TestUtils.h"
+
using namespace std;
using namespace zypp;
+using namespace zypp::testsuite::utils;
bool CustomSort(const std::string &a, const std::string &b)
{
return a < b; //example comparison.
}
-static void dumpCapSet( const CapSet &caps, const std::string &deptype)
-{
- cout << " " << "<" << deptype << ">" << std::endl;
- CapSet::iterator it = caps.begin();
- for ( ; it != caps.end(); ++it)
- {
- cout << " <capability kind=\"" << (*it).kind() << "\" refers=\"" << (*it).refers() << "\">" << (*it).asString() << "</capability>" << std::endl;
- }
- cout << " " << "</" << deptype << ">" << std::endl;
-}
-
-static void dumpDeps( const Dependencies &deps )
-{
- dumpCapSet( deps[Dep::PROVIDES], "provides" );
- dumpCapSet( deps[Dep::PREREQUIRES], "prerequires" );
- dumpCapSet( deps[Dep::CONFLICTS], "conflicts" );
- dumpCapSet( deps[Dep::OBSOLETES], "obsoletes" );
- dumpCapSet( deps[Dep::FRESHENS], "freshens" );
- dumpCapSet( deps[Dep::REQUIRES], "requires" );
- dumpCapSet( deps[Dep::RECOMMENDS], "recommends" );
- dumpCapSet( deps[Dep::ENHANCES], "enhances" );
- dumpCapSet( deps[Dep::SUPPLEMENTS], "supplements" );
- dumpCapSet( deps[Dep::SUGGESTS], "suggests" );
-}
-
-static void dump( const ResStore &store )
-{
- std::list<std::string> resolvables;
- cout << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
- cout << "<source xmlns=\"http://www.novell.com/zypp/testcases/source\">" << std::endl;
- for (ResStore::const_iterator it = store.begin(); it != store.end(); it++)
- {
- //std::string resolvable_line = "[" + (*it)->kind().asString() + "]" + (*it)->name() + " " + (*it)->edition().asString() + " " + (*it)->arch().asString();
- cout << " <resolvable kind=\"" << (*it)->kind() << "\">" << std::endl;
- cout << " <name>" << (*it)->name() << "</name>" << std::endl;
- cout << " <edition>" << (*it)->edition() << "</edition>" << std::endl;
- cout << " <arch>" << (*it)->arch() << "</arch>" << std::endl;
- cout << " <dependencies>" << std::endl;
- dumpDeps((*it)->deps());
- cout << " </dependencies>" << std::endl;
- cout << " </resolvable>" << std::endl;
- //std::cout << (**it).deps() << endl;
- }
- cout << "</source>" << std::endl;
- //std::sort( resolvables.begin(), resolvables.end(), CustomSort );
- //for (std::list<std::string>::const_iterator it = resolvables.begin(); it != resolvables.end(); ++it)
- //{
- // cout << *it << std::endl;
- //}
-}
-
/******************************************************************
**
<?xml version="1.0" encoding="UTF-8"?>
-<source xmlns="http://www.novell.com/zypp/testcases/source">
+<resolvable-list xmlns="http://www.novell.com/zypp/testcases/resolvable-list">
<resolvable kind="patch">
<name>zypp</name>
<edition>1291-0</edition>
</suggests>
</dependencies>
</resolvable>
-</source>
+</resolvable-list>
--- /dev/null
+## Process this file with automake to produce Makefile.in
+## ##################################################
+
+SUBDIRS =
+
+INCLUDES = -DZYPP_BASE_LOGGER_LOGGROUP=\"testsuite_utils\"
+
+## ##################################################
+
+##targetincludedir = $(pkgincludedir)/target
+
+##libtestsuiteinclude_HEADERS = \
+## TestUtils.h
+
+## ##################################################
+
+noinst_LTLIBRARIES = lib@PACKAGE@_testsuite_utils.la
+
+## ##################################################
+
+lib@PACKAGE@_testsuite_utils_la_SOURCES = \
+ TestUtils.cc
+
+lib@PACKAGE@_testsuite_utils_la_LDFLAGS = @LIBZYPP_VERSION_INFO@
+
+##lib@PACKAGE@_target_la_LIBADD = \
+## rpm/lib@PACKAGE@_target_rpm.la \
+## hal/lib@PACKAGE@_target_hal.la \
+## modalias/lib@PACKAGE@_target_modalias.la \
+## store/lib@PACKAGE@_target_store.la
+
+## ##################################################
\ No newline at end of file
--- /dev/null
+
+#include <iostream>
+#include "zypp/Dependencies.h"
+#include "zypp/Capability.h"
+#include "zypp/ResObject.h"
+#include "zypp/Patch.h"
+#include "zypp/ResStore.h"
+#include "testsuite/utils/TestUtils.h"
+
+using namespace std;
+
+namespace zypp
+{
+ namespace testsuite
+ {
+ namespace utils
+ {
+ static void dumpCapSet( const CapSet &caps, const std::string &deptype)
+ {
+ cout << " " << "<" << deptype << ">" << std::endl;
+ CapSet::iterator it = caps.begin();
+ for ( ; it != caps.end(); ++it)
+ {
+ cout << " <capability kind=\"" << (*it).kind() << "\" refers=\"" << (*it).refers() << "\">" << (*it).asString() << "</capability>" << std::endl;
+ }
+ cout << " " << "</" << deptype << ">" << std::endl;
+ }
+
+ static void dumpDeps( const Dependencies &deps )
+ {
+ dumpCapSet( deps[Dep::PROVIDES], "provides" );
+ dumpCapSet( deps[Dep::PREREQUIRES], "prerequires" );
+ dumpCapSet( deps[Dep::CONFLICTS], "conflicts" );
+ dumpCapSet( deps[Dep::OBSOLETES], "obsoletes" );
+ dumpCapSet( deps[Dep::FRESHENS], "freshens" );
+ dumpCapSet( deps[Dep::REQUIRES], "requires" );
+ dumpCapSet( deps[Dep::RECOMMENDS], "recommends" );
+ dumpCapSet( deps[Dep::ENHANCES], "enhances" );
+ dumpCapSet( deps[Dep::SUPPLEMENTS], "supplements" );
+ dumpCapSet( deps[Dep::SUGGESTS], "suggests" );
+ }
+
+ static std::string xml_escape( const std::string &s )
+ {
+ return s;
+ }
+
+ static void dumpResObject( const ResObject::Ptr r, bool descr, bool deps )
+ {
+ std::string resolvable_line = "[" + r->kind().asString() + "]" + r->name() + " " + r->edition().asString() + " " + r->arch().asString();
+ cout << " <resolvable kind=\"" << r->kind() << "\">" << std::endl;
+ cout << " <name>" << r->name() << "</name>" << std::endl;
+ cout << " <edition>" << r->edition() << "</edition>" << std::endl;
+ cout << " <arch>" << r->arch() << "</arch>" << std::endl;
+ if ( descr )
+ {
+ cout << " <summary>" << r->summary() << "</summary>" << std::endl;
+ cout << " <description>" << r->description() << "</description>" << std::endl;
+ }
+
+ if ( deps )
+ {
+ cout << " <dependencies>" << std::endl;
+ dumpDeps(r->deps());
+ cout << " </dependencies>" << std::endl;
+ }
+ cout << " </resolvable>" << std::endl;
+ //std::cout << (**it).deps() << endl;
+ }
+
+ void dump( const std::list<ResObject::Ptr> &list, bool descr, bool deps )
+ {
+ std::list<std::string> resolvables;
+ cout << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
+ cout << "<resolvable-list xmlns=\"http://www.novell.com/zypp/testcases/resolvable-list\">" << std::endl;
+ for (std::list<ResObject::Ptr>::const_iterator it = list.begin(); it != list.end(); it++)
+ {
+ dumpResObject(*it, descr, deps);
+ }
+ cout << "</resolvable-list>" << std::endl;
+ }
+
+ void dump( const ResStore &store, bool descr, bool deps )
+ {
+ std::list<std::string> resolvables;
+ cout << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
+ cout << "<resolvable-list xmlns=\"http://www.novell.com/zypp/testcases/resolvable-list\">" << std::endl;
+ for (ResStore::const_iterator it = store.begin(); it != store.end(); it++)
+ {
+ dumpResObject(*it, descr, deps);
+ }
+ cout << "</resolvable-list>" << std::endl;
+ //std::sort( resolvables.begin(), resolvables.end(), CustomSort );
+ //for (std::list<std::string>::const_iterator it = resolvables.begin(); it != resolvables.end(); ++it)
+ //{
+ // cout << *it << std::endl;
+ //}
+ }
+
+
+
+ }
+ }
+}
+
--- /dev/null
+
+#ifndef ZYPP_TESTSUITE_TESTUTILS
+#define ZYPP_TESTSUITE_TESTUTILS
+
+#include "zypp/Dependencies.h"
+#include "zypp/Capability.h"
+#include "zypp/ResStore.h"
+
+namespace zypp
+{
+ namespace testsuite
+ {
+ namespace utils
+ {
+ void dump( const ResStore &store, bool descr = false, bool deps = false );
+ void dump( const std::list<ResObject::Ptr> &list, bool descr = false, bool deps = false );
+ }
+ }
+}
+
+#endif
+