You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2016/01/13 19:06:02 UTC

[3/6] incubator-brooklyn git commit: Added new components to documentation

Added new components to documentation


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/25ead1d8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/25ead1d8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/25ead1d8

Branch: refs/heads/master
Commit: 25ead1d8ec357e0ea40aca4c36481f62097eaf15
Parents: 74a2248
Author: Graeme-Miller <gr...@cloudsoftcorp.com>
Authored: Tue Dec 22 14:37:05 2015 +0000
Committer: Graeme-Miller <gr...@cloudsoftcorp.com>
Committed: Thu Jan 7 16:44:40 2016 +0000

----------------------------------------------------------------------
 brooklyn-docs/guide/yaml/test/index.md          |  8 +++--
 brooklyn-docs/guide/yaml/test/test-entities.md  | 33 ++++++++++++++++++--
 ...infrastructuredeploymenttestcase-entity.yaml | 11 +++++++
 .../entities/loopovergroupmembers-entity.yaml   |  6 ++++
 4 files changed, 53 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/25ead1d8/brooklyn-docs/guide/yaml/test/index.md
----------------------------------------------------------------------
diff --git a/brooklyn-docs/guide/yaml/test/index.md b/brooklyn-docs/guide/yaml/test/index.md
index ae7f818..02482b7 100644
--- a/brooklyn-docs/guide/yaml/test/index.md
+++ b/brooklyn-docs/guide/yaml/test/index.md
@@ -6,20 +6,24 @@ children:
 - usage-examples.md
 ---
 
-Brooklyn provides a selection of basic test entities which can be used to validate Blueprints via YAML. These are divided into two groups; structural, which effect the order in which child entities are started; and validation, which are used to confirm the application is deployed as intended.
+Brooklyn provides a selection of test entities which can be used to validate Blueprints via YAML. The basic building block is a TargetableTestComponent, which is used to resolve a target. There are two different groups of entities that inherit from TargetableTestComponent. The first is structural, which effects how the tests are run, for example by affecting the order they are run in. The second group is validation, which is used to confirm the application is deployed as intended, for example by checking some sensor value.
 
 Structural test entities include:
 
 - `TestCase`  - starts child entities sequentially.
 - `ParallelTestCase` - starts child entities in parallel.
+- `LoopOverGroupMembersTestCase` - creates a TargetableTestComponent for each member of a group.
+- `InfrastructureDeploymentTestCase` - will create the specified Infrastructure and then deploy the target entity specifications there.
 
 Validation test entities include:
 
 - `TestSensor` - perform assertion on a specified sensor.
-- `TestEffector` - invoke effector on specified target entity.
+- `TestEffector` - perform assertion on response to effector call.
 - `TestHttpCall` - perform assertion on response to specified HTTP GET Request.
 - `SimpleShellCommandTest` - test assertions on the result of a shell command on the same node as the target entity.
 
+TargetableTestComponents can be chained together, with the target being inherited by the components children. For example, a ParallelTestCase could be created that has a TestHttpCall as a child. As long as the TestHttpCall itself does not have a target, it will use the target of it's parent, ParallelTestCase. Using this technique, we can build up complex test scenarios.
+
 The following sections provide details on each test entity along with examples of their use.
 
 {% include list-children.html %}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/25ead1d8/brooklyn-docs/guide/yaml/test/test-entities.md
----------------------------------------------------------------------
diff --git a/brooklyn-docs/guide/yaml/test/test-entities.md b/brooklyn-docs/guide/yaml/test/test-entities.md
index f8eb087..a81a3d6 100644
--- a/brooklyn-docs/guide/yaml/test/test-entities.md
+++ b/brooklyn-docs/guide/yaml/test/test-entities.md
@@ -33,6 +33,32 @@ This can be used to run a subset of entities in parallel as a single step when n
 
 Timeouts on child entities should be set relative to the start of the `ParallelTestCase`.
 
+### LoopOverGroupMembersTestCase
+The `LoopOverGroupMembersTestCase` entity is configured with a target group and a test specification. For each member of the targeted group, the test case will create a TargetableTestComponent entity from the supplied test specification and set the components target to be the group member.
+
+{% highlight yaml %}
+{% readj example_yaml/entities/loopovergroupmembers-entity.yaml %}
+{% endhighlight %}
+
+#### Parameters
+- `target` - group who's members are to be tested, specified via DSL. For example, `$brooklyn:component("tomcat")`. See also the `targetId` parameter.
+- `targetId` - alternative to the `target` parameter which wraps the DSL component lookup requiring only the `id` be supplied. For example, `tomcat`. Please note, this must point to a group.
+- `test.spec` - The TargetableTestComponent to create for each child.
+
+
+### InfrastructureDeploymentTestCase
+The `InfrastructureDeploymentTestCase` will first create and deploy an infrastructure from the `infrastructure.deployment.spec` config. It will then retrieve a deployment location by getting the value of the infrastructures `infrastructure.deployment.location.sensor` sensor. It will then create and deploy all entities from the `infrastructure.deployment.spec` config to the deployment location.
+
+{% highlight yaml %}
+{% readj example_yaml/entities/infrastructuredeploymenttestcase-entity.yaml %}
+{% endhighlight %}
+
+#### Parameters
+
+- `infrastructure.deployment.spec` - the infrastructure to be deployed.
+- `infrastructure.deployment.entity.specs` - the entities to be deployed to the infrastructure
+- `infrastructure.deployment.location.sensor` - the name of the sensor on the infrastructure to retrieve the deployment location
+
 ## Validation Test Entities
 
 ### TestSensor
@@ -50,7 +76,7 @@ The `TestSensor` entity performs an assertion on a specified sensors value.
 - `assert` - assertion to perform on the specified sensor value. See section on assertions below.
 
 ### TestEffector
-The `TestEffector` entity invokes the specified effector on a target entity.
+The `TestEffector` entity invokes the specified effector on a target entity. If the result of the effector is a String, it will then perform assertions on the result.
 {% highlight yaml %}
 {% readj example_yaml/entities/testeffector-entity.yaml %}
 {% endhighlight %}
@@ -61,6 +87,7 @@ The `TestEffector` entity invokes the specified effector on a target entity.
 - `timeout` - duration to wait on the effector task to complete. For example `10s`, `10m`, etc
 - `effector` - effector to invoke, for example `deploy`.
 - `params` - parameters to pass to the effector, these will depend on the entity and effector being tested. The example above shows the `url` and `targetName` parameters being passed to Tomcats `deploy` effector.
+- `assert` - assertion to perform on the returned result. See section on assertions below.
 
 ### TestHttpCall
 The `TestHttpCall` entity performs a HTTP GET on the specified URL and performs an assertion on the response.
@@ -77,7 +104,7 @@ The `TestHttpCall` entity performs a HTTP GET on the specified URL and performs
 ### SimpleShellCommandTest
 
 The SimpleShellCommandTest runs a command on the host of the target entity.
-The script is expected not to run indefinitely, but to return a result (process exit code), along with its 
+The script is expected not to run indefinitely, but to return a result (process exit code), along with its
 standard out and error streams, which can then be tested using assertions.
 If no assertions are explicitly configured, the default is to assert a non-zero exit code.
 
@@ -119,7 +146,7 @@ Assertions may be provided as a simple map:
        matches: .*[\d]* days.*
 ```
 
-If there is the need to make multiple assertions with the same key, the assertions can be specified 
+If there is the need to make multiple assertions with the same key, the assertions can be specified
 as a list of such maps:
 
 ```yaml

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/25ead1d8/docs/guide/yaml/test/example_yaml/entities/infrastructuredeploymenttestcase-entity.yaml
----------------------------------------------------------------------
diff --git a/docs/guide/yaml/test/example_yaml/entities/infrastructuredeploymenttestcase-entity.yaml b/docs/guide/yaml/test/example_yaml/entities/infrastructuredeploymenttestcase-entity.yaml
new file mode 100644
index 0000000..6b344da
--- /dev/null
+++ b/docs/guide/yaml/test/example_yaml/entities/infrastructuredeploymenttestcase-entity.yaml
@@ -0,0 +1,11 @@
+- type: org.apache.brooklyn.test.framework.InfrastructureDeploymentTestCase
+  brooklyn.config:
+    infrastructure.deployment.location.sensor: entity.dynamicLocation
+    infrastructure.deployment.spec:
+      $brooklyn:entitySpec:
+        - type: docker-cloud-calico
+          ...
+    infrastructure.deployment.entity.specs:
+      - $brooklyn:entitySpec:
+          type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
+          ...
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/25ead1d8/docs/guide/yaml/test/example_yaml/entities/loopovergroupmembers-entity.yaml
----------------------------------------------------------------------
diff --git a/docs/guide/yaml/test/example_yaml/entities/loopovergroupmembers-entity.yaml b/docs/guide/yaml/test/example_yaml/entities/loopovergroupmembers-entity.yaml
new file mode 100644
index 0000000..e97ab4c
--- /dev/null
+++ b/docs/guide/yaml/test/example_yaml/entities/loopovergroupmembers-entity.yaml
@@ -0,0 +1,6 @@
+- type: org.apache.brooklyn.test.framework.LoopOverGroupMembersTestCase
+  target: $brooklyn:component("infrastructure").component("child", "DockerHosts")
+  testSpec:
+    $brooklyn:entitySpec:
+      type: org.apache.brooklyn.test.framework.TestSensor
+      ...
\ No newline at end of file