Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Create replay message

  • Loading branch information...
commit a04e2267243ed21d51220f735fe6836fb044d237 1 parent 7861a2a
@mwl mwl authored
View
2  dgws-spring/src/main/java/com/trifork/dgws/MedcomReplayRegister.java
@@ -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);
}
View
6 dgws-spring/src/main/java/com/trifork/dgws/aspect/DgwsProtectionAspect.java
@@ -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) {
View
4 dgws-spring/src/test/java/com/trifork/dgws/aspect/DgwsProtectionAspectTest.java
@@ -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.
Something went wrong with that request. Please try again.