@Test @DisplayName("return error status if command is unsupported") @MuteLogging void returnCommandUnsupportedError() { TestActorRequestFactory factory = new TestActorRequestFactory(getClass()); Command unsupportedCmd = factory.createCommand(CmdServDontHandle.getDefaultInstance()); service.post(unsupportedCmd, responseObserver); assertTrue(responseObserver.isCompleted()); Ack result = responseObserver.firstResponse(); assertNotNull(result); assertTrue(isNotDefault(result)); Status status = result.getStatus(); assertEquals(ERROR, status.getStatusCase()); Error error = status.getError(); assertEquals(CommandValidationError.getDescriptor().getFullName(), error.getType()); }
@Override public void post(Command request, StreamObserver<Ack> responseObserver) { CommandClass commandClass = CommandClass.of(request); BoundedContext context = commandToContext.get(commandClass); if (context == null) { handleUnsupported(request, responseObserver); } else { CommandBus commandBus = context.commandBus(); commandBus.post(request, responseObserver); } }
CommandService extends CommandServiceGrpc.CommandServiceImplBase implements Logging { @Override public void post(Command request, StreamObserver<Ack> responseObserver) { CommandClass commandClass = CommandClass.of(request); BoundedContext context = commandToContext.get(commandClass); if (context == null) { handleUnsupported(request, responseObserver); } else { CommandBus commandBus = context.commandBus(); commandBus.post(request, responseObserver); } } }
CommandService extends CommandServiceGrpc.CommandServiceImplBase implements Logging { @Override public void post(Command request, StreamObserver<Ack> responseObserver) { CommandClass commandClass = CommandClass.of(request); BoundedContext context = commandToContext.get(commandClass); if (context == null) { handleUnsupported(request, responseObserver); } else { CommandBus commandBus = context.commandBus(); commandBus.post(request, responseObserver); } } private  CommandService(Map<CommandClass, BoundedContext> map); }
CommandService extends CommandServiceGrpc.CommandServiceImplBase implements Logging { @Override public void post(Command request, StreamObserver<Ack> responseObserver) { CommandClass commandClass = CommandClass.of(request); BoundedContext context = commandToContext.get(commandClass); if (context == null) { handleUnsupported(request, responseObserver); } else { CommandBus commandBus = context.commandBus(); commandBus.post(request, responseObserver); } } private  CommandService(Map<CommandClass, BoundedContext> map); static Builder newBuilder(); @Override void post(Command request, StreamObserver<Ack> responseObserver); }
CommandService extends CommandServiceGrpc.CommandServiceImplBase implements Logging { @Override public void post(Command request, StreamObserver<Ack> responseObserver) { CommandClass commandClass = CommandClass.of(request); BoundedContext context = commandToContext.get(commandClass); if (context == null) { handleUnsupported(request, responseObserver); } else { CommandBus commandBus = context.commandBus(); commandBus.post(request, responseObserver); } } private  CommandService(Map<CommandClass, BoundedContext> map); static Builder newBuilder(); @Override void post(Command request, StreamObserver<Ack> responseObserver);  }