Changeset 511

Show
Ignore:
Timestamp:
06/07/08 08:59:23 (7 months ago)
Author:
jmowery
Message:

update to storage tests

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/trunk-pmd-intproto/test/storage.tests

    r510 r511  
    88        - add a directory recursively 
    99                + as above the control files and directories for the directory exist as does a copy of each file 
     10 
    1011* remove 
    1112        - remove a file 
     
    1314        - remove a directory (always recursive) 
    1415                + no control files or directories (see above) exist in the directory or any of its sub-directories 
     16 
    1517* check-in 
    1618        - no-op if no modified files 
     
    2022        - if directory is locked should raise an exception 
    2123                + raises a RuntimeError stating that the file (or directory) is locked 
     24 
    2225* lock 
    2326        - lock a file 
     27                + there exists a symbolic link with the name of the file in the directory 
     28                + the target of the link is a file in .__storage__/ named with the same stem 
     29                + the timestamp on the storage file matches the applied date of the file 
    2430        - lock a directory 
     31                + the lock flag is set; the filesystem is unchanged 
    2532        - lock a directory recursively 
     33                + the lock flag is set on the directory 
     34                + each controlled file is not a symbolic link to a versioned copy in .__storage__/ 
     35                + each link's target matches the applied time of the file 
    2636        - no-op to lock a locked file or directory 
     37                + if it would be legal to lock the file (i.e. if it weren't already locked), no exception should be raised 
    2738        - raise an exception if attempting to lock a file in a locked directory 
     39                + raises a RuntimeError stating that the directory is locked 
     40 
    2841* unlock 
    2942        - unlock a file 
     43                + the symbolic link is replaced with a writeable copy of the file in .__storage__/ with the same stem and timestamp 
    3044        - unlock a directory 
     45                + the lock flag is unset; the filesystem is unchanged 
    3146        - unlock a directory recursively 
     47                + all of the symbolic links for controlled files are replaced as above 
     48                + the lock flag on the directory is unset 
    3249        - no-op to unlock a file or directory that is not locked 
     50                + if it would be legal to lock the file (i.e. if it weren't already unlocked), no exception should be raised 
    3351        - raise an exception if attempting to unlock a file in a locked directory 
     52                + raises a RuntimeError stating that the directory is locked 
     53 
    3454* rollback 
    3555        - rollback a file (default now) 
     56                + its applied time matches its latest time 
    3657        - rollback a file to previous date 
     58                + if a storage copy exists with the exact date specified, the applied time will be set to that time 
     59                + if no exact match exists, the newest timestamp as of the specified date will be used 
     60                + if the specified date is before the initial time of the file, the applied time will be 0 
    3761        - rollback a directory (default now) 
     62                + set the applied time for the directory to latest 
     63                + for each controlled file in the directory, preform the operations above for rolling files to present 
    3864        - rollback a directory to previous date 
     65                + set the applied time for the directory to the specified date 
     66                + for each controlled file in the directory, perform the operations above for rolling files to a previous date 
    3967        - rollback a directory recursively (default now) 
     68                + as with the non-recursive operation but also walking into all controlled sub-directories 
    4069        - rollback a directory recursively to previous date 
     70                + as with the non-recursive operation but also walking into all controlled sub-directories 
     71 
    4172* revisions 
    4273        - list revisions of a file 
     74                + list contains the timestamp of each copy of the file in .__storage__/ 
    4375        - list revisions of a directory 
     76                + list contains each unique timestamp from all controlled files in .__storage__/ 
    4477        - list revisions of a directory recursively 
     78                + lists are returned for the directory and each controlled file in the directory 
     79                + also returns similar lists for each controlled sub-directory 
    4580        - list revisions of an uncontrolled file 
     81                + returned dictionary is empty 
    4682        - list revisions of an uncontrolled directory (recursive makes no differece here) 
     83                + returned dictionary is empty 
     84 
    4785* status 
    4886        - list status of a file 
     87                + returned list contains a string representing the status of the file's applied and modification status and relevant timestamps 
    4988        - list status of a directory 
     89                + returned list contains a string for the directory and each controlled file in it 
    5090        - list status of a directory recursively 
     91                + as with the non-recursive version except the returned list contains strings for each sub-directory and thier controlled files as well 
    5192        - list status of an uncontrolled file 
     93                + returned list contains only a single string with no timestamps 
    5294        - list status of an uncontrolled directory (recursive makes no differece here) 
     95                + returned list contains only a single string for the directory with no timestamp and no file status strings 
     96 
    5397* export 
    5498        - export a directory 
    55         - raise an exception if destination exists 
    56         - raise an exception if source is not controlled 
     99                + destination path given now contains the applied version of each controlled file in the directory 
     100                + a copy of each controlled sub-directory exists under destination path with copies if its files 
     101                + no control files or directories exist for any of the copied files under destination path 
     102        - no-op if source is not controlled 
     103                + nothing changes in destination path 
    57104 
    58105Layer Class 
     
    60107* creation 
    61108        - create with a legitimate path 
     109                + data for all entries is read and initialized from disk 
    62110        - create with a path to uncontrolled directory 
    63         - raise an exception if path is not a directory 
    64         - raise an exception if path does not exist 
     111                + layer object is created with no entries and no storage object 
     112        - raise an exception if path is not a directory or does not exist 
     113                + raises a ValueError stating that the path is not a directory 
     114 
    65115* deletion 
    66116        - asserts that the deleted layer is unmodified since last sync to disk 
     117                + due to Python's treatment of exceptions in destructors, this assertion will only print a warning and be ignored if violated 
     118 
    67119* update 
    68120        - no-op if unmodified or uncontrolled 
     121                + no change in on disk or in memory entries 
    69122        - updates on disk data with all changes made 
    70123                + the modified flag should be cleared after all calls 
     124 
    71125* write 
    72126        - no-op if uncontrolled 
     127                + no change in the .__status__ file 
    73128        - write the current status to disk 
    74129                + the modified flag should be cleared after all calls 
     130 
    75131* rollback 
    76132        - no-op if current directory is not controlled 
     133                + no change in the filesystem or the layer object 
    77134        - default: current directory, now, non-recursive 
     135                + applied time for all controlled files and current directory are set to latest 
    78136        - rollback a file to now 
     137                + specified file's applied time is set to latest 
     138                + no other entries are changed 
    79139        - rollback a sub-directory to now 
     140                + no entries in current layer object are changed 
     141                + .__status__ file in the sub-directory has been modified 
    80142        - rollback a sub-directory to now recursively 
     143                + as with the non-recursive version but all sub-directories have modified .__status__ files 
     144        - rollback a file to a previous date 
     145                + the applied date is set to the most recent as of the specified date 
     146                + if the specified date is before the initial time for that entry, the applied is set to 0 
     147        - rollback current directory to a previous date 
     148                + the applied time for the current directory is set to the specified date 
     149                + the applied time for all controlled files are set as above 
     150        - rollback a sub-directory to a previous date 
     151                + no change to local entries 
     152                + the .__status__ file in the sub-directory is updated 
     153        - rollback current directory to a previous date recursively 
     154                + as per the non-recursive version and all sub-directories are also processed 
     155 
    81156* export 
    82157        - no-op if current directory is not controlled 
    83         - raise an exception if destination does not exist 
     158                + no changes in the destination path 
     159        - raise an exception if destination does not exist or is not a directory 
     160                + raises a ValueError stating that the path is not a directory 
    84161        - export current directory (recursively) to destination directory 
     162                + copies of each file and sub-directory exist under destination path with no control files 
     163 
    85164* get_current 
    86165        - get path of current applied version of a file 
     166                + timestamp matches applied time for the file's entry 
     167                + file at the returned path actually exists 
    87168        - get empty string for a directory or uncontrolled file 
     169                + empty string only returned in this case 
     170 
    88171* get_latest 
    89172        - get path of latest checked-in version of a file 
     173                + timestamp matches latest time for the file's entry 
     174                + file at the returned path actually exists 
    90175        - get empty string for a directory or uncontrolled file 
     176                + empty string only returned in this case 
     177 
    91178* is_modified 
    92179        - unconditionally false for a directory 
     180                + returns False 
    93181        - true for a file if its mtime is greater than its latest time 
     182                + only true in this case 
     183 
    94184* checkin 
    95185        - recursively add new version for every file modified under the current directory or any of its sub-directories 
     186                + new copy of any modified file exists in .__storage__/ 
     187                + the latest time for any modified file's entry is updated 
     188                + the latest time for the containing directory is updated (only if at least one file changed) 
    96189        - raise an exception if current directory is uncontrolled 
     190                + raises a RuntimeError stating that files may not be checked into an uncontrolled directory 
     191 
    97192* add 
    98193        - add a file 
     194                + layer contains an entry for the file 
     195                + a new copy exists in .__storage__/ 
     196                + the latest time for the layer is updated 
     197                + the latest time for the file is updated 
    99198        - add a directory 
     199                + control files are created in the directory 
     200                + an entry for '.' exists 
     201                + if the directory's parent is controlled, an entry for the current directory is added there 
    100202        - add a file recursively when the current directory is uncontrolled 
     203                + entry for the file exists 
     204                + entry for '.' exists 
     205                + control files are created in the directory 
     206                + a copy of the file exists in .__storage__/ 
    101207        - add a directory recursively 
     208                + adds the directory 
     209                + adds each file in the directory 
    102210        - raise an exception if file does not exist 
     211                + raises a ValueError stating the file does not exist 
     212        - raise an exception if current directory is uncontrolled and recursive flag is false 
     213                + raises a RuntimeError stating the above 
    103214        - raise an exception if file is locked 
     215                + raises a RuntimeError stating the file is locked and cannot be modified 
    104216        - raise an exception if current directory is locked 
     217                + raises a RuntimeError stating that the directory is locked and its files cannot be modified 
     218 
    105219* remove 
    106220        - no-op if current directory is uncontrolled or file is uncontrolled 
     221                + no filesystem changes 
    107222        - remove a file 
     223                + the entry for the file in the layer object is removed 
     224                + all copies of the file in .__storage__/ are removed 
     225                + the file itself still exists 
    108226        - remove a directory recursively 
     227                + remove all storage copies of files in the directory 
     228                + remove all entries 
     229                + remove control files 
     230                + repeat process for all sub-directories 
    109231        - raise an exception if file is locked 
     232                + raises a RuntimeError stating the file is locked and cannot be modified 
    110233        - raise an exception if current directory is locked 
     234                + raises a RuntimeError stating that the directory is locked and its files cannot be modified 
     235 
    111236* control 
    112237        - no-op if current is already controlled 
     238                + no filesystem changes 
    113239        - create all control files for current directory 
     240                + all control files are created in current directory (.__status__, .__storage__/, .__nodes__/, and possibly .__logs__/ if it is the root) 
     241 
    114242* clean 
     243        - raise an exception if the directory is not controlled 
     244                + raises a RuntimeError stating that uncontrolled directories cannot be cleaned 
    115245        - raise an exception if file is not controlled 
     246                + raises a ValueError stating there is no entry for file 
    116247        - clean a file 
     248                + all storage copies of file with timestamps newer than applied are deleted 
     249                + file's latest time is updated to applied 
    117250        - clean a directory 
     251                + all controlled files in the directory are cleaned 
     252                + directory's latest entry is set to the newest latest entry of any file 
    118253        - clean a directory recursively 
     254                + as with the non-recursive version but also operates on sub-directories 
    119255        - no-op if file is applied at latest time 
     256                + no files are removed from .__storage__/ 
     257 
    120258* status_prefix 
    121259        - return status prefix for a file 
     260                + returns a 6 character string the first and last of which are space 
     261                + the second is '!' if the file is not local, and space otherwise 
     262                + the third is one of the following in order of precedence: 
     263                        ~ 'D' if its applied date is less than its initial date 
     264                        ~ 'M' if the file has been modified since its last addition 
     265                        ~ 'N' if the file's applied time is newer than its parent directory's applied time 
     266                        ~ 'R' if its applied time is less than its latest time 
     267                        ~ space in all other cases 
     268                + the fourth is '.' 
     269                + the fifth is '&' if the file is locked and space otherwise 
    122270        - return status prefix for an uncontrolled file 
     271                + returns exactly '  ?.  ' (two spaces, '?', '.', two spaces) 
    123272        - return status prefix for current directory 
     273                + as with a controlled file except the fourth character is '-' (or '=' if current is a local customization directory) 
    124274        - return status prefix for a sub-directory 
     275                + as with a controlled file except the fourth character is '+' (or '=' as above) 
     276 
    125277* version_suffix 
    126278        - return version time(s) for a controlled file or current directory 
     279                + returns a string starting with '@' followed by the applied time 
     280                + if the applied time is not the latest it will also contain a '/' followed by the latest time 
     281                + if the applied time is 0 the first timestamp will instead be the string 'DISABLED' 
    127282        - return empty string for an uncontrolled file or a sub-directory 
     283                + returns empty string only in this case 
     284 
    128285* status 
    129286        - return status for a file 
     287                + return a list with one string per file of the form status_prefix, name, version_suffix 
    130288        - return status for a directory (and its files) 
     289                + return a list of status strings as above first for the directory itself then each file in it (controlled and uncontrolled) 
    131290        - return status for a directory recursively 
     291                + return a list as above for the directory then followed by each sub-directory (with its files) in order 
    132292        - raise an exception if file does not exist 
     293                + raises a RuntimeError stating that the file does not exist 
     294 
    133295* revisions 
    134         - return empty dictionary for uncontrolled current directory or uncontrolled file 
     296        - return empty dictionary for uncontrolled directory or uncontrolled file 
     297                + only empty in these two conditions 
    135298        - return dictionary with name and revisions list for a file 
     299                + dictionary contains key of file name and value of a list of all revisions of that file 
     300                + each revision in the list has a corresponding file in .__storage__/ 
     301                + all files with the same stem in .__storage__/ have a timestamp in the returned list 
    136302        - return dictionary with name and revisions list for each file in a directory 
     303                + dictionary contains an entry for '.' with a list of all unique timestamps 
     304                + also contains one entry for each controlled file as above 
     305 
    137306* list_controlled_files 
    138307        - return list of files under revision control 
     308                + all returned files have at least one copy in .__storage__/ 
     309                + all unique file stems in .__storage__/ appear in the list 
    139310        - return empty list if current directory is uncontrolled 
     311 
    140312* list_local_newer 
    141313        - return a list of files with applied times later than the directory 
     314                + only newer files appear in the list 
     315                + all newer files appear in the list 
     316 
    142317* list_controlled_dirs 
    143318        - return a list of controlled sub-directories 
     319                + all directories with control files under the current directory appear in the list 
     320 
    144321* list_controlled 
    145322        - return a list of all controlled files and directories 
     323                + combined list of list_controlled_files and list_controlled_dirs 
     324 
    146325* lock 
    147326        - no-op if file or directory is already locked 
     327                + no filesystem changes 
    148328        - lock a file 
     329                + file is replaced by a symbolic link to the applied version in .__storage__/ 
    149330        - lock a directory 
     331                + if recursive, lock all controlled files 
     332                + set the directory's lock flag 
    150333        - raise an exception if attempting to lock a file in a locked directory 
     334                + raises a RuntimeError stating that the directory is locked and its files cannot be modified 
     335 
    151336* unlock 
    152337        - no-op if file or directory is not locked 
     338                + no filesystem changes 
    153339        - unlock a locked file 
     340                + symbolic link is replaced by a writeable copy of its former target 
    154341        - unlock a locked directory 
     342                + unset the directory's lock flag 
     343                + if recursive, unlock all controlled files 
    155344        - raise an exception if attempting to unlock a locked file in a locked directory 
     345                + raises a RuntimeError stating that the directory is locked and its files cannot be modified 
     346 
    156347* is_locked 
    157348        - return true if file or directory is locked 
     349                + only true in this case 
    158350        - return true if any file under a directory is locked when called recursively 
     351                + only true in this case 
     352 
    159353* add_node //NOTE: this is an internal function 
    160354        - add a node 
    161355                + adds the appropriate file (named by node IP) to a layer's .__nodes__/ directory 
     356 
    162357* list_nodes 
    163358        - list nodes in a directory 
     359                + all nodes listed have a corresponding file in .__nodes__/ 
     360                + all nodes with a corresponding file in .__nodes__/ appear in the list 
     361 
    164362* get_node 
    165363        - get a Node object for a node in the current directory 
     364                + if the node exists return a node object; return None otherwise 
     365 
    166366* append_log_messages 
    167367        - applied a list of messages to the log for a given node 
     368                + the log file in the root directory's .__logs__/ directory will be modified 
     369                + the log file's size only increases 
     370 
    168371* get_log_messages 
    169372        - get a list of all messages recorded for a single node 
     373                + all messages appended previously are returned 
     374 
    170375* clear_log 
    171376        - clear the list of messages for a single node 
     377                + the log file should be empty 
     378 
    172379* get_entry 
    173380        - get the entry for a controlled file or sub-directory 
     381                + returns a valid entry object 
    174382        - return none for uncontrolled files or sub-directories 
     383                + only returns None in this case 
    175384 
    176385Node Class 
     
    178387* creation 
    179388        - given an id and the root of storage, return an existing node object 
     389                + object is initialized and correctly detects its classification 
    180390        - given a new id and the root of storage, return a new unclassified node object 
     391                + entries, bools, layers, and classification are all empty 
    181392        - given a new id and the root of storage and a classification, return a new node classified as requested 
     393                + node will appear in each layer in the classification's .__nodes__/ directory 
     394                + entries will contain an entry for each file in those layers with a 0 applied time 
     395                + layers will contain an entry for each layer in classification 
     396 
    182397* deletion 
    183398        - asserts the deleted node is unmodified since last sync to disk 
     399                + due to Python's treatment of exceptions in destructors, this assertion will only print a warning and be ignored if violated 
     400 
    184401* list_layers 
    185402        - return an ordered list of the paths of all layers containing the node 
     403                + list includes all layers in classification 
     404 
    186405* check_updates 
    187406        - return a dictionary of names to be updated and the file to be sent (empty for deletion) 
     407                + unless all entries applied times match the appropriate layer's entry's applied time, storage path for each file with a different applied time 
     408 
    188409* write 
    189410        - write the data to disk 
     411                + the appropriate files in .__nodes__/ are modified 
     412 
    190413* set_file_status 
    191414        - set the status of a file sent to a node 
     415                + sets the applied time for the entry to the timestamp of the sent file 
    192416        - raise an exception if file does not exist or is uncontrolled 
     417                + raises a ValueError stating that the file does not have an entry in the given layer 
    193418        - raise an exception if attempting to add local customizations to directories other than the local customization directory for that node 
     419                + raises a RuntimeError stating that local customizations can only occur in the appropriate directory 
     420 
    194421* set_bool_status 
    195422        - record the state of a boolean 
     423                + adds the boolean with the value recorded to bools 
     424 
    196425* update 
    197426        - no-op if unmodified 
     427                + no filesystem changes 
    198428        - updates on disk data with all changes made 
    199429                + the modified flag should be cleared after all calls 
     430 
    200431* classify 
    201432        - with no argument, calculate the classification of a node 
     433                + final component of classification should be the id of the node 
     434                + all controlled files in each layer in classification should have an entry 
    202435        - with a group name, reclassify the node so that the leaf in the hierarchy is under group's layer 
     436                + the directory with the name matching the node id will be moved to (or created at) the leaf of the classification tree 
     437                + all layers part of both the new and old classification should be unchanged 
     438                + the status of local customizations should be unchanged 
     439                + all entries for files not present in any layer of the new classification should be removed 
     440                + entries for all files in the new layers should exist