globalprefix=glite
lbprefix=lb
package=glite-lb-server
-version=0.0.0
+version=0.2.0
PREFIX=/opt/glite
glite_location=/opt/glite
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
SUFFIXES = .T
-DEBUG:=-g -O0
+DEBUG:=-g -O0 -Wall
# not yet
# -I${voms}/include \
# -I${gacl}/include \
${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} \
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 \
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}
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//'`
${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
--- /dev/null
+#include <getopt.h>
+#include <stdsoap2.h>
+
+#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);
+}
--- /dev/null
+#include <getopt.h>
+#include <stdsoap2.h>
+
+#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);
+}
--- /dev/null
+<WSDL:definitions
+ xmlns:tns="http://glite.org/wsdl/services/lb"
+ xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:glitensservices="http://glite.org/wsdl/services/lb"
+ xmlns:glitenstypes="http://glite.org/wsdl/types/lb"
+ xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:WSDL="http://schemas.xmlsoap.org/wsdl/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ targetNamespace="http://glite.org/wsdl/services/lb"
+ name="LoggingAndBookkeeping">
+
+ <WSDL:types>
+ <schema
+ targetNamespace="http://glite.org/wsdl/types/lb"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="unqualified"
+ attributeFormDefault="unqualified">
+
+ <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
+ <simpleType name="QueryAttr">
+ <restriction base="xsd:string">
+ <enumeration value="UNDEF"/>
+ <enumeration value="JOBID"/>
+ <enumeration value="OWNER"/>
+ <enumeration value="STATUS"/>
+ <enumeration value="LOCATION"/>
+ <enumeration value="DESTINATION"/>
+ <enumeration value="DONECODE"/>
+ <enumeration value="USERTAG"/>
+ <enumeration value="TIME"/>
+ <enumeration value="LEVEL"/>
+ <enumeration value="HOST"/>
+ <enumeration value="SOURCE"/>
+ <enumeration value="INSTANCE"/>
+ <enumeration value="EVENT-TYPE"/>
+ <enumeration value="CHKPT-TAG"/>
+ <enumeration value="RESUBMITTED"/>
+ <enumeration value="PARENT"/>
+ <enumeration value="EXITCODE"/>
+ </restriction>
+ </simpleType>
+ <simpleType name="QueryOp">
+ <restriction base="xsd:string">
+ <enumeration value="EQUAL"/>
+ <enumeration value="LESS"/>
+ <enumeration value="GREATER"/>
+ <enumeration value="WITHIN"/>
+ <enumeration value="UNEQUAL"/>
+ </restriction>
+ </simpleType>
+ <simpleType name="JobStatCode">
+ <restriction base="xsd:string">
+ <enumeration value="UNDEF"/>
+ <enumeration value="SUBMITTED"/>
+ <enumeration value="WAITING"/>
+ <enumeration value="READY"/>
+ <enumeration value="SCHEDULED"/>
+ <enumeration value="RUNNING"/>
+ <enumeration value="DONE"/>
+ <enumeration value="CLEARED"/>
+ <enumeration value="ABORTED"/>
+ <enumeration value="CANCELLED"/>
+ <enumeration value="UNKNOWN"/>
+ <enumeration value="PURGED"/>
+ </restriction>
+ </simpleType>
+ <simpleType name="StatJobType">
+ <restriction base="xsd:string">
+ <enumeration value="SIMPLE"/>
+ <enumeration value="DAG"/>
+ </restriction>
+ </simpleType>
+ <simpleType name="StatDoneCode">
+ <restriction base="xsd:string">
+ <enumeration value="OK"/>
+ <enumeration value="FAILED"/>
+ <enumeration value="CANCELLED"/>
+ </restriction>
+ </simpleType>
+ <complexType name="timeval">
+ <sequence>
+ <element name="tvSec" type="xsd:long" minOccurs="1" maxOccurs="1"/>
+ <element name="tvUsec" type="xsd:long" minOccurs="1" maxOccurs="1"/>
+ </sequence>
+ </complexType>
+ <complexType name="QueryRecAttrId">
+ <sequence>
+ <element name="tag" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <element name="state" type="glitenstypes:JobStatCode" minOccurs="0" maxOccurs="1"/>
+ </sequence>
+ </complexType>
+ <complexType name="QueryRecValue">
+ <sequence>
+ <element name="i" type="xsd:int" minOccurs="0" maxOccurs="1"/>
+ <element name="c" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <element name="t" type="glitenstypes:timeval" minOccurs="0" maxOccurs="1"/>
+ </sequence>
+ </complexType>
+ <complexType name="QueryRec">
+ <sequence>
+ <element name="op" type="glitenstypes:QueryOp" minOccurs="1" maxOccurs="1"/>
+ <element name="attrid" type="glitenstypes:QueryRecAttrId" minOccurs="0" maxOccurs="1"/>
+ <element name="value1" type="glitenstypes:QueryRecValue" minOccurs="1" maxOccurs="1"/>
+ <element name="value2" type="glitenstypes:QueryRecValue" minOccurs="0" maxOccurs="1"/>
+ </sequence>
+ </complexType>
+ <complexType name="QueryCondition">
+ <sequence>
+ <element name="attr" type="glitenstypes:QueryAttr" minOccurs="1" maxOccurs="1"/>
+ <element name="records" type="glitenstypes:QueryRec" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ <complexType name="QueryConditions">
+ <sequence>
+ <element name="condition" type="glitenstypes:QueryCondition" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ <complexType name="TagValue">
+ <sequence>
+ <element name="tag" type="xsd:string" minOccurs="1" maxOccurs="1" />
+ <element name="value" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ </sequence>
+ </complexType>
+ <simpleType name="JobStatFlag">
+ <restriction base="xsd:string">
+ <enumeration value="CLASSADS"/>
+ <enumeration value="CHILDREN"/>
+ <enumeration value="CHILDSTAT"/>
+ </restriction>
+ </simpleType>
+ <complexType name="JobStatFlags">
+ <sequence>
+ <element name="flag" type="glitenstypes:JobStatFlag" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ <complexType name="JobStat">
+ <sequence>
+ <element name="state" type="glitenstypes:JobStatCode" minOccurs="1" maxOccurs="1"/>
+ <element name="jobId" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <element name="owner" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true"/>
+ <element name="jobtype" type="glitenstypes:StatJobType" minOccurs="1" maxOccurs="1"/>
+ <element name="parentJob" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <element name="seed" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <element name="childrenNum" type="xsd:int" minOccurs="1" maxOccurs="1"/>
+ <element name="children" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="childrenHist" type="xsd:int" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="childrenStates" type="glitenstypes:JobStat" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="condorId" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <element name="globusId" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <element name="localId" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <element name="jdl" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <element name="matchedJdl" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <element name="destination" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <element name="condorJdl" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <element name="rsl" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <element name="reason" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <element name="location" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <element name="ceNode" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <element name="networkServer" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <element name="subjobFailed" type="xsd:boolean" minOccurs="1" maxOccurs="1"/>
+ <element name="doneCode" type="glitenstypes:StatDoneCode" minOccurs="1" maxOccurs="1"/>
+ <element name="exitCode" type="xsd:int" minOccurs="1" maxOccurs="1"/>
+ <element name="resubmitted" type="xsd:boolean" minOccurs="1" maxOccurs="1"/>
+ <element name="cancelling" type="xsd:boolean" minOccurs="1" maxOccurs="1"/>
+ <element name="cancelReason" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <element name="cpuTime" type="xsd:int" minOccurs="1" maxOccurs="1"/>
+ <element name="userTags" type="glitenstypes:TagValue" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="stateEnterTime" type="glitenstypes:timeval" minOccurs="1" maxOccurs="1"/>
+ <element name="lastUpdateTime" type="glitenstypes:timeval" minOccurs="1" maxOccurs="1"/>
+ <element name="stateEnterTimes" type="xsd:int" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
+ <element name="expectUpdate" type="xsd:boolean" minOccurs="1" maxOccurs="1"/>
+ <element name="expectFrom" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <element name="acl" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ </sequence>
+ </complexType>
+ <complexType name="jobsOut">
+ <sequence>
+ <element name="jobs" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ </complexType>
+ <complexType name="statesOut">
+ <sequence>
+ <element name="states" type="glitenstypes:JobStat" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ </complexType>
+ <complexType name="GenericLBFaultType">
+ <sequence>
+ <element name="source" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <element name="code" type="xsd:int" minOccurs="1" maxOccurs="1"/>
+ <element name="text" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <element name="description" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <element name="reason" type="glitenstypes:GenericLBFaultType" minOccurs="0" maxOccurs="1"/>
+ </sequence>
+ </complexType>
+ <element name="GenericLBFault" type="glitenstypes:GenericLBFaultType"/>
+ </schema>
+ </WSDL:types>
+ <message name="JobStatusRequest">
+ <part name="jobid" type="xsd:string"/>
+ <part name="flags" type="glitenstypes:JobStatFlags"/>
+ </message>
+ <message name="JobStatusResponse">
+ <part name="status" type="glitenstypes:JobStat"/>
+ </message>
+ <message name="QueryJobsRequest">
+ <part name="conditions" type="glitenstypes:QueryConditions"/>
+ <part name="flags" type="glitenstypes:JobStatFlags"/>
+ </message>
+ <message name="QueryJobsResponse">
+ <part name="jobs" type="glitenstypes:jobsOut"/>
+ <part name="states" type="glitenstypes:statesOut"/>
+ </message>
+ <message name="UserJobsRequest">
+ </message>
+ <message name="UserJobsResponse">
+ <part name="jobs" type="xsd:string"/>
+ <part name="states" type="glitenstypes:JobStat"/>
+ </message>
+
+ <message name="GenericLBFault">
+ <part name="fault" element="glitenstypes:GenericLBFault"/>
+ </message>
+
+ <portType name="LoggingAndBookkeeping_PortType">
+ <operation name="JobStatus">
+ <documentation>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
+ </documentation>
+ <input name="i" message="tns:JobStatusRequest"/>
+ <output name="o" message="tns:JobStatusResponse"/>
+ <fault name="f" message="tns:GenericLBFault"/>
+ </operation>
+ <operation name="QueryJobs">
+ <documentation>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
+ </documentation>
+ <input name="i" message="tns:QueryJobsRequest"/>
+ <output name="o" message="tns:QueryJobsResponse"/>
+ <fault name="f" message="tns:GenericLBFault"/>
+ </operation>
+ <operation name="UserJobs">
+ <documentation>Query all jobs of the current user.
+
+Input: no input
+
+Output: list of all user's jobs, including their states
+
+Faults: GenericLBFault
+ </documentation>
+ <input name="i" message="tns:UserJobsRequest"/>
+ <output name="o" message="tns:UserJobsResponse"/>
+ <fault name="f" message="tns:GenericLBFault"/>
+ </operation>
+ </portType>
+ <binding name="LoggingAndBookkeeping" type="tns:LoggingAndBookkeeping_PortType">
+ <SOAP:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="JobStatus">
+ <SOAP:operation style="rpc"/>
+ <input name="i">
+ <SOAP:body use="literal" namespace="http://glite.org/wsdl/services/lb"/>
+ </input>
+ <output name="o">
+ <SOAP:body use="literal" namespace="http://glite.org/wsdl/services/lb"/>
+ </output>
+ <fault name="f">
+ <SOAP:fault name="f" use="literal"/>
+ </fault>
+ </operation>
+ <operation name="QueryJobs">
+ <SOAP:operation style="rpc"/>
+ <input>
+ <SOAP:body use="literal" namespace="http://glite.org/wsdl/services/lb"/>
+ </input>
+ <output>
+ <SOAP:body use="literal" namespace="http://glite.org/wsdl/services/lb"/>
+ </output>
+ <fault name="f">
+ <SOAP:fault name="f" use="literal"/>
+ </fault>
+ </operation>
+ <operation name="UserJobs">
+ <SOAP:operation style="rpc"/>
+ <input>
+ <SOAP:body use="literal" namespace="http://glite.org/wsdl/services/lb"/>
+ </input>
+ <output>
+ <SOAP:body use="literal" namespace="http://glite.org/wsdl/services/lb"/>
+ </output>
+ <fault name="f">
+ <SOAP:fault name="f" use="literal"/>
+ </fault>
+ </operation>
+ </binding>
+ <service name="LoggingAndBookkeeping">
+ <documentation>Logging and Bookkeeping service</documentation>
+ <port name="LoggingAndBookkeeping" binding="tns:LoggingAndBookkeeping">
+ <SOAP:address location="http://test.glite.org/lb:8080"/>
+ </port>
+ </service>
+</WSDL:definitions>
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)
mysql_prefix=${with.mysql.prefix}
cppunit=${with.cppunit.prefix}
gridsite_prefix=${with.gridsite.prefix}
+gsoap_prefix=${with.gsoap.prefix}
</echo>
</target>
</project>
-#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
--- /dev/null
+#include <iostream>
+#include <stdsoap2.h>
+
+#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 "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;
+}
}
-CPPUNIT_TEST_SUITE_REGISTRATION( XMLParseTest );
+CPPUNIT_TEST_SUITE_REGISTRATION(XMLParseTest);
int main (int ac,const char *av[])
{