Skip to content

Commit

Permalink
Merge 0314c85 into 0151745
Browse files Browse the repository at this point in the history
  • Loading branch information
ChuntaoLu committed Mar 28, 2017
2 parents 0151745 + 0314c85 commit 61a60a5
Show file tree
Hide file tree
Showing 19 changed files with 87 additions and 89 deletions.
2 changes: 1 addition & 1 deletion benchmarks/benchserver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var PORT int32 = 8092

func main() {
logger := zap.New(zap.NewJSONEncoder())
backend := testBackend.CreateBackend(PORT)
backend := testBackend.CreateHTTPBackend(PORT)
err := backend.Bootstrap()
if err != nil {
panic(err)
Expand Down
4 changes: 2 additions & 2 deletions codegen/templates/endpoint_test.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func Test{{.HandlerID | Title}}{{.TestName | Title}}OKResponse(t *testing.T) {
var counter int

gateway, err := testGateway.CreateGateway(t, nil, &testGateway.Options{
KnownBackends: []string{"{{$clientName | camel}}"},
KnownHTTPBackends: []string{"{{$clientName | camel}}"},
TestBinary: filepath.Join(
getDirName(), "..", "..", "main.go",
),
Expand All @@ -51,7 +51,7 @@ func Test{{.HandlerID | Title}}{{.TestName | Title}}OKResponse(t *testing.T) {
counter++
}

gateway.Backends()["{{$clientName | camel}}"].HandleFunc(
gateway.HTTPBackends()["{{$clientName | camel}}"].HandleFunc(
"{{$clientMethod.HTTPMethod}}", "{{$clientMethod.HTTPPath}}", fake{{.ClientMethod | Title}},
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestArgNotStructSuccessfulRequestOKResponse(t *testing.T) {
var counter int

gateway, err := testGateway.CreateGateway(t, nil, &testGateway.Options{
KnownBackends: []string{"bar"},
KnownHTTPBackends: []string{"bar"},
TestBinary: filepath.Join(
getDirName(), "..", "..", "main.go",
),
Expand All @@ -36,7 +36,7 @@ func TestArgNotStructSuccessfulRequestOKResponse(t *testing.T) {
counter++
}

gateway.Backends()["bar"].HandleFunc(
gateway.HTTPBackends()["bar"].HandleFunc(
"POST", "/arg-not-struct-path", fakeArgNotStruct,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestMissingArgSuccessfulRequestOKResponse(t *testing.T) {
var counter int

gateway, err := testGateway.CreateGateway(t, nil, &testGateway.Options{
KnownBackends: []string{"bar"},
KnownHTTPBackends: []string{"bar"},
TestBinary: filepath.Join(
getDirName(), "..", "..", "main.go",
),
Expand All @@ -36,7 +36,7 @@ func TestMissingArgSuccessfulRequestOKResponse(t *testing.T) {
counter++
}

gateway.Backends()["bar"].HandleFunc(
gateway.HTTPBackends()["bar"].HandleFunc(
"GET", "/missing-arg-path", fakeMissingArg,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestNoRequestSuccessfulRequestOKResponse(t *testing.T) {
var counter int

gateway, err := testGateway.CreateGateway(t, nil, &testGateway.Options{
KnownBackends: []string{"bar"},
KnownHTTPBackends: []string{"bar"},
TestBinary: filepath.Join(
getDirName(), "..", "..", "main.go",
),
Expand All @@ -36,7 +36,7 @@ func TestNoRequestSuccessfulRequestOKResponse(t *testing.T) {
counter++
}

gateway.Backends()["bar"].HandleFunc(
gateway.HTTPBackends()["bar"].HandleFunc(
"GET", "/no-request-path", fakeNoRequest,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestNormalSuccessfulRequestOKResponse(t *testing.T) {
var counter int

gateway, err := testGateway.CreateGateway(t, nil, &testGateway.Options{
KnownBackends: []string{"bar"},
KnownHTTPBackends: []string{"bar"},
TestBinary: filepath.Join(
getDirName(), "..", "..", "main.go",
),
Expand All @@ -36,7 +36,7 @@ func TestNormalSuccessfulRequestOKResponse(t *testing.T) {
counter++
}

gateway.Backends()["bar"].HandleFunc(
gateway.HTTPBackends()["bar"].HandleFunc(
"POST", "/bar-path", fakeNormal,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestTooManyArgsSuccessfulRequestOKResponse(t *testing.T) {
var counter int

gateway, err := testGateway.CreateGateway(t, nil, &testGateway.Options{
KnownBackends: []string{"bar"},
KnownHTTPBackends: []string{"bar"},
TestBinary: filepath.Join(
getDirName(), "..", "..", "main.go",
),
Expand All @@ -36,7 +36,7 @@ func TestTooManyArgsSuccessfulRequestOKResponse(t *testing.T) {
counter++
}

gateway.Backends()["bar"].HandleFunc(
gateway.HTTPBackends()["bar"].HandleFunc(
"POST", "/too-many-args-path", fakeTooManyArgs,
)

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions test/endpoints/contacts/save-contacts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ var benchBytes = []byte("{\"contacts\":[{\"fragments\":[{\"type\":\"message\",\"

func BenchmarkSaveContacts(b *testing.B) {
gateway, err := benchGateway.CreateGateway(nil, &testGateway.Options{
KnownBackends: []string{"contacts"},
KnownHTTPBackends: []string{"contacts"},
})
if err != nil {
b.Error("got bootstrap err: " + err.Error())
return
}

gateway.Backends()["contacts"].HandleFunc(
gateway.HTTPBackends()["contacts"].HandleFunc(
"POST", "/foo/contacts", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(202)
_, _ = w.Write([]byte("{}"))
Expand Down Expand Up @@ -94,7 +94,7 @@ func TestSaveContactsCall(t *testing.T) {
var counter int = 0

gateway, err := testGateway.CreateGateway(t, nil, &testGateway.Options{
KnownBackends: []string{"contacts"},
KnownHTTPBackends: []string{"contacts"},
TestBinary: filepath.Join(
getDirName(), "..", "..", "..",
"examples", "example-gateway", "build", "main.go",
Expand All @@ -105,7 +105,7 @@ func TestSaveContactsCall(t *testing.T) {
}
defer gateway.Close()

gateway.Backends()["contacts"].HandleFunc(
gateway.HTTPBackends()["contacts"].HandleFunc(
"POST", "/foo/contacts", func(w http.ResponseWriter, r *http.Request) {
counter++
w.WriteHeader(202)
Expand Down
Loading

0 comments on commit 61a60a5

Please sign in to comment.