Updated manual testing configuration and added postman scripts for it

This commit is contained in:
TomPallister 2016-10-29 20:14:55 +01:00
parent f7f4a392f0
commit 1acaaa23dd
3 changed files with 230 additions and 9 deletions

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Ocelot.Configuration.Parser;
@ -48,17 +49,25 @@ namespace Ocelot.Configuration.Creator
{
var response = _configurationValidator.IsValid(_options.Value);
var reRoutes = new List<ReRoute>();
if (!response.IsError && !response.Data.IsError)
if (response.Data.IsError)
{
var errorBuilder = new StringBuilder();
foreach (var error in response.Errors)
{
errorBuilder.AppendLine(error.Message);
}
throw new Exception($"Unable to start Ocelot..configuration, errors were {errorBuilder}");
}
var reRoutes = new List<ReRoute>();
foreach (var yamlReRoute in _options.Value.ReRoutes)
{
var ocelotReRoute = SetUpReRoute(yamlReRoute);
reRoutes.Add(ocelotReRoute);
}
}
return new OcelotConfiguration(reRoutes);
}

View File

@ -0,0 +1,184 @@
{
"id": "4dbde9fe-89f5-be35-bb9f-d3b438e16375",
"name": "Ocelot",
"description": "",
"order": [
"a1c95935-ed18-d5dc-bcb8-a3db8ba1934f",
"ea0ed57a-2cb9-8acc-47dd-006b8db2f1b2",
"c4494401-3985-a5bf-71fb-6e4171384ac6",
"09af8dda-a9cb-20d2-5ee3-0a3023773a1a",
"e8825dc3-4137-99a7-0000-ef5786610dc3",
"fddfc4fa-5114-69e3-4744-203ed71a526b",
"c45d30d7-d9c4-fa05-8110-d6e769bb6ff9",
"4684c2fa-f38c-c193-5f55-bf563a1978c6"
],
"folders": [],
"timestamp": 1477767328599,
"owner": "212120",
"public": false,
"requests": [
{
"id": "09af8dda-a9cb-20d2-5ee3-0a3023773a1a",
"headers": "",
"url": "http://localhost:5000/comments?postId=1",
"pathVariables": {},
"preRequestScript": null,
"method": "GET",
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375",
"data": null,
"dataMode": "params",
"name": "GET http://localhost:5000/comments?postId=1",
"description": "",
"descriptionFormat": "html",
"time": 1477768105592,
"version": 2,
"responses": [],
"tests": null,
"currentHelper": "normal",
"helperAttributes": {}
},
{
"id": "4684c2fa-f38c-c193-5f55-bf563a1978c6",
"headers": "",
"url": "http://localhost:5000/posts/1",
"pathVariables": {},
"preRequestScript": null,
"method": "DELETE",
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375",
"data": null,
"dataMode": "params",
"name": "DELETE http://localhost:5000/posts/1",
"description": "",
"descriptionFormat": "html",
"time": 1477768404376,
"version": 2,
"responses": [],
"tests": null,
"currentHelper": "normal",
"helperAttributes": {}
},
{
"id": "a1c95935-ed18-d5dc-bcb8-a3db8ba1934f",
"headers": "",
"url": "http://localhost:5000/posts",
"pathVariables": {},
"preRequestScript": null,
"method": "GET",
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375",
"data": null,
"dataMode": "params",
"name": "GET http://localhost:5000/posts",
"description": "",
"descriptionFormat": "html",
"time": 1477768007806,
"version": 2,
"responses": [],
"tests": null,
"currentHelper": "normal",
"helperAttributes": {}
},
{
"id": "c4494401-3985-a5bf-71fb-6e4171384ac6",
"headers": "",
"url": "http://localhost:5000/posts/1/comments",
"pathVariables": {},
"preRequestScript": null,
"method": "GET",
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375",
"data": null,
"dataMode": "params",
"name": "GET http://localhost:5000/posts/1/comments",
"description": "",
"descriptionFormat": "html",
"time": 1477768043524,
"version": 2,
"responses": [],
"tests": null,
"currentHelper": "normal",
"helperAttributes": {}
},
{
"id": "c45d30d7-d9c4-fa05-8110-d6e769bb6ff9",
"headers": "",
"url": "http://localhost:5000/posts/1",
"pathVariables": {},
"preRequestScript": null,
"method": "PATCH",
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375",
"data": [],
"dataMode": "raw",
"name": "PATCH http://localhost:5000/posts/1",
"description": "",
"descriptionFormat": "html",
"time": 1477768379775,
"version": 2,
"responses": [],
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
"rawModeData": "{\n \"title\": \"gfdgsgsdgsdfgsdfgdfg\",\n}"
},
{
"id": "e8825dc3-4137-99a7-0000-ef5786610dc3",
"headers": "",
"url": "http://localhost:5000/posts",
"pathVariables": {},
"preRequestScript": null,
"method": "POST",
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375",
"data": [],
"dataMode": "raw",
"name": "POST http://localhost:5000/posts/1",
"description": "",
"descriptionFormat": "html",
"time": 1477768186023,
"version": 2,
"responses": [],
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
"rawModeData": "{\n \"userId\": 1,\n \"title\": \"test\",\n \"body\": \"test\"\n}"
},
{
"id": "ea0ed57a-2cb9-8acc-47dd-006b8db2f1b2",
"headers": "",
"url": "http://localhost:5000/posts/1",
"pathVariables": {},
"preRequestScript": null,
"method": "GET",
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375",
"data": null,
"dataMode": "params",
"name": "GET http://localhost:5000/posts/1",
"description": "",
"descriptionFormat": "html",
"time": 1477768023989,
"version": 2,
"responses": [],
"tests": null,
"currentHelper": "normal",
"helperAttributes": {}
},
{
"id": "fddfc4fa-5114-69e3-4744-203ed71a526b",
"headers": "",
"url": "http://localhost:5000/posts/1",
"pathVariables": {},
"preRequestScript": null,
"method": "PUT",
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375",
"data": [],
"dataMode": "raw",
"name": "PUT http://localhost:5000/posts/1",
"description": "",
"descriptionFormat": "html",
"time": 1477768307036,
"version": 2,
"responses": [],
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
"rawModeData": "{\n \"userId\": 1,\n \"title\": \"test\",\n \"body\": \"test\"\n}"
}
]
}

View File

@ -54,3 +54,31 @@ RouteClaimsRequirement:
- DownstreamTemplate: http://jsonplaceholder.typicode.com/posts
UpstreamTemplate: /posts
UpstreamHttpMethod: Get
# The next re route...
- DownstreamTemplate: http://jsonplaceholder.typicode.com/posts/{postId}
UpstreamTemplate: /posts/{postId}
UpstreamHttpMethod: Get
# The next re route...
- DownstreamTemplate: http://jsonplaceholder.typicode.com/posts/{postId}/comments
UpstreamTemplate: /posts/{postId}/comments
UpstreamHttpMethod: Get
# The next re route...
- DownstreamTemplate: http://jsonplaceholder.typicode.com/comments
UpstreamTemplate: /comments
UpstreamHttpMethod: Get
# The next re route...
- DownstreamTemplate: http://jsonplaceholder.typicode.com/posts
UpstreamTemplate: /posts
UpstreamHttpMethod: Post
# The next re route...
- DownstreamTemplate: http://jsonplaceholder.typicode.com/posts/{postId}
UpstreamTemplate: /posts/{postId}
UpstreamHttpMethod: Put
# The next re route...
- DownstreamTemplate: http://jsonplaceholder.typicode.com/posts/{postId}
UpstreamTemplate: /posts/{postId}
UpstreamHttpMethod: Patch
# The next re route...
- DownstreamTemplate: http://jsonplaceholder.typicode.com/posts/{postId}
UpstreamTemplate: /posts/{postId}
UpstreamHttpMethod: Delete