@Test public void generatesAndRegistersWithoutDisplayConfirmation() { final DepositGenerateAndRegisterCommand depositGenerateAndRegisterCommand = new DepositGenerateAndRegisterCommand( shutdownFunction, registerParams, generateParams, new VerboseOutputParam(false)); depositGenerateAndRegisterCommand.run(); verify(generateParams).createGenerateAction(false); verify(registerParams).createRegisterAction(false); verify(generateAction).generateKeysStream(); }
@Override public void run() { final GenerateAction generateAction = generateParams.createGenerateAction(verboseOutputParam.isVerboseOutputEnabled()); try (final RegisterAction registerAction = registerParams.createRegisterAction(verboseOutputParam.isVerboseOutputEnabled())) { registerAction.displayConfirmation(generateParams.getValidatorCount()); final List<SafeFuture<TransactionReceipt>> transactionReceipts = generateAction .generateKeysStream() .map(registerValidator(registerAction)) .collect(Collectors.toList()); SafeFuture.allOf(transactionReceipts.toArray(SafeFuture[]::new)).get(2, TimeUnit.MINUTES); } catch (final Throwable t) { SUB_COMMAND_LOG.sendDepositFailure(t); shutdownFunction.accept(1); } shutdownFunction.accept(0); }
DepositGenerateAndRegisterCommand implements Runnable { @Override public void run() { final GenerateAction generateAction = generateParams.createGenerateAction(verboseOutputParam.isVerboseOutputEnabled()); try (final RegisterAction registerAction = registerParams.createRegisterAction(verboseOutputParam.isVerboseOutputEnabled())) { registerAction.displayConfirmation(generateParams.getValidatorCount()); final List<SafeFuture<TransactionReceipt>> transactionReceipts = generateAction .generateKeysStream() .map(registerValidator(registerAction)) .collect(Collectors.toList()); SafeFuture.allOf(transactionReceipts.toArray(SafeFuture[]::new)).get(2, TimeUnit.MINUTES); } catch (final Throwable t) { SUB_COMMAND_LOG.sendDepositFailure(t); shutdownFunction.accept(1); } shutdownFunction.accept(0); } }
DepositGenerateAndRegisterCommand implements Runnable { @Override public void run() { final GenerateAction generateAction = generateParams.createGenerateAction(verboseOutputParam.isVerboseOutputEnabled()); try (final RegisterAction registerAction = registerParams.createRegisterAction(verboseOutputParam.isVerboseOutputEnabled())) { registerAction.displayConfirmation(generateParams.getValidatorCount()); final List<SafeFuture<TransactionReceipt>> transactionReceipts = generateAction .generateKeysStream() .map(registerValidator(registerAction)) .collect(Collectors.toList()); SafeFuture.allOf(transactionReceipts.toArray(SafeFuture[]::new)).get(2, TimeUnit.MINUTES); } catch (final Throwable t) { SUB_COMMAND_LOG.sendDepositFailure(t); shutdownFunction.accept(1); } shutdownFunction.accept(0); } DepositGenerateAndRegisterCommand(); @VisibleForTesting  DepositGenerateAndRegisterCommand(
      final Consumer<Integer> shutdownFunction,
      final RegisterParams registerParams,
      final GenerateParams generateParams,
      final VerboseOutputParam verboseOutputParam); }
DepositGenerateAndRegisterCommand implements Runnable { @Override public void run() { final GenerateAction generateAction = generateParams.createGenerateAction(verboseOutputParam.isVerboseOutputEnabled()); try (final RegisterAction registerAction = registerParams.createRegisterAction(verboseOutputParam.isVerboseOutputEnabled())) { registerAction.displayConfirmation(generateParams.getValidatorCount()); final List<SafeFuture<TransactionReceipt>> transactionReceipts = generateAction .generateKeysStream() .map(registerValidator(registerAction)) .collect(Collectors.toList()); SafeFuture.allOf(transactionReceipts.toArray(SafeFuture[]::new)).get(2, TimeUnit.MINUTES); } catch (final Throwable t) { SUB_COMMAND_LOG.sendDepositFailure(t); shutdownFunction.accept(1); } shutdownFunction.accept(0); } DepositGenerateAndRegisterCommand(); @VisibleForTesting  DepositGenerateAndRegisterCommand(
      final Consumer<Integer> shutdownFunction,
      final RegisterParams registerParams,
      final GenerateParams generateParams,
      final VerboseOutputParam verboseOutputParam); @Override void run(); }
DepositGenerateAndRegisterCommand implements Runnable { @Override public void run() { final GenerateAction generateAction = generateParams.createGenerateAction(verboseOutputParam.isVerboseOutputEnabled()); try (final RegisterAction registerAction = registerParams.createRegisterAction(verboseOutputParam.isVerboseOutputEnabled())) { registerAction.displayConfirmation(generateParams.getValidatorCount()); final List<SafeFuture<TransactionReceipt>> transactionReceipts = generateAction .generateKeysStream() .map(registerValidator(registerAction)) .collect(Collectors.toList()); SafeFuture.allOf(transactionReceipts.toArray(SafeFuture[]::new)).get(2, TimeUnit.MINUTES); } catch (final Throwable t) { SUB_COMMAND_LOG.sendDepositFailure(t); shutdownFunction.accept(1); } shutdownFunction.accept(0); } DepositGenerateAndRegisterCommand(); @VisibleForTesting  DepositGenerateAndRegisterCommand(
      final Consumer<Integer> shutdownFunction,
      final RegisterParams registerParams,
      final GenerateParams generateParams,
      final VerboseOutputParam verboseOutputParam); @Override void run();  }