Search in sources :

Example 1 with ProcessingResult

use of com.netflix.eureka.util.batcher.TaskProcessor.ProcessingResult in project eureka by Netflix.

the class ReplicationTaskProcessorTest method testNonBatchableTaskExecution.

@Test
public void testNonBatchableTaskExecution() throws Exception {
    TestableInstanceReplicationTask task = aReplicationTask().withAction(Action.Heartbeat).withReplyStatusCode(200).build();
    ProcessingResult status = replicationTaskProcessor.process(task);
    assertThat(status, is(ProcessingResult.Success));
}
Also used : ProcessingResult(com.netflix.eureka.util.batcher.TaskProcessor.ProcessingResult) Test(org.junit.Test)

Example 2 with ProcessingResult

use of com.netflix.eureka.util.batcher.TaskProcessor.ProcessingResult in project eureka by Netflix.

the class RecordingProcessor method expectTransientErrors.

public void expectTransientErrors(int count) throws InterruptedException {
    for (int i = 0; i < count; i++) {
        ProcessingResult task = transientErrorTasks.poll(5, TimeUnit.SECONDS);
        assertThat(task, is(notNullValue()));
    }
}
Also used : ProcessingResult(com.netflix.eureka.util.batcher.TaskProcessor.ProcessingResult)

Example 3 with ProcessingResult

use of com.netflix.eureka.util.batcher.TaskProcessor.ProcessingResult in project eureka by Netflix.

the class RecordingProcessor method expectSuccesses.

public void expectSuccesses(int count) throws InterruptedException {
    for (int i = 0; i < count; i++) {
        ProcessingResult task = completedTasks.poll(5, TimeUnit.SECONDS);
        assertThat(task, is(notNullValue()));
    }
}
Also used : ProcessingResult(com.netflix.eureka.util.batcher.TaskProcessor.ProcessingResult)

Example 4 with ProcessingResult

use of com.netflix.eureka.util.batcher.TaskProcessor.ProcessingResult in project eureka by Netflix.

the class TaskDispatchersTest method testSingleTaskDispatcher.

@Test
public void testSingleTaskDispatcher() throws Exception {
    dispatcher = TaskDispatchers.createNonBatchingTaskDispatcher("TEST", MAX_BUFFER_SIZE, 1, MAX_BATCHING_DELAY_MS, SERVER_UNAVAILABLE_SLEEP_TIME_MS, RETRY_SLEEP_TIME_MS, processor);
    dispatcher.process(1, ProcessingResult.Success, System.currentTimeMillis() + 60 * 1000);
    ProcessingResult result = processor.completedTasks.poll(5, TimeUnit.SECONDS);
    assertThat(result, is(equalTo(ProcessingResult.Success)));
}
Also used : ProcessingResult(com.netflix.eureka.util.batcher.TaskProcessor.ProcessingResult) Test(org.junit.Test)

Example 5 with ProcessingResult

use of com.netflix.eureka.util.batcher.TaskProcessor.ProcessingResult in project eureka by Netflix.

the class ReplicationTaskProcessorTest method testNonBatchableTaskCongestionFailureHandling.

@Test
public void testNonBatchableTaskCongestionFailureHandling() throws Exception {
    TestableInstanceReplicationTask task = aReplicationTask().withAction(Action.Heartbeat).withReplyStatusCode(503).build();
    ProcessingResult status = replicationTaskProcessor.process(task);
    assertThat(status, is(ProcessingResult.Congestion));
    assertThat(task.getProcessingState(), is(ProcessingState.Pending));
}
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