Skip to content

Commit

Permalink
Merge branch 'master' into rj.deps
Browse files Browse the repository at this point in the history
  • Loading branch information
ravirajj committed Oct 10, 2017
2 parents 57a8e7e + 4cc6c32 commit a629fea
Show file tree
Hide file tree
Showing 73 changed files with 1,314 additions and 1,045 deletions.
4 changes: 2 additions & 2 deletions Makefile
Expand Up @@ -41,12 +41,12 @@ fix-licence:
eclint-check:
@echo "Checking eclint..."
@ls ./node_modules/.bin/eclint >/dev/null 2>&1 || npm i eclint@v1.1.5
@./node_modules/.bin/eclint check "./{codegen,examples}/**/*.{json,tmpl}"
@./node_modules/.bin/eclint check "./{codegen,examples,backend}/**/*.{json,tmpl}"

.PHONY: eclint-fix
eclint-fix:
@ls ./node_modules/.bin/eclint >/dev/null 2>&1 || npm i eclint@v1.1.5
./node_modules/.bin/eclint fix "./{codegen,examples}/**/*.{json,tmpl}"
./node_modules/.bin/eclint fix "./{codegen,examples,backend}/**/*.{json,tmpl}"

.PHONY: spell-check
spell-check:
Expand Down
57 changes: 13 additions & 44 deletions backend/repository/config.go
Expand Up @@ -56,50 +56,19 @@ type ThriftServiceMap map[string]map[string]*ThriftService

// EndpointConfig stores configuration for an endpoint.
type EndpointConfig struct {
ID string `json:"endpointId"`
Type ProtocolType `json:"endpointType"`
HandleID string `json:"handleId"`
ThriftFile string `json:"thriftFile"`
ThriftFileSha string `json:"thriftFileSha,omitempty"`
ThriftMethodName string `json:"thriftMethodName"`
WorkflowType string `json:"workflowType"`
ClientID string `json:"clientID"`
ClientMethod string `json:"clientMethod"`
TestFixtures []*TestStub `json:"testFixtures"`
Middlewares []*codegen.MiddlewareSpec `json:"middlewares"`
ReqHeaderMap map[string]string `json:"reqHeaderMap"`
ResHeaderMap map[string]string `json:"resHeaderMap"`
}

// TestStub saves stubbed requests/responses for an endpoint test.
type TestStub struct {
TestName string `json:"testName"`
EndpointID string `json:"endpointId"`
HandlerID string `json:"handlerId"`
EndpointRequest map[string]interface{} `json:"endpointRequest"`
EndpointRequestString string `json:"endpointRequestString"`
EndpointReqHeaders map[string]string `json:"endpointReqHeaders"`
EndpointReqHeaderKeys []string `json:"endpointReqHeaderKeys"`
EndpointResponse map[string]interface{} `json:"endpointResponse"`
EndpointResponseString string `json:"endpointResponseString"`
EndpointResHeaders map[string]string `json:"endpointResHeaders"`
EndpointResHeaderKeys []string `json:"endpointResHeaderKeys"`
ClientStubs []ClientStub `json:"clientStubs"`
TestServiceName string `json:"testServiceName"`
}

// ClientStub saves stubbed client request/response for an endpoint test.
type ClientStub struct {
ClientID string `json:"clientId"`
ClientMethod string `json:"clientMethod"`
ClientRequest map[string]interface{} `json:"clientRequest"`
ClientRequestString string `json:"clientRequestString"`
ClientReqHeaders map[string]string `json:"clientReqHeaders"`
ClientReqHeaderKeys []string `json:"clientReqHeaderKeys"`
ClientResponse map[string]interface{} `json:"clientResponse"`
ClientResponseString string `json:"clientResponseString"`
ClientResHeaders map[string]string `json:"clientResHeaders"`
ClientResHeaderKeys []string `json:"clientResHeaderKeys"`
ID string `json:"endpointId"`
Type ProtocolType `json:"endpointType"`
HandleID string `json:"handleId"`
ThriftFile string `json:"thriftFile"`
ThriftFileSha string `json:"thriftFileSha,omitempty"`
ThriftMethodName string `json:"thriftMethodName"`
WorkflowType string `json:"workflowType"`
ClientID string `json:"clientId"`
ClientMethod string `json:"clientMethod"`
TestFixtures map[string]*codegen.EndpointTestFixture `json:"testFixtures"`
Middlewares []*codegen.MiddlewareSpec `json:"middlewares"`
ReqHeaderMap map[string]string `json:"reqHeaderMap"`
ResHeaderMap map[string]string `json:"resHeaderMap"`
}

// ClientConfig stores configuration for an client.
Expand Down
62 changes: 31 additions & 31 deletions backend/repository/data/client/baz_client_update.json
@@ -1,33 +1,33 @@
{
"_comment_": "JSON for updating a tchannel client.",
"name": "baz",
"type": "tchannel",
"thriftFile": "clients/baz/baz.thrift",
"serviceName": "Qux",
"exposedMethods": {
"Call": "SimpleService::call",
"Compare": "SimpleService::compare",
"DeliberateDiffNoop": "SimpleService::sillyNoop",
"EchoI8": "SecondService::echoI8",
"EchoI16": "SecondService::echoI16",
"EchoI32": "SecondService::echoI32",
"EchoI64": "SecondService::echoI64",
"EchoDouble": "SecondService::echoDouble",
"EchoBool": "SecondService::echoBool",
"EchoBinary": "SecondService::echoBinary",
"EchoString": "SecondService::echoString",
"EchoEnum": "SecondService::echoEnum",
"EchoTypedef": "SecondService::echoTypedef",
"EchoStringSet": "SecondService::echoStringSet",
"EchoStructSet": "SecondService::echoStructSet",
"EchoStringList": "SecondService::echoStringList",
"EchoStructList": "SecondService::echoStructList",
"EchoStringMap": "SecondService::echoStringMap",
"EchoStructMap": "SecondService::echoStructMap",
"Ping": "SimpleService::ping"
},
"ip": "127.0.0.1",
"port": 4002,
"clientTimeout": 10000,
"clientTimeoutPerAttempt": 2000
"_comment_": "JSON for updating a tchannel client.",
"name": "baz",
"type": "tchannel",
"thriftFile": "clients/baz/baz.thrift",
"serviceName": "Qux",
"exposedMethods": {
"Call": "SimpleService::call",
"Compare": "SimpleService::compare",
"DeliberateDiffNoop": "SimpleService::sillyNoop",
"EchoI8": "SecondService::echoI8",
"EchoI16": "SecondService::echoI16",
"EchoI32": "SecondService::echoI32",
"EchoI64": "SecondService::echoI64",
"EchoDouble": "SecondService::echoDouble",
"EchoBool": "SecondService::echoBool",
"EchoBinary": "SecondService::echoBinary",
"EchoString": "SecondService::echoString",
"EchoEnum": "SecondService::echoEnum",
"EchoTypedef": "SecondService::echoTypedef",
"EchoStringSet": "SecondService::echoStringSet",
"EchoStructSet": "SecondService::echoStructSet",
"EchoStringList": "SecondService::echoStringList",
"EchoStructList": "SecondService::echoStructList",
"EchoStringMap": "SecondService::echoStringMap",
"EchoStructMap": "SecondService::echoStructMap",
"Ping": "SimpleService::ping"
},
"ip": "127.0.0.1",
"port": 4002,
"clientTimeout": 10000,
"clientTimeoutPerAttempt": 2000
}
18 changes: 9 additions & 9 deletions backend/repository/data/client/contacts_client_update.json
@@ -1,11 +1,11 @@
{
"_comment_": "JSON for updating a HTTP client",
"name": "contacts",
"type": "http",
"thriftFile": "clients/contacts/contacts.thrift",
"exposedMethods": {
"SaveContacts": "Contacts::saveContacts"
},
"ip": "127.0.0.1",
"port": 4000
"_comment_": "JSON for updating a HTTP client",
"name": "contacts",
"type": "http",
"thriftFile": "clients/contacts/contacts.thrift",
"exposedMethods": {
"SaveContacts": "Contacts::saveContacts"
},
"ip": "127.0.0.1",
"port": 4000
}
73 changes: 44 additions & 29 deletions backend/repository/data/endpoint_config_updated_expected.json
Expand Up @@ -6,53 +6,68 @@
"thriftFileSha": "v1",
"thriftMethodName": "SimpleService::compare",
"workflowType": "tchannelClient",
"clientID": "baz",
"clientId": "baz",
"clientMethod": "Compare",
"testFixtures": [
{
"testFixtures": {
"successfulRequest": {
"testName": "successfulRequest",
"endpointId": "baz",
"handlerId": "compare",
"handleId": "compare",
"endpointRequest": {
"arg1": {
"b1": true,
"i3": 42,
"s2": "hello"
},
"arg2": {
"b1": true,
"i3": 42,
"s2": "hola"
"requestType": "http",
"httpRequest": {
"method": "POST",
"body": {
"bodyType": "json",
"bodyJson": {
"arg1": {
"b1": true,
"i3": 42,
"s2": "hello"
},
"arg2": {
"b1": true,
"i3": 42,
"s2": "hola"
}
}
}
}
},
"endpointRequestString": "",
"endpointReqHeaders": {},
"endpointReqHeaderKeys": null,
"endpointResponse": {
"message": "different"
"responseType": "http",
"httpResponse": {
"statusCode": 200,
"body": {
"bodyType": "json",
"bodyJson": {
"message": "different"
}
}
}
},
"endpointResponseString": "",
"endpointResHeaders": {},
"endpointResHeaderKeys": null,
"clientStubs": [
{
"clientTestFixtures": {
"baz::compare": {
"clientId": "baz",
"clientMethod": "compare",
"clientRequest": {},
"clientRequestString": "",
"clientRequest": {
"requestType": "tchannel"
},
"clientReqHeaders": {},
"clientReqHeaderKeys": null,
"clientResponse": {
"message": "different"
"responseType": "tchannel",
"tchannelResponse": {
"message": "different"
}
},
"clientResponseString": "",
"clientResHeaders": {},
"clientResHeaderKeys": null
"clientResHeaders": {}
}
],
},
"testServiceName": "example-gateway"
}
],
},
"middlewares": [],
"reqHeaderMap": {},
"resHeaderMap": {}
Expand Down

0 comments on commit a629fea

Please sign in to comment.