-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generator: fix extractServices slice index (#45)
* generator: fix extractServices slice index Signed-off-by: Guillaume Delbergue <[email protected]> * multifiles test Co-authored-by: Ahmad Muzakki <[email protected]>
- Loading branch information
Showing
10 changed files
with
537 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"log" | ||
"time" | ||
|
||
pb "github.com/tokopedia/gripmock/example/multi-files" | ||
"google.golang.org/grpc" | ||
) | ||
|
||
func main() { | ||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) | ||
defer cancel() | ||
|
||
// Set up a connection to the server. | ||
conn, err := grpc.DialContext(ctx, "localhost:4770", grpc.WithInsecure(), grpc.WithBlock()) | ||
if err != nil { | ||
log.Fatalf("did not connect: %v", err) | ||
} | ||
defer conn.Close() | ||
|
||
c := pb.NewGripmock1Client(conn) | ||
|
||
// Contact the server and print out its response. | ||
r, err := c.SayHello(context.Background(), &pb.Request1{Name: "tokopedia"}) | ||
if err != nil { | ||
log.Fatalf("error from grpc: %v", err) | ||
} | ||
log.Printf("Greeting: %s", r.Message) | ||
|
||
c2 := pb.NewGripmock2Client(conn) | ||
|
||
// Contact the server and print out its response. | ||
r2, err := c2.SayHello(context.Background(), &pb.Request2{Name: "tokopedia"}) | ||
if err != nil { | ||
log.Fatalf("error from grpc: %v", err) | ||
} | ||
log.Printf("Greeting: %s", r2.Message) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env sh | ||
|
||
# this file is used by .github/workflows/integration-test.yml | ||
|
||
gripmock --stub=example/multi-files/stub example/multi-files/file1.proto example/multi-files/file2.proto & | ||
|
||
go run example/multi-files/client/*.go |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
syntax = "proto3"; | ||
|
||
package multifiles; | ||
|
||
// The Gripmock service definition. | ||
service Gripmock1 { | ||
// simple unary method | ||
rpc SayHello (Request1) returns (Reply1); | ||
} | ||
|
||
// The request message containing the user's name. | ||
message Request1 { | ||
string name = 1; | ||
} | ||
|
||
// The response message containing the greetings | ||
message Reply1 { | ||
string message = 1; | ||
int32 return_code = 2; | ||
} |
Oops, something went wrong.