@Inject public BlockUntilInitScriptStatusIsZeroThenReturnOutput( @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, EventBus eventBus, ComputeServiceConstants.InitStatusProperties properties, @Assisted SudoAwareInitManager commandRunner) { this(userExecutor, eventBus, Predicates.<String> alwaysTrue(), commandRunner); // this is mutable only until we can determine how to decouple "this" from here notRunningAnymore = loopUntilTrueOrThrowCancellationException(new ExitStatusOfCommandGreaterThanZero( commandRunner), properties.initStatusMaxPeriod, properties.initStatusInitialPeriod, this); }
public void testExitStatusOfCommandGreaterThanZeroFalseWhen0() { SudoAwareInitManager commandRunner = createMockBuilder(SudoAwareInitManager.class).addMockedMethod("runAction") .createStrictMock(); expect(commandRunner.runAction("status")).andReturn(new ExecResponse("", "", 0)); replay(commandRunner); Predicate<String> pred = new ExitStatusOfCommandGreaterThanZero(commandRunner); assertEquals(pred.apply("status"), false); verify(commandRunner); }
public void testExitStatusOfCommandGreaterThanZeroTrueWhen1() { SudoAwareInitManager commandRunner = createMockBuilder(SudoAwareInitManager.class).addMockedMethod("runAction") .createStrictMock(); expect(commandRunner.runAction("status")).andReturn(new ExecResponse("", "", 1)); replay(commandRunner); Predicate<String> pred = new ExitStatusOfCommandGreaterThanZero(commandRunner); assertEquals(pred.apply("status"), true); verify(commandRunner); }
@Inject public BlockUntilInitScriptStatusIsZeroThenReturnOutput( @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, EventBus eventBus, ComputeServiceConstants.InitStatusProperties properties, @Assisted SudoAwareInitManager commandRunner) { this(userExecutor, eventBus, Predicates.<String> alwaysTrue(), commandRunner); // this is mutable only until we can determine how to decouple "this" from here notRunningAnymore = loopUntilTrueOrThrowCancellationException(new ExitStatusOfCommandGreaterThanZero( commandRunner), properties.initStatusMaxPeriod, properties.initStatusInitialPeriod, this); }
public void testExitStatusOfCommandGreaterThanZeroFalseWhen0() { SudoAwareInitManager commandRunner = createMockBuilder(SudoAwareInitManager.class).addMockedMethod("runAction") .createStrictMock(); expect(commandRunner.runAction("status")).andReturn(new ExecResponse("", "", 0)); replay(commandRunner); Predicate<String> pred = new ExitStatusOfCommandGreaterThanZero(commandRunner); assertEquals(pred.apply("status"), false); verify(commandRunner); }
@Inject public BlockUntilInitScriptStatusIsZeroThenReturnOutput( @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, EventBus eventBus, ComputeServiceConstants.InitStatusProperties properties, @Assisted SudoAwareInitManager commandRunner) { this(userExecutor, eventBus, Predicates.<String> alwaysTrue(), commandRunner); // this is mutable only until we can determine how to decouple "this" from here notRunningAnymore = loopUntilTrueOrThrowCancellationException(new ExitStatusOfCommandGreaterThanZero( commandRunner), properties.initStatusMaxPeriod, properties.initStatusInitialPeriod, this); }
@Inject public BlockUntilInitScriptStatusIsZeroThenReturnOutput( @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, EventBus eventBus, ComputeServiceConstants.InitStatusProperties properties, @Assisted SudoAwareInitManager commandRunner) { this(userExecutor, eventBus, Predicates.<String> alwaysTrue(), commandRunner); // this is mutable only until we can determine how to decouple "this" from here notRunningAnymore = loopUntilTrueOrThrowCancellationException(new ExitStatusOfCommandGreaterThanZero( commandRunner), properties.initStatusMaxPeriod, properties.initStatusInitialPeriod, this); }
public void testExitStatusOfCommandGreaterThanZeroTrueWhen1() { SudoAwareInitManager commandRunner = createMockBuilder(SudoAwareInitManager.class).addMockedMethod("runAction") .createStrictMock(); expect(commandRunner.runAction("status")).andReturn(new ExecResponse("", "", 1)); replay(commandRunner); Predicate<String> pred = new ExitStatusOfCommandGreaterThanZero(commandRunner); assertEquals(pred.apply("status"), true); verify(commandRunner); }