use of com.netflix.eureka.cluster.protocol.ReplicationInstance in project eureka by Netflix.
the class PeerEurekaNodeTest method testDeleteStatusOverrideBatchReplication.
@Test
public void testDeleteStatusOverrideBatchReplication() throws Throwable {
createPeerEurekaNode().deleteStatusOverride(instanceInfo.getAppName(), instanceInfo.getId(), instanceInfo);
ReplicationInstance replicationInstance = expectSingleBatchRequest();
assertThat(replicationInstance.getAction(), is(equalTo(Action.DeleteStatusOverride)));
}
use of com.netflix.eureka.cluster.protocol.ReplicationInstance in project eureka by Netflix.
the class PeerEurekaNodeTest method expectSingleBatchRequest.
private ReplicationInstance expectSingleBatchRequest() throws InterruptedException {
HandledRequest handledRequest = httpReplicationClient.nextHandledRequest(30, TimeUnit.SECONDS);
assertThat(handledRequest, is(notNullValue()));
assertThat(handledRequest.getRequestType(), is(equalTo(RequestType.Batch)));
Object data = handledRequest.getData();
assertThat(data, is(instanceOf(ReplicationList.class)));
List<ReplicationInstance> replications = ((ReplicationList) data).getReplicationList();
assertThat(replications.size(), is(equalTo(1)));
return replications.get(0);
}
use of com.netflix.eureka.cluster.protocol.ReplicationInstance in project eureka by Netflix.
the class PeerReplicationResourceTest method testHeartbeat.
@Test
public void testHeartbeat() throws Exception {
when(instanceResource.renewLease(anyString(), anyString(), anyString(), anyString())).thenReturn(Response.ok().build());
ReplicationInstance replicationInstance = newReplicationInstanceOf(Action.Heartbeat, instanceInfo);
Response response = peerReplicationResource.batchReplication(new ReplicationList(replicationInstance));
assertStatusOkReply(response);
verify(instanceResource, times(1)).renewLease("true", replicationInstance.getOverriddenStatus(), instanceInfo.getStatus().name(), Long.toString(replicationInstance.getLastDirtyTimestamp()));
}
use of com.netflix.eureka.cluster.protocol.ReplicationInstance in project eureka by Netflix.
the class PeerReplicationResourceTest method testDeleteStatusOverride.
@Test
public void testDeleteStatusOverride() throws Exception {
when(instanceResource.deleteStatusUpdate(anyString(), anyString(), anyString())).thenReturn(Response.ok().build());
ReplicationInstance replicationInstance = newReplicationInstanceOf(Action.DeleteStatusOverride, instanceInfo);
Response response = peerReplicationResource.batchReplication(new ReplicationList(replicationInstance));
assertStatusOkReply(response);
verify(instanceResource, times(1)).deleteStatusUpdate("true", replicationInstance.getStatus(), Long.toString(replicationInstance.getLastDirtyTimestamp()));
}
use of com.netflix.eureka.cluster.protocol.ReplicationInstance in project eureka by Netflix.
the class PeerEurekaNodeTest method testRegistrationBatchReplication.
@Test
public void testRegistrationBatchReplication() throws Exception {
createPeerEurekaNode().register(instanceInfo);
ReplicationInstance replicationInstance = expectSingleBatchRequest();
assertThat(replicationInstance.getAction(), is(equalTo(Action.Register)));
}
Aggregations