├── .gitignore ├── .travis.yml ├── raml-tester-client ├── src │ ├── test │ │ ├── resources │ │ │ └── guru │ │ │ │ └── nidi │ │ │ │ └── ramlproxy │ │ │ │ ├── v1 │ │ │ │ ├── data.json │ │ │ │ ├── multi.json │ │ │ │ ├── multi.xml │ │ │ │ ├── POST-data.json │ │ │ │ ├── super │ │ │ │ │ ├── RESPONSE.json │ │ │ │ │ └── META-RESPONSE.json │ │ │ │ ├── META-data.json │ │ │ │ └── META-POST-data.json │ │ │ │ ├── github-meta.json │ │ │ │ ├── github-meta.raml │ │ │ │ └── simple.raml │ │ └── java │ │ │ └── guru │ │ │ └── nidi │ │ │ └── ramlproxy │ │ │ ├── Ramls.java │ │ │ ├── CollectionUtils.java │ │ │ ├── HighlevelTest.java │ │ │ ├── TestSubProcess.java │ │ │ ├── SimpleServlet.java │ │ │ ├── LiveDebug.java │ │ │ ├── TomcatServer.java │ │ │ ├── cli │ │ │ ├── ProcessTest.java │ │ │ └── ServerOptionsParserTest.java │ │ │ ├── CorsTest.java │ │ │ ├── HttpSender.java │ │ │ ├── CodeTest.java │ │ │ ├── ProxyTest.java │ │ │ ├── MockTest.java │ │ │ └── ReporterTest.java │ └── main │ │ ├── resources │ │ ├── validation.json │ │ ├── logback.xml │ │ ├── usage.json │ │ ├── report.json │ │ └── proxy.raml │ │ └── java │ │ └── guru │ │ └── nidi │ │ └── ramlproxy │ │ ├── Version.java │ │ ├── data │ │ ├── UsageDatas.java │ │ ├── ViolationDatas.java │ │ ├── Converters.java │ │ ├── ValidationData.java │ │ ├── UsageData.java │ │ └── ViolationData.java │ │ ├── core │ │ ├── CommandContext.java │ │ ├── ClientOptions.java │ │ ├── ReponseMetaData.java │ │ ├── CommandDecorators.java │ │ ├── SubProcess.java │ │ ├── CommandSender.java │ │ ├── RamlProxyServer.java │ │ ├── ValidatorConfigurator.java │ │ ├── TesterFilter.java │ │ ├── MockServlet.java │ │ └── Command.java │ │ ├── cli │ │ ├── OptionComparator.java │ │ ├── LogConfigurer.java │ │ ├── OptionsParser.java │ │ ├── ClientOptionsParser.java │ │ └── Main.java │ │ ├── jetty │ │ ├── JettyServerProvider.java │ │ ├── JettyRamlProxyServer.java │ │ └── JettyProxyServlet.java │ │ ├── report │ │ ├── Reporter.java │ │ ├── ReportSaver.java │ │ └── ReportFormat.java │ │ └── RamlProxy.java └── pom.xml ├── raml-tester-js ├── test │ └── raml-tester.spec.js ├── src │ ├── raml-tester-cli │ ├── raml-tester-browser.js │ └── raml-tester.js ├── package.json ├── Gruntfile.js ├── README.md └── lib │ ├── raml-tester-browser.js │ └── raml-tester.js ├── bower.json ├── raml-tester-standalone ├── src │ └── main │ │ └── java │ │ └── guru │ │ └── nidi │ │ └── ramlproxy │ │ └── Placeholder.java └── pom.xml ├── README.md └── pom.xml /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | target/ 3 | *.iml 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: java 3 | -------------------------------------------------------------------------------- /raml-tester-client/src/test/resources/guru/nidi/ramlproxy/v1/data.json: -------------------------------------------------------------------------------- 1 | 42 -------------------------------------------------------------------------------- /raml-tester-client/src/test/resources/guru/nidi/ramlproxy/v1/multi.json: -------------------------------------------------------------------------------- 1 | 42 -------------------------------------------------------------------------------- /raml-tester-client/src/test/resources/guru/nidi/ramlproxy/v1/multi.xml: -------------------------------------------------------------------------------- 1 | 42 -------------------------------------------------------------------------------- /raml-tester-client/src/test/resources/guru/nidi/ramlproxy/v1/POST-data.json: -------------------------------------------------------------------------------- 1 | 666 -------------------------------------------------------------------------------- /raml-tester-client/src/test/resources/guru/nidi/ramlproxy/v1/super/RESPONSE.json: -------------------------------------------------------------------------------- 1 | 163 -------------------------------------------------------------------------------- /raml-tester-client/src/test/resources/guru/nidi/ramlproxy/v1/super/META-RESPONSE.json: -------------------------------------------------------------------------------- 1 | { 2 | "headers": { 3 | "X-meta": true 4 | } 5 | } -------------------------------------------------------------------------------- /raml-tester-client/src/test/resources/guru/nidi/ramlproxy/v1/META-data.json: -------------------------------------------------------------------------------- 1 | { 2 | "code": 202, 3 | "headers": { 4 | "X-meta": "get!" 5 | } 6 | } -------------------------------------------------------------------------------- /raml-tester-client/src/test/resources/guru/nidi/ramlproxy/v1/META-POST-data.json: -------------------------------------------------------------------------------- 1 | { 2 | "code": 201, 3 | "headers": { 4 | "X-meta": [ 5 | "yes!", 6 | 5 7 | ] 8 | } 9 | } -------------------------------------------------------------------------------- /raml-tester-js/test/raml-tester.spec.js: -------------------------------------------------------------------------------- 1 | var rt = require('../lib/raml-tester'); 2 | 3 | describe('raml-tester', function () { 4 | it('', function () { 5 | rt.startCli() 6 | }); 7 | }); -------------------------------------------------------------------------------- /raml-tester-client/src/test/resources/guru/nidi/ramlproxy/github-meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "object", 3 | "properties": { 4 | "git": {"type": "array"}, 5 | "hooks": {"type": "array"}, 6 | "github_services_sha": {"type": "string"}, 7 | "verifiable_password_authentication": {"type": "boolean"} 8 | } 9 | } -------------------------------------------------------------------------------- /raml-tester-client/src/test/resources/guru/nidi/ramlproxy/github-meta.raml: -------------------------------------------------------------------------------- 1 | #%RAML 0.8 2 | --- 3 | title: github-meta 4 | baseUri: https://api.github.com 5 | version: v1 6 | 7 | /meta: 8 | get: 9 | responses: 10 | 200: 11 | body: 12 | application/json: 13 | schema: !include github-meta.json 14 | headers: 15 | Access-Control-{?}: 16 | Content-Security-Policy: -------------------------------------------------------------------------------- /raml-tester-client/src/main/resources/validation.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/schema#", 3 | "definitions": { 4 | "stringArray": { 5 | "type": "array", 6 | "additionalItems": false, 7 | "items": { 8 | "type": "string" 9 | } 10 | } 11 | }, 12 | "type": "object", 13 | "properties": { 14 | "ramlTitle": { 15 | "type": "string" 16 | }, 17 | "validationViolations": { 18 | "$ref": "#/definitions/stringArray" 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /raml-tester-js/src/raml-tester-cli: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const rt = require('raml-tester'), 4 | params = process.argv.slice(2), 5 | opts = rt.parseCli(params); 6 | 7 | switch (opts.mode) { 8 | case 'server': 9 | rt.start(opts, function (out) { 10 | console.log(out); 11 | }); 12 | break; 13 | case 'client': 14 | rt.command(opts, function (ok) { 15 | console.log(ok); 16 | }, function (fail) { 17 | console.log(fail); 18 | }); 19 | break; 20 | default: 21 | rt.help(function (out) { 22 | console.log(out); 23 | }); 24 | break; 25 | } 26 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "raml-tester", 3 | "version": "0.8.10-SNAPSHOT", 4 | "homepage": "https://github.com/nidi3/raml-tester-proxy/blob/master/raml-tester-js/README.md", 5 | "authors": [ 6 | "Stefan Niederhauser " 7 | ], 8 | "description": "Verify requests / responses against a RAML definition", 9 | "main": "raml-tester-js/lib/raml-tester-browser.js", 10 | "keywords": [ 11 | "RAML", 12 | "test" 13 | ], 14 | "license": "Apache-2.0", 15 | "ignore": [ 16 | "raml-tester-client/", 17 | "raml-tester-standalone/", 18 | ".travis.yml", 19 | "pom.xml" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /raml-tester-client/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{HH:mm:ss.SSS} %-5p - %-30C{30}: %m%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /raml-tester-client/src/test/resources/guru/nidi/ramlproxy/simple.raml: -------------------------------------------------------------------------------- 1 | #%RAML 0.8 2 | --- 3 | title: simple 4 | baseUri: http://nidi.guru/raml/{version} 5 | version: v1 6 | mediaType: application/default 7 | 8 | /data: 9 | post: 10 | body: 11 | application/x-www-form-urlencoded: 12 | formParameters: 13 | a: 14 | responses: 15 | 201: 16 | body: 17 | application/json: 18 | get: 19 | headers: 20 | head: 21 | queryParameters: 22 | q: 23 | responses: 24 | 200: 25 | body: 26 | application/json: 27 | schema: | 28 | {"type":"integer"} 29 | example: wrong 30 | headers: 31 | rh: 32 | 201: 33 | /other: 34 | /super/sub: 35 | /unused: 36 | get: 37 | -------------------------------------------------------------------------------- /raml-tester-client/src/main/java/guru/nidi/ramlproxy/Version.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014 Stefan Niederhauser (nidin@gmx.ch) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package guru.nidi.ramlproxy; 17 | 18 | public class Version { 19 | public static final String VERSION = "0.8.13-SNAPSHOT"; 20 | } 21 | -------------------------------------------------------------------------------- /raml-tester-standalone/src/main/java/guru/nidi/ramlproxy/Placeholder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014 Stefan Niederhauser (nidin@gmx.ch) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package guru.nidi.ramlproxy; 17 | 18 | /** 19 | * See sources of raml-tester-client project. 20 | */ 21 | public class Placeholder { 22 | } 23 | -------------------------------------------------------------------------------- /raml-tester-client/src/main/java/guru/nidi/ramlproxy/data/UsageDatas.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014 Stefan Niederhauser (nidin@gmx.ch) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package guru.nidi.ramlproxy.data; 17 | 18 | import java.util.HashMap; 19 | 20 | public class UsageDatas extends HashMap { 21 | 22 | } 23 | -------------------------------------------------------------------------------- /raml-tester-client/src/main/java/guru/nidi/ramlproxy/data/ViolationDatas.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014 Stefan Niederhauser (nidin@gmx.ch) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package guru.nidi.ramlproxy.data; 17 | 18 | import java.util.HashMap; 19 | import java.util.List; 20 | 21 | public class ViolationDatas extends HashMap> { 22 | } 23 | -------------------------------------------------------------------------------- /raml-tester-js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "raml-tester", 3 | "title": "Verify requests / responses against a RAML definition", 4 | "description": "Verify requests / responses against a RAML definition", 5 | "version": "0.8.10-SNAPSHOT", 6 | "homepage": "https://github.com/nidi3/raml-tester-proxy/blob/master/raml-tester-js/README.md", 7 | "private": false, 8 | "license": "Apache-2.0", 9 | "author": { 10 | "name": "Stefan Niederhauser ", 11 | "company": "" 12 | }, 13 | "bin": { 14 | "raml-tester": "bin/raml-tester-cli" 15 | }, 16 | "main": "lib/raml-tester.js", 17 | "repository": { 18 | "type": "git", 19 | "url": "https://github.com/nidi3/raml-tester-proxy.git" 20 | }, 21 | "devDependencies": { 22 | "chai": "~2.1.2", 23 | "grunt": "^0.4.5", 24 | "grunt-cli": "^0.1.13", 25 | "grunt-contrib-clean": "~0.6.0", 26 | "grunt-contrib-copy": "~0.8.0", 27 | "grunt-mocha-cli": "~1.12.0", 28 | "mocha": "~2.2.1" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /raml-tester-client/src/main/java/guru/nidi/ramlproxy/core/CommandContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014 Stefan Niederhauser (nidin@gmx.ch) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package guru.nidi.ramlproxy.core; 17 | 18 | import guru.nidi.ramlproxy.report.ReportSaver; 19 | import guru.nidi.ramltester.core.RamlReport; 20 | 21 | public interface CommandContext { 22 | void reloadRamlDefinition(); 23 | 24 | RamlReport validateRaml(); 25 | 26 | void stopProxy() throws Exception; 27 | 28 | ReportSaver getSaver(); 29 | } 30 | -------------------------------------------------------------------------------- /raml-tester-client/src/main/resources/usage.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/schema#", 3 | "definitions": { 4 | "stringArray": { 5 | "type": "array", 6 | "additionalItems": false, 7 | "items": {"type": "string"} 8 | } 9 | }, 10 | "type": "object", 11 | "patternProperties": { 12 | ".*": { 13 | "type": "object", 14 | "additionalProperties": false, 15 | "required": [ 16 | "unusedActions", 17 | "unusedResources", 18 | "unusedRequestHeaders", 19 | "unusedQueryParameters", 20 | "unusedFormParameters", 21 | "unusedResponseHeaders", 22 | "unusedResponseCodes" 23 | ], 24 | "properties": { 25 | "unusedActions": {"$ref": "#/definitions/stringArray"}, 26 | "unusedResources": {"$ref": "#/definitions/stringArray"}, 27 | "unusedRequestHeaders": {"$ref": "#/definitions/stringArray"}, 28 | "unusedQueryParameters": {"$ref": "#/definitions/stringArray"}, 29 | "unusedFormParameters": {"$ref": "#/definitions/stringArray"}, 30 | "unusedResponseHeaders": {"$ref": "#/definitions/stringArray"}, 31 | "unusedResponseCodes": {"$ref": "#/definitions/stringArray"} 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /raml-tester-client/src/main/java/guru/nidi/ramlproxy/cli/OptionComparator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014 Stefan Niederhauser (nidin@gmx.ch) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package guru.nidi.ramlproxy.cli; 17 | 18 | import org.apache.commons.cli.Option; 19 | 20 | import java.util.Comparator; 21 | 22 | class OptionComparator implements Comparator