Search in sources :

Example 11 with ReplicationInstance

use of com.netflix.eureka.cluster.protocol.ReplicationInstance in project eureka by Netflix.

the class PeerEurekaNodeTest method testHeartbeatReplicationFailure.

@Test
public void testHeartbeatReplicationFailure() throws Throwable {
    httpReplicationClient.withNetworkStatusCode(200, 200);
    // Not found, to trigger registration
    httpReplicationClient.withBatchReply(404);
    createPeerEurekaNode().heartbeat(instanceInfo.getAppName(), instanceInfo.getId(), instanceInfo, null, false);
    // Heartbeat replied with an error
    ReplicationInstance replicationInstance = expectSingleBatchRequest();
    assertThat(replicationInstance.getAction(), is(equalTo(Action.Heartbeat)));
    // Second, registration task is scheduled
    replicationInstance = expectSingleBatchRequest();
    assertThat(replicationInstance.getAction(), is(equalTo(Action.Register)));
}
Also used : ReplicationInstance(com.netflix.eureka.cluster.protocol.ReplicationInstance) Test(org.junit.Test)

Example 12 with ReplicationInstance

use of com.netflix.eureka.cluster.protocol.ReplicationInstance in project eureka by Netflix.

the class PeerEurekaNodeTest method testStatusUpdateBatchReplication.

@Test
public void testStatusUpdateBatchReplication() throws Throwable {
    createPeerEurekaNode().statusUpdate(instanceInfo.getAppName(), instanceInfo.getId(), InstanceStatus.DOWN, instanceInfo);
    ReplicationInstance replicationInstance = expectSingleBatchRequest();
    assertThat(replicationInstance.getAction(), is(equalTo(Action.StatusUpdate)));
}
Also used : ReplicationInstance(com.netflix.eureka.cluster.protocol.ReplicationInstance) Test(org.junit.Test)

Aggregations

ReplicationInstance (com.netflix.eureka.cluster.protocol.ReplicationInstance)12 Test (org.junit.Test)11 ReplicationList (com.netflix.eureka.cluster.protocol.ReplicationList)6 ReplicationInstanceResponse (com.netflix.eureka.cluster.protocol.ReplicationInstanceResponse)4 ReplicationListResponse (com.netflix.eureka.cluster.protocol.ReplicationListResponse)4 Response (javax.ws.rs.core.Response)3 InstanceInfo (com.netflix.appinfo.InstanceInfo)2 CodecWrapper (com.netflix.discovery.converters.wrappers.CodecWrapper)1 CodecWrappers (com.netflix.discovery.converters.wrappers.CodecWrappers)1 DecoderWrapper (com.netflix.discovery.converters.wrappers.DecoderWrapper)1 EncoderWrapper (com.netflix.discovery.converters.wrappers.EncoderWrapper)1 HandledRequest (com.netflix.eureka.cluster.TestableHttpReplicationClient.HandledRequest)1 ArrayList (java.util.ArrayList)1