@Test public void testNextTaskWithOps() { final DeploymentGroupTasks deploymentGroupTasks = DeploymentGroupTasks.newBuilder() .setTaskIndex(0) .setRolloutTasks(Lists.newArrayList( RolloutTask.of(RolloutTask.Action.UNDEPLOY_OLD_JOBS, "host1"), RolloutTask.of(RolloutTask.Action.AWAIT_RUNNING, "host1"), RolloutTask.of(RolloutTask.Action.DEPLOY_NEW_JOB, "host1"))) .setDeploymentGroup(MANUAL_DEPLOYMENT_GROUP) .build(); final RollingUpdateOpFactory opFactory = new RollingUpdateOpFactory( deploymentGroupTasks, eventFactory); final ZooKeeperOperation mockOp = mock(ZooKeeperOperation.class); final RollingUpdateOp op = opFactory.nextTask(Lists.newArrayList(mockOp)); assertEquals( ImmutableSet.of( mockOp, new SetData("/status/deployment-group-tasks/my_group", deploymentGroupTasks.toBuilder() .setTaskIndex(1) .build() .toJsonBytes())), ImmutableSet.copyOf(op.operations())); assertEquals(1, op.events().size()); verify(eventFactory).rollingUpdateTaskSucceeded( MANUAL_DEPLOYMENT_GROUP, deploymentGroupTasks.getRolloutTasks().get(deploymentGroupTasks.getTaskIndex())); }
public RollingUpdateOp nextTask() { return nextTask(Collections.<ZooKeeperOperation>emptyList()); }
RollingUpdateOpFactory { public RollingUpdateOp nextTask() { return nextTask(Collections.<ZooKeeperOperation>emptyList()); } }
RollingUpdateOpFactory { public RollingUpdateOp nextTask() { return nextTask(Collections.<ZooKeeperOperation>emptyList()); } RollingUpdateOpFactory(final DeploymentGroupTasks tasks,
                                final DeploymentGroupEventFactory eventFactory); }
RollingUpdateOpFactory { public RollingUpdateOp nextTask() { return nextTask(Collections.<ZooKeeperOperation>emptyList()); } RollingUpdateOpFactory(final DeploymentGroupTasks tasks,
                                final DeploymentGroupEventFactory eventFactory); RollingUpdateOp start(final DeploymentGroup deploymentGroup,
                               final ZooKeeperClient client); RollingUpdateOp nextTask(); RollingUpdateOp nextTask(final List<ZooKeeperOperation> operations); RollingUpdateOp yield(); RollingUpdateOp error(final String msg, final String host,
                               final RollingUpdateError errorCode,
                               final Map<String, Object> metadata); RollingUpdateOp error(final String msg, final String host,
                               final RollingUpdateError errorCode); RollingUpdateOp error(final Exception ex, final String host,
                               final RollingUpdateError errorCode); }
RollingUpdateOpFactory { public RollingUpdateOp nextTask() { return nextTask(Collections.<ZooKeeperOperation>emptyList()); } RollingUpdateOpFactory(final DeploymentGroupTasks tasks,
                                final DeploymentGroupEventFactory eventFactory); RollingUpdateOp start(final DeploymentGroup deploymentGroup,
                               final ZooKeeperClient client); RollingUpdateOp nextTask(); RollingUpdateOp nextTask(final List<ZooKeeperOperation> operations); RollingUpdateOp yield(); RollingUpdateOp error(final String msg, final String host,
                               final RollingUpdateError errorCode,
                               final Map<String, Object> metadata); RollingUpdateOp error(final String msg, final String host,
                               final RollingUpdateError errorCode); RollingUpdateOp error(final Exception ex, final String host,
                               final RollingUpdateError errorCode);  }