-
Notifications
You must be signed in to change notification settings - Fork 0
Using storages
Storages are the way you can get to your files for input or output within DTF. They have been designed to support pulling data from the local file system or from a remote FTP site without having to go through your test and changing all of the locations that you reference that same file from. This is achieved by you creating a storage using the createstorage tag and then only referencing the storage using the id you gave it at creation time. Here's how you create a storage:
<createstorage id="INPUT" path="${dtf.xml.path}/input"/>Now whenever you want to reference it you can just use the simple syntax storage://INPUT/mynewfile.txt from the various uri attributes of certain tags and that will pull the file from the local path you specified earlier. In the future we can easily support creating storages that reference an FTP location or Webdav folder instead of a locally identified path with the path attribute and you'll only have to change the the createstorage tag to reference a different location. There's also the possibility that instead of reference the storage://INPUT/xxx location you could just use the syntax webdav://someserver/myremotefile, but none of those features have been developed and there's a lot of freedom to make a choice in the future when required.
Ranges can be used from a component for both reading and writing but you have to set the export attribute to true and you should only use that on storages you really need to share with other components because it will trigger synchronization between the various remote copies of that same storage and the various nodes being used. The following is a simple example of using remote storages:
<?xml version="1.0" encoding="UTF-8"?>
<script xmlns="http://dtf.org/v1" name="remote_storages">
<info>
<author>
<name>Rodney Gomes</name>
<email>rlgomes@yahoo-inc.com</email>
</author>
<description>
</description>
</info>
<local>
<createstorage id="STORE" path="${dtf.xml.path}" export="true"/>
<lockcomponent id="C1"/>
</local>
<component id="C1">
<cat uri="storage://STORE/testfile">message from component</cat>
</component>
<property name="data" uri="storage://STORE/testfile"/>
<log>${data}</log>
</script>You can read the data back on the runner as soon as you've returned from executing on the DTFA you were using and this data transfer between storages is handled in both directions by DTF.