YACC=bison -y
-VPATH=${top_srcdir}/src
+VPATH=${top_srcdir}/src:${top_srcdir}/test
AT3=perl -I${top_srcdir}/project ${top_srcdir}/project/at3
+TEST_LIBS:=-L${cppunit}/lib -lcppunit
+TEST_INC:=-I${cppunit}/include
+
SUFFIXES = .T
DEBUG:=-g -O0
-I${globus_prefix}/include/${nothrflavour}
LINK:=libtool --mode=link ${CC} ${LDFLAGS}
+LINKXX:=libtool --mode=link ${CXX} ${LDFLAGS}
INSTALL:=libtool --mode=install install
# assisst & gss due to VOMS only
compile: glite_lb_bkserverd glite_lb_bkindex
-check:
- echo No unit tests so far.
+check:
+ -echo check.query not complete yet
+
+check.query: test_query_events
+ ./test_query_events
+
+query_events_objs:=`echo ${SERVER_OBJS} | sed 's/lbs_db\.o//;s/bkserverd\.o//'`
+
+test_query_events: test_query_events.o
+ ${LINKXX} -o $@ test_query_events.o ${query_events_objs} \
+ ${TEST_LIBS} ${COMMON_LIB} ${EXT_LIBS}
doc:
mv y.tab.h $*.h
${CC} -c ${CFLAGS} $*.c
rm $*.c
+
+
+test_query_events.o: %.o: %.cpp
+ ${CXX} -c ${CFLAGS} ${GLOBUSINC} ${TEST_INC} $<
+
Revision history:
$Log$
+ Revision 1.1 2004/07/07 12:08:09 akrenek
+ *** empty log message ***
+
Revision 1.2 2004/07/06 20:47:11 flammer
Moved to configure.properties.xml
expat_prefix=${with.expat.prefix}
ares_prefix=${with.ares.prefix}
mysql_prefix=${with.mysql.prefix}
+cppunit=${with.cppunit.prefix}
</echo>
</target>
</project>
/* Internal functions for getting event sets from the LB database */
#include "lbs_db.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#if 0 /* rel 1 */
char *edg_wll_jobid_to_user( edg_wll_Context, char *);
void edg_wll_set_event_field_warn( edg_wll_Event *, char *, char *);
void edg_wll_SortEvents(edg_wll_Event *);
int edg_wll_compare_seq(const char *, const char *);
+#ifdef __cplusplus
+}
+#endif
+
--- /dev/null
+#include <iostream>
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+
+#include <glite/lb/consumer.h>
+#include <glite/lb/context-int.h>
+
+#include "lbs_db.h"
+#include "get_events.h"
+
+using namespace std;
+
+class QueryEventsTest: public CppUnit::TestFixture
+{
+ CPPUNIT_TEST_SUITE(QueryEventsTest);
+ CPPUNIT_TEST(oneJob);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ edg_wll_Context ctx;
+
+public:
+ void oneJob();
+
+ void setUp() {
+ edg_wll_InitContext(&ctx);
+ ctx->mysql = (void *) this; /* XXX */
+ }
+
+};
+
+void QueryEventsTest::oneJob()
+{
+ edg_wll_QueryRec job[2];
+ const edg_wll_QueryRec *jobs[2] = { job,NULL} ;
+ edg_wll_Event *events;
+
+ job[0].attr = EDG_WLL_QUERY_ATTR_JOBID;
+ job[0].op = EDG_WLL_QUERY_OP_EQUAL ;
+ edg_wlc_JobIdParse("https://fake.server/fake_job",&job[0].value.j);
+ job[1].attr = EDG_WLL_QUERY_ATTR_UNDEF;
+
+ CPPUNIT_ASSERT(!edg_wll_QueryEventsServer(ctx,1,jobs,NULL,&events));
+}
+
+extern "C" {
+
+int edg_wll_ExecStmt(edg_wll_Context ctx,char *qry,edg_wll_Stmt *stmt)
+{
+ cout << qry << endl;
+ return 0;
+}
+
+int edg_wll_FetchRow(edg_wll_Stmt stmt, char **cols)
+{
+ return 0;
+}
+
+void edg_wll_FreeStmt(edg_wll_Stmt *) {}
+
+int debug;
+
+int edg_wll_QueryColumns(edg_wll_Stmt stmt, char**cols) {}
+char *edg_wll_TimeToDB(long t) {}
+
+time_t edg_wll_DBToTime(char *c) {}
+edg_wll_ErrorCode edg_wll_DBConnect(edg_wll_Context ctx, char*str) {}
+
+
+
+
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(QueryEventsTest);
+
+int main (int ac,const char *av[])
+{
+ CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
+ CppUnit::TextUi::TestRunner runner;
+
+ runner.addTest(suite);
+ return runner.run() ? 0 : 1;
+}