Added postman tests based on the setup created by docker-compose

Project: http://git-wip-us.apache.org/repos/asf/metamodel-membrane/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/metamodel-membrane/commit/a6033aa5
Tree: http://git-wip-us.apache.org/repos/asf/metamodel-membrane/tree/a6033aa5
Diff: http://git-wip-us.apache.org/repos/asf/metamodel-membrane/diff/a6033aa5

Branch: refs/heads/master
Commit: a6033aa5c13c696623ad0e279507da8d62458020
Parents: 83a7e6f
Author: Kasper Sørensen <[email protected]>
Authored: Sun Aug 20 01:14:49 2017 -0700
Committer: Kasper Sørensen <[email protected]>
Committed: Sun Aug 20 01:14:49 2017 -0700

----------------------------------------------------------------------
 core/pom.xml                                    |  12 ++
 pom.xml                                         |  29 ++-
 postman-tests/Membrane.postman_collection.json  | 202 +++++++++++++++++++
 postman-tests/README.md                         |  20 ++
 .../docker-toolbox.postman_environment.json     |  16 ++
 .../localhost.postman_environment.json          |  16 ++
 6 files changed, 289 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/metamodel-membrane/blob/a6033aa5/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index c46c699..2de9377 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -86,6 +86,18 @@ under the License.
                        <groupId>org.slf4j</groupId>
                        <artifactId>jcl-over-slf4j</artifactId>
                </dependency>
+               
+               <!-- Database drivers -->
+               <dependency>
+                       <groupId>org.postgresql</groupId>
+                       <artifactId>postgresql</artifactId>
+                       <version>42.1.4</version>
+               </dependency>
+               <dependency>
+                       <groupId>net.sourceforge.jtds</groupId>
+                       <artifactId>jtds</artifactId>
+                       <version>1.3.1</version>
+               </dependency>
 
                <!-- Provided -->
                <dependency>

http://git-wip-us.apache.org/repos/asf/metamodel-membrane/blob/a6033aa5/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 4b43522..4a9ec09 100644
--- a/pom.xml
+++ b/pom.xml
@@ -42,12 +42,29 @@ under the License.
        <url>http://metamodel.apache.org</url>
        <inceptionYear>2017</inceptionYear>
        <packaging>pom</packaging>
-       <modules>
-               <module>swagger-codegen</module>
-               <module>core</module>
-               <module>war</module>
-               <module>undertow</module>
-       </modules>
+       
+       <profiles>
+               <profile>
+                       <id>all</id>
+                       <activation>
+                               <activeByDefault>true</activeByDefault>
+                       </activation>
+                       <modules>
+                               <module>swagger-codegen</module>
+                               <module>core</module>
+                               <module>war</module>
+                               <module>undertow</module>
+                       </modules>
+               </profile>
+               <profile>
+                       <id>dockerbuild</id>
+                       <modules>
+                               <module>swagger-codegen</module>
+                               <module>core</module>
+                               <module>undertow</module>
+                       </modules>
+               </profile>
+       </profiles>
 
        <dependencyManagement>
                <dependencies>

http://git-wip-us.apache.org/repos/asf/metamodel-membrane/blob/a6033aa5/postman-tests/Membrane.postman_collection.json
----------------------------------------------------------------------
diff --git a/postman-tests/Membrane.postman_collection.json 
b/postman-tests/Membrane.postman_collection.json
new file mode 100644
index 0000000..d8f0896
--- /dev/null
+++ b/postman-tests/Membrane.postman_collection.json
@@ -0,0 +1,202 @@
+{
+       "variables": [],
+       "info": {
+               "name": "Membrane",
+               "_postman_id": "084c91ce-fccc-8fc4-a3c4-1dc5d5b41388",
+               "description": "",
+               "schema": 
"https://schema.getpostman.com/json/collection/v2.0.0/collection.json";
+       },
+       "item": [
+               {
+                       "name": "Create my-tenant",
+                       "event": [
+                               {
+                                       "listen": "test",
+                                       "script": {
+                                               "type": "text/javascript",
+                                               "exec": [
+                                                       "tests[\"Status code is 
200\"] = responseCode.code === 200;",
+                                                       "",
+                                                       "var jsonData = 
JSON.parse(responseBody);",
+                                                       "tests[\"type is 
tenant\"] = jsonData.type === \"tenant\";"
+                                               ]
+                                       }
+                               }
+                       ],
+                       "request": {
+                               "url": "{{baseUrl}}/my-tenant",
+                               "method": "PUT",
+                               "header": [
+                                       {
+                                               "key": "Content-Type",
+                                               "value": "application/json",
+                                               "description": ""
+                                       }
+                               ],
+                               "body": {
+                                       "mode": "raw",
+                                       "raw": "{\n    \n}"
+                               },
+                               "description": ""
+                       },
+                       "response": []
+               },
+               {
+                       "name": "Get my-tenant",
+                       "event": [
+                               {
+                                       "listen": "test",
+                                       "script": {
+                                               "type": "text/javascript",
+                                               "exec": [
+                                                       "tests[\"Status code is 
200\"] = responseCode.code === 200;",
+                                                       "",
+                                                       "var jsonData = 
JSON.parse(responseBody);",
+                                                       "tests[\"type is 
tenant\"] = jsonData.type === \"tenant\";"
+                                               ]
+                                       }
+                               }
+                       ],
+                       "request": {
+                               "url": "{{baseUrl}}/my-tenant",
+                               "method": "GET",
+                               "header": [],
+                               "body": {},
+                               "description": ""
+                       },
+                       "response": []
+               },
+               {
+                       "name": "Create my-tenant/example-pojo",
+                       "event": [
+                               {
+                                       "listen": "test",
+                                       "script": {
+                                               "type": "text/javascript",
+                                               "exec": [
+                                                       "tests[\"Status code is 
200\"] = responseCode.code === 200;",
+                                                       "",
+                                                       "var jsonData = 
JSON.parse(responseBody);",
+                                                       "tests[\"type is 
datasource\"] = jsonData.type === \"datasource\";",
+                                                       "tests[\"is 
updateable\"] = jsonData.updateable;"
+                                               ]
+                                       }
+                               }
+                       ],
+                       "request": {
+                               "url": "{{baseUrl}}/my-tenant/example-pojo",
+                               "method": "PUT",
+                               "header": [
+                                       {
+                                               "key": "Content-Type",
+                                               "value": "application/json",
+                                               "description": ""
+                                       }
+                               ],
+                               "body": {
+                                       "mode": "raw",
+                                       "raw": "{\n    \"type\":\"pojo\",\n    
\"table-defs\":\"hello_world (greeting VARCHAR, who VARCHAR); foo (bar INTEGER, 
baz DATE);\"\n}"
+                               },
+                               "description": ""
+                       },
+                       "response": []
+               },
+               {
+                       "name": "Create my-tenant/example-postgres",
+                       "event": [
+                               {
+                                       "listen": "test",
+                                       "script": {
+                                               "type": "text/javascript",
+                                               "exec": [
+                                                       "tests[\"Status code is 
200\"] = responseCode.code === 200;",
+                                                       "",
+                                                       "var jsonData = 
JSON.parse(responseBody);",
+                                                       "tests[\"type is 
datasource\"] = jsonData.type === \"datasource\";",
+                                                       "tests[\"is 
updateable\"] = jsonData.updateable;"
+                                               ]
+                                       }
+                               }
+                       ],
+                       "request": {
+                               "url": "{{baseUrl}}/my-tenant/example-postgres",
+                               "method": "PUT",
+                               "header": [
+                                       {
+                                               "key": "Content-Type",
+                                               "value": "application/json",
+                                               "description": ""
+                                       }
+                               ],
+                               "body": {
+                                       "mode": "raw",
+                                       "raw": "{\n    \"type\":\"jdbc\",\n    
\"url\": \"jdbc:postgresql://example-postgres/membrane\",\n    \"username\": 
\"membrane\",\n    \"password\": \"secret\"\n}"
+                               },
+                               "description": ""
+                       },
+                       "response": []
+               },
+               {
+                       "name": "Create my-tenant/example-couchdb",
+                       "event": [
+                               {
+                                       "listen": "test",
+                                       "script": {
+                                               "type": "text/javascript",
+                                               "exec": [
+                                                       "tests[\"Status code is 
200\"] = responseCode.code === 200;",
+                                                       "",
+                                                       "var jsonData = 
JSON.parse(responseBody);",
+                                                       "tests[\"type is 
datasource\"] = jsonData.type === \"datasource\";",
+                                                       "tests[\"is 
updateable\"] = jsonData.updateable;"
+                                               ]
+                                       }
+                               }
+                       ],
+                       "request": {
+                               "url": "{{baseUrl}}/my-tenant/example-couchdb",
+                               "method": "PUT",
+                               "header": [
+                                       {
+                                               "key": "Content-Type",
+                                               "value": "application/json",
+                                               "description": ""
+                                       }
+                               ],
+                               "body": {
+                                       "mode": "raw",
+                                       "raw": "{\n    \"type\":\"couchdb\",\n  
  \"hostname\": \"example-couchdb\",\n    \"username\": \"membrane\",\n    
\"password\": \"secret\"\n}"
+                               },
+                               "description": ""
+                       },
+                       "response": []
+               },
+               {
+                       "name": "Delete my-tenant",
+                       "event": [
+                               {
+                                       "listen": "test",
+                                       "script": {
+                                               "type": "text/javascript",
+                                               "exec": [
+                                                       "tests[\"Status code is 
200\"] = responseCode.code === 200;",
+                                                       "",
+                                                       "var jsonData = 
JSON.parse(responseBody);",
+                                                       "tests[\"type is 
tenant\"] = jsonData.type === \"tenant\";",
+                                                       "tests[\"deleted is 
true\"] = jsonData.deleted;",
+                                                       ""
+                                               ]
+                                       }
+                               }
+                       ],
+                       "request": {
+                               "url": "{{baseUrl}}/my-tenant",
+                               "method": "DELETE",
+                               "header": [],
+                               "body": {},
+                               "description": ""
+                       },
+                       "response": []
+               }
+       ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/metamodel-membrane/blob/a6033aa5/postman-tests/README.md
----------------------------------------------------------------------
diff --git a/postman-tests/README.md b/postman-tests/README.md
new file mode 100644
index 0000000..0f69277
--- /dev/null
+++ b/postman-tests/README.md
@@ -0,0 +1,20 @@
+# Membrane Postman tests
+
+This folder has a set of tests and examples for use with the 
[Postman](https://www.getpostman.com/) tool.
+
+## Environment files
+
+The environments folder contains a set of reusable environment configs. 
Creating your own custom environment file should also be trivial since we only 
currently have one environment variable: `baseUrl`. 
+
+## Prerequisites
+
+The tests are designed to work with the default `docker-compose.yml` file in 
the root of the membrane project. This compose file has some databases and such 
which are used as part of the tests.
+
+## Running from command line
+
+If you have Postman's CLI tool `newman` installed, simply go like this:
+
+```
+newman run -e environments/docker-toolbox.postman_environment.json 
Membrane.postman_collection.json
+```
+(using the `docker-toolbox` environment)

http://git-wip-us.apache.org/repos/asf/metamodel-membrane/blob/a6033aa5/postman-tests/environments/docker-toolbox.postman_environment.json
----------------------------------------------------------------------
diff --git a/postman-tests/environments/docker-toolbox.postman_environment.json 
b/postman-tests/environments/docker-toolbox.postman_environment.json
new file mode 100644
index 0000000..c3e3d30
--- /dev/null
+++ b/postman-tests/environments/docker-toolbox.postman_environment.json
@@ -0,0 +1,16 @@
+{
+  "id": "556c1331-5e87-4201-2767-8089cdb8e523",
+  "name": "Membrane boot2docker",
+  "values": [
+    {
+      "enabled": true,
+      "key": "baseUrl",
+      "value": "http://192.168.99.100:8080";,
+      "type": "text"
+    }
+  ],
+  "timestamp": 1503214232219,
+  "_postman_variable_scope": "environment",
+  "_postman_exported_at": "2017-08-20T08:06:07.385Z",
+  "_postman_exported_using": "Postman/5.1.3"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/metamodel-membrane/blob/a6033aa5/postman-tests/environments/localhost.postman_environment.json
----------------------------------------------------------------------
diff --git a/postman-tests/environments/localhost.postman_environment.json 
b/postman-tests/environments/localhost.postman_environment.json
new file mode 100644
index 0000000..5dc0d0f
--- /dev/null
+++ b/postman-tests/environments/localhost.postman_environment.json
@@ -0,0 +1,16 @@
+{
+  "id": "fa99af7e-2115-254e-649e-7a2742704dbb",
+  "name": "Membrane local",
+  "values": [
+    {
+      "enabled": true,
+      "key": "baseUrl",
+      "value": "http://localhost:8080";,
+      "type": "text"
+    }
+  ],
+  "timestamp": 1503066492942,
+  "_postman_variable_scope": "environment",
+  "_postman_exported_at": "2017-08-20T08:06:12.977Z",
+  "_postman_exported_using": "Postman/5.1.3"
+}
\ No newline at end of file

Reply via email to