Begin test update

This commit is contained in:
2024-04-08 00:24:46 -04:00
parent 8f0d1c64bd
commit 1a93a30b42
28 changed files with 559 additions and 78 deletions

View File

@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
import com.mattrixwv.cipherstream.combination.ADFGVX;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
import lombok.extern.slf4j.Slf4j;
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
@RestController
@RequestMapping("adfgvx")
public class AdfgvxCipherController{
@GetMapping
public ObjectNode getCipherInfo(){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGVX_CIPHER_NAME);
log.info("Getting info for {}", CipherInfoUtil.ADFGVX_CIPHER_NAME);
return CipherInfoUtil.buildInfoNode(CipherInfoUtil.ADFGVX_CIPHER_NAME, CipherInfoUtil.ADFGVX_CIPHER_DESCRIPTION);
}
@GetMapping("/encode")
public ObjectNode encodeAdfgvx(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "ADFGVX");
log.info("Encoding ADFGVX");
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGVX_CIPHER_NAME);
log.info("Encoding {}", CipherInfoUtil.ADFGVX_CIPHER_NAME);
CipherParameterUtil.verifySquareKeyword(cipherParams);
@@ -45,8 +55,8 @@ public class AdfgvxCipherController{
@GetMapping("/decode")
public ObjectNode decodeAdfgvx(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "ADFGVX");
log.info("Decoding ADFGVX");
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGVX_CIPHER_NAME);
log.info("Decoding {}", CipherInfoUtil.ADFGVX_CIPHER_NAME);
CipherParameterUtil.verifySquareKeyword(cipherParams);

View File

@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
import com.mattrixwv.cipherstream.combination.ADFGX;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
import lombok.extern.slf4j.Slf4j;
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
@RestController
@RequestMapping("adfgx")
public class AdfgxCipherController{
@GetMapping
public ObjectNode getCipherInfo(){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGX_CIPHER_NAME);
log.info("Getting info for {}", CipherInfoUtil.ADFGX_CIPHER_NAME);
return CipherInfoUtil.buildInfoNode(CipherInfoUtil.ADFGX_CIPHER_NAME, CipherInfoUtil.ADFGX_CIPHER_DESCRIPTION);
}
@GetMapping("/encode")
public ObjectNode encodeAdfgx(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "ADFGX");
log.info("Encoding ADFGX");
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGX_CIPHER_NAME);
log.info("Encoding {}", CipherInfoUtil.ADFGX_CIPHER_NAME);
CipherParameterUtil.verifySquareKeyword(cipherParams);
@@ -45,8 +55,8 @@ public class AdfgxCipherController{
@GetMapping("/decode")
public ObjectNode decodeAdfgx(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "ADFGX");
log.info("Decoding ADFGX");
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGX_CIPHER_NAME);
log.info("Decoding {}", CipherInfoUtil.ADFGX_CIPHER_NAME);
CipherParameterUtil.verifySquareKeyword(cipherParams);

View File

@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
import com.mattrixwv.cipherstream.monosubstitution.Affine;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
import lombok.extern.slf4j.Slf4j;
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
@RestController
@RequestMapping("/cipherStream/affine")
public class AffineCipherController{
@GetMapping
public ObjectNode getCipherInfo(){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.AFFINE_CIPHER_NAME);
log.info("Getting info for {}", CipherInfoUtil.AFFINE_CIPHER_NAME);
return CipherInfoUtil.buildInfoNode(CipherInfoUtil.AFFINE_CIPHER_NAME, CipherInfoUtil.AFFINE_CIPHER_DESCRIPTION);
}
@GetMapping("/encode")
public ObjectNode encodeAffine(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Affine");
log.info("Encoding Affine");
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.AFFINE_CIPHER_NAME);
log.info("Encoding {}", CipherInfoUtil.AFFINE_CIPHER_NAME);
CipherParameterUtil.verifyAffineParams(cipherParams);
@@ -45,8 +55,8 @@ public class AffineCipherController{
@GetMapping("/decode")
public ObjectNode decodeAffine(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Affine");
log.info("Decoding Affine");
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.AFFINE_CIPHER_NAME);
log.info("Decoding {}", CipherInfoUtil.AFFINE_CIPHER_NAME);
CipherParameterUtil.verifyAffineParams(cipherParams);

View File

@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
import com.mattrixwv.cipherstream.monosubstitution.Atbash;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
import lombok.extern.slf4j.Slf4j;
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
@RestController
@RequestMapping("/cipherStream/atbash")
public class AtbashCipherController{
@GetMapping
public ObjectNode getCipherInfo(){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ATBASH_CIPHER_NAME);
log.info("Getting info for {}", CipherInfoUtil.ATBASH_CIPHER_NAME);
return CipherInfoUtil.buildInfoNode(CipherInfoUtil.ATBASH_CIPHER_NAME, CipherInfoUtil.ATBASH_CIPHER_DESCRIPTION);
}
@GetMapping("/encode")
public ObjectNode encodeAtbash(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Atbash");
log.info("Encoding Atbash");
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ATBASH_CIPHER_NAME);
log.info("Encoding {}", CipherInfoUtil.ATBASH_CIPHER_NAME);
CipherParameterUtil.verifyAtbashParams(cipherParams);
@@ -43,8 +53,8 @@ public class AtbashCipherController{
@GetMapping("/decode")
public ObjectNode decodeAtbash(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Atbash");
log.info("Decoding Atbash");
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ATBASH_CIPHER_NAME);
log.info("Decoding {}", CipherInfoUtil.ATBASH_CIPHER_NAME);
CipherParameterUtil.verifyAtbashParams(cipherParams);

View File

@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
import com.mattrixwv.cipherstream.monosubstitution.Autokey;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
import lombok.extern.slf4j.Slf4j;
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
@RestController
@RequestMapping("/cipherStream/autokey")
public class AutokeyCipherController{
@GetMapping
public ObjectNode getCipherInfo(){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.AUTOKEY_CIPHER_NAME);
log.info("Getting info for {}", CipherInfoUtil.AUTOKEY_CIPHER_NAME);
return CipherInfoUtil.buildInfoNode(CipherInfoUtil.AUTOKEY_CIPHER_NAME, CipherInfoUtil.AUTOKEY_CIPHER_DESCRIPTION);
}
@GetMapping("/encode")
public ObjectNode encodeAutokey(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Autokey");
log.info("Encoding Autokey");
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.AUTOKEY_CIPHER_NAME);
log.info("Encoding {}", CipherInfoUtil.AUTOKEY_CIPHER_NAME);
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
@@ -44,8 +54,8 @@ public class AutokeyCipherController{
@GetMapping("/decode")
public ObjectNode decodeAutokey(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Autokey");
log.info("Decoding Autokey");
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.AUTOKEY_CIPHER_NAME);
log.info("Decoding {}", CipherInfoUtil.AUTOKEY_CIPHER_NAME);
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);

View File

@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
import com.mattrixwv.cipherstream.monosubstitution.Baconian;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
import lombok.extern.slf4j.Slf4j;
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
@RestController
@RequestMapping("/cipherStream/baconian")
public class BaconianCipherController{
@GetMapping
public ObjectNode getCipherInfo(){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.BACONIAN_CIPHER_NAME);
log.info("Getting info for {}", CipherInfoUtil.BACONIAN_CIPHER_NAME);
return CipherInfoUtil.buildInfoNode(CipherInfoUtil.BACONIAN_CIPHER_NAME, CipherInfoUtil.BACONIAN_CIPHER_DESCRIPTION);
}
@GetMapping("/encode")
public ObjectNode encodeBaconian(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Baconian");
log.info("Encoding Baconian");
log.info("Encoding {}", CipherInfoUtil.BACONIAN_CIPHER_NAME);
CipherParameterUtil.verifyBaconianParams(cipherParams);
@@ -42,7 +52,7 @@ public class BaconianCipherController{
@GetMapping("/decode")
public ObjectNode decodeBaconian(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Baconian");
log.info("Decoding Baconian");
log.info("Decoding {}", CipherInfoUtil.BACONIAN_CIPHER_NAME);
CipherParameterUtil.verifyBaconianParams(cipherParams);

View File

@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
import com.mattrixwv.cipherstream.monosubstitution.BaseX;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
import lombok.extern.slf4j.Slf4j;
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
@RestController
@RequestMapping("/cipherStream/basex")
public class BaseXCipherController{
@GetMapping
public ObjectNode getCipherInfo(){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.BASE_X_CIPHER_NAME);
log.info("Getting info for {}", CipherInfoUtil.BASE_X_CIPHER_NAME);
return CipherInfoUtil.buildInfoNode(CipherInfoUtil.BASE_X_CIPHER_NAME, CipherInfoUtil.BASE_X_CIPHER_DESCRIPTION);
}
@GetMapping("/encode")
public ObjectNode encodeBaseX(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "BaseX");
log.info("Encoding BaseX");
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.BASE_X_CIPHER_NAME);
log.info("Encoding {}", CipherInfoUtil.BASE_X_CIPHER_NAME);
CipherParameterUtil.verifyBaseXParams(cipherParams);
@@ -41,8 +51,8 @@ public class BaseXCipherController{
@GetMapping("/decode")
public ObjectNode decodeBaseX(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "BaseX");
log.info("Decoding BaseX");
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.BASE_X_CIPHER_NAME);
log.info("Decoding {}", CipherInfoUtil.BASE_X_CIPHER_NAME);
CipherParameterUtil.verifyBaseXParams(cipherParams);

View File

@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
import com.mattrixwv.cipherstream.monosubstitution.Beaufort;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
import lombok.extern.slf4j.Slf4j;
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
@RestController
@RequestMapping("/cipherStream/beaufort")
public class BeaufortCipherController{
@GetMapping
public ObjectNode getCipherInfo(){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.BEAUFORT_CIPHER_NAME);
log.info("Getting info for {}", CipherInfoUtil.BEAUFORT_CIPHER_NAME);
return CipherInfoUtil.buildInfoNode(CipherInfoUtil.BEAUFORT_CIPHER_NAME, CipherInfoUtil.BEAUFORT_CIPHER_DESCRIPTION);
}
@GetMapping("/encode")
public ObjectNode encodeBeaufort(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Beaufort");
log.info("Encoding Beaufort");
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.BEAUFORT_CIPHER_NAME);
log.info("Encoding {}", CipherInfoUtil.BEAUFORT_CIPHER_NAME);
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
@@ -44,8 +54,8 @@ public class BeaufortCipherController{
@GetMapping("/decode")
public ObjectNode decodeBeaufort(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Beaufort");
log.info("Decoding Beaufort");
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.BEAUFORT_CIPHER_NAME);
log.info("Decoding {}", CipherInfoUtil.BEAUFORT_CIPHER_NAME);
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);

View File

@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
import com.mattrixwv.cipherstream.monosubstitution.Caesar;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
import lombok.extern.slf4j.Slf4j;
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
@RestController
@RequestMapping("/cipherStream/caesar")
public class CaesarCipherController{
@GetMapping
public ObjectNode getCipherInfo(){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.CAESAR_CIPHER_NAME);
log.info("Getting info for {}", CipherInfoUtil.CAESAR_CIPHER_NAME);
return CipherInfoUtil.buildInfoNode(CipherInfoUtil.CAESAR_CIPHER_NAME, CipherInfoUtil.CAESAR_CIPHER_DESCRIPTION);
}
@GetMapping("/encode")
public ObjectNode encodeCaesar(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Caesar");
log.info("Encoding Caesar");
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.CAESAR_CIPHER_NAME);
log.info("Encoding {}", CipherInfoUtil.CAESAR_CIPHER_NAME);
CipherParameterUtil.verifyCaesarParams(cipherParams);
@@ -44,8 +54,8 @@ public class CaesarCipherController{
@GetMapping("/decode")
public ObjectNode decodeCaesar(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Caesar");
log.info("Decoding Caesar");
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.CAESAR_CIPHER_NAME);
log.info("Decoding {}", CipherInfoUtil.CAESAR_CIPHER_NAME);
CipherParameterUtil.verifyCaesarParams(cipherParams);

View File

@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
import com.mattrixwv.cipherstream.monosubstitution.OneTimePad;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
import lombok.extern.slf4j.Slf4j;
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
@RestController
@RequestMapping("/cipherStream/oneTimePad")
public class OneTimePadCipherController{
@GetMapping
public ObjectNode getCipherInfo(){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ONE_TIME_PAD_CIPHER_NAME);
log.info("Getting info for {}", CipherInfoUtil.ONE_TIME_PAD_CIPHER_NAME);
return CipherInfoUtil.buildInfoNode(CipherInfoUtil.ONE_TIME_PAD_CIPHER_NAME, CipherInfoUtil.ONE_TIME_PAD_CIPHER_DESCRIPTION);
}
@GetMapping("/encode")
public ObjectNode encodeOneTimePad(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "One-Time Pad");
log.info("Encoding One Time Pad");
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ONE_TIME_PAD_CIPHER_NAME);
log.info("Encoding {}", CipherInfoUtil.ONE_TIME_PAD_CIPHER_NAME);
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
@@ -44,8 +54,8 @@ public class OneTimePadCipherController{
@GetMapping("/decode")
public ObjectNode decodeOneTimePad(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "One-Time Pad");
log.info("Decoding One Time Pad");
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ONE_TIME_PAD_CIPHER_NAME);
log.info("Decoding {}", CipherInfoUtil.ONE_TIME_PAD_CIPHER_NAME);
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);

View File

@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
import com.mattrixwv.cipherstream.monosubstitution.Porta;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
import lombok.extern.slf4j.Slf4j;
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
@RestController
@RequestMapping("/cipherStream/porta")
public class PortaCipherController{
@GetMapping
public ObjectNode getCipherInfo(){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.PORTA_CIPHER_NAME);
log.info("Getting info for {}", CipherInfoUtil.PORTA_CIPHER_NAME);
return CipherInfoUtil.buildInfoNode(CipherInfoUtil.PORTA_CIPHER_NAME, CipherInfoUtil.PORTA_CIPHER_DESCRIPTION);
}
@GetMapping("/encode")
public ObjectNode encodePorta(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Porta");
log.info("Encoding Porta");
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.PORTA_CIPHER_NAME);
log.info("Encoding {}", CipherInfoUtil.PORTA_CIPHER_NAME);
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
@@ -44,8 +54,8 @@ public class PortaCipherController{
@GetMapping("/decode")
public ObjectNode decodePorta(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Porta");
log.info("Decoding Porta");
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.PORTA_CIPHER_NAME);
log.info("Decoding {}", CipherInfoUtil.PORTA_CIPHER_NAME);
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);

View File

@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
import com.mattrixwv.cipherstream.monosubstitution.Substitution;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
import lombok.extern.slf4j.Slf4j;
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
@RestController
@RequestMapping("/cipherStream/substitution")
public class SubstitutionCipherController{
@GetMapping
public ObjectNode getCipherInfo(){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.SUBSTITUTION_CIPHER_NAME);
log.info("Getting info for {}", CipherInfoUtil.SUBSTITUTION_CIPHER_NAME);
return CipherInfoUtil.buildInfoNode(CipherInfoUtil.SUBSTITUTION_CIPHER_NAME, CipherInfoUtil.SUBSTITUTION_CIPHER_DESCRIPTION);
}
@GetMapping("/encode")
public ObjectNode encodeSubstitution(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Substitution");
log.info("Encoding Substitution");
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.SUBSTITUTION_CIPHER_NAME);
log.info("Encoding {}", CipherInfoUtil.SUBSTITUTION_CIPHER_NAME);
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
@@ -44,8 +54,8 @@ public class SubstitutionCipherController{
@GetMapping("/decode")
public ObjectNode decodeSubstitution(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Substitution");
log.info("Decoding Substitution");
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.SUBSTITUTION_CIPHER_NAME);
log.info("Decoding {}", CipherInfoUtil.SUBSTITUTION_CIPHER_NAME);
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);

View File

@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
import com.mattrixwv.cipherstream.monosubstitution.Vigenere;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
import lombok.extern.slf4j.Slf4j;
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
@RestController
@RequestMapping("/cipherStream/vigenere")
public class VigenereCipherController{
@GetMapping
public ObjectNode getCipherInfo(){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.VIGENERE_CIPHER_NAME);
log.info("Getting info for {}", CipherInfoUtil.VIGENERE_CIPHER_NAME);
return CipherInfoUtil.buildInfoNode(CipherInfoUtil.VIGENERE_CIPHER_NAME, CipherInfoUtil.VIGENERE_CIPHER_DESCRIPTION);
}
@GetMapping("/encode")
public ObjectNode encodeVigenere(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Vigenere");
log.info("Encoding Vigenere");
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.VIGENERE_CIPHER_NAME);
log.info("Encoding {}", CipherInfoUtil.VIGENERE_CIPHER_NAME);
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
@@ -44,8 +54,8 @@ public class VigenereCipherController{
@GetMapping("/decode")
public ObjectNode decodeVigenere(@RequestBody ObjectNode cipherParams){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Vigenere");
log.info("Decoding Vigenere");
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.VIGENERE_CIPHER_NAME);
log.info("Decoding {}", CipherInfoUtil.VIGENERE_CIPHER_NAME);
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);

View File

@@ -0,0 +1,60 @@
package com.mattrixwv.cipherstream.utils;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import lombok.experimental.UtilityClass;
@UtilityClass
public class CipherInfoUtil{
public static final ObjectMapper mapper = new ObjectMapper();
//Parameters
public static final String CIPHER_NAME = "name";
public static final String CIPHER_DESCRIPTION = "description";
//Cipher Names
public static final String ADFGVX_CIPHER_NAME = "ADFGVX";
public static final String ADFGX_CIPHER_NAME = "ADFGX";
public static final String AFFINE_CIPHER_NAME = "Affine";
public static final String ATBASH_CIPHER_NAME = "Atbash";
public static final String AUTOKEY_CIPHER_NAME = "Autokey";
public static final String BACONIAN_CIPHER_NAME = "Baconian";
public static final String BASE_X_CIPHER_NAME = "Base X";
public static final String BEAUFORT_CIPHER_NAME = "Beaufort";
public static final String CAESAR_CIPHER_NAME = "Caesar";
public static final String ONE_TIME_PAD_CIPHER_NAME = "One-Time Pad";
public static final String PORTA_CIPHER_NAME = "Porta";
public static final String SUBSTITUTION_CIPHER_NAME = "Substitution";
public static final String VIGENERE_CIPHER_NAME = "Vigenere";
//TODO: Cipher descriptions
public static final String ADFGVX_CIPHER_DESCRIPTION = "ADFGVX Cipher";
public static final String ADFGX_CIPHER_DESCRIPTION = "ADFGX Cipher";
public static final String AFFINE_CIPHER_DESCRIPTION = "Affine Cipher";
public static final String ATBASH_CIPHER_DESCRIPTION = "Atbash Cipher";
public static final String AUTOKEY_CIPHER_DESCRIPTION = "Autokey Cipher";
public static final String BACONIAN_CIPHER_DESCRIPTION = "Baconian Cipher";
public static final String BASE_X_CIPHER_DESCRIPTION = "Base X Cipher";
public static final String BEAUFORT_CIPHER_DESCRIPTION = "Beaufort Cipher";
public static final String CAESAR_CIPHER_DESCRIPTION = "Caesar Cipher";
public static final String ONE_TIME_PAD_CIPHER_DESCRIPTION = "One-Time Pad Cipher";
public static final String PORTA_CIPHER_DESCRIPTION = "Porta Cipher";
public static final String SUBSTITUTION_CIPHER_DESCRIPTION = "Substitution Cipher";
public static final String VIGENERE_CIPHER_DESCRIPTION = "Vigenere Cipher";
public static ObjectNode buildInfoNode(String name, String description){
ObjectNode infoNode = mapper.createObjectNode();
infoNode.put(CIPHER_NAME, name);
infoNode.put(CIPHER_DESCRIPTION, description);
return infoNode;
}
}

View File

@@ -46,7 +46,7 @@ public class FullFilterIntegrationTest{
@Test
public void testDoFilterInternal() throws Exception{
mockMvc.perform(get("/cipherStream")
mockMvc.perform(get("/cipherStream/caesar")
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", ipAddresses)
.param("param1", "value1")
@@ -63,7 +63,7 @@ public class FullFilterIntegrationTest{
@Test
public void testDoFilterInternal_NoParameters() throws Exception{
mockMvc.perform(get("/cipherStream")
mockMvc.perform(get("/cipherStream/caesar")
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", ipAddresses))
.andExpect(status().isOk());

View File

@@ -13,7 +13,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
@@ -51,6 +53,27 @@ public class AdfgvxCipherControllerIntegrationTest extends CipherStreamControlle
encodedNode.put(CipherParameterUtil.OUTPUT_STRING, decodedString);
}
@Test
public void testGetCipherInfo() throws Exception{
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(CipherInfoUtil.ADFGVX_CIPHER_NAME, CipherInfoUtil.ADFGVX_CIPHER_DESCRIPTION);
mockMvc.perform(get(url)
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", "192.168.1.1"))
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(CipherInfoUtil.ADFGVX_CIPHER_NAME))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(CipherInfoUtil.ADFGVX_CIPHER_DESCRIPTION));
//Filter
super.verifyFilter(url);
//Controller
verify(adfgvxLogger, times(1)).info("Getting info for {}", CipherInfoUtil.ADFGVX_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", infoNode);
}
@Test
public void testEncodeAdfgvx() throws Exception{
mockMvc.perform(get(url + "/encode")
@@ -65,7 +88,7 @@ public class AdfgvxCipherControllerIntegrationTest extends CipherStreamControlle
//Filter
super.verifyFilter(url + "/encode");
//Controller
verify(adfgvxLogger, times(1)).info("Encoding ADFGVX");
verify(adfgvxLogger, times(1)).info("Encoding {}", CipherInfoUtil.ADFGVX_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
}
@@ -84,7 +107,7 @@ public class AdfgvxCipherControllerIntegrationTest extends CipherStreamControlle
//Filter
super.verifyFilter(url + "/decode");
//Controller
verify(adfgvxLogger, times(1)).info("Decoding ADFGVX");
verify(adfgvxLogger, times(1)).info("Decoding {}", CipherInfoUtil.ADFGVX_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
}

View File

@@ -13,7 +13,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
@@ -52,6 +54,26 @@ public class AdfgxCipherControllerIntegrationTest extends CipherStreamController
}
@Test
public void testGetCipherInfo() throws Exception{
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(CipherInfoUtil.ADFGX_CIPHER_NAME, CipherInfoUtil.ADFGX_CIPHER_DESCRIPTION);
mockMvc.perform(get(url)
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", "192.168.1.1"))
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(CipherInfoUtil.ADFGX_CIPHER_NAME))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(CipherInfoUtil.ADFGX_CIPHER_DESCRIPTION));
//Filter
super.verifyFilter(url);
//Controller
verify(adfgxLogger, times(1)).info("Getting info for {}", CipherInfoUtil.ADFGX_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", infoNode);
}
@Test
public void testEncodeAdfgx() throws Exception{
mockMvc.perform(get(url + "/encode")
@@ -66,7 +88,7 @@ public class AdfgxCipherControllerIntegrationTest extends CipherStreamController
//Filter
super.verifyFilter(url + "/encode");
//Controller
verify(adfgxLogger, times(1)).info("Encoding ADFGX");
verify(adfgxLogger, times(1)).info("Encoding {}", CipherInfoUtil.ADFGX_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
}
@@ -85,7 +107,7 @@ public class AdfgxCipherControllerIntegrationTest extends CipherStreamController
//Filter
super.verifyFilter(url + "/decode");
//Controller
verify(adfgxLogger, times(1)).info("Decoding ADFGX");
verify(adfgxLogger, times(1)).info("Decoding {}", CipherInfoUtil.ADFGX_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
}

View File

@@ -13,7 +13,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
@@ -51,6 +53,27 @@ public class AffineCipherControllerIntegrationTest extends CipherStreamControlle
encodedNode.put(CipherParameterUtil.OUTPUT_STRING, decodedString);
}
@Test
public void testGetCipherInfo() throws Exception{
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(CipherInfoUtil.AFFINE_CIPHER_NAME, CipherInfoUtil.AFFINE_CIPHER_DESCRIPTION);
mockMvc.perform(get(url)
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", "192.168.1.1"))
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(CipherInfoUtil.AFFINE_CIPHER_DESCRIPTION))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(CipherInfoUtil.AFFINE_CIPHER_NAME));
//Filter
super.verifyFilter(url);
//Controller
verify(affineLogger, times(1)).info("Getting info for {}", CipherInfoUtil.AFFINE_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", infoNode);
}
@Test
public void testEncodeAffine() throws Exception{
mockMvc.perform(get(url + "/encode")
@@ -65,7 +88,7 @@ public class AffineCipherControllerIntegrationTest extends CipherStreamControlle
//Filter
super.verifyFilter(url + "/encode");
//Controller
verify(affineLogger, times(1)).info("Encoding Affine");
verify(affineLogger, times(1)).info("Encoding {}", CipherInfoUtil.AFFINE_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
}
@@ -84,7 +107,7 @@ public class AffineCipherControllerIntegrationTest extends CipherStreamControlle
//Filter
super.verifyFilter(url + "/decode");
//Controller
verify(affineLogger, times(1)).info("Decoding Affine");
verify(affineLogger, times(1)).info("Decoding {}", CipherInfoUtil.AFFINE_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
}

View File

@@ -13,7 +13,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
@@ -46,6 +48,26 @@ public class AtbashCipherControllerIntegrationTest extends CipherStreamControlle
}
@Test
public void testGetCipherInfo() throws Exception{
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(CipherInfoUtil.ATBASH_CIPHER_NAME, CipherInfoUtil.ATBASH_CIPHER_DESCRIPTION);
mockMvc.perform(get(url)
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", "192.168.1.1"))
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(CipherInfoUtil.ATBASH_CIPHER_DESCRIPTION))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(CipherInfoUtil.ATBASH_CIPHER_NAME));
//Filter
super.verifyFilter(url);
//Controller
verify(atbashLogger, times(1)).info("Getting info for {}", CipherInfoUtil.ATBASH_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", infoNode);
}
@Test
public void testEncodeAtbash() throws Exception{
mockMvc.perform(get(url + "/encode")
@@ -60,7 +82,7 @@ public class AtbashCipherControllerIntegrationTest extends CipherStreamControlle
//Filter
super.verifyFilter(url + "/encode");
//Controller
verify(atbashLogger, times(1)).info("Encoding Atbash");
verify(atbashLogger, times(1)).info("Encoding {}", CipherInfoUtil.ATBASH_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
}
@@ -79,7 +101,7 @@ public class AtbashCipherControllerIntegrationTest extends CipherStreamControlle
//Filter
super.verifyFilter(url + "/decode");
//Controller
verify(atbashLogger, times(1)).info("Decoding Atbash");
verify(atbashLogger, times(1)).info("Decoding {}", CipherInfoUtil.ATBASH_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
}

View File

@@ -13,7 +13,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
@@ -49,6 +51,27 @@ public class AutokeyCipherControllerIntegrationTest extends CipherStreamControll
encodedNode.put(CipherParameterUtil.OUTPUT_STRING, decodedString);
}
@Test
public void testGetCipherInfo() throws Exception{
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(CipherInfoUtil.AUTOKEY_CIPHER_NAME, CipherInfoUtil.AUTOKEY_CIPHER_DESCRIPTION);
mockMvc.perform(get(url)
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", "192.168.1.1"))
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(CipherInfoUtil.AUTOKEY_CIPHER_DESCRIPTION))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(CipherInfoUtil.AUTOKEY_CIPHER_NAME));
//Filter
super.verifyFilter(url);
//Controller
verify(autokeyLogger, times(1)).info("Getting info for {}", CipherInfoUtil.AUTOKEY_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", infoNode);
}
@Test
public void testEncodeAutokey() throws Exception{
mockMvc.perform(get(url + "/encode")
@@ -63,7 +86,7 @@ public class AutokeyCipherControllerIntegrationTest extends CipherStreamControll
//Filter
super.verifyFilter(url + "/encode");
//Controller
verify(autokeyLogger, times(1)).info("Encoding Autokey");
verify(autokeyLogger, times(1)).info("Encoding {}", CipherInfoUtil.AUTOKEY_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
}
@@ -82,7 +105,7 @@ public class AutokeyCipherControllerIntegrationTest extends CipherStreamControll
//Filter
super.verifyFilter(url + "/decode");
//Controller
verify(autokeyLogger, times(1)).info("Decoding Autokey");
verify(autokeyLogger, times(1)).info("Decoding {}", CipherInfoUtil.AUTOKEY_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
}

View File

@@ -13,7 +13,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
@@ -45,6 +47,27 @@ public class BaconianCipherControllerIntegrationTest extends CipherStreamControl
encodedNode.put(CipherParameterUtil.OUTPUT_STRING, decodedString.replaceAll("[^a-zA-Z]", ""));
}
@Test
public void testGetCipherInfo() throws Exception{
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(CipherInfoUtil.BACONIAN_CIPHER_NAME, CipherInfoUtil.BACONIAN_CIPHER_DESCRIPTION);
mockMvc.perform(get(url)
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", "192.168.1.1"))
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(CipherInfoUtil.BACONIAN_CIPHER_DESCRIPTION))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(CipherInfoUtil.BACONIAN_CIPHER_NAME));
//Filter
super.verifyFilter(url);
//Controller
verify(baconianLogger, times(1)).info("Getting info for {}", CipherInfoUtil.BACONIAN_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", infoNode);
}
@Test
public void testEncodeBaconian() throws Exception{
mockMvc.perform(get(url + "/encode")
@@ -59,7 +82,7 @@ public class BaconianCipherControllerIntegrationTest extends CipherStreamControl
//Filter
super.verifyFilter(url + "/encode");
//Controller
verify(baconianLogger, times(1)).info("Encoding Baconian");
verify(baconianLogger, times(1)).info("Encoding {}", CipherInfoUtil.BACONIAN_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
}
@@ -78,7 +101,7 @@ public class BaconianCipherControllerIntegrationTest extends CipherStreamControl
//Filter
super.verifyFilter(url + "/decode");
//Controller
verify(baconianLogger, times(1)).info("Decoding Baconian");
verify(baconianLogger, times(1)).info("Decoding {}", CipherInfoUtil.BACONIAN_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
}

View File

@@ -13,7 +13,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
@@ -49,6 +51,26 @@ public class BaseXCipherControllerIntegrationTest extends CipherStreamController
}
@Test
public void testGetCipherInfo() throws Exception{
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(CipherInfoUtil.BASE_X_CIPHER_NAME, CipherInfoUtil.BASE_X_CIPHER_DESCRIPTION);
mockMvc.perform(get(url)
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", "192.168.1.1"))
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(CipherInfoUtil.BASE_X_CIPHER_DESCRIPTION))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(CipherInfoUtil.BASE_X_CIPHER_NAME));
//Filter
super.verifyFilter(url);
//Controller
verify(baseXLogger, times(1)).info("Getting info for {}", CipherInfoUtil.BASE_X_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", infoNode);
}
@Test
public void testEncodeBaseXEncode() throws Exception{
mockMvc.perform(get(url + "/encode")
@@ -63,7 +85,7 @@ public class BaseXCipherControllerIntegrationTest extends CipherStreamController
//Filter
super.verifyFilter(url + "/encode");
//Controller
verify(baseXLogger, times(1)).info("Encoding BaseX");
verify(baseXLogger, times(1)).info("Encoding {}", CipherInfoUtil.BASE_X_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
}
@@ -82,7 +104,7 @@ public class BaseXCipherControllerIntegrationTest extends CipherStreamController
//Filter
super.verifyFilter(url + "/decode");
//Controller
verify(baseXLogger, times(1)).info("Decoding BaseX");
verify(baseXLogger, times(1)).info("Decoding {}", CipherInfoUtil.BASE_X_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
}

View File

@@ -13,7 +13,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
@@ -48,6 +50,27 @@ public class BeaufortCipherControllerIntegrationTest extends CipherStreamControl
encodedNode.put(CipherParameterUtil.OUTPUT_STRING, decodedString);
}
@Test
public void testGetCipherInfo() throws Exception{
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(CipherInfoUtil.BEAUFORT_CIPHER_NAME, CipherInfoUtil.BEAUFORT_CIPHER_DESCRIPTION);
mockMvc.perform(get(url)
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", "192.168.1.1"))
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(CipherInfoUtil.BEAUFORT_CIPHER_DESCRIPTION))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(CipherInfoUtil.BEAUFORT_CIPHER_NAME));
//Filter
super.verifyFilter(url);
//Controller
verify(beaufortLogger, times(1)).info("Getting info for {}", CipherInfoUtil.BEAUFORT_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", infoNode);
}
@Test
public void testEncodeBeaufort() throws Exception{
mockMvc.perform(get(url + "/encode")
@@ -62,7 +85,7 @@ public class BeaufortCipherControllerIntegrationTest extends CipherStreamControl
//Filter
super.verifyFilter(url + "/encode");
//Controller
verify(beaufortLogger, times(1)).info("Encoding Beaufort");
verify(beaufortLogger, times(1)).info("Encoding {}", CipherInfoUtil.BEAUFORT_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
}
@@ -81,7 +104,7 @@ public class BeaufortCipherControllerIntegrationTest extends CipherStreamControl
//Filter
super.verifyFilter(url + "/decode");
//Controller
verify(beaufortLogger, times(1)).info("Decoding Beaufort");
verify(beaufortLogger, times(1)).info("Decoding {}", CipherInfoUtil.BEAUFORT_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
}

View File

@@ -13,7 +13,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
@@ -49,6 +51,26 @@ public class CaesarCipherControllerIntegrationTest extends CipherStreamControlle
}
@Test
public void testGetCipherInfo() throws Exception{
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(CipherInfoUtil.CAESAR_CIPHER_NAME, CipherInfoUtil.CAESAR_CIPHER_DESCRIPTION);
mockMvc.perform(get(url)
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", "192.168.1.1"))
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(CipherInfoUtil.CAESAR_CIPHER_DESCRIPTION))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(CipherInfoUtil.CAESAR_CIPHER_NAME));
//Filter
super.verifyFilter(url);
//Controller
verify(caesarLogger, times(1)).info("Getting info for {}", CipherInfoUtil.CAESAR_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", infoNode);
}
@Test
public void testEncodeCaesar() throws Exception{
mockMvc.perform(get(url + "/encode")
@@ -63,7 +85,7 @@ public class CaesarCipherControllerIntegrationTest extends CipherStreamControlle
//Filter
super.verifyFilter(url + "/encode");
//Controller
verify(caesarLogger, times(1)).info("Encoding Caesar");
verify(caesarLogger, times(1)).info("Encoding {}", CipherInfoUtil.CAESAR_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
}
@@ -82,7 +104,7 @@ public class CaesarCipherControllerIntegrationTest extends CipherStreamControlle
//Filter
super.verifyFilter(url + "/decode");
//Controller
verify(caesarLogger, times(1)).info("Decoding Caesar");
verify(caesarLogger, times(1)).info("Decoding {}", CipherInfoUtil.CAESAR_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
}

View File

@@ -13,7 +13,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
@@ -49,6 +51,26 @@ public class OneTimePadCipherControllerIntegrationTest extends CipherStreamContr
}
@Test
public void testGetCipherInfo() throws Exception{
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(CipherInfoUtil.ONE_TIME_PAD_CIPHER_NAME, CipherInfoUtil.ONE_TIME_PAD_CIPHER_DESCRIPTION);
mockMvc.perform(get(url)
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", "192.168.1.1"))
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(CipherInfoUtil.ONE_TIME_PAD_CIPHER_DESCRIPTION))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(CipherInfoUtil.ONE_TIME_PAD_CIPHER_NAME));
//Filter
super.verifyFilter(url);
//Controller
verify(oneTimePadLogger, times(1)).info("Getting info for {}", CipherInfoUtil.ONE_TIME_PAD_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", infoNode);
}
@Test
public void testEncodeOneTimePad() throws Exception{
mockMvc.perform(get(url + "/encode")
@@ -63,7 +85,7 @@ public class OneTimePadCipherControllerIntegrationTest extends CipherStreamContr
//Filter
super.verifyFilter(url + "/encode");
//Controller
verify(oneTimePadLogger, times(1)).info("Encoding One Time Pad");
verify(oneTimePadLogger, times(1)).info("Encoding {}", CipherInfoUtil.ONE_TIME_PAD_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
}
@@ -82,7 +104,7 @@ public class OneTimePadCipherControllerIntegrationTest extends CipherStreamContr
//Filter
super.verifyFilter(url + "/decode");
//Controller
verify(oneTimePadLogger, times(1)).info("Decoding One Time Pad");
verify(oneTimePadLogger, times(1)).info("Decoding {}", CipherInfoUtil.ONE_TIME_PAD_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
}

View File

@@ -14,7 +14,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
@@ -50,6 +52,26 @@ public class PortaCipherControllerIntegrationTest extends CipherStreamController
}
@Test
public void testGetCipherInfo() throws Exception{
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(CipherInfoUtil.PORTA_CIPHER_NAME, CipherInfoUtil.PORTA_CIPHER_DESCRIPTION);
mockMvc.perform(get(url)
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", "192.168.1.1"))
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(CipherInfoUtil.PORTA_CIPHER_DESCRIPTION))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(CipherInfoUtil.PORTA_CIPHER_NAME));
//Filter
super.verifyFilter(url);
//Controller
verify(portaLogger, times(1)).info("Getting info for {}", CipherInfoUtil.PORTA_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", infoNode);
}
@Test
public void testEncodePorta() throws Exception{
mockMvc.perform(get(url + "/encode")
@@ -68,7 +90,7 @@ public class PortaCipherControllerIntegrationTest extends CipherStreamController
verify(mdc, times(1)).put("url", url + "/encode");
verify(mdc, times(1)).clear();
//Controller
verify(portaLogger, times(1)).info("Encoding Porta");
verify(portaLogger, times(1)).info("Encoding {}", CipherInfoUtil.PORTA_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
}
@@ -91,7 +113,7 @@ public class PortaCipherControllerIntegrationTest extends CipherStreamController
verify(mdc, times(1)).put("url", url + "/decode");
verify(mdc, times(1)).clear();
//Controller
verify(portaLogger, times(1)).info("Decoding Porta");
verify(portaLogger, times(1)).info("Decoding {}", CipherInfoUtil.PORTA_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
}

View File

@@ -13,7 +13,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
@@ -49,6 +51,26 @@ public class SubstitutionCipherControllerIntegrationTest extends CipherStreamCon
}
@Test
public void testGetCipherInfo() throws Exception{
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(CipherInfoUtil.SUBSTITUTION_CIPHER_NAME, CipherInfoUtil.SUBSTITUTION_CIPHER_DESCRIPTION);
mockMvc.perform(get(url)
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", "192.168.1.1"))
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(CipherInfoUtil.SUBSTITUTION_CIPHER_DESCRIPTION))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(CipherInfoUtil.SUBSTITUTION_CIPHER_NAME));
//Filter
super.verifyFilter(url);
//Controller
verify(substitutionLogger, times(1)).info("Getting info for {}", CipherInfoUtil.SUBSTITUTION_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", infoNode);
}
@Test
public void testEncodeSubstitution() throws Exception{
mockMvc.perform(get(url + "/encode")
@@ -63,7 +85,7 @@ public class SubstitutionCipherControllerIntegrationTest extends CipherStreamCon
//Filter
super.verifyFilter(url + "/encode");
//Controller
verify(substitutionLogger, times(1)).info("Encoding Substitution");
verify(substitutionLogger, times(1)).info("Encoding {}", CipherInfoUtil.SUBSTITUTION_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
}
@@ -82,7 +104,7 @@ public class SubstitutionCipherControllerIntegrationTest extends CipherStreamCon
//Filter
super.verifyFilter(url + "/decode");
//Controller
verify(substitutionLogger, times(1)).info("Decoding Substitution");
verify(substitutionLogger, times(1)).info("Decoding {}", CipherInfoUtil.SUBSTITUTION_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
}

View File

@@ -13,7 +13,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
@@ -49,6 +51,26 @@ public class VigenereCipherControllerIntegrationTest extends CipherStreamControl
}
@Test
public void testGetCipherInfo() throws Exception{
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(CipherInfoUtil.VIGENERE_CIPHER_NAME, CipherInfoUtil.VIGENERE_CIPHER_DESCRIPTION);
mockMvc.perform(get(url)
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", "192.168.1.1"))
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(CipherInfoUtil.VIGENERE_CIPHER_DESCRIPTION))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(CipherInfoUtil.VIGENERE_CIPHER_NAME));
//Filter
super.verifyFilter(url);
//Controller
verify(vigenereLogger, times(1)).info("Getting info for {}", CipherInfoUtil.VIGENERE_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", infoNode);
}
@Test
public void testEncodeVigenere() throws Exception{
mockMvc.perform(get(url + "/encode")
@@ -63,7 +85,7 @@ public class VigenereCipherControllerIntegrationTest extends CipherStreamControl
//Filter
super.verifyFilter(url + "/encode");
//Controller
verify(vigenereLogger, times(1)).info("Encoding Vigenere");
verify(vigenereLogger, times(1)).info("Encoding {}", CipherInfoUtil.VIGENERE_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
}
@@ -82,7 +104,7 @@ public class VigenereCipherControllerIntegrationTest extends CipherStreamControl
//Filter
super.verifyFilter(url + "/decode");
//Controller
verify(vigenereLogger, times(1)).info("Decoding Vigenere");
verify(vigenereLogger, times(1)).info("Decoding {}", CipherInfoUtil.VIGENERE_CIPHER_NAME);
//Cipher Aspect
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
}