X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;ds=sidebyside;f=doc%2Fsite%2Fapt%2Fhowtos%2Fhowto-executionResources.apt;fp=doc%2Fsite%2Fapt%2Fhowtos%2Fhowto-executionResources.apt;h=a73cd55254192746f34b1029c037ddb501996faf;hb=39627315891eec4af8423926483044bb279fa837;hp=0000000000000000000000000000000000000000;hpb=ee353b0563fe08488971dd53f76926f2b97aae07;p=gpl%2Fargeo-slc.git diff --git a/doc/site/apt/howtos/howto-executionResources.apt b/doc/site/apt/howtos/howto-executionResources.apt new file mode 100644 index 000000000..a73cd5525 --- /dev/null +++ b/doc/site/apt/howtos/howto-executionResources.apt @@ -0,0 +1,92 @@ +Management of writable files within tests + + This provides an abstraction for files generated by the test. + + The files are stored in the standard osgi instance area (argument -data to an OSGi launch, default is a ./data directory in the execution directory) under a ${osgi.instance.area}/executionResources directory. + + A subdirectory is created for each execution, thus avoiding that the files override each other. + + The format of this directory is yyyyMMdd_HHmmss_ + + In order to use it: + + [[1]] First declare a ResourcesManager in your application context. It has to reference the SLC Execution Context (always available): + ++-------------------------------+ + + + ++-------------------------------+ + + [[1]] Then you can retrieve Spring Resources via a call to this manager. For example (it could also be an inner bean): + ++-------------------------------+ + + + + ++-------------------------------+ + + The "constructor argument" (just a Spring notation in this case) is a relative path that you want to give to this file. + Within a given execution, repeated calls on the manager with the same relative path will always point to the same file. + + [[1]] Then simply use this standard Spring Resource where required: + ++-------------------------------+ + + + + ++-------------------------------+ + + Underlying calls to the getFile() method of this resource won't fail (since they are writable). + +Factory bean for execution resources + + Here is an enhancement to declare execution resources: + ++-------------------------------+ + + + + + + + + + + + + + + + + + ++-------------------------------+ + + This allows to pass @{} execution parameters. + + The other form WON'T WORK if you try to passe @{} in the constructor-arg tag (but still works if the relative path does not contain a @{}): + ++-------------------------------+ + + + + + + + + + + + + + + + + ++-------------------------------+ +