io.grpc.reflection.testing.ReflectionTestDepthThreeProto Java Examples

The following examples show how to use io.grpc.reflection.testing.ReflectionTestDepthThreeProto. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProtoReflectionServiceTest.java    From grpc-nebula-java with Apache License 2.0 6 votes vote down vote up
@Test
public void fileContainingNestedSymbol() throws Exception {
  ServerReflectionRequest request =
      ServerReflectionRequest.newBuilder()
          .setHost(TEST_HOST)
          .setFileContainingSymbol("grpc.reflection.testing.NestedTypeOuter.Middle.Inner")
          .build();

  ServerReflectionResponse goldenResponse =
      ServerReflectionResponse.newBuilder()
          .setValidHost(TEST_HOST)
          .setOriginalRequest(request)
          .setFileDescriptorResponse(
              FileDescriptorResponse.newBuilder()
                  .addFileDescriptorProto(
                      ReflectionTestDepthThreeProto.getDescriptor().toProto().toByteString())
                  .build())
          .build();

  StreamRecorder<ServerReflectionResponse> responseObserver = StreamRecorder.create();
  StreamObserver<ServerReflectionRequest> requestObserver =
      stub.serverReflectionInfo(responseObserver);
  requestObserver.onNext(request);
  requestObserver.onCompleted();
  assertEquals(goldenResponse, responseObserver.firstValue().get());
}
 
Example #2
Source File: GrpcReflectionTest.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@Test
public void testRetrievingFilesByFileName() {
    ServerReflectionRequest request = ServerReflectionRequest.newBuilder()
            .setHost("localhost")
            .setFileByFilename("reflection/reflection_test_depth_three.proto")
            .build();

    ServerReflectionResponse expected = ServerReflectionResponse.newBuilder()
            .setValidHost("localhost")
            .setOriginalRequest(request)
            .setFileDescriptorResponse(
                    FileDescriptorResponse.newBuilder()
                            .addFileDescriptorProto(
                                    ReflectionTestDepthThreeProto.getDescriptor().toProto().toByteString())
                            .build())
            .build();

    ServerReflectionResponse response = invoke(request);
    assertThat(response).isEqualTo(expected);
}
 
Example #3
Source File: GrpcReflectionTest.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@Test
public void testRetrievingFilesContainingSymbol() {
    ServerReflectionRequest request = ServerReflectionRequest.newBuilder()
            .setHost("localhost")
            .setFileContainingSymbol("grpc.reflection.testing.ReflectableService.Method")
            .build();

    List<ByteString> responses = Arrays.asList(
            ReflectionTestProto.getDescriptor().toProto().toByteString(),
            ReflectionTestDepthTwoProto.getDescriptor().toProto().toByteString(),
            ReflectionTestDepthThreeProto.getDescriptor().toProto().toByteString());

    ServerReflectionResponse response = invoke(request);
    List<ByteString> list = response.getFileDescriptorResponse().getFileDescriptorProtoList();
    assertThat(list).containsExactlyInAnyOrderElementsOf(responses);
}
 
Example #4
Source File: GrpcReflectionTest.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@Test
public void testRetrievingFilesContainingNestedSymbol() {
    ServerReflectionRequest request = ServerReflectionRequest.newBuilder()
            .setHost("localhost")
            .setFileContainingSymbol("grpc.reflection.testing.NestedTypeOuter.Middle.Inner")
            .build();
    ServerReflectionResponse expected = ServerReflectionResponse.newBuilder()
            .setValidHost("localhost")
            .setOriginalRequest(request)
            .setFileDescriptorResponse(
                    FileDescriptorResponse.newBuilder()
                            .addFileDescriptorProto(
                                    ReflectionTestDepthThreeProto.getDescriptor().toProto().toByteString())
                            .build())
            .build();
    ServerReflectionResponse resp = invoke(request);
    assertThat(resp).isEqualTo(expected);
}
 
Example #5
Source File: GrpcReflectionTest.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@Test
public void testRetrievingFilesContainingExtension() {
    ServerReflectionRequest request = ServerReflectionRequest.newBuilder()
            .setHost("localhost")
            .setFileContainingExtension(
                    ExtensionRequest.newBuilder()
                            .setContainingType("grpc.reflection.testing.ThirdLevelType")
                            .setExtensionNumber(100)
                            .build())
            .build();

    List<ByteString> expected = Arrays.asList(
            ReflectionTestProto.getDescriptor().toProto().toByteString(),
            ReflectionTestDepthTwoProto.getDescriptor().toProto().toByteString(),
            ReflectionTestDepthThreeProto.getDescriptor().toProto().toByteString());

    ServerReflectionResponse response = invoke(request);
    assertThat(response.getFileDescriptorResponse().getFileDescriptorProtoList())
            .containsExactlyInAnyOrderElementsOf(expected);
}
 
Example #6
Source File: GrpcReflectionTest.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@Test
public void testRetrievingFilesContainingNestedExtension() {
    ServerReflectionRequest request = ServerReflectionRequest.newBuilder()
            .setHost("localhost")
            .setFileContainingExtension(
                    ExtensionRequest.newBuilder()
                            .setContainingType("grpc.reflection.testing.ThirdLevelType")
                            .setExtensionNumber(101)
                            .build())
            .build();

    ServerReflectionResponse expected = ServerReflectionResponse.newBuilder()
            .setValidHost("localhost")
            .setOriginalRequest(request)
            .setFileDescriptorResponse(
                    FileDescriptorResponse.newBuilder()
                            .addFileDescriptorProto(
                                    ReflectionTestDepthTwoProto.getDescriptor().toProto().toByteString())
                            .addFileDescriptorProto(
                                    ReflectionTestDepthThreeProto.getDescriptor().toProto().toByteString())
                            .build())
            .build();

    ServerReflectionResponse response = invoke(request);
    assertThat(response).isEqualTo(expected);
}
 
Example #7
Source File: ProtoReflectionServiceTest.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
@Test
public void fileContainingNestedSymbol() throws Exception {
  ServerReflectionRequest request =
      ServerReflectionRequest.newBuilder()
          .setHost(TEST_HOST)
          .setFileContainingSymbol("grpc.reflection.testing.NestedTypeOuter.Middle.Inner")
          .build();

  ServerReflectionResponse goldenResponse =
      ServerReflectionResponse.newBuilder()
          .setValidHost(TEST_HOST)
          .setOriginalRequest(request)
          .setFileDescriptorResponse(
              FileDescriptorResponse.newBuilder()
                  .addFileDescriptorProto(
                      ReflectionTestDepthThreeProto.getDescriptor().toProto().toByteString())
                  .build())
          .build();

  StreamRecorder<ServerReflectionResponse> responseObserver = StreamRecorder.create();
  StreamObserver<ServerReflectionRequest> requestObserver =
      stub.serverReflectionInfo(responseObserver);
  requestObserver.onNext(request);
  requestObserver.onCompleted();
  assertEquals(goldenResponse, responseObserver.firstValue().get());
}
 
Example #8
Source File: ProtoReflectionServiceTest.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
@Test
public void fileByFilename() throws Exception {
  ServerReflectionRequest request =
      ServerReflectionRequest.newBuilder()
          .setHost(TEST_HOST)
          .setFileByFilename("io/grpc/reflection/testing/reflection_test_depth_three.proto")
          .build();

  ServerReflectionResponse goldenResponse =
      ServerReflectionResponse.newBuilder()
          .setValidHost(TEST_HOST)
          .setOriginalRequest(request)
          .setFileDescriptorResponse(
              FileDescriptorResponse.newBuilder()
                  .addFileDescriptorProto(
                      ReflectionTestDepthThreeProto.getDescriptor().toProto().toByteString())
                  .build())
          .build();

  StreamRecorder<ServerReflectionResponse> responseObserver = StreamRecorder.create();
  StreamObserver<ServerReflectionRequest> requestObserver =
      stub.serverReflectionInfo(responseObserver);
  requestObserver.onNext(request);
  requestObserver.onCompleted();

  assertEquals(goldenResponse, responseObserver.firstValue().get());
}
 
Example #9
Source File: ProtoReflectionServiceTest.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
@Test
public void fileContainingSymbol() throws Exception {
  ServerReflectionRequest request =
      ServerReflectionRequest.newBuilder()
          .setHost(TEST_HOST)
          .setFileContainingSymbol("grpc.reflection.testing.ReflectableService.Method")
          .build();

  List<ByteString> goldenResponse =
      Arrays.asList(
          ReflectionTestProto.getDescriptor().toProto().toByteString(),
          ReflectionTestDepthTwoProto.getDescriptor().toProto().toByteString(),
          ReflectionTestDepthTwoAlternateProto.getDescriptor().toProto().toByteString(),
          ReflectionTestDepthThreeProto.getDescriptor().toProto().toByteString());

  StreamRecorder<ServerReflectionResponse> responseObserver = StreamRecorder.create();
  StreamObserver<ServerReflectionRequest> requestObserver =
      stub.serverReflectionInfo(responseObserver);
  requestObserver.onNext(request);
  requestObserver.onCompleted();

  List<ByteString> response =
      responseObserver
          .firstValue()
          .get()
          .getFileDescriptorResponse()
          .getFileDescriptorProtoList();
  assertEquals(goldenResponse.size(), response.size());
  assertEquals(new HashSet<ByteString>(goldenResponse), new HashSet<ByteString>(response));
}
 
Example #10
Source File: ProtoReflectionServiceTest.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
@Test
public void fileContainingExtension() throws Exception {
  ServerReflectionRequest request =
      ServerReflectionRequest.newBuilder()
          .setHost(TEST_HOST)
          .setFileContainingExtension(
              ExtensionRequest.newBuilder()
                  .setContainingType("grpc.reflection.testing.ThirdLevelType")
                  .setExtensionNumber(100)
                  .build())
          .build();

  List<ByteString> goldenResponse =
      Arrays.asList(
          ReflectionTestProto.getDescriptor().toProto().toByteString(),
          ReflectionTestDepthTwoProto.getDescriptor().toProto().toByteString(),
          ReflectionTestDepthTwoAlternateProto.getDescriptor().toProto().toByteString(),
          ReflectionTestDepthThreeProto.getDescriptor().toProto().toByteString());

  StreamRecorder<ServerReflectionResponse> responseObserver = StreamRecorder.create();
  StreamObserver<ServerReflectionRequest> requestObserver =
      stub.serverReflectionInfo(responseObserver);
  requestObserver.onNext(request);
  requestObserver.onCompleted();

  List<ByteString> response =
      responseObserver
          .firstValue()
          .get()
          .getFileDescriptorResponse()
          .getFileDescriptorProtoList();
  assertEquals(goldenResponse.size(), response.size());
  assertEquals(new HashSet<ByteString>(goldenResponse), new HashSet<ByteString>(response));
}
 
Example #11
Source File: ProtoReflectionServiceTest.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
@Test
public void fileContainingNestedExtension() throws Exception {
  ServerReflectionRequest request =
      ServerReflectionRequest.newBuilder()
          .setHost(TEST_HOST)
          .setFileContainingExtension(
              ExtensionRequest.newBuilder()
                  .setContainingType("grpc.reflection.testing.ThirdLevelType")
                  .setExtensionNumber(101)
                  .build())
          .build();

  ServerReflectionResponse goldenResponse =
      ServerReflectionResponse.newBuilder()
          .setValidHost(TEST_HOST)
          .setOriginalRequest(request)
          .setFileDescriptorResponse(
              FileDescriptorResponse.newBuilder()
                  .addFileDescriptorProto(
                      ReflectionTestDepthTwoProto.getDescriptor().toProto().toByteString())
                  .addFileDescriptorProto(
                      ReflectionTestDepthThreeProto.getDescriptor().toProto().toByteString())
                  .build())
          .build();

  StreamRecorder<ServerReflectionResponse> responseObserver = StreamRecorder.create();
  StreamObserver<ServerReflectionRequest> requestObserver =
      stub.serverReflectionInfo(responseObserver);
  requestObserver.onNext(request);
  requestObserver.onCompleted();
  assertEquals(goldenResponse, responseObserver.firstValue().get());
}
 
Example #12
Source File: ProtoReflectionServiceTest.java    From grpc-java with Apache License 2.0 5 votes vote down vote up
@Test
public void fileByFilename() throws Exception {
  ServerReflectionRequest request =
      ServerReflectionRequest.newBuilder()
          .setHost(TEST_HOST)
          .setFileByFilename("io/grpc/reflection/testing/reflection_test_depth_three.proto")
          .build();

  ServerReflectionResponse goldenResponse =
      ServerReflectionResponse.newBuilder()
          .setValidHost(TEST_HOST)
          .setOriginalRequest(request)
          .setFileDescriptorResponse(
              FileDescriptorResponse.newBuilder()
                  .addFileDescriptorProto(
                      ReflectionTestDepthThreeProto.getDescriptor().toProto().toByteString())
                  .build())
          .build();

  StreamRecorder<ServerReflectionResponse> responseObserver = StreamRecorder.create();
  StreamObserver<ServerReflectionRequest> requestObserver =
      stub.serverReflectionInfo(responseObserver);
  requestObserver.onNext(request);
  requestObserver.onCompleted();

  assertEquals(goldenResponse, responseObserver.firstValue().get());
}
 
Example #13
Source File: ProtoReflectionServiceTest.java    From grpc-java with Apache License 2.0 5 votes vote down vote up
@Test
public void fileContainingSymbol() throws Exception {
  ServerReflectionRequest request =
      ServerReflectionRequest.newBuilder()
          .setHost(TEST_HOST)
          .setFileContainingSymbol("grpc.reflection.testing.ReflectableService.Method")
          .build();

  List<ByteString> goldenResponse =
      Arrays.asList(
          ReflectionTestProto.getDescriptor().toProto().toByteString(),
          ReflectionTestDepthTwoProto.getDescriptor().toProto().toByteString(),
          ReflectionTestDepthTwoAlternateProto.getDescriptor().toProto().toByteString(),
          ReflectionTestDepthThreeProto.getDescriptor().toProto().toByteString());

  StreamRecorder<ServerReflectionResponse> responseObserver = StreamRecorder.create();
  StreamObserver<ServerReflectionRequest> requestObserver =
      stub.serverReflectionInfo(responseObserver);
  requestObserver.onNext(request);
  requestObserver.onCompleted();

  List<ByteString> response =
      responseObserver
          .firstValue()
          .get()
          .getFileDescriptorResponse()
          .getFileDescriptorProtoList();
  assertEquals(goldenResponse.size(), response.size());
  assertEquals(new HashSet<>(goldenResponse), new HashSet<>(response));
}
 
Example #14
Source File: ProtoReflectionServiceTest.java    From grpc-java with Apache License 2.0 5 votes vote down vote up
@Test
public void fileContainingExtension() throws Exception {
  ServerReflectionRequest request =
      ServerReflectionRequest.newBuilder()
          .setHost(TEST_HOST)
          .setFileContainingExtension(
              ExtensionRequest.newBuilder()
                  .setContainingType("grpc.reflection.testing.ThirdLevelType")
                  .setExtensionNumber(100)
                  .build())
          .build();

  List<ByteString> goldenResponse =
      Arrays.asList(
          ReflectionTestProto.getDescriptor().toProto().toByteString(),
          ReflectionTestDepthTwoProto.getDescriptor().toProto().toByteString(),
          ReflectionTestDepthTwoAlternateProto.getDescriptor().toProto().toByteString(),
          ReflectionTestDepthThreeProto.getDescriptor().toProto().toByteString());

  StreamRecorder<ServerReflectionResponse> responseObserver = StreamRecorder.create();
  StreamObserver<ServerReflectionRequest> requestObserver =
      stub.serverReflectionInfo(responseObserver);
  requestObserver.onNext(request);
  requestObserver.onCompleted();

  List<ByteString> response =
      responseObserver
          .firstValue()
          .get()
          .getFileDescriptorResponse()
          .getFileDescriptorProtoList();
  assertEquals(goldenResponse.size(), response.size());
  assertEquals(new HashSet<>(goldenResponse), new HashSet<>(response));
}
 
Example #15
Source File: ProtoReflectionServiceTest.java    From grpc-java with Apache License 2.0 5 votes vote down vote up
@Test
public void fileContainingNestedExtension() throws Exception {
  ServerReflectionRequest request =
      ServerReflectionRequest.newBuilder()
          .setHost(TEST_HOST)
          .setFileContainingExtension(
              ExtensionRequest.newBuilder()
                  .setContainingType("grpc.reflection.testing.ThirdLevelType")
                  .setExtensionNumber(101)
                  .build())
          .build();

  ServerReflectionResponse goldenResponse =
      ServerReflectionResponse.newBuilder()
          .setValidHost(TEST_HOST)
          .setOriginalRequest(request)
          .setFileDescriptorResponse(
              FileDescriptorResponse.newBuilder()
                  .addFileDescriptorProto(
                      ReflectionTestDepthTwoProto.getDescriptor().toProto().toByteString())
                  .addFileDescriptorProto(
                      ReflectionTestDepthThreeProto.getDescriptor().toProto().toByteString())
                  .build())
          .build();

  StreamRecorder<ServerReflectionResponse> responseObserver = StreamRecorder.create();
  StreamObserver<ServerReflectionRequest> requestObserver =
      stub.serverReflectionInfo(responseObserver);
  requestObserver.onNext(request);
  requestObserver.onCompleted();
  assertEquals(goldenResponse, responseObserver.firstValue().get());
}