"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "dso-l2/src/test/java/com/tc/objectserver/entity/ManagedEntityImplTest.java" between
terracotta-core-5.7.0.tar.gz and terracotta-core-5.7.1.tar.gz

About: Terracotta - Clustering technology for Java ("Network Attached Memory", "Distributed Cache"). Source code of the server (5.x) core components.

ManagedEntityImplTest.java  (terracotta-core-5.7.0):ManagedEntityImplTest.java  (terracotta-core-5.7.1)
skipping to change at line 248 skipping to change at line 248
@Override @Override
public EntityResponse decodeResponse(byte[] payload) throws MessageCodecEx ception { public EntityResponse decodeResponse(byte[] payload) throws MessageCodecEx ception {
throw new UnsupportedOperationException("Not supported yet."); //To chan ge body of generated methods, choose Tools | Templates. throw new UnsupportedOperationException("Not supported yet."); //To chan ge body of generated methods, choose Tools | Templates.
} }
}); });
return entityService; return entityService;
} }
@Test @Test
public void testReconfigureEntity() throws Exception { public void testReconfigureEntityWhenPassive() throws Exception {
// first create a passive entity and then promote ServerEntityRequest createRequest = mockCreateEntityRequest();
ServerEntityRequest request = mockCreateEntityRequest(); TestingResponse createResponse = mockResponse();
TestingResponse response = mockResponse(); invokeOnTransactionHandler(()->managedEntity.addRequestMessage(createRequest
String config = "foo"; , mockCreatePayload("foo"), createResponse));
MessagePayload arg = mockCreatePayload(config); createResponse.waitFor();
invokeOnTransactionHandler(()->managedEntity.addRequestMessage(request, arg, verify(createResponse).complete();
response));
response.waitFor(); ServerEntityRequest reconfigureRequest = mockReconfigureEntityRequest();
verify(response).complete(); TestingResponse reconfigureResponse = mockResponse();
MessagePayload barPayload = mockReconfigurePayload("bar");
invokeOnTransactionHandler(()->managedEntity.addRequestMessage(reconfigureRe
quest, barPayload, reconfigureResponse));
reconfigureResponse.waitFor();
verify(reconfigureResponse).complete(Mockito.any());
verify(serverEntityService).reconfigureEntity(eq(serviceRegistry), eq(passiv
eServerEntity), eq(barPayload.getRawPayload()));
}
@Test
public void testReconfigureEntityWhenActive() throws Exception {
ServerEntityRequest createRequest = mockCreateEntityRequest();
TestingResponse createResponse = mockResponse();
invokeOnTransactionHandler(()->managedEntity.addRequestMessage(createRequest
, mockCreatePayload("foo"), createResponse));
createResponse.waitFor();
verify(createResponse).complete();
promote(); promote();
// first create a passive entity and then promote ServerEntityRequest reconfigureRequest = mockReconfigureEntityRequest();
ServerEntityRequest request2 = mockReconfigureEntityRequest(); TestingResponse reconfigureResponse = mockResponse();
TestingResponse response2 = mockResponse(); MessagePayload barPayload = mockReconfigurePayload("bar");
String config2 = "foo2"; invokeOnTransactionHandler(()->managedEntity.addRequestMessage(reconfigureRe
MessagePayload arg2 = mockReconfigurePayload(config2); quest, barPayload, reconfigureResponse));
invokeOnTransactionHandler(()->managedEntity.addRequestMessage(request2, arg reconfigureResponse.waitFor();
2, response2)); verify(reconfigureResponse).complete(Mockito.any());
response2.waitFor();
verify(response2).complete(Mockito.any());
// We expected to see this as a result of the promotion. verify(serverEntityService).reconfigureEntity(eq(serviceRegistry), eq(active
verify(serverEntityService).reconfigureEntity(ArgumentMatchers.eq(serviceReg ServerEntity), eq(barPayload.getRawPayload()));
istry), eq(this.activeServerEntity), ArgumentMatchers.eq(arg2.getRawPayload()));
} }
@Test @Test
public void testNotifyDestroy() throws Exception { public void testNotifyDestroy() throws Exception {
// first create a passive entity and then promote // first create a passive entity and then promote
ServerEntityRequest request = mockCreateEntityRequest(); ServerEntityRequest request = mockCreateEntityRequest();
TestingResponse response = mockResponse(); TestingResponse response = mockResponse();
String config = "foo"; String config = "foo";
MessagePayload arg = mockCreatePayload(config); MessagePayload arg = mockCreatePayload(config);
invokeOnTransactionHandler(()->managedEntity.addRequestMessage(request, arg, response)); invokeOnTransactionHandler(()->managedEntity.addRequestMessage(request, arg, response));
 End of changes. 3 change blocks. 
22 lines changed or deleted 38 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)