GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

advertservice_getadvertisable_tests.c

Go to the documentation of this file.
00001 /** @file advertservice_getadvertisable_tests.c
00002  *
00003  *  Tests the GATAdvertService_GetAdvertisable functionality
00004  * 
00005  *  @date Sun Mar 21 2004
00006  * 
00007  *  @version $Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/test/simple/advertservice_getadvertisable_tests.c,v 1.4 2004/04/20 17:04:59 hartmutkaiser Exp $
00008  *
00009  *  Copyright (C) Hartmut Kaiser
00010  *  This file is part of the GAT Engine.
00011  *  Contributed by Hartmut Kaiser <hartmutkaiser [at] t-online [dot] de>.
00012  *
00013  *  Use, modification and distribution is subject to the Gridlab Software
00014  *  License. (See accompanying file GLlicense.txt or copy at
00015  *  http://www.gridlab.org/GLlicense.txt)
00016  */
00017 
00018 static const char *rcsid = "$Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/test/simple/advertservice_getadvertisable_tests.c,v 1.4 2004/04/20 17:04:59 hartmutkaiser Exp $";
00019 
00020 /* System Header Files */
00021 
00022 #include <stdio.h>
00023 #include <stdlib.h>
00024 #include <string.h>
00025 
00026 /* GAT Header Files */
00027 
00028 #include "GAT.h"
00029 #include "GATTestUtils.h"
00030 
00031 /* Macros */
00032 
00033 /* Structures, unions and enums */
00034 
00035 /* Static function prototypes */
00036 
00037 /* File scope variables */
00038 
00039 /* External functions */
00040 
00041 int main(int argc, const char * const argv[])
00042 {
00043   GATContext context = NULL;
00044   GATAdvertService advertservice = NULL;
00045   GATResult   retval   = GAT_SUCCESS;
00046   char const *pwdstr   = "/AdvertServiceTests";
00047   char const *pathstr  = "Files/../Files/MyCheckpointFile";
00048   GATString   pwd      = NULL;
00049   GATString   path     = NULL;
00050   GATObject   advertisable = NULL;
00051   
00052   GAT_TEST_INIT  (-1);
00053   GAT_TEST_SUITE ("AdvertService")
00054 
00055   context = GATContext_Create();
00056   GAT_TEST(NULL != context);
00057   
00058   /* the following test makes sure, that there were no errors during the 
00059      creation of the GATContext object */
00060   GAT_TEST_TRACE(GATType_GATContext == GATContext_GetType(context), context);
00061 
00062   GAT_TEST_START ("AdvertService GetAdvertisable Test");
00063 
00064   advertservice = GATAdvertService_Create(context, 0);
00065   GAT_TEST_TRACE(NULL != advertservice, context);
00066 
00067   /* create the pwd */
00068   pwd = GATString_Create(pwdstr, (GATuint32)strlen(pwdstr)+1, "ASCII");
00069   GAT_TEST_TRACE(NULL != pwd, context);
00070   
00071   /* create the path, where to store the file inside the advertservice */
00072   path = GATString_Create(pathstr, (GATuint32)strlen(pathstr)+1, "ASCII");
00073   GAT_TEST_TRACE(NULL != path, context);
00074   
00075   /* set the pwd, since the path is relative */
00076   retval = GATAdvertService_SetPWD(advertservice, pwd);
00077   GAT_TEST_TRACE(GAT_SUCCEEDED(retval), context);
00078   
00079   /* get the associated metadata from the advertservice */
00080   retval = GATAdvertService_GetAdvertisable(advertservice, path, &advertisable);
00081   GAT_TEST_TRACE(GAT_SUCCEEDED(retval), context);
00082   
00083   /* free all the allocated memory */
00084   GATObject_Destroy(&advertisable);
00085   GATString_Destroy(&path);
00086   GATString_Destroy(&pwd);
00087   GATAdvertService_Destroy(&advertservice);
00088   GATContext_Destroy(&context);
00089 
00090   GAT_TEST_STOP ();
00091   GAT_TEST_FINISH();
00092 
00093   return 0;
00094 }
00095