GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



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

logicalfile_removefile_tests.c

Go to the documentation of this file.
00001 /** @file logicalfile_removefile.c
00002  * Example of using the GAT to remove a file from a logical file store.
00003  * 
00004  * Uses the GAT to remove a file from a GATLogicalFile.
00005  * 
00006  * @date Fri Oct 17 2003
00007  * 
00008  * @version $Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/test/simple/logicalfile_removefile_tests.c,v 1.11 2004/04/20 17:04:59 hartmutkaiser Exp $
00009  *
00010  *  Copyright (C) Hartmut Kaiser
00011  *  This file is part of the GAT Engine.
00012  *  Contributed by Hartmut Kaiser <hartmutkaiser [at] t-online [dot] de>.
00013  *
00014  *  Use, modification and distribution is subject to the Gridlab Software
00015  *  License. (See accompanying file GLlicense.txt or copy at
00016  *  http://www.gridlab.org/GLlicense.txt)
00017  */
00018 
00019 static const char *rcsid = "$Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/test/simple/logicalfile_removefile_tests.c,v 1.11 2004/04/20 17:04:59 hartmutkaiser Exp $";
00020 
00021 
00022 /* System Header Files */
00023 
00024 #include <stdio.h>
00025 #include <stdlib.h>
00026 
00027 
00028 /* GAT Header Files */
00029 
00030 #include <GAT.h>
00031 #include <GATTestUtils.h>
00032 
00033 
00034 /* External functions */
00035 
00036 int main (void)
00037 {
00038   GATResult      retcode   = GAT_SUCCESS;
00039   GATContext     context   = NULL;
00040   GATLocation    target    = NULL;
00041   GATLocation    logfile   = NULL;
00042   GATFile        file      = NULL;
00043   GATLogicalFile filestore = NULL;
00044   const char*    store     = NULL;
00045   const char*    url       = NULL;
00046 
00047   GAT_TEST_INIT  (-1);
00048   GAT_TEST_SUITE ("Logical File")
00049 
00050   context = GATContext_Create ();
00051   GAT_TEST (NULL != context);
00052 
00053   /* the following test makes sure, that there were no errors during the 
00054      creation of the GATContext object */
00055   GAT_TEST_TRACE(GATType_GATContext == GATContext_GetType(context), context);
00056 
00057   GAT_TEST_START ("Logical File Remove File Test")
00058 
00059   url = GATTest_GetTempFileName ("gat_url");
00060   GAT_TEST_TRACE (NULL != url, context);
00061 
00062   target = GATLocation_Create (url);
00063   GAT_TEST_TRACE (NULL != target, context);
00064 
00065   store = GATTest_GetTempFileName ("gat_store");
00066   GAT_TEST_TRACE (NULL != store, context);
00067 
00068   logfile = GATLocation_Create (store);
00069   GAT_TEST_TRACE (NULL != logfile, context);
00070 
00071   filestore = GATLogicalFile_Create (context, logfile, GATLogicalFileMode_Open, 0);
00072   GAT_TEST_TRACE (NULL != filestore, context);
00073   
00074   file = GATFile_Create (context, target, 0);
00075   GAT_TEST_TRACE (NULL != file, context);
00076   
00077   retcode = GATLogicalFile_RemoveFile (filestore, file);
00078   GAT_TEST_TRACE (GAT_SUCCESS == retcode, context);
00079 
00080   GAT_TEST_STOP ();
00081 
00082   GATFile_Destroy        (&file);
00083   GATLogicalFile_Destroy (&filestore);
00084   GATLocation_Destroy    (&logfile);
00085   GATLocation_Destroy    (&target);
00086   GATContext_Destroy     (&context);
00087 
00088   GAT_TEST_FINISH();
00089 
00090   return (retcode);
00091 }
00092