EndpointManager extends GatewayGrpc.GatewayImplBase { @Override public void createWorkflowInstance( final CreateWorkflowInstanceRequest request, final StreamObserver<CreateWorkflowInstanceResponse> responseObserver) { sendRequestWithRetryPartitions( request, RequestMapper::toCreateWorkflowInstanceRequest, ResponseMapper::toCreateWorkflowInstanceResponse, responseObserver); } EndpointManager(
      final BrokerClient brokerClient, final ActivateJobsHandler activateJobsHandler); @Override void activateJobs(
      final ActivateJobsRequest request,
      final StreamObserver<ActivateJobsResponse> responseObserver); @Override void cancelWorkflowInstance(
      final CancelWorkflowInstanceRequest request,
      final StreamObserver<CancelWorkflowInstanceResponse> responseObserver); @Override void completeJob(
      final CompleteJobRequest request,
      final StreamObserver<CompleteJobResponse> responseObserver); @Override void createWorkflowInstance(
      final CreateWorkflowInstanceRequest request,
      final StreamObserver<CreateWorkflowInstanceResponse> responseObserver); @Override void createWorkflowInstanceWithResult(
      final CreateWorkflowInstanceWithResultRequest request,
      final StreamObserver<CreateWorkflowInstanceWithResultResponse> responseObserver); @Override void deployWorkflow(
      final DeployWorkflowRequest request,
      final StreamObserver<DeployWorkflowResponse> responseObserver); @Override void failJob(
      final FailJobRequest request, final StreamObserver<FailJobResponse> responseObserver); @Override void throwError(
      final ThrowErrorRequest request, final StreamObserver<ThrowErrorResponse> responseObserver); @Override void publishMessage(
      final PublishMessageRequest request,
      final StreamObserver<PublishMessageResponse> responseObserver); @Override void resolveIncident(
      final ResolveIncidentRequest request,
      final StreamObserver<ResolveIncidentResponse> responseObserver); @Override void setVariables(
      final SetVariablesRequest request,
      final StreamObserver<SetVariablesResponse> responseObserver); @Override void topology(
      final TopologyRequest request, final StreamObserver<TopologyResponse> responseObserver); @Override void updateJobRetries(
      final UpdateJobRetriesRequest request,
      final StreamObserver<UpdateJobRetriesResponse> responseObserver); static StatusRuntimeException convertThrowable(final Throwable cause);  }
@Test public void shouldNotLogErrorOnSuccess() { new CreateWorkflowInstanceStub().registerWith(brokerClient); client.createWorkflowInstance(CreateWorkflowInstanceRequest.newBuilder().build()); assertThat(recorder.getAppendedEvents()) .extracting(LogEvent::getLevel) .doesNotContain(Level.ERROR); }
@Test public void shouldLogBrokerError() { new CreateWorkflowInstanceStub() .respondWith( new BrokerErrorResponse<>( new BrokerError( ErrorCode.INTERNAL_ERROR, "Expected to create workflow instance, but internal error occurred"))) .registerWith(brokerClient); assertThatThrownBy( () -> client.createWorkflowInstance(CreateWorkflowInstanceRequest.newBuilder().build())) .isInstanceOf(StatusRuntimeException.class); assertThat(recorder.getAppendedEvents()) .extracting( LogEvent::getLevel, logEvent -> logEvent.getSource().getClassName(), logEvent -> logEvent.getSource().getMethodName()) .contains(Tuple.tuple(Level.ERROR, "io.zeebe.gateway.EndpointManager", "convertThrowable")); }