2
Copyright (C) 2003 by Sean David Fleming
6
This program is free software; you can redistribute it and/or
7
modify it under the terms of the GNU General Public License
8
as published by the Free Software Foundation; either version 2
9
of the License, or (at your option) any later version.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
The GNU GPL can also be found at http://www.gnu.org
30
#include "grisu_client.h"
33
/************************************************/
34
/* print list consisting of pointers to strings */
35
/************************************************/
36
void test_print_text_list(GSList *list)
40
for (item=list ; item ; item=g_slist_next(item))
42
printf("[%s]\n", (gchar *) item->data);
46
/*******************************/
47
/* run tests on grisu WS calls */
48
/*******************************/
52
gint passed=0, total=0;
54
gchar *password, *name;
57
gchar *username, buff[999];
60
printf("testing grisu ...\n");
64
//printf("\nTEST - EXPERIMENTAL\n");
67
//grisu_file_list("gsiftp://ngdata.ivec.org/store/ng03/grid-admin/C_AU_O_APACGrid_OU_iVEC_CN_Sean_Fleming/");
69
/* NEW - uploading & downloading works */
70
/* TODO - stress testing / binary content */
71
//grisu_file_download("gsiftp://ngdata.ivec.org/store/ng03/grid-admin/C_AU_O_APACGrid_OU_iVEC_CN_Sean_Fleming/gibb_best3.got", "/home/sean/prog/gdis/gotcha.got");
74
//grisu_file_upload("/home/sean/prog/gdis/gdis_manual.txt", "gsiftp://ngdata.ivec.org/store/ng03/grid-admin/C_AU_O_APACGrid_OU_iVEC_CN_Sean_Fleming/upload.txt");
75
//grisu_file_download("gsiftp://ngdata.ivec.org/store/ng03/grid-admin/C_AU_O_APACGrid_OU_iVEC_CN_Sean_Fleming/upload.txt", "TODO_use_this");
78
printf("URL for directory listing: ");
79
if (fgets(buff, sizeof(buff), stdin) != NULL)
80
dir = parse_strip_newline(buff);
83
printf("Input error.\n");
89
/* NEW - job submission now works!!! */
91
if (g_file_get_contents("test.xml", &contents, &length, NULL))
94
name = grisu_job_submit(contents);
98
printf("Failed to open sample job description XML file in cwd.\n");
103
printf("submitted [%s] : success!\n", name);
113
grisu_auth_set(FALSE);
115
printf("\nTEST 1 - Submit location query (no auth)\n");
116
list = grisu_submit_find("mrbayes");
119
test_print_text_list(list);
124
printf("\nTEST 2 - Submit location query (with auth)\n");
125
grisu_auth_set(TRUE);
126
list = grisu_submit_find("mrbayes");
129
test_print_text_list(list);
134
printf("\nTEST 3 - Retrieve available VOs\n");
135
grisu_auth_set(TRUE);
136
list = grisu_fqans_get();
139
test_print_text_list(list);
143
/* TODO - upload/download file */
145
grisu_auth_set(TRUE);
146
name = grisu_job_submit("rubbish");
150
grisu_auth_set(TRUE);
151
grisu_absolute_job_dir("gok", "ng2.ivec.org", "/ARCS/Startup");
154
/* TODO - submit job */
156
grisu_upload("home/sean/prog/gdis/README.grisu", "grisu-jobs-dir/gok/test.txt");
159
printf("grisu tests passed: %d/%d\n", passed, total);
162
printf("grisu component not compiled.\n");
166
void test_run(gchar *name)
170
if (g_ascii_strncasecmp(name, "gri", 3) == 0)
172
/* DEBUG - re-use existing (already uploaded) proxy */
174
printf("Enter your MYPROXY credential username: ");
175
if (fgets(buff, sizeof(buff), stdin) != NULL)
177
username = parse_strip_newline(buff);
181
printf("Input error.\n");
184
printf("Enter your MYPROXY credential password: ");
185
password = parse_getline_hidden();
186
grisu_keypair_set(username, password);
189
grisu_keypair_set("someguy", "qetuo135");
192
/* cmd line prompt for passwd ... */
194
printf("Please enter your GRID passphrase: ");
195
password = parse_getline_hidden();
196
grisu_keypair_set(NULL, password);
197
grid_connect(GRID_LOCALPROXY);