use of com.netflix.eureka.util.batcher.TaskProcessor.ProcessingResult in project eureka by Netflix.
the class ReplicationTaskProcessorTest method testBatchableTaskPermanentFailureHandling.
@Test
public void testBatchableTaskPermanentFailureHandling() throws Exception {
TestableInstanceReplicationTask task = aReplicationTask().build();
InstanceInfo instanceInfoFromPeer = InstanceInfoGenerator.takeOne();
replicationClient.withNetworkStatusCode(200);
replicationClient.withBatchReply(400);
replicationClient.withInstanceInfo(instanceInfoFromPeer);
ProcessingResult status = replicationTaskProcessor.process(Collections.<ReplicationTask>singletonList(task));
assertThat(status, is(ProcessingResult.Success));
assertThat(task.getProcessingState(), is(ProcessingState.Failed));
}
use of com.netflix.eureka.util.batcher.TaskProcessor.ProcessingResult in project eureka by Netflix.
the class RecordingProcessor method expectPermanentErrors.
public void expectPermanentErrors(int count) throws InterruptedException {
for (int i = 0; i < count; i++) {
ProcessingResult task = permanentErrorTasks.poll(5, TimeUnit.SECONDS);
assertThat(task, is(notNullValue()));
}
}
use of com.netflix.eureka.util.batcher.TaskProcessor.ProcessingResult in project eureka by Netflix.
the class ReplicationTaskProcessorTest method testNonBatchableTaskNetworkFailureHandling.
@Test
public void testNonBatchableTaskNetworkFailureHandling() throws Exception {
TestableInstanceReplicationTask task = aReplicationTask().withAction(Action.Heartbeat).withNetworkFailures(1).build();
ProcessingResult status = replicationTaskProcessor.process(task);
assertThat(status, is(ProcessingResult.TransientError));
assertThat(task.getProcessingState(), is(ProcessingState.Pending));
}
use of com.netflix.eureka.util.batcher.TaskProcessor.ProcessingResult in project eureka by Netflix.
the class ReplicationTaskProcessorTest method testBatchableTaskListExecution.
@Test
public void testBatchableTaskListExecution() throws Exception {
TestableInstanceReplicationTask task = aReplicationTask().build();
replicationClient.withBatchReply(200);
replicationClient.withNetworkStatusCode(200);
ProcessingResult status = replicationTaskProcessor.process(Collections.<ReplicationTask>singletonList(task));
assertThat(status, is(ProcessingResult.Success));
assertThat(task.getProcessingState(), is(ProcessingState.Finished));
}
use of com.netflix.eureka.util.batcher.TaskProcessor.ProcessingResult in project eureka by Netflix.
the class ReplicationTaskProcessorTest method testNonBatchableTaskPermanentFailureHandling.
@Test
public void testNonBatchableTaskPermanentFailureHandling() throws Exception {
TestableInstanceReplicationTask task = aReplicationTask().withAction(Action.Heartbeat).withReplyStatusCode(406).build();
ProcessingResult status = replicationTaskProcessor.process(task);
assertThat(status, is(ProcessingResult.PermanentError));
assertThat(task.getProcessingState(), is(ProcessingState.Failed));
}
Aggregations