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 2015/11/11 18:21:31 UTC
[04/21] incubator-brooklyn git commit: Updated README with details
for TestHtmlCall
Updated README with details for TestHtmlCall
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/cfa4b3b5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/cfa4b3b5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/cfa4b3b5
Branch: refs/heads/master
Commit: cfa4b3b5fbad96fdaade2d08085911a6504be7f7
Parents: 0e8c31d
Author: Mark McKenna <m4...@users.noreply.github.com>
Authored: Mon Nov 2 22:15:49 2015 +0000
Committer: Mark McKenna <m4...@gmail.com>
Committed: Mon Nov 9 20:56:21 2015 +0000
----------------------------------------------------------------------
.../brooklyn-sandbox-test-framework/README.md | 51 +++++++++++++++++++-
1 file changed, 50 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/cfa4b3b5/sandbox/brooklyn-sandbox-test-framework/README.md
----------------------------------------------------------------------
diff --git a/sandbox/brooklyn-sandbox-test-framework/README.md b/sandbox/brooklyn-sandbox-test-framework/README.md
index 991ec48..6405af6 100644
--- a/sandbox/brooklyn-sandbox-test-framework/README.md
+++ b/sandbox/brooklyn-sandbox-test-framework/README.md
@@ -21,6 +21,13 @@ Entity that tests a sensor value on another entity eg service.isUp == TRUE
| 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")
@@ -54,4 +61,46 @@ effector: deploy
params:
url: https://tomcat.apache.org/tomcat-6.0-doc/appdev/sample/sample.war
targetName: sample1
-```
\ No newline at end of file
+```
+
+## 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 |
+
+##### 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")
+ assert:
+ status: 200
+ - type: org.apache.brooklyn.test.framework.TestHttpCall
+ name: Status Code 404
+ url: $brooklyn:formatString("%s/invalidpath/", component("tomcat").attributeWhenReady("main.uri"))
+ assert:
+ status: 404
+ - type: org.apache.brooklyn.test.framework.TestHttpCall
+ name: String match
+ url: $brooklyn:component("tomcat").attributeWhenReady("main.uri")
+ assert:
+ string: Sample Brooklyn Deployed
+ - type: org.apache.brooklyn.test.framework.TestHttpCall
+ name: Regex match
+ url: $brooklyn:component("tomcat").attributeWhenReady("main.uri")
+ # 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.*"
+```