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:37 UTC
[10/21] incubator-brooklyn git commit: Moved etc directory to
src/test/resources/test-framework-examples as the files are not needed at
runtime
Moved etc directory to src/test/resources/test-framework-examples as the files are not needed at runtime
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/b0405c89
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/b0405c89
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/b0405c89
Branch: refs/heads/master
Commit: b0405c89471c28c4a3c574ae68b2086ab883c521
Parents: 01f19e7
Author: Mark McKenna <m4...@gmail.com>
Authored: Wed Nov 11 10:56:11 2015 +0000
Committer: Mark McKenna <m4...@gmail.com>
Committed: Wed Nov 11 11:12:53 2015 +0000
----------------------------------------------------------------------
.../test-framework/etc/example-catalog-test.bom | 22 ----
usage/test-framework/etc/example-catalog.bom | 15 ---
.../test-framework/etc/nginx-test-examples.yml | 98 ---------------
.../etc/testhttpcall-examples.yml | 124 -------------------
.../test-framework/etc/tomcat-test-examples.yml | 45 -------
.../resources/test-framework-examples/README.md | 0
.../example-catalog-test.bom | 22 ++++
.../test-framework-examples/example-catalog.bom | 15 +++
.../nginx-test-examples.yml | 98 +++++++++++++++
.../testhttpcall-examples.yml | 124 +++++++++++++++++++
.../tomcat-test-examples.yml | 45 +++++++
11 files changed, 304 insertions(+), 304 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b0405c89/usage/test-framework/etc/example-catalog-test.bom
----------------------------------------------------------------------
diff --git a/usage/test-framework/etc/example-catalog-test.bom b/usage/test-framework/etc/example-catalog-test.bom
deleted file mode 100644
index 0605f9d..0000000
--- a/usage/test-framework/etc/example-catalog-test.bom
+++ /dev/null
@@ -1,22 +0,0 @@
-brooklyn.catalog:
- id: simple-tomcat-test
- version: 1.0
- itemType: template
- iconUrl: http://tomcat.apache.org/images/tomcat.png
- name: Simple Tomcat Test
- license: Apache-2.0
- item:
- brooklyn.config:
- simple.confg: someValue
- services:
- - type: org.apache.brooklyn.test.framework.TestCase
- name: Simple Tomcat Tests
- brooklyn.children:
- - type: simple-tomcat
- id: tomcat
- - type: org.apache.brooklyn.test.framework.TestSensor
- target: $brooklyn:component("tomcat")
- sensor: service.isUp
- timeout: 10m
- assert:
- equals: true
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b0405c89/usage/test-framework/etc/example-catalog.bom
----------------------------------------------------------------------
diff --git a/usage/test-framework/etc/example-catalog.bom b/usage/test-framework/etc/example-catalog.bom
deleted file mode 100644
index ab7e54b..0000000
--- a/usage/test-framework/etc/example-catalog.bom
+++ /dev/null
@@ -1,15 +0,0 @@
-brooklyn.catalog:
- id: simple-tomcat
- version: 1.0
- itemType: template
- iconUrl: http://tomcat.apache.org/images/tomcat.png
- name: Simple Tomcat
- license: Apache-2.0
- item:
- brooklyn.config:
- simple.confg: someValue
- services:
- - type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
- id: tomcat
- name: Tomcat
- war: https://tomcat.apache.org/tomcat-6.0-doc/appdev/sample/sample.war
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b0405c89/usage/test-framework/etc/nginx-test-examples.yml
----------------------------------------------------------------------
diff --git a/usage/test-framework/etc/nginx-test-examples.yml b/usage/test-framework/etc/nginx-test-examples.yml
deleted file mode 100644
index f1711ea..0000000
--- a/usage/test-framework/etc/nginx-test-examples.yml
+++ /dev/null
@@ -1,98 +0,0 @@
----
-# 1. Start an nginx
-# 2. Test it is running
-# 3. Stop it
-# 4. Test it stopped
-# Note there are two alternative forms to look up target - either just provide the 'targetId' to do an implicit DSL lookup,
-# or look it up with explicit DSL and provide it as 'target'.
-name: NGINX Test
-location: localhost
-services:
-- type: org.apache.brooklyn.test.framework.TestCase
- name: Stop Test
- brooklyn.children:
- - type: org.apache.brooklyn.entity.proxy.nginx.NginxController
- id: nginx1
- - type: org.apache.brooklyn.test.framework.TestSensor
- target: $brooklyn:component("nginx1")
- sensor: service.isUp
- equals: true
- timeout: 5m
- - type: org.apache.brooklyn.test.framework.TestEffector
- target: $brooklyn:component("nginx1")
- effector: stop
- - type: org.apache.brooklyn.test.framework.TestSensor
- target: $brooklyn:component("nginx1")
- sensor: service.isUp
- assert:
- equals: false
-...
-
----
-name: NGINX Test
-location: localhost
-services:
-- type: org.apache.brooklyn.test.framework.TestCase
- name: Stop Test
- targetId: nginx1
- brooklyn.children:
- - type: org.apache.brooklyn.entity.proxy.nginx.NginxController
- id: nginx1
- - type: org.apache.brooklyn.test.framework.TestSensor
- sensor: service.isUp
- equals: true
- timeout: 5m
- - type: org.apache.brooklyn.test.framework.TestEffector
- effector: stop
- - type: org.apache.brooklyn.test.framework.TestSensor
- sensor: service.isUp
- equals: false
-
-
-
----
-name: NGINX Test
-location: localhost
-services:
-- type: org.apache.brooklyn.test.framework.TestCase
- name: Stop Test
- brooklyn.children:
- - type: org.apache.brooklyn.entity.proxy.nginx.NginxController
- id: nginx1
- - type: org.apache.brooklyn.test.framework.TestSensor
- target: $brooklyn:component("nginx1")
- sensor: service.isUp
- timeout: 5m
- assert:
- equals: true
- - type: org.apache.brooklyn.test.framework.TestEffector
- target: $brooklyn:component("nginx1")
- effector: stop
- - type: org.apache.brooklyn.test.framework.TestSensor
- target: $brooklyn:component("nginx1")
- sensor: service.isUp
- assert:
- equals: false
- regex: .*
-...
-
----
-name: NGINX Test
-location: localhost
-services:
-- type: org.apache.brooklyn.entity.proxy.nginx.NginxController
- id: nginx1
-- type: org.apache.brooklyn.test.framework.TestSensor
- target: $brooklyn:component("nginx1")
- sensor: service.isUp
- timeout: 5m
- assert:
- equals: true
-- type: org.apache.brooklyn.test.framework.TestSensor
- name: Test Regex
- target: $brooklyn:component("nginx1")
- sensor: service.isUp
- timeout: 5m
- assert:
- regex: .*
-...
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b0405c89/usage/test-framework/etc/testhttpcall-examples.yml
----------------------------------------------------------------------
diff --git a/usage/test-framework/etc/testhttpcall-examples.yml b/usage/test-framework/etc/testhttpcall-examples.yml
deleted file mode 100644
index a418fd8..0000000
--- a/usage/test-framework/etc/testhttpcall-examples.yml
+++ /dev/null
@@ -1,124 +0,0 @@
----
-name: Basic HTTP Call Tests
-location: localhost
-services:
-- type: org.apache.brooklyn.test.framework.TestCase
- brooklyn.children:
- - type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
- id: tomcat
- brooklyn.config:
- war: "http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0/brooklyn-example-hello-world-sql-webapp-0.6.0.war"
- - type: org.apache.brooklyn.test.framework.TestHttpCall
- name: Status Code 200
- url: $brooklyn:component("tomcat").attributeWhenReady("webapp.url")
- assert:
- status: 200
- - type: org.apache.brooklyn.test.framework.TestHttpCall
- name: Status Code 404
- url: $brooklyn:formatString("%s/invalidpath/", component("tomcat").attributeWhenReady("webapp.url"))
- timeout: 10s
- assert:
- status: 404
- - type: org.apache.brooklyn.test.framework.TestHttpCall
- name: String match
- url: $brooklyn:component("tomcat").attributeWhenReady("webapp.url")
- assert:
- string: Sample Brooklyn Deployed
- - 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.*"
-...
-
----
-name: HTTP Call Test with Effector
-location: localhost
-services:
-- type: org.apache.brooklyn.test.framework.TestCase
- brooklyn.children:
- - type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
- id: tomcat
- brooklyn.config:
- war: "http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0/brooklyn-example-hello-world-sql-webapp-0.6.0.war"
- - type: org.apache.brooklyn.test.framework.TestHttpCall
- name: / Status Code 200
- url: $brooklyn:component("tomcat").attributeWhenReady("webapp.url")
- assert:
- status: 200
- - type: org.apache.brooklyn.test.framework.TestHttpCall
- name: /newcontext Status Code 404
- url: $brooklyn:formatString("%s/newcontext/", component("tomcat").attributeWhenReady("webapp.url"))
- assert:
- status: 404
- - type: org.apache.brooklyn.test.framework.TestEffector
- name: Deploy WAR in /newcontext
- target: $brooklyn:component("tomcat")
- effector: deploy
- params:
- url: http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0/brooklyn-example-hello-world-sql-webapp-0.6.0.war
- targetName: newcontext
- - type: org.apache.brooklyn.test.framework.TestHttpCall
- name: /newcontext Status Code 200
- url: $brooklyn:formatString("%s/newcontext/", component("tomcat").attributeWhenReady("webapp.url"))
- # Give Tomcat time to make the newly deployed War accessible
- timeout: 10s
- assert:
- status: 200
-...
-
----
-name: HTTP Call Test with Eventual String and Regex Matches
-location: localhost
-services:
-- type: org.apache.brooklyn.test.framework.TestCase
- brooklyn.children:
- - type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
- id: tomcat
- brooklyn.config:
- war: "http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0/brooklyn-example-hello-world-sql-webapp-0.6.0.war"
- - type: org.apache.brooklyn.test.framework.TestEffector
- name: Deploy WAR in /newcontext
- target: $brooklyn:component("tomcat")
- effector: deploy
- params:
- url: http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0/brooklyn-example-hello-world-sql-webapp-0.6.0.war
- targetName: newcontext
- - type: org.apache.brooklyn.test.framework.TestHttpCall
- name: Regex match
- url: $brooklyn:formatString("%s/newcontext/", component("tomcat").attributeWhenReady("webapp.url"))
- timeout: 10s
- assert:
- regex: "(?s).*illustrate(\\s)*how(\\s)*web(\\s)*applications.*"
- - type: org.apache.brooklyn.test.framework.TestEffector
- name: Deploy WAR in /newcontext2
- target: $brooklyn:component("tomcat")
- effector: deploy
- params:
- url: http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0/brooklyn-example-hello-world-sql-webapp-0.6.0.war
- targetName: newcontext2
- - type: org.apache.brooklyn.test.framework.TestHttpCall
- name: String match
- url: $brooklyn:formatString("%s/newcontext2/", component("tomcat").attributeWhenReady("webapp.url"))
- timeout: 10s
- assert:
- string: Sample Brooklyn Deployed
- assert:
- status: 404
- - type: org.apache.brooklyn.test.framework.TestHttpCall
- name: String match
- url: $brooklyn:component("tomcat").attributeWhenReady("webapp.url")
- assert:
- string: Sample Brooklyn Deployed
- - 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.*"
-...
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b0405c89/usage/test-framework/etc/tomcat-test-examples.yml
----------------------------------------------------------------------
diff --git a/usage/test-framework/etc/tomcat-test-examples.yml b/usage/test-framework/etc/tomcat-test-examples.yml
deleted file mode 100644
index 37d7f4d..0000000
--- a/usage/test-framework/etc/tomcat-test-examples.yml
+++ /dev/null
@@ -1,45 +0,0 @@
----
-name: Tomcat Multi-War Test
-location: localhost
-services:
-- type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
- id: tomcat
- name: Tomcat
- brooklyn.config:
- wars.by.context:
- hello1: "http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0/brooklyn-example-hello-world-sql-webapp-0.6.0.war"
- hello2: "http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0/brooklyn-example-hello-world-sql-webapp-0.6.0.war"
- start.timeout: 10m
-- type: org.apache.brooklyn.test.framework.TestSensor
- target: $brooklyn:component("tomcat")
- sensor: service.isUp
- assert:
- equals: true
- timeout: 10m
-...
-
----
-name: Tomcat Tests
-location: BYON 1
-services:
- - type: org.apache.brooklyn.test.framework.TestCase
- name: Effector - Deploy Test
- brooklyn.children:
- - type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
- id: tomcat
- name: Tomcat
- war: https://tomcat.apache.org/tomcat-6.0-doc/appdev/sample/sample.war
- - type: org.apache.brooklyn.test.framework.TestEffector
- name: Deploy Another WAR
- target: $brooklyn:component("tomcat")
- effector: deploy
- params:
- url: https://tomcat.apache.org/tomcat-6.0-doc/appdev/sample/sample.war
- targetName: sample1
-# - type: org.apache.brooklyn.test.framework.TestSensor
-# target: $brooklyn:component("tomcat")
-# sensor: webapp.deployedWars
-# assert:
-# regex: .*sample1.*
-# timeout: 1m
-...
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b0405c89/usage/test-framework/src/test/resources/test-framework-examples/README.md
----------------------------------------------------------------------
diff --git a/usage/test-framework/src/test/resources/test-framework-examples/README.md b/usage/test-framework/src/test/resources/test-framework-examples/README.md
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b0405c89/usage/test-framework/src/test/resources/test-framework-examples/example-catalog-test.bom
----------------------------------------------------------------------
diff --git a/usage/test-framework/src/test/resources/test-framework-examples/example-catalog-test.bom b/usage/test-framework/src/test/resources/test-framework-examples/example-catalog-test.bom
new file mode 100644
index 0000000..0605f9d
--- /dev/null
+++ b/usage/test-framework/src/test/resources/test-framework-examples/example-catalog-test.bom
@@ -0,0 +1,22 @@
+brooklyn.catalog:
+ id: simple-tomcat-test
+ version: 1.0
+ itemType: template
+ iconUrl: http://tomcat.apache.org/images/tomcat.png
+ name: Simple Tomcat Test
+ license: Apache-2.0
+ item:
+ brooklyn.config:
+ simple.confg: someValue
+ services:
+ - type: org.apache.brooklyn.test.framework.TestCase
+ name: Simple Tomcat Tests
+ brooklyn.children:
+ - type: simple-tomcat
+ id: tomcat
+ - type: org.apache.brooklyn.test.framework.TestSensor
+ target: $brooklyn:component("tomcat")
+ sensor: service.isUp
+ timeout: 10m
+ assert:
+ equals: true
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b0405c89/usage/test-framework/src/test/resources/test-framework-examples/example-catalog.bom
----------------------------------------------------------------------
diff --git a/usage/test-framework/src/test/resources/test-framework-examples/example-catalog.bom b/usage/test-framework/src/test/resources/test-framework-examples/example-catalog.bom
new file mode 100644
index 0000000..ab7e54b
--- /dev/null
+++ b/usage/test-framework/src/test/resources/test-framework-examples/example-catalog.bom
@@ -0,0 +1,15 @@
+brooklyn.catalog:
+ id: simple-tomcat
+ version: 1.0
+ itemType: template
+ iconUrl: http://tomcat.apache.org/images/tomcat.png
+ name: Simple Tomcat
+ license: Apache-2.0
+ item:
+ brooklyn.config:
+ simple.confg: someValue
+ services:
+ - type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
+ id: tomcat
+ name: Tomcat
+ war: https://tomcat.apache.org/tomcat-6.0-doc/appdev/sample/sample.war
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b0405c89/usage/test-framework/src/test/resources/test-framework-examples/nginx-test-examples.yml
----------------------------------------------------------------------
diff --git a/usage/test-framework/src/test/resources/test-framework-examples/nginx-test-examples.yml b/usage/test-framework/src/test/resources/test-framework-examples/nginx-test-examples.yml
new file mode 100644
index 0000000..f1711ea
--- /dev/null
+++ b/usage/test-framework/src/test/resources/test-framework-examples/nginx-test-examples.yml
@@ -0,0 +1,98 @@
+---
+# 1. Start an nginx
+# 2. Test it is running
+# 3. Stop it
+# 4. Test it stopped
+# Note there are two alternative forms to look up target - either just provide the 'targetId' to do an implicit DSL lookup,
+# or look it up with explicit DSL and provide it as 'target'.
+name: NGINX Test
+location: localhost
+services:
+- type: org.apache.brooklyn.test.framework.TestCase
+ name: Stop Test
+ brooklyn.children:
+ - type: org.apache.brooklyn.entity.proxy.nginx.NginxController
+ id: nginx1
+ - type: org.apache.brooklyn.test.framework.TestSensor
+ target: $brooklyn:component("nginx1")
+ sensor: service.isUp
+ equals: true
+ timeout: 5m
+ - type: org.apache.brooklyn.test.framework.TestEffector
+ target: $brooklyn:component("nginx1")
+ effector: stop
+ - type: org.apache.brooklyn.test.framework.TestSensor
+ target: $brooklyn:component("nginx1")
+ sensor: service.isUp
+ assert:
+ equals: false
+...
+
+---
+name: NGINX Test
+location: localhost
+services:
+- type: org.apache.brooklyn.test.framework.TestCase
+ name: Stop Test
+ targetId: nginx1
+ brooklyn.children:
+ - type: org.apache.brooklyn.entity.proxy.nginx.NginxController
+ id: nginx1
+ - type: org.apache.brooklyn.test.framework.TestSensor
+ sensor: service.isUp
+ equals: true
+ timeout: 5m
+ - type: org.apache.brooklyn.test.framework.TestEffector
+ effector: stop
+ - type: org.apache.brooklyn.test.framework.TestSensor
+ sensor: service.isUp
+ equals: false
+
+
+
+---
+name: NGINX Test
+location: localhost
+services:
+- type: org.apache.brooklyn.test.framework.TestCase
+ name: Stop Test
+ brooklyn.children:
+ - type: org.apache.brooklyn.entity.proxy.nginx.NginxController
+ id: nginx1
+ - type: org.apache.brooklyn.test.framework.TestSensor
+ target: $brooklyn:component("nginx1")
+ sensor: service.isUp
+ timeout: 5m
+ assert:
+ equals: true
+ - type: org.apache.brooklyn.test.framework.TestEffector
+ target: $brooklyn:component("nginx1")
+ effector: stop
+ - type: org.apache.brooklyn.test.framework.TestSensor
+ target: $brooklyn:component("nginx1")
+ sensor: service.isUp
+ assert:
+ equals: false
+ regex: .*
+...
+
+---
+name: NGINX Test
+location: localhost
+services:
+- type: org.apache.brooklyn.entity.proxy.nginx.NginxController
+ id: nginx1
+- type: org.apache.brooklyn.test.framework.TestSensor
+ target: $brooklyn:component("nginx1")
+ sensor: service.isUp
+ timeout: 5m
+ assert:
+ equals: true
+- type: org.apache.brooklyn.test.framework.TestSensor
+ name: Test Regex
+ target: $brooklyn:component("nginx1")
+ sensor: service.isUp
+ timeout: 5m
+ assert:
+ regex: .*
+...
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b0405c89/usage/test-framework/src/test/resources/test-framework-examples/testhttpcall-examples.yml
----------------------------------------------------------------------
diff --git a/usage/test-framework/src/test/resources/test-framework-examples/testhttpcall-examples.yml b/usage/test-framework/src/test/resources/test-framework-examples/testhttpcall-examples.yml
new file mode 100644
index 0000000..a418fd8
--- /dev/null
+++ b/usage/test-framework/src/test/resources/test-framework-examples/testhttpcall-examples.yml
@@ -0,0 +1,124 @@
+---
+name: Basic HTTP Call Tests
+location: localhost
+services:
+- type: org.apache.brooklyn.test.framework.TestCase
+ brooklyn.children:
+ - type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
+ id: tomcat
+ brooklyn.config:
+ war: "http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0/brooklyn-example-hello-world-sql-webapp-0.6.0.war"
+ - type: org.apache.brooklyn.test.framework.TestHttpCall
+ name: Status Code 200
+ url: $brooklyn:component("tomcat").attributeWhenReady("webapp.url")
+ assert:
+ status: 200
+ - type: org.apache.brooklyn.test.framework.TestHttpCall
+ name: Status Code 404
+ url: $brooklyn:formatString("%s/invalidpath/", component("tomcat").attributeWhenReady("webapp.url"))
+ timeout: 10s
+ assert:
+ status: 404
+ - type: org.apache.brooklyn.test.framework.TestHttpCall
+ name: String match
+ url: $brooklyn:component("tomcat").attributeWhenReady("webapp.url")
+ assert:
+ string: Sample Brooklyn Deployed
+ - 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.*"
+...
+
+---
+name: HTTP Call Test with Effector
+location: localhost
+services:
+- type: org.apache.brooklyn.test.framework.TestCase
+ brooklyn.children:
+ - type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
+ id: tomcat
+ brooklyn.config:
+ war: "http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0/brooklyn-example-hello-world-sql-webapp-0.6.0.war"
+ - type: org.apache.brooklyn.test.framework.TestHttpCall
+ name: / Status Code 200
+ url: $brooklyn:component("tomcat").attributeWhenReady("webapp.url")
+ assert:
+ status: 200
+ - type: org.apache.brooklyn.test.framework.TestHttpCall
+ name: /newcontext Status Code 404
+ url: $brooklyn:formatString("%s/newcontext/", component("tomcat").attributeWhenReady("webapp.url"))
+ assert:
+ status: 404
+ - type: org.apache.brooklyn.test.framework.TestEffector
+ name: Deploy WAR in /newcontext
+ target: $brooklyn:component("tomcat")
+ effector: deploy
+ params:
+ url: http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0/brooklyn-example-hello-world-sql-webapp-0.6.0.war
+ targetName: newcontext
+ - type: org.apache.brooklyn.test.framework.TestHttpCall
+ name: /newcontext Status Code 200
+ url: $brooklyn:formatString("%s/newcontext/", component("tomcat").attributeWhenReady("webapp.url"))
+ # Give Tomcat time to make the newly deployed War accessible
+ timeout: 10s
+ assert:
+ status: 200
+...
+
+---
+name: HTTP Call Test with Eventual String and Regex Matches
+location: localhost
+services:
+- type: org.apache.brooklyn.test.framework.TestCase
+ brooklyn.children:
+ - type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
+ id: tomcat
+ brooklyn.config:
+ war: "http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0/brooklyn-example-hello-world-sql-webapp-0.6.0.war"
+ - type: org.apache.brooklyn.test.framework.TestEffector
+ name: Deploy WAR in /newcontext
+ target: $brooklyn:component("tomcat")
+ effector: deploy
+ params:
+ url: http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0/brooklyn-example-hello-world-sql-webapp-0.6.0.war
+ targetName: newcontext
+ - type: org.apache.brooklyn.test.framework.TestHttpCall
+ name: Regex match
+ url: $brooklyn:formatString("%s/newcontext/", component("tomcat").attributeWhenReady("webapp.url"))
+ timeout: 10s
+ assert:
+ regex: "(?s).*illustrate(\\s)*how(\\s)*web(\\s)*applications.*"
+ - type: org.apache.brooklyn.test.framework.TestEffector
+ name: Deploy WAR in /newcontext2
+ target: $brooklyn:component("tomcat")
+ effector: deploy
+ params:
+ url: http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0/brooklyn-example-hello-world-sql-webapp-0.6.0.war
+ targetName: newcontext2
+ - type: org.apache.brooklyn.test.framework.TestHttpCall
+ name: String match
+ url: $brooklyn:formatString("%s/newcontext2/", component("tomcat").attributeWhenReady("webapp.url"))
+ timeout: 10s
+ assert:
+ string: Sample Brooklyn Deployed
+ assert:
+ status: 404
+ - type: org.apache.brooklyn.test.framework.TestHttpCall
+ name: String match
+ url: $brooklyn:component("tomcat").attributeWhenReady("webapp.url")
+ assert:
+ string: Sample Brooklyn Deployed
+ - 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.*"
+...
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b0405c89/usage/test-framework/src/test/resources/test-framework-examples/tomcat-test-examples.yml
----------------------------------------------------------------------
diff --git a/usage/test-framework/src/test/resources/test-framework-examples/tomcat-test-examples.yml b/usage/test-framework/src/test/resources/test-framework-examples/tomcat-test-examples.yml
new file mode 100644
index 0000000..37d7f4d
--- /dev/null
+++ b/usage/test-framework/src/test/resources/test-framework-examples/tomcat-test-examples.yml
@@ -0,0 +1,45 @@
+---
+name: Tomcat Multi-War Test
+location: localhost
+services:
+- type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
+ id: tomcat
+ name: Tomcat
+ brooklyn.config:
+ wars.by.context:
+ hello1: "http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0/brooklyn-example-hello-world-sql-webapp-0.6.0.war"
+ hello2: "http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0/brooklyn-example-hello-world-sql-webapp-0.6.0.war"
+ start.timeout: 10m
+- type: org.apache.brooklyn.test.framework.TestSensor
+ target: $brooklyn:component("tomcat")
+ sensor: service.isUp
+ assert:
+ equals: true
+ timeout: 10m
+...
+
+---
+name: Tomcat Tests
+location: BYON 1
+services:
+ - type: org.apache.brooklyn.test.framework.TestCase
+ name: Effector - Deploy Test
+ brooklyn.children:
+ - type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
+ id: tomcat
+ name: Tomcat
+ war: https://tomcat.apache.org/tomcat-6.0-doc/appdev/sample/sample.war
+ - type: org.apache.brooklyn.test.framework.TestEffector
+ name: Deploy Another WAR
+ target: $brooklyn:component("tomcat")
+ effector: deploy
+ params:
+ url: https://tomcat.apache.org/tomcat-6.0-doc/appdev/sample/sample.war
+ targetName: sample1
+# - type: org.apache.brooklyn.test.framework.TestSensor
+# target: $brooklyn:component("tomcat")
+# sensor: webapp.deployedWars
+# assert:
+# regex: .*sample1.*
+# timeout: 1m
+...
\ No newline at end of file