|
|
@ -38,7 +38,7 @@ |
|
|
|
#import <gRPC/GRPCMethodName.h> |
|
|
|
#import <gRPC/GRPCMethodName.h> |
|
|
|
#import <gRPC/GRXWriter+Immediate.h> |
|
|
|
#import <gRPC/GRXWriter+Immediate.h> |
|
|
|
#import <gRPC/GRXWriteable.h> |
|
|
|
#import <gRPC/GRXWriteable.h> |
|
|
|
#import <Route_guide/Route_guide.pb.h> |
|
|
|
#import <Route_guide/RouteGuide.pbobjc.h> |
|
|
|
|
|
|
|
|
|
|
|
@interface SampleTests : XCTestCase |
|
|
|
@interface SampleTests : XCTestCase |
|
|
|
@end |
|
|
|
@end |
|
|
@ -105,15 +105,15 @@ |
|
|
|
|
|
|
|
|
|
|
|
- (void)testSimpleProtoRPC { |
|
|
|
- (void)testSimpleProtoRPC { |
|
|
|
__weak XCTestExpectation *response = [self expectationWithDescription:@"Response received."]; |
|
|
|
__weak XCTestExpectation *response = [self expectationWithDescription:@"Response received."]; |
|
|
|
__weak XCTestExpectation *expectedResponse = |
|
|
|
|
|
|
|
[self expectationWithDescription:@"Expected response."]; |
|
|
|
|
|
|
|
__weak XCTestExpectation *completion = [self expectationWithDescription:@"RPC completed."]; |
|
|
|
__weak XCTestExpectation *completion = [self expectationWithDescription:@"RPC completed."]; |
|
|
|
|
|
|
|
|
|
|
|
GRPCMethodName *method = [[GRPCMethodName alloc] initWithPackage:@"grpc.example.routeguide" |
|
|
|
GRPCMethodName *method = [[GRPCMethodName alloc] initWithPackage:@"grpc.example.routeguide" |
|
|
|
interface:@"RouteGuide" |
|
|
|
interface:@"RouteGuide" |
|
|
|
method:@"GetFeature"]; |
|
|
|
method:@"GetFeature"]; |
|
|
|
|
|
|
|
|
|
|
|
RGDPoint *point = [[[[[RGDPointBuilder alloc] init] setLatitude:28E7] setLongitude:-15E7] build]; |
|
|
|
RGDPoint *point = [RGDPoint message]; |
|
|
|
|
|
|
|
point.latitude = 28E7; |
|
|
|
|
|
|
|
point.longitude = -15E7; |
|
|
|
id<GRXWriter> requestsWriter = [GRXWriter writerWithValue:[point data]]; |
|
|
|
id<GRXWriter> requestsWriter = [GRXWriter writerWithValue:[point data]]; |
|
|
|
|
|
|
|
|
|
|
|
GRPCCall *call = [[GRPCCall alloc] initWithHost:@"http://127.0.0.1:8980" |
|
|
|
GRPCCall *call = [[GRPCCall alloc] initWithHost:@"http://127.0.0.1:8980" |
|
|
@ -122,11 +122,10 @@ |
|
|
|
|
|
|
|
|
|
|
|
id<GRXWriteable> responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) { |
|
|
|
id<GRXWriteable> responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) { |
|
|
|
XCTAssertNotNil(value, @"nil value received as response."); |
|
|
|
XCTAssertNotNil(value, @"nil value received as response."); |
|
|
|
[response fulfill]; |
|
|
|
|
|
|
|
RGDFeature *feature = [RGDFeature parseFromData:value]; |
|
|
|
RGDFeature *feature = [RGDFeature parseFromData:value]; |
|
|
|
XCTAssertEqualObjects(point, feature.location); |
|
|
|
XCTAssertEqualObjects(point, feature.location); |
|
|
|
XCTAssertNotNil(feature.name, @"Response's name is nil."); |
|
|
|
XCTAssertNotNil(feature.name, @"Response's name is nil."); |
|
|
|
[expectedResponse fulfill]; |
|
|
|
[response fulfill]; |
|
|
|
} completionHandler:^(NSError *errorOrNil) { |
|
|
|
} completionHandler:^(NSError *errorOrNil) { |
|
|
|
XCTAssertNil(errorOrNil, @"Finished with unexpected error: %@", errorOrNil); |
|
|
|
XCTAssertNil(errorOrNil, @"Finished with unexpected error: %@", errorOrNil); |
|
|
|
[completion fulfill]; |
|
|
|
[completion fulfill]; |
|
|
|