Update tests to include MDC changes

This commit is contained in:
2024-04-08 21:28:02 -04:00
parent 2d1bb099c0
commit 330a185795
23 changed files with 143 additions and 2 deletions

View File

@@ -16,6 +16,7 @@ import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
@@ -76,6 +77,7 @@ public class AdfgvxCipherControllerIntegrationTest extends CipherStreamControlle
super.verifyFilter(url);
//Controller
verify(adfgvxLogger, times(1)).info("Getting info for {}", CipherInfoUtil.ADFGVX_CIPHER_NAME);
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGVX_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", infoNode);
}
@@ -95,6 +97,7 @@ public class AdfgvxCipherControllerIntegrationTest extends CipherStreamControlle
super.verifyFilter(url + "/encode");
//Controller
verify(adfgvxLogger, times(1)).info("Encoding {}", CipherInfoUtil.ADFGVX_CIPHER_NAME);
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGVX_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
}
@@ -114,6 +117,7 @@ public class AdfgvxCipherControllerIntegrationTest extends CipherStreamControlle
super.verifyFilter(url + "/encode");
//Controller
verify(adfgvxLogger, times(1)).info("Encoding {}", CipherInfoUtil.ADFGVX_CIPHER_NAME);
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGVX_CIPHER_NAME);
//Cipher Aspect
verifyNoInteractions(aspectLogger);
}
@@ -133,6 +137,7 @@ public class AdfgvxCipherControllerIntegrationTest extends CipherStreamControlle
super.verifyFilter(url + "/decode");
//Controller
verify(adfgvxLogger, times(1)).info("Decoding {}", CipherInfoUtil.ADFGVX_CIPHER_NAME);
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGVX_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
}
@@ -152,6 +157,7 @@ public class AdfgvxCipherControllerIntegrationTest extends CipherStreamControlle
super.verifyFilter(url + "/decode");
//Controller
verify(adfgvxLogger, times(1)).info("Decoding {}", CipherInfoUtil.ADFGVX_CIPHER_NAME);
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGVX_CIPHER_NAME);
//Cipher Aspect
verifyNoInteractions(aspectLogger);
}

View File

@@ -16,6 +16,7 @@ import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
@@ -76,6 +77,7 @@ public class AdfgxCipherControllerIntegrationTest extends CipherStreamController
super.verifyFilter(url);
//Controller
verify(adfgxLogger, times(1)).info("Getting info for {}", CipherInfoUtil.ADFGX_CIPHER_NAME);
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGX_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", infoNode);
}
@@ -95,6 +97,7 @@ public class AdfgxCipherControllerIntegrationTest extends CipherStreamController
super.verifyFilter(url + "/encode");
//Controller
verify(adfgxLogger, times(1)).info("Encoding {}", CipherInfoUtil.ADFGX_CIPHER_NAME);
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGX_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
}
@@ -114,6 +117,7 @@ public class AdfgxCipherControllerIntegrationTest extends CipherStreamController
super.verifyFilter(url + "/encode");
//Controller
verify(adfgxLogger, times(1)).info("Encoding {}", CipherInfoUtil.ADFGX_CIPHER_NAME);
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGX_CIPHER_NAME);
//Cipher Aspect
verifyNoInteractions(aspectLogger);
}
@@ -133,6 +137,7 @@ public class AdfgxCipherControllerIntegrationTest extends CipherStreamController
super.verifyFilter(url + "/decode");
//Controller
verify(adfgxLogger, times(1)).info("Decoding {}", CipherInfoUtil.ADFGX_CIPHER_NAME);
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGX_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
}
@@ -152,6 +157,7 @@ public class AdfgxCipherControllerIntegrationTest extends CipherStreamController
super.verifyFilter(url + "/decode");
//Controller
verify(adfgxLogger, times(1)).info("Decoding {}", CipherInfoUtil.ADFGX_CIPHER_NAME);
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGX_CIPHER_NAME);
//Cipher Aspect
verifyNoInteractions(aspectLogger);
}