From e3449a88918aceac02f19d1124620dbd86f59bb1 Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Tue, 9 Jun 2009 16:45:04 +0000 Subject: [PATCH] Improve documentation git-svn-id: https://svn.argeo.org/slc/trunk@2522 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- pom.xml | 7 +- src/site/apt/howtos/howto-attachments.apt | 94 +++++++++++++++++++ .../apt/howtos/howto-executionResources.apt | 92 ++++++++++++++++++ src/site/site.xml | 6 ++ 4 files changed, 198 insertions(+), 1 deletion(-) create mode 100644 src/site/apt/howtos/howto-attachments.apt create mode 100644 src/site/apt/howtos/howto-executionResources.apt diff --git a/pom.xml b/pom.xml index d718ce24e..b6274b439 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ 3.4.2.R34x_v20080826-1230 2.0.0 5.2.0.0006 - 0.1.12 + 0.1.13 file:///var/argeo/projects/SLC/www/site http://www.argeo.org/projects/slc/site @@ -604,6 +604,11 @@ limitations under the License. org.argeo.dep.osgi.commons.cli 1.1 + + org.argeo.dep.osgi + org.argeo.dep.osgi.commons.exec + 1.0.0.argeo1 + org.apache.commons com.springsource.org.apache.commons.pool diff --git a/src/site/apt/howtos/howto-attachments.apt b/src/site/apt/howtos/howto-attachments.apt new file mode 100644 index 000000000..1df2adcb7 --- /dev/null +++ b/src/site/apt/howtos/howto-attachments.apt @@ -0,0 +1,94 @@ +Upload of attachments to a test result + + This allows to attach ANY Spring resource (for example the one created above but not only, since it can also be classpath: or osgibundle: Resources or ANY file on the file system where the agent is running (e.g. Mx *.mxres files on a server...)) + + In order to use it: + + [[1]] First reference an attachment uploader service via OSGi (it is provided by the standard agent): + ++-------------------------------+ + ++-------------------------------+ + + [[1]] Then use an UploadAttachment task: + ++-------------------------------+ + + + + + + + + + + + + + + ++-------------------------------+ + + You have to specify an Attachment object with at least a 'name', you can also specify a 'contentType', but the server will recognize common extension of the name. + You have to specify a (Spring) Resource, for example the one that you created before (the name of the attachment doesn't have to be the name of the file). + Just doing this will already upload a file to the server, but if you want to access it you need to bind it to some object, typically a TreeTestResult. You can provide a list of AttachmentEnabled objects (only TreeTestResult implements it so far). + + You could use directly Spring Resource URL, e.g.: + ++-------------------------------+ + ++-------------------------------+ + + You can also upload and attach many attachments in one shot. In that case provide a Map with the keys being Attachment objects and the values Resource objects. E.g.: + ++-------------------------------+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++-------------------------------+ + + Retrieving the resources from this bean: + ++-------------------------------+ + + + + + ++-------------------------------+ + + [[1]] You can access the attachments from the Web UI by selecting a result in the list in the results perspective. + You will see that a new button 'Attachment' in the toolbar get activated (if there are any attachments). diff --git a/src/site/apt/howtos/howto-executionResources.apt b/src/site/apt/howtos/howto-executionResources.apt new file mode 100644 index 000000000..a73cd5525 --- /dev/null +++ b/src/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 @{}): + ++-------------------------------+ + + + + + + + + + + + + + + + + ++-------------------------------+ + diff --git a/src/site/site.xml b/src/site/site.xml index 0443b01f5..88f8bcab3 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -16,6 +16,12 @@ + + + + -- 2.39.2