Search in sources :

Example 6 with ProcessingResult

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));
}
Also used : ProcessingResult(com.netflix.eureka.util.batcher.TaskProcessor.ProcessingResult) InstanceInfo(com.netflix.appinfo.InstanceInfo) Test(org.junit.Test)

Example 7 with ProcessingResult

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()));
    }
}
Also used : ProcessingResult(com.netflix.eureka.util.batcher.TaskProcessor.ProcessingResult)

Example 8 with ProcessingResult

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));
}
Also used : ProcessingResult(com.netflix.eureka.util.batcher.TaskProcessor.ProcessingResult) Test(org.junit.Test)

Example 9 with ProcessingResult

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));
}
Also used : ProcessingResult(com.netflix.eureka.util.batcher.TaskProcessor.ProcessingResult) Test(org.junit.Test)

Example 10 with ProcessingResult

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));
}
Also used : ProcessingResult(com.netflix.eureka.util.batcher.TaskProcessor.ProcessingResult) Test(org.junit.Test)

Aggregations

ProcessingResult (com.netflix.eureka.util.batcher.TaskProcessor.ProcessingResult)12 Test (org.junit.Test)9 InstanceInfo (com.netflix.appinfo.InstanceInfo)1