From 6f8863cf292b784a3ac56602cad6c4270b9fa8e6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ji=C5=99=C3=AD=20=C5=A0kr=C3=A1bal?= Date: Fri, 15 Oct 2004 11:03:03 +0000 Subject: [PATCH] - merge fixes --- org.glite.lb.server/Makefile | 90 ++++-- org.glite.lb.server/examples/ws_jobstat.c | 161 ++++++++++ org.glite.lb.server/examples/ws_query_ex.c | 182 ++++++++++++ org.glite.lb.server/project/LB.wsdl | 326 +++++++++++++++++++++ .../project/configure.properties.xml | 13 + org.glite.lb.server/project/version.properties | 6 +- org.glite.lb.server/test/test_soap_conv.cpp | 319 ++++++++++++++++++++ org.glite.lb.server/test/test_xml.cpp.T | 2 +- 8 files changed, 1066 insertions(+), 33 deletions(-) create mode 100644 org.glite.lb.server/examples/ws_jobstat.c create mode 100644 org.glite.lb.server/examples/ws_query_ex.c create mode 100644 org.glite.lb.server/project/LB.wsdl create mode 100644 org.glite.lb.server/test/test_soap_conv.cpp diff --git a/org.glite.lb.server/Makefile b/org.glite.lb.server/Makefile index 5b168c2..d46665b 100644 --- a/org.glite.lb.server/Makefile +++ b/org.glite.lb.server/Makefile @@ -7,7 +7,7 @@ distdir=. globalprefix=glite lbprefix=lb package=glite-lb-server -version=0.0.0 +version=0.2.0 PREFIX=/opt/glite glite_location=/opt/glite @@ -16,13 +16,20 @@ nothrflavour=gcc32 thrflavour=gcc32pthr expat_prefix=/opt/expat ares_prefix=/opt/ares +gsoap_prefix=/opt/gsoap +# include project/version.properties -include Makefile.inc +-include ../Makefile.inc + +CC=gcc + +GSOAP_FILES_PREFIX:= bk_ws_ YACC=bison -y CC=gcc -VPATH=${top_srcdir}/src:${top_srcdir}/test +VPATH=${top_srcdir}/src:${top_srcdir}/test:${top_srcdir}/examples:${top_srcdir}/project AT3=perl -I${top_srcdir}/project ${top_srcdir}/project/at3 TEST_LIBS:=-L${cppunit}/lib -lcppunit @@ -30,7 +37,7 @@ TEST_INC:=-I${cppunit}/include SUFFIXES = .T -DEBUG:=-g -O0 +DEBUG:=-g -O0 -Wall # not yet # -I${voms}/include \ # -I${gacl}/include \ @@ -41,6 +48,7 @@ CFLAGS:= -DNO_VOMS -DNO_GACL \ ${DEBUG} -I${stagedir}/include -I${top_srcdir}/src -I. \ -I${expat_prefix}/include \ -I${ares_prefix}/include \ + -I${gsoap_prefix}/include \ ${COVERAGE_FLAGS} \ -I${mysql_prefix}/include \ -I${globus_prefix}/include/${nothrflavour} \ @@ -55,31 +63,20 @@ LINKXX:=libtool --mode=link ${CXX} ${LDFLAGS} INSTALL:=libtool --mode=install install LINKXX:=libtool --mode=link ${CXX} -rpath ${stagedir}/lib ${LDFLAGS} -# assisst & gss due to VOMS only -# -lglobus_gss_assist_${nothrflavour} \ -# -lglobus_gssapi_gsi_${nothrflavour} \ - GLOBUS_LIBS:= -L${globus_prefix}/lib \ -lglobus_common_${nothrflavour} \ -lglobus_gssapi_gsi_${nothrflavour} \ - -# XXX: our vomsc.la depends on badly installed expat - -# not yet -# -L${repository}/${gacl}/lib -lgacl \ -# ${repository}/${voms}/lib/libvomsc.a \ - EXT_LIBS:= -L${ares_prefix}/lib -lares \ -L${mysql_prefix}/lib -lmysqlclient -lz\ -L${expat_prefix}/lib -lexpat \ ${GLOBUS_LIBS} -# -L${gridsite_prefix}/lib -lgridsite -lxml2 +GSOAP_LIBS:= -L${gsoap_prefix}/lib -lgsoap -COMMON_LIB:= -L${stagedir}/lib -lglite_lb_common_${nothrflavour} +SRVBONES_LIB:= -L${stagedir}/lib -lglite_lb_server_bones -# -lvomsc +COMMON_LIB:= -L${stagedir}/lib -lglite_lb_common_${nothrflavour} SERVER_OBJS:= bkserverd.o get_events.o index.o jobstat.o jobstat_supp.o \ write2rgma.o lbs_db.o lb_html.o lb_http.o lb_proto.o lb_xml_parse.o \ @@ -88,12 +85,19 @@ SERVER_OBJS:= bkserverd.o get_events.o index.o jobstat.o jobstat_supp.o \ stored_master.o srv_purge.o server_state.o dump.o lb_authz.o load.o \ notification.o il_notification.o notif_match.o +SERVER_SOAP_OBJS:=${GSOAP_FILES_PREFIX}C.o ${GSOAP_FILES_PREFIX}Server.o \ + ws_plugin.o ws_query.o ws_fault.o ws_typeref.o + INDEX_OBJS:= index.o index_parse.o jobstat_supp.o lbs_db.o openserver.o \ jobstat.o query.o lock.o get_events.o write2rgma.o index_lex.o \ lb_authz.o store.o bkindex.o -glite_lb_bkserverd: ${SERVER_OBJS} - ${LINK} -o $@ ${SERVER_OBJS} ${COMMON_LIB} ${EXT_LIBS} +WS_CLIENT_OBJS:= test_ws_plugin.o $(GSOAP_FILES_PREFIX)C.o $(GSOAP_FILES_PREFIX)Client.o ws_fault.o ws_typeref.o +WS_CLIENT_LIBS:= ${GSOAP_LIBS} -L${stagedir}/lib -lglite_lb_client_${nothrflavour} + + +glite_lb_bkserverd: ${SERVER_OBJS} ${SERVER_SOAP_OBJS} + ${LINK} -o $@ ${SERVER_OBJS} ${SERVER_SOAP_OBJS} ${COMMON_LIB} ${SRVBONES_LIB} ${GSOAP_LIBS} ${EXT_LIBS} glite_lb_bkindex: ${INDEX_OBJS} ${LINK} -o $@ ${INDEX_OBJS} ${COMMON_LIB} ${EXT_LIBS} @@ -105,23 +109,32 @@ compile: glite_lb_bkserverd glite_lb_bkindex check: compile test.xml test.query -echo check.query not complete yet -test_xml: test_xml.cpp - ${CXX} -c ${CFLAGS} ${TEST_INC} $< - ${LINKXX} -o $@ test_xml.o lb_xml_parse.o ${COMMON_LIB} ${TEST_LIBS} ${EXT_LIBS} - -test.query: test_query_events - ./test_query_events ${top_srcdir}/test - -test.xml: test_xml - ./test_xml +test_coverage: + -mkdir coverage + cd coverage && $(MAKE) -f ../Makefile top_srcdir=../../ COVERAGE_FLAGS="-fprofile-arcs -ftest-coverage" check + cd coverage && for i in `echo ${INDEX_OBJS} ${SERVER_OBJS} | tr ' ' '\012' | sort -u`; do gcov $$i ; done lb_xml_parse.c: lb_xml_parse.c.T rm -f $@ ${AT3} $< >$@ || rm -f $@ chmod -w $@ >/dev/null +${GSOAP_FILES_PREFIX}H.h ${GSOAP_FILES_PREFIX}C.c ${GSOAP_FILES_PREFIX}Server.c ${GSOAP_FILES_PREFIX}Client.c: LB.xh + ${gsoap_prefix}/bin/soapcpp2 -w -c -p ${GSOAP_FILES_PREFIX} LB.xh + +LB.xh: LB.wsdl ws_typemap.dat + cp ${top_srcdir}/project/LB.wsdl . + ${gsoap_prefix}/bin/wsdl2h -c -t ${top_srcdir}/src/ws_typemap.dat -o $@ LB.wsdl + rm LB.wsdl + +test.xml: test_xml + ./test_xml + +test_xml: test_xml.cpp + ${CXX} -c ${CFLAGS} ${TEST_INC} $< + ${LINKXX} -o $@ test_xml.o lb_xml_parse.o ${COMMON_LIB} ${TEST_LIBS} -check.query: test_query_events +test.query: test_query_events ./test_query_events query_events_objs:=`echo ${SERVER_OBJS} | sed 's/lbs_db\.o//;s/bkserverd\.o//'` @@ -130,6 +143,25 @@ test_query_events: test_query_events.o ${LINKXX} -o $@ test_query_events.o ${query_events_objs} \ ${TEST_LIBS} ${COMMON_LIB} ${EXT_LIBS} +test.soapconv: test_soap_conv + ./test_soap_conv + +test_soap_conv: test_soap_conv.cpp ${WS_CLIENT_OBJS} + ${CXX} -c ${CFLAGS} ${TEST_INC} $< + ${LINKXX} -o $@ test_soap_conv.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ${COMMON_LIB} ${TEST_LIBS} + +ws_jobstat: ws_jobstat.o ${WS_CLIENT_OBJS} + ${LINK} -o $@ ws_jobstat.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ${EXT_LIBS} + +ws_query_ex: ws_query_ex.o ${WS_CLIENT_OBJS} + ${LINK} -o $@ ws_query_ex.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ${EXT_LIBS} + +ws_query_ext: ws_query_ext.o ${WS_CLIENT_OBJS} + ${LINK} -o $@ ws_query_ext.o ${WS_CLIENT_OBJS} ${WS_CLIENT_LIBS} ${EXT_LIBS} + +test_ws_plugin.o: ws_plugin.c + ${CC} ${CFLAGS} -DPLUGIN_TEST -c -o $@ ${top_srcdir}/src/ws_plugin.c + doc: stage: compile diff --git a/org.glite.lb.server/examples/ws_jobstat.c b/org.glite.lb.server/examples/ws_jobstat.c new file mode 100644 index 0000000..0b64399 --- /dev/null +++ b/org.glite.lb.server/examples/ws_jobstat.c @@ -0,0 +1,161 @@ +#include +#include + +#include "glite/lb/consumer.h" + +#include "ws_plugin.h" +#include "bk_ws_H.h" + +static struct option opts[] = { + {"help", 0, NULL, 'h'}, + {"server", 1, NULL, 'm'}, + {"jobid", 1, NULL, 'j'} +}; + +static void usage(char *me) +{ + fprintf(stderr,"usage: %s [option]\n" + "\t-h, --help Shows this screen.\n" + "\t-m, --server BK server address:port.\n" + "\t-j, --jobid ID of requested job.\n" + , me); +} + +static void printstat(edg_wll_JobStat stat, int level); + +int main(int argc,char** argv) +{ + edg_wll_Context ctx; + struct soap *mydlo = soap_new(); + struct edgwll2__JobStatusResponse out; + int opt, err; + char *server = "http://localhost:8999/", + *jobid = NULL, + *name = NULL; + + + name = strrchr(argv[0],'/'); + if (name) name++; else name = argv[0]; + + while ((opt = getopt_long(argc, argv, "hm:j:", opts, NULL)) != EOF) switch (opt) + { + case 'h': usage(name); return 0; + case 'm': server = strdup(optarg); break; + case 'j': jobid = strdup(optarg); break; + case '?': usage(name); return 1; + } + + if ( !jobid ) + { + printf("jobid should be given\n"); + usage(name); + return 1; + } + + edg_wll_InitContext(&ctx); + + if ( soap_register_plugin_arg(mydlo, edg_wll_ws_plugin, (void *)ctx) ) + { + soap_print_fault(mydlo, stderr); + return 1; + } + + switch (err = soap_call_edgwll2__JobStatus(mydlo, server, "", jobid,0,&out)) + { + case SOAP_OK: + { + edg_wll_JobStat s; + + edg_wll_SoapToStatus(mydlo,out.status,&s); + printstat(s, 0); + } + break; + case SOAP_FAULT: + case SOAP_SVR_FAULT: + { + char *et,*ed; + + edg_wll_FaultToErr(mydlo,ctx); + edg_wll_Error(ctx,&et,&ed); + fprintf(stderr,"%s: %s (%s)\n",argv[0],et,ed); + exit(1); + } + default: + fprintf(stderr,"err = %d\n",err); + soap_print_fault(mydlo,stderr); + } + + return 0; +} + +static void printstat(edg_wll_JobStat stat, int level) +{ + char *s, *j, ind[10]; + int i; + + + for (i=0; i < level; i++) + ind[i]='\t'; + ind[i]='\0'; + + s = edg_wll_StatToString(stat.state); +/* print whole flat structure */ + printf("%sstate : %s\n", ind, s); + printf("%sjobId : %s\n", ind, j = edg_wlc_JobIdUnparse(stat.jobId)); + printf("%sowner : %s\n", ind, stat.owner); + printf("%sjobtype : %s\n", ind, (stat.jobtype ? "DAG" : "SIMPLE") ); + printf("%sparent_job : %s\n", ind, + j = edg_wlc_JobIdUnparse(stat.parent_job)); + if (stat.jobtype) {; + printf("%sseed : %s\n", ind, stat.seed); + printf("%schildren_num : %d\n", ind, stat.children_num); + printf("%schildren :\n", ind); + if (stat.children) + for (i=0; stat.children[i]; i++) + printf("%s\tchildren : %s\n", ind, stat.children[i]); + printf("%schildren_states :\n", ind); + if (stat.children_states) + for (i=0; stat.children_states[i].state; i++) + printstat(stat.children_states[i], level+1); + printf("%schildren_hist :\n",ind); + if (stat.children_hist) + for (i=1; i<=stat.children_hist[0]; i++) + printf("%s%14s %d\n", ind, edg_wll_StatToString(i-1),stat.children_hist[i]); + } + printf("%scondorId : %s\n", ind, stat.condorId); + printf("%sglobusId : %s\n", ind, stat.globusId); + printf("%slocalId : %s\n", ind, stat.localId); + printf("%sjdl : %s\n", ind, stat.jdl); + printf("%smatched_jdl : %s\n", ind, stat.matched_jdl); + printf("%sdestination : %s\n", ind, stat.destination); + printf("%snetwork server : %s\n", ind, stat.network_server); + printf("%scondor_jdl : %s\n", ind, stat.condor_jdl); + printf("%srsl : %s\n", ind, stat.rsl); + printf("%sreason : %s\n", ind, stat.reason); + printf("%slocation : %s\n", ind, stat.location); + printf("%ssubjob_failed : %d\n", ind, stat.subjob_failed); + printf("%sdone_code : %d\n", ind, stat.done_code); + printf("%sexit_code : %d\n", ind, stat.exit_code); + printf("%sresubmitted : %d\n", ind, stat.resubmitted); + printf("%scancelling : %d\n", ind, stat.cancelling); + printf("%scancelReason : %s\n", ind, stat.cancelReason); + printf("%scpuTime : %d\n", ind, stat.cpuTime); + printf("%suser_tags :\n",ind); + if (stat.user_tags) + for (i=0; stat.user_tags[i].tag; i++) printf("%s%14s = \"%s\"\n", ind, + stat.user_tags[i].tag,stat.user_tags[i].value); + printf("%sstateEnterTime : %ld.%06ld\n", ind, stat.stateEnterTime.tv_sec,stat.stateEnterTime.tv_usec); + printf("%sstateEnterTimes : \n",ind); + if (stat.stateEnterTimes) + for (i=1; i<=stat.stateEnterTimes[0]; i++) + printf("%s%14s %s", ind, edg_wll_StatToString(i-1), (stat.stateEnterTimes[i] == 0) ? + " - not available -\n" : ctime((time_t *) &stat.stateEnterTimes[i])); + printf("%slastUpdateTime : %ld.%06ld\n", ind, stat.lastUpdateTime.tv_sec,stat.lastUpdateTime.tv_usec); + printf("%sexpectUpdate : %d\n", ind, stat.expectUpdate); + printf("%sexpectFrom : %s\n", ind, stat.expectFrom); + printf("%sacl : %s\n", ind, stat.acl); + printf("\n"); + + free(j); + free(s); +} diff --git a/org.glite.lb.server/examples/ws_query_ex.c b/org.glite.lb.server/examples/ws_query_ex.c new file mode 100644 index 0000000..a08fe33 --- /dev/null +++ b/org.glite.lb.server/examples/ws_query_ex.c @@ -0,0 +1,182 @@ +#include +#include + +#include "glite/lb/consumer.h" + +#include "ws_plugin.h" +#include "bk_ws_H.h" + +#include "ws_typeref.h" + + +static struct option opts[] = { + {"help", 0, NULL, 'h'}, + {"server", 1, NULL, 'm'} +}; + +static void usage(char *me) +{ + fprintf(stderr,"usage: %s [option]\n" + "\t-h, --help Shows this screen.\n" + "\t-m, --server BK server address:port.\n" + , me); +} + +static void printstat(edg_wll_JobStat stat, int level); + +int main(int argc,char** argv) +{ + edg_wll_Context ctx; + edg_wll_QueryRec **conditions = NULL; + struct soap *soap = soap_new(); + struct edgwll__QueryConditions *jconds = NULL; + struct edgwll__JobStatFlags flags; + struct edgwll2__QueryJobsResponse out; + int opt, err; + char *server = "http://localhost:8999/", + *name = NULL; + + + name = strrchr(argv[0],'/'); + if (name) name++; else name = argv[0]; + + while ((opt = getopt_long(argc, argv, "hm:", opts, NULL)) != EOF) switch (opt) + { + case 'h': usage(name); return 0; + case 'm': server = strdup(optarg); break; + case '?': usage(name); return 1; + } + + edg_wll_InitContext(&ctx); + + if ( soap_register_plugin_arg(soap, edg_wll_ws_plugin, (void *)ctx) ) + { + soap_print_fault(soap, stderr); + return 1; + } + + conditions = (edg_wll_QueryRec **)calloc(3,sizeof(edg_wll_QueryRec *)); + + conditions[0] = (edg_wll_QueryRec *)calloc(2,sizeof(edg_wll_QueryRec)); + conditions[0][0].attr = EDG_WLL_QUERY_ATTR_STATUS; + conditions[0][0].op = EDG_WLL_QUERY_OP_UNEQUAL; + conditions[0][0].value.i = EDG_WLL_JOB_DONE; + + conditions[1] = (edg_wll_QueryRec *)calloc(2, sizeof(edg_wll_QueryRec)); + conditions[1][0].attr = EDG_WLL_QUERY_ATTR_OWNER; + conditions[1][0].op = EDG_WLL_QUERY_OP_EQUAL; + conditions[1][0].value.c = NULL; + + if ( edg_wll_QueryCondsExtToSoap(soap, (const edg_wll_QueryRec **)conditions, &jconds) + || edg_wll_JobStatFlagsToSoap(soap, 0, &flags) ) { + char *et,*ed; + + fprintf(stderr, "%s: soap types conversion error...\n", argv[0]); + edg_wll_FaultToErr(soap, ctx); + edg_wll_Error(ctx, &et, &ed); + fprintf(stderr, "%s: %s (%s)\n", argv[0], et, ed); + exit(1); + } + + err = soap_call_edgwll2__QueryJobs(soap, server, "", jconds, &flags, &out); + switch ( err ) { + case SOAP_OK: { + int i; + + printf("Query succesfull...\n"); + printf("%-65s%s\n\n", "jobid", "state"); + for ( i = 0; i < out.jobs->__sizejobs; i++ ) { + char *s = edg_wll_StatToString(out.states->states[i]->state); + printf("%-65s%s\n", out.jobs->jobs[i], s); + free(s); + } + } + break; + case SOAP_FAULT: + case SOAP_SVR_FAULT: { + char *et,*ed; + + edg_wll_FaultToErr(soap, ctx); + edg_wll_Error(ctx,&et,&ed); + fprintf(stderr,"%s: %s (%s)\n",argv[0],et,ed); + exit(1); + } + default: + fprintf(stderr,"err = %d\n",err); + soap_print_fault(soap,stderr); + } + + return 0; +} + +static void printstat(edg_wll_JobStat stat, int level) +{ + char *s, *j, ind[10]; + int i; + + + for (i=0; i < level; i++) + ind[i]='\t'; + ind[i]='\0'; + + s = edg_wll_StatToString(stat.state); +/* print whole flat structure */ + printf("%sstate : %s\n", ind, s); + printf("%sjobId : %s\n", ind, j = edg_wlc_JobIdUnparse(stat.jobId)); + printf("%sowner : %s\n", ind, stat.owner); + printf("%sjobtype : %s\n", ind, (stat.jobtype ? "DAG" : "SIMPLE") ); + printf("%sparent_job : %s\n", ind, + j = edg_wlc_JobIdUnparse(stat.parent_job)); + if (stat.jobtype) {; + printf("%sseed : %s\n", ind, stat.seed); + printf("%schildren_num : %d\n", ind, stat.children_num); + printf("%schildren :\n", ind); + if (stat.children) + for (i=0; stat.children[i]; i++) + printf("%s\tchildren : %s\n", ind, stat.children[i]); + printf("%schildren_states :\n", ind); + if (stat.children_states) + for (i=0; stat.children_states[i].state; i++) + printstat(stat.children_states[i], level+1); + printf("%schildren_hist :\n",ind); + if (stat.children_hist) + for (i=1; i<=stat.children_hist[0]; i++) + printf("%s%14s %d\n", ind, edg_wll_StatToString(i-1),stat.children_hist[i]); + } + printf("%scondorId : %s\n", ind, stat.condorId); + printf("%sglobusId : %s\n", ind, stat.globusId); + printf("%slocalId : %s\n", ind, stat.localId); + printf("%sjdl : %s\n", ind, stat.jdl); + printf("%smatched_jdl : %s\n", ind, stat.matched_jdl); + printf("%sdestination : %s\n", ind, stat.destination); + printf("%snetwork server : %s\n", ind, stat.network_server); + printf("%scondor_jdl : %s\n", ind, stat.condor_jdl); + printf("%srsl : %s\n", ind, stat.rsl); + printf("%sreason : %s\n", ind, stat.reason); + printf("%slocation : %s\n", ind, stat.location); + printf("%ssubjob_failed : %d\n", ind, stat.subjob_failed); + printf("%sdone_code : %d\n", ind, stat.done_code); + printf("%sexit_code : %d\n", ind, stat.exit_code); + printf("%sresubmitted : %d\n", ind, stat.resubmitted); + printf("%scancelling : %d\n", ind, stat.cancelling); + printf("%scancelReason : %s\n", ind, stat.cancelReason); + printf("%scpuTime : %d\n", ind, stat.cpuTime); + printf("%suser_tags :\n",ind); + if (stat.user_tags) + for (i=0; stat.user_tags[i].tag; i++) printf("%s%14s = \"%s\"\n", ind, + stat.user_tags[i].tag,stat.user_tags[i].value); + printf("%sstateEnterTime : %ld.%06ld\n", ind, stat.stateEnterTime.tv_sec,stat.stateEnterTime.tv_usec); + printf("%sstateEnterTimes : \n",ind); + if (stat.stateEnterTimes) + for (i=1; i<=stat.stateEnterTimes[0]; i++) + printf("%s%14s %s", ind, edg_wll_StatToString(i-1), (stat.stateEnterTimes[i] == 0) ? + " - not available -\n" : ctime((time_t *) &stat.stateEnterTimes[i])); + printf("%slastUpdateTime : %ld.%06ld\n", ind, stat.lastUpdateTime.tv_sec,stat.lastUpdateTime.tv_usec); + printf("%sexpectUpdate : %d\n", ind, stat.expectUpdate); + printf("%sexpectFrom : %s\n", ind, stat.expectFrom); + printf("%sacl : %s\n", ind, stat.acl); + printf("\n"); + + free(j); + free(s); +} diff --git a/org.glite.lb.server/project/LB.wsdl b/org.glite.lb.server/project/LB.wsdl new file mode 100644 index 0000000..33e39d1 --- /dev/null +++ b/org.glite.lb.server/project/LB.wsdl @@ -0,0 +1,326 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Retrieve state of a single job. + +Given a job id queries LB for detailed state of the job. + + +Input: + +jobid: Id of the job + +flags: Which fields of the job state should be retrieved: zero or more of CLASSADS, CHILDREN, CHILDSTAT + +Output: state of the job + +Faults: GenericLBFault + + + + + + + Query for jobs satisfying set of conditions. + +Intput: + +conditions: list of lists of query conditions. + Elements of the inner lists refer to a single job attribute, the conditions are or-ed. + Elements of the outer list may refer to different job attributes, they are and-ed. + +flags: Which fields of the job state should be retrieved: see JobStatus + +Output: list of mathching jobs, including their states + +Faults: GenericLBFault + + + + + + + Query all jobs of the current user. + +Input: no input + +Output: list of all user's jobs, including their states + +Faults: GenericLBFault + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Logging and Bookkeeping service + + + + + diff --git a/org.glite.lb.server/project/configure.properties.xml b/org.glite.lb.server/project/configure.properties.xml index f01fbda..cbf186d 100644 --- a/org.glite.lb.server/project/configure.properties.xml +++ b/org.glite.lb.server/project/configure.properties.xml @@ -20,6 +20,18 @@ Revision history: $Log$ + Revision 1.3 2004/10/06 08:14:36 dkouril + Support for VOMS and GACL (gridsite) from SCM CVS + - legacy names of GACL routines changed to new ones, which also prevents from + conflicts with a few older routine names being badly redefined to new ones + - VOMS and GACL are still commented out in the Makefile until a correct way + of defining dependencies is negotiated. + + Revision 1.2.2.1 2004/09/21 07:39:45 akrenek + + - First version of BK server using "server bones" library and WS protocol. + - Under hard development - unstable & buggy + Revision 1.2 2004/09/08 13:38:03 akrenek query event unit test (not complete yet) @@ -60,6 +72,7 @@ ares_prefix=${with.ares.prefix} mysql_prefix=${with.mysql.prefix} cppunit=${with.cppunit.prefix} gridsite_prefix=${with.gridsite.prefix} +gsoap_prefix=${with.gsoap.prefix} diff --git a/org.glite.lb.server/project/version.properties b/org.glite.lb.server/project/version.properties index 84d36aa..21f905a 100644 --- a/org.glite.lb.server/project/version.properties +++ b/org.glite.lb.server/project/version.properties @@ -1,4 +1,4 @@ -#Fri Oct 15 07:09:44 CEST 2004 -module.version=0.1.0 -module.build=42 +#Thu Oct 14 03:24:40 CEST 2004 +module.version=0.2.0 +module.build=41 module.age=0 diff --git a/org.glite.lb.server/test/test_soap_conv.cpp b/org.glite.lb.server/test/test_soap_conv.cpp new file mode 100644 index 0000000..f57d744 --- /dev/null +++ b/org.glite.lb.server/test/test_soap_conv.cpp @@ -0,0 +1,319 @@ +#include +#include + +#include +#include +#include +#include + +#include + +#include "bk_ws_H.h" +#include "ws_typeref.h" + +using namespace std; + +class SoapConvTest: public CppUnit::TestFixture +{ + CPPUNIT_TEST_SUITE(SoapConvTest); + CPPUNIT_TEST(Conditions); + CPPUNIT_TEST(States); + CPPUNIT_TEST_SUITE_END(); + +private: + struct soap *soap; + edg_wll_QueryRec **stdConds; + edg_wll_JobStat stdStat; + + int stdRecCmp(edg_wll_QueryRec &, edg_wll_QueryRec &); + int stdCondsCmp(edg_wll_QueryRec **, edg_wll_QueryRec **); + int soapRecCmp(struct edgwll__QueryRec &, struct edgwll__QueryRec &); + int soapCondsCmp(struct edgwll__QueryConditions &, struct edgwll__QueryConditions &); + +public: + void setUp(); + + void Conditions(); + void States(); +}; + +void SoapConvTest::setUp() +{ + soap = soap_new(); + + stdConds = (edg_wll_QueryRec **)calloc(17, sizeof(edg_wll_QueryRec *)); + + stdConds[0] = (edg_wll_QueryRec *)calloc(4, sizeof(edg_wll_QueryRec)); + stdConds[0][0].attr = EDG_WLL_QUERY_ATTR_STATUS; + stdConds[0][0].op = EDG_WLL_QUERY_OP_EQUAL; + stdConds[0][0].value.i = EDG_WLL_JOB_DONE; + stdConds[0][1].attr = EDG_WLL_QUERY_ATTR_STATUS; + stdConds[0][1].op = EDG_WLL_QUERY_OP_EQUAL; + stdConds[0][1].value.i = EDG_WLL_JOB_RUNNING; + stdConds[0][2].attr = EDG_WLL_QUERY_ATTR_STATUS; + stdConds[0][2].op = EDG_WLL_QUERY_OP_EQUAL; + stdConds[0][2].value.i = EDG_WLL_JOB_CANCELLED; + + stdConds[1] = (edg_wll_QueryRec *)calloc(2, sizeof(edg_wll_QueryRec)); + stdConds[1][0].attr = EDG_WLL_QUERY_ATTR_OWNER; + stdConds[1][0].op = EDG_WLL_QUERY_OP_EQUAL; + stdConds[1][0].value.c = NULL; + + stdConds[2] = (edg_wll_QueryRec *)calloc(2, sizeof(edg_wll_QueryRec)); + stdConds[2][0].attr = EDG_WLL_QUERY_ATTR_JOBID; + stdConds[2][0].op = EDG_WLL_QUERY_OP_EQUAL; + edg_wlc_JobIdCreate("my.server.org", 9000, &(stdConds[2][0].value.j)); + + stdConds[3] = (edg_wll_QueryRec *)calloc(2, sizeof(edg_wll_QueryRec)); + stdConds[3][0].attr = EDG_WLL_QUERY_ATTR_LOCATION; + stdConds[3][0].op = EDG_WLL_QUERY_OP_EQUAL; + stdConds[3][0].value.c = strdup("my_location"); + + stdConds[4] = (edg_wll_QueryRec *)calloc(2, sizeof(edg_wll_QueryRec)); + stdConds[4][0].attr = EDG_WLL_QUERY_ATTR_DESTINATION; + stdConds[4][0].op = EDG_WLL_QUERY_OP_EQUAL; + stdConds[4][0].value.c = strdup("my_destination"); + + stdConds[5] = (edg_wll_QueryRec *)calloc(2, sizeof(edg_wll_QueryRec)); + stdConds[5][0].attr = EDG_WLL_QUERY_ATTR_DONECODE; + stdConds[5][0].op = EDG_WLL_QUERY_OP_GREATER; + stdConds[5][0].value.i = 1; + + stdConds[6] = (edg_wll_QueryRec *)calloc(2, sizeof(edg_wll_QueryRec)); + stdConds[6][0].attr = EDG_WLL_QUERY_ATTR_USERTAG; + stdConds[6][0].op = EDG_WLL_QUERY_OP_EQUAL; + stdConds[6][0].attr_id.tag = strdup("color"); + stdConds[6][0].value.c = strdup("red"); + + stdConds[7] = (edg_wll_QueryRec *)calloc(2, sizeof(edg_wll_QueryRec)); + stdConds[7][0].attr = EDG_WLL_QUERY_ATTR_TIME; + stdConds[7][0].op = EDG_WLL_QUERY_OP_WITHIN; + stdConds[7][0].value.t = (struct timeval){10, 1}; + stdConds[7][0].value2.t = (struct timeval){20, 1}; + + stdConds[8] = (edg_wll_QueryRec *)calloc(2, sizeof(edg_wll_QueryRec)); + stdConds[8][0].attr = EDG_WLL_QUERY_ATTR_LEVEL; + stdConds[8][0].op = EDG_WLL_QUERY_OP_WITHIN; + stdConds[8][0].value.i = 10; + stdConds[8][0].value2.i = 20; + + stdConds[9] = (edg_wll_QueryRec *)calloc(2, sizeof(edg_wll_QueryRec)); + stdConds[9][0].attr = EDG_WLL_QUERY_ATTR_HOST; + stdConds[9][0].op = EDG_WLL_QUERY_OP_EQUAL; + stdConds[9][0].value.c = strdup("any.host"); + + stdConds[10] = (edg_wll_QueryRec *)calloc(2, sizeof(edg_wll_QueryRec)); + stdConds[10][0].attr = EDG_WLL_QUERY_ATTR_SOURCE; + stdConds[10][0].op = EDG_WLL_QUERY_OP_EQUAL; + stdConds[10][0].value.i = 2; + + stdConds[11] = (edg_wll_QueryRec *)calloc(2, sizeof(edg_wll_QueryRec)); + stdConds[11][0].attr = EDG_WLL_QUERY_ATTR_INSTANCE; + stdConds[11][0].op = EDG_WLL_QUERY_OP_EQUAL; + stdConds[11][0].value.c = strdup("any.instance"); + + stdConds[12] = (edg_wll_QueryRec *)calloc(2, sizeof(edg_wll_QueryRec)); + stdConds[12][0].attr = EDG_WLL_QUERY_ATTR_EVENT_TYPE; + stdConds[12][0].op = EDG_WLL_QUERY_OP_EQUAL; + stdConds[12][0].value.i = 1; + + stdConds[13] = (edg_wll_QueryRec *)calloc(2, sizeof(edg_wll_QueryRec)); + stdConds[13][0].attr = EDG_WLL_QUERY_ATTR_RESUBMITTED; + stdConds[13][0].op = EDG_WLL_QUERY_OP_EQUAL; + stdConds[13][0].value.c = strdup("where"); + + stdConds[14] = (edg_wll_QueryRec *)calloc(2, sizeof(edg_wll_QueryRec)); + stdConds[14][0].attr = EDG_WLL_QUERY_ATTR_PARENT; + stdConds[14][0].op = EDG_WLL_QUERY_OP_EQUAL; + edg_wlc_JobIdCreate("my.server.org", 8000, &(stdConds[14][0].value.j)); + + stdConds[15] = (edg_wll_QueryRec *)calloc(2, sizeof(edg_wll_QueryRec)); + stdConds[15][0].attr = EDG_WLL_QUERY_ATTR_EXITCODE; + stdConds[15][0].op = EDG_WLL_QUERY_OP_LESS; + stdConds[15][0].value.i = 255; +/* + * XXX: what is that for? + stdConds[13] = (edg_wll_QueryRec *)calloc(2, sizeof(edg_wll_QueryRec)); + stdConds[13][0].attr = EDG_WLL_QUERY_ATTR_CHKPT_TAG; + stdConds[13][0].op = EDG_WLL_QUERY_OP_EQUAL; + stdConds[13][0].value.i = 1; +*/ +} + +int SoapConvTest::stdCondsCmp(edg_wll_QueryRec **c1, edg_wll_QueryRec **c2) +{ + int i, j; + + + if ( (c1 && !c2) || (!c1 && c2) ) return 1; + if ( c1 ) for ( i = 0; c1[i]; i++ ) { + if ( !c2[i] ) return 2; + for ( j = 0; c1[i][j].attr; j++ ) { + if ( !c2[i][j].attr ) return 3; + if ( stdRecCmp(c1[i][j], c2[i][j]) ) return 4; + } + if ( c2[i][j].attr ) return 3; + } + if ( c2[i] ) return 2; + + return 0; +} + +int SoapConvTest::stdRecCmp(edg_wll_QueryRec &qr1, edg_wll_QueryRec &qr2) +{ + if ( qr1.attr != qr2.attr ) return 1; + if ( qr1.op != qr2.op ) return 1; + switch ( qr1.attr) { + case EDG_WLL_QUERY_ATTR_USERTAG: + if ( strcmp(qr1.attr_id.tag, qr2.attr_id.tag) ) return 1; + case EDG_WLL_QUERY_ATTR_OWNER: + case EDG_WLL_QUERY_ATTR_LOCATION: + case EDG_WLL_QUERY_ATTR_DESTINATION: + case EDG_WLL_QUERY_ATTR_HOST: + case EDG_WLL_QUERY_ATTR_INSTANCE: + if ( (qr1.value.c && !qr2.value.c) || (!qr1.value.c && qr2.value.c) ) return 1; + if ( qr1.value.c && qr2.value.c && strcmp(qr1.value.c, qr2.value.c) ) return 1; + break; + case EDG_WLL_QUERY_ATTR_JOBID: + case EDG_WLL_QUERY_ATTR_PARENT: { + char *s1, *s2; + int rv; + + s1 = edg_wlc_JobIdUnparse(qr1.value.j); + s2 = edg_wlc_JobIdUnparse(qr2.value.j); + if ( !s1 || !s2 ) rv = 1; + else rv = strcmp(s1, s2); + free(s1); free(s2); + return rv; + } + break; + case EDG_WLL_QUERY_ATTR_STATUS: + case EDG_WLL_QUERY_ATTR_DONECODE: + case EDG_WLL_QUERY_ATTR_LEVEL: + case EDG_WLL_QUERY_ATTR_SOURCE: + case EDG_WLL_QUERY_ATTR_EVENT_TYPE: + case EDG_WLL_QUERY_ATTR_RESUBMITTED: + case EDG_WLL_QUERY_ATTR_EXITCODE: + if ( (qr1.value.i != qr2.value.i) + || (qr1.op == EDG_WLL_QUERY_OP_WITHIN && qr1.value2.i != qr2.value2.i) ) + return 1; + break; + case EDG_WLL_QUERY_ATTR_TIME: + if ( (qr1.value.t.tv_sec != qr2.value.t.tv_sec + || qr1.value.t.tv_usec != qr2.value.t.tv_usec) + || (qr1.op == EDG_WLL_QUERY_OP_WITHIN + && (qr1.value2.t.tv_sec != qr2.value2.t.tv_sec + || qr1.value2.t.tv_usec != qr2.value2.t.tv_usec)) ) + return 1; + break; + /* + * XXX: what about EDG_WLL_QUERY_ATTR_CHKPT_TAG ??? + */ + default: + return 1; + } + + return 0; +} + +int SoapConvTest::soapCondsCmp(struct edgwll__QueryConditions &qc1, struct edgwll__QueryConditions &qc2) +{ + int i, j; + + + if ( qc1.__sizecondition != qc2.__sizecondition ) return 1; + if ( (qc1.condition && !qc2.condition) || (!qc1.condition && qc2.condition) ) + for ( i = 0; i < qc1.__sizecondition; i++ ) { + if ( qc1.condition[i]->attr != qc2.condition[i]->attr ) return 2; + if ( qc1.condition[i]->__sizerecords != qc2.condition[i]->__sizerecords ) return 3; + for ( j = 0; j < qc1.condition[i]->__sizerecords; j++ ) + if ( soapRecCmp(*(qc1.condition[i]->records[j]), + *(qc2.condition[i]->records[j])) ) return 4; + } + + return 0; +} + +int SoapConvTest::soapRecCmp(struct edgwll__QueryRec &qr1, struct edgwll__QueryRec &qr2) +{ + if ( qr1.op != qr2.op ) return 1; + if ( (qr1.attrid->tag && !qr2.attrid->tag) + || (!qr1.attrid->tag && qr2.attrid->tag) + || (qr1.attrid->tag && strcmp(qr1.attrid->tag, qr2.attrid->tag)) ) return 2; + if ( (qr1.attrid->state && !qr2.attrid->state) + || (!qr1.attrid->state && qr2.attrid->state) + || (qr1.attrid->state && (qr1.attrid->state != qr2.attrid->state)) ) return 3; + + if ( (qr1.value1 && !qr2.value1) + || (!qr1.value1 && qr2.value1) ) return 3; + if ( qr1.value1 ) { + if ( (qr1.value1->i && !qr2.value1->i) + || (!qr1.value1->i && qr2.value1->i) + || (qr1.value1->i && qr1.value1->i != qr2.value1->i) ) + return 4; + if ( (qr1.value1->c && !qr2.value1->c) + || (!qr1.value1->c && qr2.value1->c) + || (qr1.value1->c && strcmp(qr1.value1->c,qr2.value1->c)) ) + return 4; + if ( (qr1.value1->t && !qr2.value1->t) + || (!qr1.value1->t && qr2.value1->t) + || (qr1.value1->t && memcmp(qr1.value1->t,qr2.value1->t,sizeof(*qr2.value1->t))) ) + return 4; + } + + if ( (qr1.value2 && !qr2.value2) + || (!qr1.value2 && qr2.value2) ) return 3; + if ( qr1.value2 ) { + if ( (qr1.value2->i && !qr2.value2->i) + || (!qr1.value2->i && qr2.value2->i) + || (qr1.value2->i && qr1.value2->i != qr2.value2->i) ) + return 4; + if ( (qr1.value2->c && !qr2.value2->c) + || (!qr1.value2->c && qr2.value2->c) + || (qr1.value2->c && strcmp(qr1.value2->c,qr2.value2->c)) ) + return 4; + if ( (qr1.value2->t && !qr2.value2->t) + || (!qr1.value2->t && qr2.value2->t) + || (qr1.value2->t && memcmp(qr1.value2->t,qr2.value2->t,sizeof(*qr2.value2->t))) ) + return 4; + } + + + return 0; +} + +void SoapConvTest::Conditions() +{ + struct edgwll__QueryConditions *soapConds, *soapConds2; + edg_wll_QueryRec **stdConds2; + int ret; + + ret = edg_wll_QueryCondsExtToSoap(soap, (const edg_wll_QueryRec**)stdConds, &soapConds); + CPPUNIT_ASSERT_MESSAGE("edg_wll_QueryCondsExtToSoap()", ret == SOAP_OK); + ret = edg_wll_SoapToQueryCondsExt(soapConds, &stdConds2); + CPPUNIT_ASSERT_MESSAGE("edg_wll_SoapToQueryCondsExt()", !ret); + + CPPUNIT_ASSERT_MESSAGE("Converted std results differs", !stdCondsCmp(stdConds, stdConds2)); + + ret = edg_wll_QueryCondsExtToSoap(soap, (const edg_wll_QueryRec**)stdConds2, &soapConds2); + CPPUNIT_ASSERT_MESSAGE("edg_wll_QueryCondsExtToSoap()", ret == SOAP_OK); + + CPPUNIT_ASSERT_MESSAGE("Converted soap results differs", !soapCondsCmp(*soapConds, *soapConds2)); +} + +void SoapConvTest::States() +{ + struct edgwll__JobStat *soapStat; + edg_wll_JobStat stdStat2; +} + +CPPUNIT_TEST_SUITE_REGISTRATION(SoapConvTest); + +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; +} diff --git a/org.glite.lb.server/test/test_xml.cpp.T b/org.glite.lb.server/test/test_xml.cpp.T index c0762fe..11875fc 100644 --- a/org.glite.lb.server/test/test_xml.cpp.T +++ b/org.glite.lb.server/test/test_xml.cpp.T @@ -200,7 +200,7 @@ void XMLParseTest::protoStatusTest() } -CPPUNIT_TEST_SUITE_REGISTRATION( XMLParseTest ); +CPPUNIT_TEST_SUITE_REGISTRATION(XMLParseTest); int main (int ac,const char *av[]) { -- 1.8.2.3