From 7422891e15b928d707ee1557d4c459e68aecd650 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Milo=C5=A1=20Mula=C4=8D?= Date: Thu, 13 Oct 2005 18:06:06 +0000 Subject: [PATCH] added one more attribute to obtain adjust test example free md5 sums --- org.glite.jp.index/examples/jpis-test.c | 13 +++++++------ org.glite.jp.index/src/conf.c | 3 ++- org.glite.jp.index/src/soap_ops.c | 14 ++++++++------ 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/org.glite.jp.index/examples/jpis-test.c b/org.glite.jp.index/examples/jpis-test.c index 3aec090..34f3970 100644 --- a/org.glite.jp.index/examples/jpis-test.c +++ b/org.glite.jp.index/examples/jpis-test.c @@ -63,7 +63,8 @@ static int check_fault(struct soap *soap,int err) { int main(int argc,char *argv[]) { - char *server = "http://localhost:8902"; + //char *server = "http://localhost:8902"; + char *server = "http://localhost:10005"; struct soap *soap = soap_new(); soap_init(soap); @@ -134,7 +135,7 @@ query: cond = soap_malloc(soap, sizeof(*cond)); memset(cond, 0, sizeof(*cond)); - cond->attr = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/JP/System:owner"); + cond->attr = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus"); cond->origin = NULL; cond->__sizerecord = 1; cond->record = soap_malloc(soap, sizeof(*(cond->record))); @@ -143,7 +144,7 @@ query: memset(rec, 0, sizeof(*rec)); rec->op = jptype__queryOp__EQUAL; rec->value = soap_malloc(soap, sizeof(*(rec->value))); - rec->value->string = soap_strdup(soap, "/O=CESNET/O=Masaryk University/CN=Milos Mulac"); + rec->value->string = soap_strdup(soap, "Cancelled"); rec->value->blob = NULL; *(cond->record) = rec; @@ -153,9 +154,9 @@ query: in.attributes = soap_malloc(soap, in.__sizeattributes * sizeof(*(in.attributes))); - in.attributes[0] = soap_strdup(soap, "owner"); - in.attributes[1] = soap_strdup(soap, "date"); - in.attributes[2] = soap_strdup(soap, "location"); + in.attributes[0] = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/JP/System:owner"); + in.attributes[1] = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/JP/System:jobId"); + in.attributes[2] = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus"); memset(&out, 0, sizeof(out)); diff --git a/org.glite.jp.index/src/conf.c b/org.glite.jp.index/src/conf.c index df64aae..78959b3 100644 --- a/org.glite.jp.index/src/conf.c +++ b/org.glite.jp.index/src/conf.c @@ -24,10 +24,11 @@ int glite_jp_get_conf(int argc, char **argv, char *config_file, glite_jp_is_conf // lb.server/build/jp_job_attrs.h (created when build plugin) // jp.common/interfaces/known_attr.h - conf->attrs = calloc(4, sizeof(*conf->attrs)); + conf->attrs = calloc(5, sizeof(*conf->attrs)); conf->attrs[0] = strdup("http://egee.cesnet.cz/en/Schema/JP/System:owner"); conf->attrs[1] = strdup("http://egee.cesnet.cz/en/Schema/JP/System:jobId"); conf->attrs[2] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus"); + conf->attrs[3] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:user"); conf->indexed_attrs = calloc(3, sizeof(*conf->indexed_attrs)); conf->indexed_attrs[0] = strdup("http://egee.cesnet.cz/en/Schema/JP/System:owner"); diff --git a/org.glite.jp.index/src/soap_ops.c b/org.glite.jp.index/src/soap_ops.c index 342951b..a4ab580 100644 --- a/org.glite.jp.index/src/soap_ops.c +++ b/org.glite.jp.index/src/soap_ops.c @@ -229,7 +229,7 @@ static int get_op(const enum jptype__queryOp in, char **out) static int get_jobids(struct soap *soap, glite_jpis_context_t ctx, struct _jpelem__QueryJobs *in, char ***jobids, char *** ps_list) { - char *qa = NULL, *qb = NULL, *qop = NULL, + char *qa = NULL, *qb = NULL, *qop = NULL, *attr_md5, *qwhere = NULL, *query = NULL, *res[2], **jids = NULL, **pss = NULL, **attr_tables = NULL; int i, j, ret; @@ -238,12 +238,13 @@ static int get_jobids(struct soap *soap, glite_jpis_context_t ctx, struct _jpele for (i=0; i < in->__sizeconditions; i++) { + attr_md5 = str2md5(in->conditions[i]->attr); trio_asprintf(&qa,"%s jobs.jobid = attr_%|Ss.jobid AND (", - (i ? "AND" : ""), str2md5(in->conditions[i]->attr)); + (i ? "AND" : ""), attr_md5); for (j=0; j < in->conditions[i]->__sizerecord; j++) { if (get_op(in->conditions[i]->record[j]->op, &qop)) goto err; - add_attr_table(str2md5(in->conditions[i]->attr), &attr_tables); + add_attr_table(attr_md5, &attr_tables); if (in->conditions[i]->record[j]->value->string) { attr.name = in->conditions[i]->attr; @@ -252,7 +253,7 @@ static int get_jobids(struct soap *soap, glite_jpis_context_t ctx, struct _jpele glite_jpis_SoapToAttrOrig(soap, in->conditions[i]->origin, &(attr.origin)); trio_asprintf(&qb,"%s %s attr_%|Ss.value %s \"%|Ss\" ", - qa, (j ? "OR" : ""), str2md5(in->conditions[i]->attr), qop, + qa, (j ? "OR" : ""), attr_md5, qop, glite_jp_attrval_to_db_index(ctx->jpctx, &attr, 255)); free(qop); free(qa); qa = qb; qb = NULL; @@ -265,11 +266,12 @@ static int get_jobids(struct soap *soap, glite_jpis_context_t ctx, struct _jpele glite_jpis_SoapToAttrOrig(soap, in->conditions[i]->origin, &(attr.origin)); trio_asprintf(&qb,"%s %s attr_%|Ss.value %s \"%|Ss\" ", - qa, (j ? "OR" : ""), str2md5(in->conditions[i]->attr), qop, + qa, (j ? "OR" : ""), attr_md5, qop, glite_jp_attrval_to_db_index(ctx->jpctx, &attr, 255)); free(qop); free(qa); qa = qb; qb = NULL; } + free(attr_md5); } trio_asprintf(&qb,"%s)",qa); free(qa); qa = qb; qb = NULL; @@ -279,7 +281,7 @@ static int get_jobids(struct soap *soap, glite_jpis_context_t ctx, struct _jpele qa = strdup(""); for (i=0; (attr_tables && attr_tables[i]); i++) { - trio_asprintf(&qb,"%s, %s", qa, attr_tables[i]); + trio_asprintf(&qb,"%s, attr_%s", qa, attr_tables[i]); free(qa); qa = qb; qb = NULL; } -- 1.8.2.3