You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2015/11/14 16:26:48 UTC
[2/3] incubator-brooklyn git commit: Move test framework
documentation to within brooklyn docs guide.
Move test framework documentation to within brooklyn docs guide.
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/1dc4e690
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/1dc4e690
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/1dc4e690
Branch: refs/heads/master
Commit: 1dc4e6905ca9d6457a0fde3220e389f72f640e40
Parents: cd8fae2
Author: Chris Burke <ch...@cloudsoft.io>
Authored: Fri Nov 13 13:48:00 2015 +0000
Committer: Chris Burke <ch...@cloudsoft.io>
Committed: Fri Nov 13 13:48:00 2015 +0000
----------------------------------------------------------------------
docs/guide/index.md | 1 +
docs/guide/test/entities.md | 143 ++++++++++++++++++++++++++++++++++++
docs/guide/test/index.md | 8 ++
usage/test-framework/README.md | 141 -----------------------------------
4 files changed, 152 insertions(+), 141 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/1dc4e690/docs/guide/index.md
----------------------------------------------------------------------
diff --git a/docs/guide/index.md b/docs/guide/index.md
index cdb3b46..7ada3f2 100644
--- a/docs/guide/index.md
+++ b/docs/guide/index.md
@@ -12,6 +12,7 @@ children:
- { path: /guide/java/index.md }
- { path: /guide/ops/index.md }
- { path: /guide/misc/index.md }
+- { path: /guide/test/index.md }
---
This is the Brooklyn User Guide for v{{ site.brooklyn-version }}:
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/1dc4e690/docs/guide/test/entities.md
----------------------------------------------------------------------
diff --git a/docs/guide/test/entities.md b/docs/guide/test/entities.md
new file mode 100644
index 0000000..d96eeaf
--- /dev/null
+++ b/docs/guide/test/entities.md
@@ -0,0 +1,143 @@
+---
+title: Entities
+layout: website-normal
+---
+## TestCase
+A logical grouping for tests, e.g. Restart tests.
+
+```
+type: org.apache.brooklyn.test.framework.TestCase
+name: Stop Test
+brooklyn.children:
+ - ***
+ - ***
+```
+
+## ParallelTestCase
+A logical grouping for tests where each child is started in parallel instead of being run sequentially.
+
+```
+type: org.apache.brooklyn.test.framework.ParallelTestCase
+name: Start Test
+brooklyn.children:
+ - ***
+ - ***
+```
+
+## TestSensor
+Entity that tests a sensor value on another entity, e.g. service.isUp == TRUE.
+
+#### Configuration
+| Key | Description | Required |
+| --- | ----------- | -------- |
+| target | The target entity to test | yes (no if *targetId* is supplied) |
+| targetId | The id of the target entity to test | yes (no if *target* is supplied) |
+| assert | Assertions to be evaluated | yes |
+| timeout | The duration to wait on a result | no |
+
+##### Assertions
+| Key | Description |
+| --- | ----------- |
+| equal | Sensor value equals |
+| regex | Sensor value matches regex |
+| isNull | Sensor value has not been set |
+
+```
+type: org.apache.brooklyn.test.framework.TestSensor
+target: $brooklyn:component("nginx1")
+sensor: service.isUp
+equals: true
+timeout: 5m
+```
+
+## TestEffector
+Entity that invokes an effector on another entity, e.g. restart.
+
+#### Configuration
+| Key | Description | Required |
+| --- | ----------- | -------- |
+| target | The target entity to effect | yes (no if *targetId* is supplied) |
+| targetId | The id of the target entity to effect | yes (no if *target* is supplied) |
+| effector | The name of the effector to invoke | yes |
+| params | Parameters to pass to the effector | no |
+| timeout | The duration to wait on a response from an effector | no |
+
+#### Sensors
+| Key | Description |
+| --- | ----------- |
+| result | The result of invoking the effector (null if no result) |
+
+```
+type: org.apache.brooklyn.test.framework.TestEffector
+name: Deploy WAR
+target: $brooklyn:component("tomcat")
+effector: deploy
+params:
+ url: https://tomcat.apache.org/tomcat-6.0-doc/appdev/sample/sample.war
+ targetName: sample1
+```
+
+## TestHtmlCall
+Entity that makes a HTTP Request and tests the response.
+
+#### Configuration
+| Key | Description | Required |
+| --- | ----------- | -------- |
+| url | The URL to test | yes |
+| assert | Assertions to be evaluated | yes |
+| timeout | The duration to wait for assertion result | no |
+
+##### Assertions
+| Key | Description |
+| --- | ----------- |
+| string | HTTP body contains text |
+| regex | HTTP body matches regex |
+| status | HTTP status code equals |
+
+```
+ - type: org.apache.brooklyn.test.framework.TestHttpCall
+ name: Status Code 200
+ url: $brooklyn:component("tomcat").attributeWhenReady("main.uri")
+ timeout: 1m
+ assert:
+ status: 200
+ - type: org.apache.brooklyn.test.framework.TestHttpCall
+ name: String match
+ url: $brooklyn:component("tomcat").attributeWhenReady("main.uri")
+ timeout: 1m
+ assert:
+ bodyContains: Sample Brooklyn Deployed
+ - type: org.apache.brooklyn.test.framework.TestHttpCall
+ name: Status Code 404
+ url: $brooklyn:formatString("%s/invalidpath/", component("tomcat").attributeWhenReady("webapp.url"))
+ assert:
+ status: 404
+ - type: org.apache.brooklyn.test.framework.TestHttpCall
+ name: Regex match
+ url: $brooklyn:component("tomcat").attributeWhenReady("webapp.url")
+ # the regex assert uses java.lang.String under the hood so if the url is expected to returns
+ # a multi-line response you should use the embedded dotall flag expression `(?s)` in your regex.
+ # See: http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
+ assert:
+ regex: "(?s).*illustrate(\\s)*how(\\s)*web(\\s)*applications.*"
+```
+
+
+
+----
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/1dc4e690/docs/guide/test/index.md
----------------------------------------------------------------------
diff --git a/docs/guide/test/index.md b/docs/guide/test/index.md
new file mode 100644
index 0000000..72501bf
--- /dev/null
+++ b/docs/guide/test/index.md
@@ -0,0 +1,8 @@
+---
+title: QA Test Framework
+layout: website-normal
+children:
+ - entities.md
+---
+
+{% include list-children.html %}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/1dc4e690/usage/test-framework/README.md
----------------------------------------------------------------------
diff --git a/usage/test-framework/README.md b/usage/test-framework/README.md
deleted file mode 100644
index 3899bd3..0000000
--- a/usage/test-framework/README.md
+++ /dev/null
@@ -1,141 +0,0 @@
-# Entities
-
-## TestCase
-A logical grouping for tests, e.g. Restart tests.
-
-```
-type: org.apache.brooklyn.test.framework.TestCase
-name: Stop Test
-brooklyn.children:
- - ***
- - ***
-```
-
-## ParallelTestCase
-A logical grouping for tests where each child is started in parallel instead of being run sequentially.
-
-```
-type: org.apache.brooklyn.test.framework.ParallelTestCase
-name: Start Test
-brooklyn.children:
- - ***
- - ***
-```
-
-## TestSensor
-Entity that tests a sensor value on another entity, e.g. service.isUp == TRUE.
-
-#### Configuration
-| Key | Description | Required |
-| --- | ----------- | -------- |
-| target | The target entity to test | yes (no if *targetId* is supplied) |
-| targetId | The id of the target entity to test | yes (no if *target* is supplied) |
-| assert | Assertions to be evaluated | yes |
-| timeout | The duration to wait on a result | no |
-
-##### Assertions
-| Key | Description |
-| --- | ----------- |
-| equal | Sensor value equals |
-| regex | Sensor value matches regex |
-| isNull | Sensor value has not been set |
-
-```
-type: org.apache.brooklyn.test.framework.TestSensor
-target: $brooklyn:component("nginx1")
-sensor: service.isUp
-equals: true
-timeout: 5m
-```
-
-## TestEffector
-Entity that invokes an effector on another entity, e.g. restart.
-
-#### Configuration
-| Key | Description | Required |
-| --- | ----------- | -------- |
-| target | The target entity to effect | yes (no if *targetId* is supplied) |
-| targetId | The id of the target entity to effect | yes (no if *target* is supplied) |
-| effector | The name of the effector to invoke | yes |
-| params | Parameters to pass to the effector | no |
-| timeout | The duration to wait on a response from an effector | no |
-
-#### Sensors
-| Key | Description |
-| --- | ----------- |
-| result | The result of invoking the effector (null if no result) |
-
-```
-type: org.apache.brooklyn.test.framework.TestEffector
-name: Deploy WAR
-target: $brooklyn:component("tomcat")
-effector: deploy
-params:
- url: https://tomcat.apache.org/tomcat-6.0-doc/appdev/sample/sample.war
- targetName: sample1
-```
-
-## TestHtmlCall
-Entity that makes a HTTP Request and tests the response.
-
-#### Configuration
-| Key | Description | Required |
-| --- | ----------- | -------- |
-| url | The URL to test | yes |
-| assert | Assertions to be evaluated | yes |
-| timeout | The duration to wait for assertion result | no |
-
-##### Assertions
-| Key | Description |
-| --- | ----------- |
-| string | HTTP body contains text |
-| regex | HTTP body matches regex |
-| status | HTTP status code equals |
-
-```
- - type: org.apache.brooklyn.test.framework.TestHttpCall
- name: Status Code 200
- url: $brooklyn:component("tomcat").attributeWhenReady("main.uri")
- timeout: 1m
- assert:
- status: 200
- - type: org.apache.brooklyn.test.framework.TestHttpCall
- name: String match
- url: $brooklyn:component("tomcat").attributeWhenReady("main.uri")
- timeout: 1m
- assert:
- bodyContains: Sample Brooklyn Deployed
- - type: org.apache.brooklyn.test.framework.TestHttpCall
- name: Status Code 404
- url: $brooklyn:formatString("%s/invalidpath/", component("tomcat").attributeWhenReady("webapp.url"))
- assert:
- status: 404
- - type: org.apache.brooklyn.test.framework.TestHttpCall
- name: Regex match
- url: $brooklyn:component("tomcat").attributeWhenReady("webapp.url")
- # the regex assert uses java.lang.String under the hood so if the url is expected to returns
- # a multi-line response you should use the embedded dotall flag expression `(?s)` in your regex.
- # See: http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
- assert:
- regex: "(?s).*illustrate(\\s)*how(\\s)*web(\\s)*applications.*"
-```
-
-
-
-----
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
\ No newline at end of file