Bugfixes and updating tests.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Wed, 28 Mar 2007 16:46:49 +0000 (16:46 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Wed, 28 Mar 2007 16:46:49 +0000 (16:46 +0000)
13 files changed:
org.glite.jp.index/Makefile
org.glite.jp.index/examples/jpis-client.c
org.glite.jp.index/examples/query-tests/authz.out
org.glite.jp.index/examples/query-tests/complex_query.out
org.glite.jp.index/examples/query-tests/jobid_query.out
org.glite.jp.index/examples/query-tests/origin_query.out
org.glite.jp.index/examples/query-tests/run-test.sh
org.glite.jp.index/examples/query-tests/simple_query.out
org.glite.jp.index/src/conf.c
org.glite.jp.index/src/soap_ops.c
org.glite.jp.index/src/ws_is_typeref.c
org.glite.jp.index/src/ws_is_typeref.h
org.glite.jp.index/src/ws_ps_typeref.c

index 00ed923..dda38cb 100644 (file)
@@ -141,7 +141,7 @@ check:
 
 doc: ${MANS} ${HTMLS}
 
-stage: compile
+stage: compile doc
        ${MAKE} PREFIX=${stagedir} DOSTAGE=yes install
 
 dist: distsrc distbin
@@ -195,10 +195,11 @@ db_ops.o: db_ops.c conf.h context.h db_ops.h
 context.o: context.c conf.h context.h
 soap_ps_calls.o: soap_ps_calls.c jpps_H.h jpps_.nsmap soap_version.h conf.h db_ops.h ws_ps_typeref.h context.h
 soap_ops.o: soap_ops.c jpis_H.h jpis_.nsmap soap_version.h db_ops.h ws_ps_typeref.h ws_is_typeref.h context.h
-ws_ps_typeref.o: ws_ps_typeref.c jpis_H.h ws_typemap.h ws_ps_typeref.h
-ws_is_typeref.o: ws_is_typeref.c jpis_H.h ws_typemap.h ws_is_typeref.h
+ws_ps_typeref.o: ws_ps_typeref.c ${ps_prefix}H.h ws_typemap.h ws_ps_typeref.h soap_version.h
+ws_is_typeref.o: ws_is_typeref.c ${is_prefix}H.h ws_typemap.h ws_is_typeref.h soap_version.h
 comon_server.o: common_server.c common_server.h
 jpis-client.o: jpis-client.c ${is_client_prefix}H.h soap_version.h
+jpis-test.o: jpis-client.c ${is_client_prefix}H.h soap_version.h
 conf.o: conf.c ${is_prefix}H.h soap_version.h
 
 %.1: %.sgml
index e285006..50c7875 100644 (file)
@@ -71,7 +71,7 @@ struct {
        {0, "unknown"}
 };
 
-typedef enum {FORMAT_XML, FORMAT_HR} format_t;
+typedef enum {FORMAT_XML, FORMAT_STRIPPEDXML, FORMAT_HR} format_t;
 
 
 /*
@@ -186,7 +186,6 @@ static int query_recv(struct soap *soap, int fd, struct _jpisclient__QueryJobs *
                return EINVAL;
        }
        soap_end_recv(soap);
-       soap_free(soap); /* don't destroy the data we want */
 
        /* strip white-space characters from attributes */
        for (i = 0; i < qj->__sizeattributes; i++)
@@ -251,6 +250,7 @@ static int query_dump(struct soap *soap, int fd, struct _jpisclient__QueryJobs *
        soap_serialize__jpisclient__QueryJobs(soap, qj);
        retval = soap_put__jpisclient__QueryJobs(soap, qj, "jpisclient:QueryJobs", NULL);
        soap_end_send(soap);
+       write(fd, "\n", strlen("\n"));
 
        return retval;
 }
@@ -258,7 +258,9 @@ static int query_dump(struct soap *soap, int fd, struct _jpisclient__QueryJobs *
 
 static int query_format(struct soap *soap, format_t format, FILE *f, struct _jpisclient__QueryJobs *qj) {
        switch (format) {
-       case FORMAT_XML: return query_dump(soap, fileno(f), qj);
+       case FORMAT_XML:
+       case FORMAT_STRIPPEDXML:
+               return query_dump(soap, fileno(f), qj);
        case FORMAT_HR:  query_print(f, qj); return 0;
        default: return EINVAL;
        }
@@ -294,6 +296,7 @@ static int queryresult_dump(struct soap *soap, int fd, const struct _jpisclient_
        soap_serialize__jpisclient__QueryJobsResponse(soap, qjr);
        retval = soap_put__jpisclient__QueryJobsResponse(soap, qjr, "jpisclient:QueryJobsResponse", NULL);
        soap_end_send(soap);
+       write(fd, "\n", strlen("\n"));
 
        return retval;
 }
@@ -335,7 +338,9 @@ static void queryresult_print(FILE *out, const struct  _jpelem__QueryJobsRespons
 
 static int queryresult_format(struct soap *soap, format_t format, FILE *f, const struct  _jpelem__QueryJobsResponse *qj) {
        switch (format) {
-       case FORMAT_XML: return queryresult_dump(soap, fileno(f), qj);
+       case FORMAT_XML:
+       case FORMAT_STRIPPEDXML:
+               return queryresult_dump(soap, fileno(f), qj);
        case FORMAT_HR:  queryresult_print(f, qj); return 0;
        default: return EINVAL;
        }
@@ -353,7 +358,7 @@ static void usage(const char *prog_name) {
        fprintf(stderr, "  -q|--query-file IN_FILE.XML\n");
        fprintf(stderr, "  -t|--test-file IN_FILE.XML\n");
        fprintf(stderr, "  -e|--example-file OUT_FILE.XML\n");
-       fprintf(stderr, "  -f|--format xml | human\n");
+       fprintf(stderr, "  -f|--format xml | strippedxml | human\n");
 }
 
 
@@ -380,10 +385,6 @@ int main(int argc, char * const argv[]) {
 
        soap_init(&soap);
 
-#ifdef SOAP_XML_INDENT
-       soap_omode(&soap, SOAP_XML_INDENT);
-#endif
-
        /*
         * Following code is needed, when we can't combine more XSD/WSDL files
         * for using both as client. We direct use structures only from
@@ -447,6 +448,7 @@ int main(int argc, char * const argv[]) {
                        break;
                case 'f':
                        if (strcasecmp(optarg, "xml") == 0) format = FORMAT_XML;
+                       else if (strcasecmp(optarg, "strippedxml") == 0) format = FORMAT_STRIPPEDXML;
                        else format = FORMAT_HR;
                        break;
                default:
@@ -458,6 +460,10 @@ int main(int argc, char * const argv[]) {
                goto cleanup;
        }
        if (!server) server = strdup(DEFAULT_JPIS);
+#ifdef SOAP_XML_INDENT
+       if (format != FORMAT_STRIPPEDXML) soap_omode(&soap, SOAP_XML_INDENT);
+#endif
+
 
        /* prepare steps according to the arguments */
        if (query_file) {
index a3d8c20..4d93551 100644 (file)
@@ -11,4 +11,4 @@ Attributes:
        http://egee.cesnet.cz/en/Schema/LB/Attributes:user
 
 OK
-<?xml version="1.0" encoding="UTF-8"?><jpisclient:QueryJobsResponse 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:jptype="http://glite.org/wsdl/types/jp" xmlns:jpsrv="http://glite.org/wsdl/services/jp" xmlns:jpelem="http://glite.org/wsdl/elements/jp" xmlns:jpisclient="http://glite.org/xsd/types/jpisclient"></jpisclient:QueryJobsResponse>
+<jpisclient:QueryJobsResponse 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:jptype="http://glite.org/wsdl/types/jp" xmlns:jpsrv="http://glite.org/wsdl/services/jp" xmlns:jpelem="http://glite.org/wsdl/elements/jp" xmlns:jpisclient="http://glite.org/xsd/types/jpisclient"></jpisclient:QueryJobsResponse>
index a16cd61..98775c5 100644 (file)
@@ -15,4 +15,4 @@ Attributes:
        http://egee.cesnet.cz/en/Schema/LB/Attributes:user
 
 OK
-<?xml version="1.0" encoding="UTF-8"?><jpisclient:QueryJobsResponse 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:jptype="http://glite.org/wsdl/types/jp" xmlns:jpsrv="http://glite.org/wsdl/services/jp" xmlns:jpelem="http://glite.org/wsdl/elements/jp" xmlns:jpisclient="http://glite.org/xsd/types/jpisclient"><jobs><jobid>https://localhost:7846/pokus1</jobid><owner>/O=CESNET/O=Masaryk University/CN=Milos Mulac</owner><attributes><name>http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus</name><value><string>Done</string></value><timestamp>1970-01-01T02:00:01Z</timestamp><origin>FILE</origin></attributes><attributes><name>http://egee.cesnet.cz/en/Schema/LB/Attributes:user</name><value><string>CertSubj</string></value><timestamp>1970-01-01T02:00:01Z</timestamp><origin>FILE</origin></attributes><primaryStorage>http://localhost:8901</primaryStorage></jobs><jobs><jobid>https://localhost:7846/pokus2</jobid><owner>OwnerName</owner><attributes><name>http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus</name><value><string>Ready</string></value><timestamp>1970-01-01T02:00:01Z</timestamp><origin>SYSTEM</origin></attributes><attributes><name>http://egee.cesnet.cz/en/Schema/LB/Attributes:user</name><value><string>CertSubj</string></value><timestamp>1970-01-01T02:00:01Z</timestamp><origin>SYSTEM</origin></attributes><primaryStorage>http://localhost:8901</primaryStorage></jobs></jpisclient:QueryJobsResponse>
+<jpisclient:QueryJobsResponse 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:jptype="http://glite.org/wsdl/types/jp" xmlns:jpsrv="http://glite.org/wsdl/services/jp" xmlns:jpelem="http://glite.org/wsdl/elements/jp" xmlns:jpisclient="http://glite.org/xsd/types/jpisclient"><jobs><jobid>https://localhost:7846/pokus1</jobid><owner>/O=CESNET/O=Masaryk University/CN=Milos Mulac</owner><attributes><name>http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus</name><value><string>Done</string></value><timestamp>1970-01-01T02:00:01Z</timestamp><origin>FILE</origin></attributes><attributes><name>http://egee.cesnet.cz/en/Schema/LB/Attributes:user</name><value><string>CertSubj</string></value><timestamp>1970-01-01T02:00:01Z</timestamp><origin>FILE</origin></attributes><primaryStorage>http://localhost:8901</primaryStorage></jobs><jobs><jobid>https://localhost:7846/pokus2</jobid><owner>OwnerName</owner><attributes><name>http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus</name><value><string>Ready</string></value><timestamp>1970-01-01T02:00:01Z</timestamp><origin>SYSTEM</origin></attributes><attributes><name>http://egee.cesnet.cz/en/Schema/LB/Attributes:user</name><value><string>CertSubj</string></value><timestamp>1970-01-01T02:00:01Z</timestamp><origin>SYSTEM</origin></attributes><primaryStorage>http://localhost:8901</primaryStorage></jobs></jpisclient:QueryJobsResponse>
index 2450fbe..dc31dd9 100644 (file)
@@ -11,4 +11,4 @@ Attributes:
        http://egee.cesnet.cz/en/Schema/LB/Attributes:user
 
 OK
-<?xml version="1.0" encoding="UTF-8"?><jpisclient:QueryJobsResponse 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:jptype="http://glite.org/wsdl/types/jp" xmlns:jpsrv="http://glite.org/wsdl/services/jp" xmlns:jpelem="http://glite.org/wsdl/elements/jp" xmlns:jpisclient="http://glite.org/xsd/types/jpisclient"><jobs><jobid>https://localhost:7846/pokus1</jobid><owner>/O=CESNET/O=Masaryk University/CN=Milos Mulac</owner><attributes><name>http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus</name><value><string>Done</string></value><timestamp>1970-01-01T02:00:01Z</timestamp><origin>FILE</origin></attributes><attributes><name>http://egee.cesnet.cz/en/Schema/LB/Attributes:user</name><value><string>CertSubj</string></value><timestamp>1970-01-01T02:00:01Z</timestamp><origin>FILE</origin></attributes><primaryStorage>http://localhost:8901</primaryStorage></jobs></jpisclient:QueryJobsResponse>
+<jpisclient:QueryJobsResponse 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:jptype="http://glite.org/wsdl/types/jp" xmlns:jpsrv="http://glite.org/wsdl/services/jp" xmlns:jpelem="http://glite.org/wsdl/elements/jp" xmlns:jpisclient="http://glite.org/xsd/types/jpisclient"><jobs><jobid>https://localhost:7846/pokus1</jobid><owner>/O=CESNET/O=Masaryk University/CN=Milos Mulac</owner><attributes><name>http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus</name><value><string>Done</string></value><timestamp>1970-01-01T02:00:01Z</timestamp><origin>FILE</origin></attributes><attributes><name>http://egee.cesnet.cz/en/Schema/LB/Attributes:user</name><value><string>CertSubj</string></value><timestamp>1970-01-01T02:00:01Z</timestamp><origin>FILE</origin></attributes><primaryStorage>http://localhost:8901</primaryStorage></jobs></jpisclient:QueryJobsResponse>
index bd8e3a7..a88401a 100644 (file)
@@ -11,4 +11,4 @@ Attributes:
        http://egee.cesnet.cz/en/Schema/LB/Attributes:user
 
 OK
-<?xml version="1.0" encoding="UTF-8"?><jpisclient:QueryJobsResponse 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:jptype="http://glite.org/wsdl/types/jp" xmlns:jpsrv="http://glite.org/wsdl/services/jp" xmlns:jpelem="http://glite.org/wsdl/elements/jp" xmlns:jpisclient="http://glite.org/xsd/types/jpisclient"><jobs><jobid>https://localhost:7846/pokus1</jobid><owner>/O=CESNET/O=Masaryk University/CN=Milos Mulac</owner><attributes><name>http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus</name><value><string>Done</string></value><timestamp>1970-01-01T02:00:01Z</timestamp><origin>FILE</origin></attributes><attributes><name>http://egee.cesnet.cz/en/Schema/LB/Attributes:user</name><value><string>CertSubj</string></value><timestamp>1970-01-01T02:00:01Z</timestamp><origin>FILE</origin></attributes><primaryStorage>http://localhost:8901</primaryStorage></jobs></jpisclient:QueryJobsResponse>
\ No newline at end of file
+<jpisclient:QueryJobsResponse 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:jptype="http://glite.org/wsdl/types/jp" xmlns:jpsrv="http://glite.org/wsdl/services/jp" xmlns:jpelem="http://glite.org/wsdl/elements/jp" xmlns:jpisclient="http://glite.org/xsd/types/jpisclient"><jobs><jobid>https://localhost:7846/pokus1</jobid><owner>/O=CESNET/O=Masaryk University/CN=Milos Mulac</owner><attributes><name>http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus</name><value><string>Done</string></value><timestamp>1970-01-01T02:00:01Z</timestamp><origin>FILE</origin></attributes><attributes><name>http://egee.cesnet.cz/en/Schema/LB/Attributes:user</name><value><string>CertSubj</string></value><timestamp>1970-01-01T02:00:01Z</timestamp><origin>FILE</origin></attributes><primaryStorage>http://localhost:8901</primaryStorage></jobs></jpisclient:QueryJobsResponse>
index e386211..89f99d0 100755 (executable)
@@ -105,13 +105,20 @@ drop_db() {
 }
 
 run_is() {
+       # check
+       if [ -f "${GLITE_JPIS_TEST_PIDFILE}" ]; then
+               echo "Index server already running!"
+               echo "  pid $(cat ${GLITE_JPIS_TEST_PIDFILE})"
+               echo "  pidfile ${GLITE_JPIS_TEST_PIDFILE}"
+               exit 1
+       fi
+
        # run index server
        X509_USER_KEY=${X509_USER_KEY} X509_USER_CERT=${X509_USER_CERT} \
        $GLITE_LOCATION/bin/glite-jp-indexd -m $GLITE_JPIS_TEST_DB -p $GLITE_JPIS_TEST_PORT \
                        -i ${GLITE_JPIS_TEST_PIDFILE} -o ${GLITE_JPIS_TEST_LOGFILE} \
                        -x ${GLITE_JPIS_TEST_CONFIG} $1\
-                       2>/dev/null
-
+                       2>/tmp/result
 
        if [ x"$?" != x"0" ]; then
                echo FAILED
@@ -119,6 +126,9 @@ run_is() {
                exit 1
        fi
        if [ ! -s "${GLITE_JPIS_TEST_PIDFILE}" ]; then
+               sleep 1
+       fi
+       if [ ! -s "${GLITE_JPIS_TEST_PIDFILE}" ]; then
                echo "Can't startup index server."
                drop_db;
                exit 1
@@ -140,13 +150,14 @@ kill_is() {
        kill `cat ${GLITE_JPIS_TEST_PIDFILE}`;
        sleep 1;
        kill -9 `cat ${GLITE_JPIS_TEST_PIDFILE}` 2>/dev/null
+       rm -f ${GLITE_JPIS_TEST_PIDFILE}
 }
 
 run_test_query() {
        X509_USER_KEY=${X509_USER_KEY} X509_USER_CERT=${X509_USER_CERT} \
-       $GLITE_LOCATION/examples/glite-jpis-client -f xml -q $1 \
-                -i http://localhost:$GLITE_JPIS_TEST_PORT &>/tmp/result
-       DIFF=`diff -b --ignore-matching-lines="query: using JPIS" $2 /tmp/result`
+       $GLITE_LOCATION/examples/glite-jpis-client -f strippedxml -q $1 \
+                -i http://localhost:$GLITE_JPIS_TEST_PORT 2>&1 | sed -e 's,<?xml version="1.0" encoding="UTF-8"?>,,' -e 's, SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/",,' > /tmp/result
+       DIFF=`diff -b -B --ignore-matching-lines="query: using JPIS" $2 /tmp/result`
        if [ -z "$DIFF" -a "$?" -eq "0" ] ; then
                echo "OK."
                rm /tmp/result
@@ -172,13 +183,24 @@ run_test_query() {
 
 run_test_feed() {
        # run the example
-       numok=`X509_USER_KEY=${X509_USER_KEY} X509_USER_CERT=${X509_USER_CERT}\
-               $GLITE_LOCATION/examples/glite-jpis-test -p $GLITE_JPIS_TEST_PORT \
-               -m $GLITE_JPIS_TEST_DB -x $GLITE_JPIS_TEST_CONFIG 2>&1 | grep -c OK`
+       X509_USER_KEY=${X509_USER_KEY} X509_USER_CERT=${X509_USER_CERT}\
+                $GLITE_LOCATION/examples/glite-jpis-test -p $GLITE_JPIS_TEST_PORT \
+                -m $GLITE_JPIS_TEST_DB -x $GLITE_JPIS_TEST_CONFIG &>/tmp/result
+       numok="$(cat /tmp/result | grep -c OK)"
        if [ "$numok" -eq "2" ]; then
                echo OK.
        else
                echo FAILED!
+               echo ---------------------------------------------------------------------------------------------------
+               echo
+               echo "Obtained result (in /tmp/result):"
+               echo ---------------------------------
+               cat /tmp/result
+               echo
+               echo ---------------------------------------------------------------------------------------------------
+               drop_db;
+               kill_is;
+               exit 1
        fi
 }
 
index 7cd54fb..06c027b 100644 (file)
@@ -11,4 +11,4 @@ Attributes:
        http://egee.cesnet.cz/en/Schema/LB/Attributes:user
 
 OK
-<?xml version="1.0" encoding="UTF-8"?><jpisclient:QueryJobsResponse 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:jptype="http://glite.org/wsdl/types/jp" xmlns:jpsrv="http://glite.org/wsdl/services/jp" xmlns:jpelem="http://glite.org/wsdl/elements/jp" xmlns:jpisclient="http://glite.org/xsd/types/jpisclient"><jobs><jobid>https://localhost:7846/pokus2</jobid><owner>OwnerName</owner><attributes><name>http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus</name><value><string>Ready</string></value><timestamp>1970-01-01T02:00:01Z</timestamp><origin>SYSTEM</origin></attributes><attributes><name>http://egee.cesnet.cz/en/Schema/LB/Attributes:user</name><value><string>CertSubj</string></value><timestamp>1970-01-01T02:00:01Z</timestamp><origin>SYSTEM</origin></attributes><primaryStorage>http://localhost:8901</primaryStorage></jobs></jpisclient:QueryJobsResponse>
+<jpisclient:QueryJobsResponse 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:jptype="http://glite.org/wsdl/types/jp" xmlns:jpsrv="http://glite.org/wsdl/services/jp" xmlns:jpelem="http://glite.org/wsdl/elements/jp" xmlns:jpisclient="http://glite.org/xsd/types/jpisclient"><jobs><jobid>https://localhost:7846/pokus2</jobid><owner>OwnerName</owner><attributes><name>http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus</name><value><string>Ready</string></value><timestamp>1970-01-01T02:00:01Z</timestamp><origin>SYSTEM</origin></attributes><attributes><name>http://egee.cesnet.cz/en/Schema/LB/Attributes:user</name><value><string>CertSubj</string></value><timestamp>1970-01-01T02:00:01Z</timestamp><origin>SYSTEM</origin></attributes><primaryStorage>http://localhost:8901</primaryStorage></jobs></jpisclient:QueryJobsResponse>
index 0617a79..52b44c5 100644 (file)
 
 #include <glite/jp/types.h>
 #include <glite/jp/context.h>
+#include "soap_version.h"
+#include <glite/security/glite_gscompat.h>
+
 #include "conf.h"
 #include "db_ops.h"
 #include "ws_is_typeref.h"
 
+#include <glite/jp/ws_fault.c>
 
 #define SOAP_FMAC3 static
 #define WITH_NOGLOBAL
@@ -65,7 +69,7 @@ static void usage(char *me)
 
 int glite_jp_get_conf(int argc, char **argv, char *config_file, glite_jp_is_conf **configuration)
 {
-       char                    *ps = NULL, *qt = NULL, *conf_file = NULL;
+       char                    *qt = NULL, *conf_file = NULL;
        int                     opt;
        glite_jp_is_conf        *conf;
 
@@ -199,19 +203,21 @@ static int read_conf(glite_jp_is_conf *conf, char *conf_file)
                }
        }
        if (out.__sizefeeds) {
-#warning FIXME: list
                conf->feeds = calloc(out.__sizefeeds + 1, sizeof(*conf->feeds));
                for (i=0; i < out.__sizefeeds; i++) {
+                       struct jptype__feedSession *feed;
+
+                       feed = GLITE_SECURITY_GSOAP_LIST_GET(out.feeds, i);
                        conf->feeds[i] = calloc(1, sizeof(*conf->feeds[i]));
-                       conf->feeds[i]->PS_URL=strdup(out.feeds[i]->primaryServer);
+                       conf->feeds[i]->PS_URL=strdup(feed->primaryServer);
 
-                       if (out.feeds[i]->__sizecondition) {
-                               glite_jpis_SoapToPrimaryQueryConds(&soap, out.feeds[i]->__sizecondition,
-                                       out.feeds[i]->condition, &conf->feeds[i]->query);
+                       if (feed->__sizecondition) {
+                               glite_jpis_SoapToPrimaryQueryConds(&soap, feed->__sizecondition,
+                                       feed->condition, &conf->feeds[i]->query);
                        }
                        
-                       conf->feeds[i]->history = out.feeds[0]->history;
-                       conf->feeds[i]->continuous = out.feeds[0]->continuous;
+                       conf->feeds[i]->history = feed->history;
+                       conf->feeds[i]->continuous = feed->continuous;
                }
        }
 
@@ -230,7 +236,8 @@ static int dump_conf(void) {
         int retval;
        struct  _jpelem__ServerConfigurationResponse    out;
        struct soap                                     soap;
-       
+       struct jptype__feedSession                      *feed;
+       struct jptype__primaryQuery                     *cond;
 
        soap_init(&soap);
         soap_set_namespaces(&soap, jpis__namespaces);
@@ -254,21 +261,19 @@ static int dump_conf(void) {
         out.plugins[0] = strdup("plugin1");
         out.plugins[1] = strdup("plugin2");
 
-#warning: FIXME: lists
-       out.__sizefeeds = 1;
-        out.feeds = calloc(1, sizeof(*out.feeds));
-       out.feeds[0] = calloc(1, sizeof(*out.feeds[0]));
-        out.feeds[0]->primaryServer = strdup("PrimaryServer");
-       out.feeds[0]->__sizecondition = 1;
-       out.feeds[0]->condition = calloc(1, sizeof(*(out.feeds[0]->condition)) );
-       out.feeds[0]->condition[0] = calloc(1, sizeof(*(out.feeds[0]->condition[0])) );
-       out.feeds[0]->condition[0]->attr = strdup("queryAttr");
-       out.feeds[0]->condition[0]->op = jptype__queryOp__EQUAL;
-       out.feeds[0]->condition[0]->origin = jptype__attrOrig__SYSTEM;
-       out.feeds[0]->condition[0]->value = calloc(1, sizeof(*(out.feeds[0]->condition[0]->value)) );
-       out.feeds[0]->condition[0]->value->string = strdup("attrValue");
-       out.feeds[0]->history = 1;
-       out.feeds[0]->continuous = 0; 
+       GLITE_SECURITY_GSOAP_LIST_CREATE(&soap, &out, feeds, struct jptype__feedSession, 1);
+       feed = GLITE_SECURITY_GSOAP_LIST_GET(out.feeds, 0);
+        feed->primaryServer = strdup("PrimaryServer");
+       feed->__sizecondition = 1;
+       GLITE_SECURITY_GSOAP_LIST_CREATE(&soap, feed, condition, struct jptype__primaryQuery, 1);
+       cond = GLITE_SECURITY_GSOAP_LIST_GET(feed->condition, 0);
+       cond->attr = strdup("queryAttr");
+       cond->op = jptype__queryOp__EQUAL;
+       cond->origin = jptype__attrOrig__SYSTEM;
+       cond->value = calloc(1, sizeof(*(cond->value)));
+       GSOAP_SETSTRING(cond->value, soap_strdup(&soap, "attrValue"));
+       feed->history = 1;
+       feed->continuous = 0; 
 
         soap_serialize__jpelem__ServerConfigurationResponse(&soap, &out);
         retval = soap_put__jpelem__ServerConfigurationResponse(&soap, &out, "jpelem:ServerConfiguration", NULL);
index 9b4772b..834c035 100644 (file)
@@ -213,67 +213,65 @@ static int get_jobids(struct soap *soap, glite_jpis_context_t ctx, struct _jpele
        
        qwhere = strdup("");
        for (i=0; i < in->__sizeconditions; i++) {
-       {
-                       struct jptype__indexQuery *condition;
-
-                       condition = GLITE_SECURITY_GSOAP_LIST_GET(in->conditions, i);
-
-                       /* attr name */
-                       if (strcmp(condition->attr, GLITE_JP_ATTR_JOBID) == 0) {
-                               /* no subset from attr_ table, used jobs table instead */
-                               attr_md5 = NULL;
-                               qa = strdup("(");
-                       } else {
-                               attr_md5 = str2md5(condition->attr);
+               struct jptype__indexQuery *condition;
+
+               condition = GLITE_SECURITY_GSOAP_LIST_GET(in->conditions, i);
+
+               /* attr name */
+               if (strcmp(condition->attr, GLITE_JP_ATTR_JOBID) == 0) {
+                       /* no subset from attr_ table, used jobs table instead */
+                       attr_md5 = NULL;
+                       qa = strdup("(");
+               } else {
+                       attr_md5 = str2md5(condition->attr);
+
+                       /* origin */
+                       if (condition->origin) {
+                               glite_jpis_SoapToAttrOrig(soap, condition->origin, &orig);
+                               trio_asprintf(&qb, "attr_%|Ss.origin = %d AND ", attr_md5, orig);
+                       } else
+                               trio_asprintf(&qb, "");
+
+                       /* select given records in attr_ table */
+                       trio_asprintf(&qa,"%s%s jobs.jobid = attr_%|Ss.jobid AND (",
+                               (i ? "AND" : ""), qb, attr_md5);
+
+                       free(qb);
+               }
 
-                               /* origin */
-                               if (condition->origin) {
-                                       glite_jpis_SoapToAttrOrig(soap, condition->origin, &orig);
-                                       trio_asprintf(&qb, "attr_%|Ss.origin = %d AND ", attr_md5, orig);
-                               } else
-                                       trio_asprintf(&qb, "");
+               /* inside part of the condition: record list (ORs) */
+               for (j=0; j < condition->__sizerecord; j++) { 
+                       struct jptype__indexQueryRecord *record;
 
-                               /* select given records in attr_ table */
-                               trio_asprintf(&qa,"%s%s jobs.jobid = attr_%|Ss.jobid AND (",
-                                       (i ? "AND" : ""), qb, attr_md5);
+                       record = GLITE_SECURITY_GSOAP_LIST_GET(condition->record, j);
+                       if (get_op(record->op, &qop)) goto err;
+                       if (attr_md5) add_attr_table(attr_md5, &attr_tables);
 
-                               free(qb);
+                       attr.name = condition->attr;
+                       if (GSOAP_ISSTRING(record->value)) {
+                               attr.value = GSOAP_STRING(record->value);
+                               attr.binary = 0;
+                       } else {
+                               attr.value = GSOAP_BLOB(record->value)->__ptr;
+                               attr.size = GSOAP_BLOB(record->value)->__size;
+                               attr.binary = 1;
                        }
-
-                       /* inside part of the condition: record list (ORs) */
-                       for (j=0; j < condition->__sizerecord; j++) { 
-                               struct jptype__indexQueryRecord *record;
-
-                               record = GLITE_SECURITY_GSOAP_LIST_GET(condition->record, j);
-                               if (get_op(record->op, &qop)) goto err;
-                               if (attr_md5) add_attr_table(attr_md5, &attr_tables);
-
-                               attr.name = condition->attr;
-                               if (GSOAP_ISSTRING(record->value)) {
-                                       attr.value = GSOAP_STRING(record->value);
-                                       attr.binary = 0;
-                               } else {
-                                       attr.value = GSOAP_BLOB(record->value)->__ptr;
-                                       attr.size = GSOAP_BLOB(record->value)->__size;
-                                       attr.binary = 1;
-                               }
-                               glite_jpis_SoapToAttrOrig(soap,
-                                       condition->origin, &(attr.origin));
-                               if (strcmp(condition->attr, GLITE_JP_ATTR_JOBID) == 0) {
-                                       trio_asprintf(&qb,"%s%sjobs.dg_jobid %s \"%|Ss\"",
-                                               qa, (j ? " OR " : ""), qop, attr.value);
-                               } else {
-                                       trio_asprintf(&qb,"%s%sattr_%|Ss.value %s \"%|Ss\"",
-                                               qa, (j ? " OR " : ""), attr_md5, qop,
-                                               glite_jp_attrval_to_db_index(ctx->jpctx, &attr, 255));
-                               }
-                               free(qop);
-                               free(qa); qa = qb; qb = NULL;
+                       glite_jpis_SoapToAttrOrig(soap,
+                               condition->origin, &(attr.origin));
+                       if (strcmp(condition->attr, GLITE_JP_ATTR_JOBID) == 0) {
+                               trio_asprintf(&qb,"%s%sjobs.dg_jobid %s \"%|Ss\"",
+                                       qa, (j ? " OR " : ""), qop, attr.value);
+                       } else {
+                               trio_asprintf(&qb,"%s%sattr_%|Ss.value %s \"%|Ss\"",
+                                       qa, (j ? " OR " : ""), attr_md5, qop,
+                                       glite_jp_attrval_to_db_index(ctx->jpctx, &attr, 255));
                        }
-                       trio_asprintf(&qb,"%s %s)", qwhere, qa);
-                       free(qa); qwhere = qb; qb = NULL; qa = NULL;
-                       free(attr_md5);
+                       free(qop);
+                       free(qa); qa = qb; qb = NULL;
                }
+               trio_asprintf(&qb,"%s %s)", qwhere, qa);
+               free(qa); qwhere = qb; qb = NULL; qa = NULL;
+               free(attr_md5);
        }
 
        qa = strdup("");
index 414b033..a888351 100644 (file)
@@ -4,9 +4,11 @@
 #include <stdsoap2.h>
 
 #include <glite/jp/types.h>
+#include "soap_version.h"
 
 #include "jpis_H.h"
 #include "ws_typemap.h"
+#include <glite/security/glite_gscompat.h>
 #include "ws_is_typeref.h"
 
 #include "glite/jp/ws_fault.c"
@@ -198,7 +200,7 @@ static int SoapToPrimaryQueryCond(
 int glite_jpis_SoapToPrimaryQueryConds(
         struct soap                    *soap,
        int                             size,
-        struct jptype__primaryQuery    **in,
+        GLITE_SECURITY_GSOAP_LIST_TYPE(jptype, primaryQuery)   in,
         glite_jp_query_rec_t           ***out)
 {
        glite_jp_query_rec_t    **qr;
@@ -208,7 +210,7 @@ int glite_jpis_SoapToPrimaryQueryConds(
         qr = calloc(size+1, sizeof(*qr));
 
        for (i=0; i<size; i++) {
-               if ( SoapToPrimaryQueryCond(soap, in[i], &(qr[i])) ) {
+               if ( SoapToPrimaryQueryCond(soap, GLITE_SECURITY_GSOAP_LIST_GET(in, i), &(qr[i])) ) {
                        *out = NULL;
                        return 1;
                }
index b141781..1a329f0 100644 (file)
@@ -6,6 +6,6 @@
 void glite_jpis_SoapToQueryOp(const enum jptype__queryOp in, glite_jp_queryop_t *out);
 void glite_jpis_SoapToAttrOrig(struct soap *soap, const enum jptype__attrOrig *in, glite_jp_attr_orig_t *out);
 int glite_jpis_SoapToQueryConds(struct soap *soap, int size, struct jptype__indexQuery **in, glite_jp_query_rec_t ***out);
-int glite_jpis_SoapToPrimaryQueryConds(struct soap *soap, int size, struct jptype__primaryQuery **in, glite_jp_query_rec_t ***out);
+int glite_jpis_SoapToPrimaryQueryConds(struct soap *soap, int size, GLITE_SECURITY_GSOAP_LIST_TYPE(jptype, primaryQuery) in, glite_jp_query_rec_t ***out);
 
 #endif
index 9574f05..4e92d22 100644 (file)
@@ -56,16 +56,16 @@ static int QueryRecordValToSoap(
        memset(val, 0, sizeof(*val) );
 
         if (binary) {
-               GSOAP_STRING(val) = NULL;
-               if ( !(GSOAP_BLOB(val) = soap_malloc(soap, sizeof(*GSOAP_BLOB(val)))) ) return SOAP_FAULT;
+               GSOAP_SETBLOB(val, soap_malloc(soap, sizeof(*GSOAP_BLOB(val))));
+               if ( !GSOAP_BLOB(val) ) return SOAP_FAULT;
                GSOAP_BLOB(val)->__size = size;
                if ( !(GSOAP_BLOB(val)->__ptr = soap_malloc(soap, GSOAP_BLOB(val)->__size)) ) return SOAP_FAULT;
                memcpy(GSOAP_BLOB(val)->__ptr, in, GSOAP_BLOB(val)->__size);
                // XXX how to handle id, type, option?
        }
        else {
-               GSOAP_BLOB(val) = NULL;
-               if ( !(GSOAP_STRING(val) = soap_strdup(soap, in)) )  return SOAP_FAULT;
+               GSOAP_SETSTRING(val, soap_strdup(soap, in));
+               if ( !(GSOAP_STRING(val) ) )  return SOAP_FAULT;
        }
 
        *out = val;
@@ -123,8 +123,7 @@ static void SoapToAttrOrig(glite_jp_attr_orig_t *out, const enum jptype__attrOri
 void glite_jpis_SoapToAttrVal(glite_jp_attrval_t *av, const struct jptype__attrValue *attr) {
        memset(av, 0, sizeof(*av));
        av->name = attr->name;
-       av->binary = GSOAP_BLOB(attr->value) ? 1 : 0;
-       assert(av->binary || GSOAP_STRING(attr->value));
+       av->binary = GSOAP_ISBLOB(attr->value);
        if (av->binary) {
                av->value = GSOAP_BLOB(attr->value)->__ptr;
                av->size = GSOAP_BLOB(attr->value)->__size ;