Permalink
Browse files

Create replay message

  • Loading branch information...
1 parent 7861a2a commit a04e2267243ed21d51220f735fe6836fb044d237 @mwl mwl committed Apr 18, 2012
@@ -7,4 +7,6 @@
* @return MedcomReplay containing a replayable message or null, if no message is found
*/
MedcomReplay getReplay(String messageId);
+
+ void createReplay(String messageID, Object responseMessage);
}
@@ -41,7 +41,11 @@ public Object doAccessCheck(ProceedingJoinPoint pjp, Protected protectedAnnotati
return replay.getResponseMessage();
}
- return pjp.proceed(pjp.getArgs());
+ Object responseMessage = pjp.proceed(pjp.getArgs());
+
+ medcomReplayRegister.createReplay(messageID, responseMessage);
+
+ return responseMessage;
}
private SoapHeader extractSoapHeader(ProceedingJoinPoint pjp) {
@@ -89,7 +89,7 @@ public void willThrowOnMissingSoapHeader() throws Exception {
}
@Test
- public void willForwardCallToTarget() throws Exception {
+ public void willForwardCallToTargetAndStoreReplay() throws Exception {
SoapHeaderElement soapHeaderElement = mock(SoapHeaderElement.class);
Source source = mock(Source.class);
Header medcomHeader = createMedcomHeader("TEST");
@@ -105,6 +105,7 @@ public void willForwardCallToTarget() throws Exception {
verify(soapHeaderElement).getSource();
verify(unmarshaller).unmarshal(source);
verify(protectedTargetMock).hitMe(soapHeader);
+ verify(medcomReplayRegister).createReplay("TEST", "HIT");
}
@Test
@@ -136,6 +137,7 @@ public void willNotForwardCallOnReplay() throws Exception {
verify(soapHeaderElement).getSource();
verify(unmarshaller).unmarshal(source);
verify(protectedTargetMock, never()).hitMe(soapHeader);
+ verify(medcomReplayRegister, never()).createReplay("TEST", expectedResponse);
}
private Header createMedcomHeader(String messageID) {

0 comments on commit a04e226

Please sign in to comment.