Begin test update
This commit is contained in:
@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
||||||
import com.mattrixwv.cipherstream.combination.ADFGVX;
|
import com.mattrixwv.cipherstream.combination.ADFGVX;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("adfgvx")
|
@RequestMapping("adfgvx")
|
||||||
public class AdfgvxCipherController{
|
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")
|
@GetMapping("/encode")
|
||||||
public ObjectNode encodeAdfgvx(@RequestBody ObjectNode cipherParams){
|
public ObjectNode encodeAdfgvx(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "ADFGVX");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGVX_CIPHER_NAME);
|
||||||
log.info("Encoding ADFGVX");
|
log.info("Encoding {}", CipherInfoUtil.ADFGVX_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifySquareKeyword(cipherParams);
|
CipherParameterUtil.verifySquareKeyword(cipherParams);
|
||||||
@@ -45,8 +55,8 @@ public class AdfgvxCipherController{
|
|||||||
|
|
||||||
@GetMapping("/decode")
|
@GetMapping("/decode")
|
||||||
public ObjectNode decodeAdfgvx(@RequestBody ObjectNode cipherParams){
|
public ObjectNode decodeAdfgvx(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "ADFGVX");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGVX_CIPHER_NAME);
|
||||||
log.info("Decoding ADFGVX");
|
log.info("Decoding {}", CipherInfoUtil.ADFGVX_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifySquareKeyword(cipherParams);
|
CipherParameterUtil.verifySquareKeyword(cipherParams);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
||||||
import com.mattrixwv.cipherstream.combination.ADFGX;
|
import com.mattrixwv.cipherstream.combination.ADFGX;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("adfgx")
|
@RequestMapping("adfgx")
|
||||||
public class AdfgxCipherController{
|
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")
|
@GetMapping("/encode")
|
||||||
public ObjectNode encodeAdfgx(@RequestBody ObjectNode cipherParams){
|
public ObjectNode encodeAdfgx(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "ADFGX");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGX_CIPHER_NAME);
|
||||||
log.info("Encoding ADFGX");
|
log.info("Encoding {}", CipherInfoUtil.ADFGX_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifySquareKeyword(cipherParams);
|
CipherParameterUtil.verifySquareKeyword(cipherParams);
|
||||||
@@ -45,8 +55,8 @@ public class AdfgxCipherController{
|
|||||||
|
|
||||||
@GetMapping("/decode")
|
@GetMapping("/decode")
|
||||||
public ObjectNode decodeAdfgx(@RequestBody ObjectNode cipherParams){
|
public ObjectNode decodeAdfgx(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "ADFGX");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGX_CIPHER_NAME);
|
||||||
log.info("Decoding ADFGX");
|
log.info("Decoding {}", CipherInfoUtil.ADFGX_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifySquareKeyword(cipherParams);
|
CipherParameterUtil.verifySquareKeyword(cipherParams);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
||||||
import com.mattrixwv.cipherstream.monosubstitution.Affine;
|
import com.mattrixwv.cipherstream.monosubstitution.Affine;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/cipherStream/affine")
|
@RequestMapping("/cipherStream/affine")
|
||||||
public class AffineCipherController{
|
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")
|
@GetMapping("/encode")
|
||||||
public ObjectNode encodeAffine(@RequestBody ObjectNode cipherParams){
|
public ObjectNode encodeAffine(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Affine");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.AFFINE_CIPHER_NAME);
|
||||||
log.info("Encoding Affine");
|
log.info("Encoding {}", CipherInfoUtil.AFFINE_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifyAffineParams(cipherParams);
|
CipherParameterUtil.verifyAffineParams(cipherParams);
|
||||||
@@ -45,8 +55,8 @@ public class AffineCipherController{
|
|||||||
|
|
||||||
@GetMapping("/decode")
|
@GetMapping("/decode")
|
||||||
public ObjectNode decodeAffine(@RequestBody ObjectNode cipherParams){
|
public ObjectNode decodeAffine(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Affine");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.AFFINE_CIPHER_NAME);
|
||||||
log.info("Decoding Affine");
|
log.info("Decoding {}", CipherInfoUtil.AFFINE_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifyAffineParams(cipherParams);
|
CipherParameterUtil.verifyAffineParams(cipherParams);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
||||||
import com.mattrixwv.cipherstream.monosubstitution.Atbash;
|
import com.mattrixwv.cipherstream.monosubstitution.Atbash;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/cipherStream/atbash")
|
@RequestMapping("/cipherStream/atbash")
|
||||||
public class AtbashCipherController{
|
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")
|
@GetMapping("/encode")
|
||||||
public ObjectNode encodeAtbash(@RequestBody ObjectNode cipherParams){
|
public ObjectNode encodeAtbash(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Atbash");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ATBASH_CIPHER_NAME);
|
||||||
log.info("Encoding Atbash");
|
log.info("Encoding {}", CipherInfoUtil.ATBASH_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifyAtbashParams(cipherParams);
|
CipherParameterUtil.verifyAtbashParams(cipherParams);
|
||||||
@@ -43,8 +53,8 @@ public class AtbashCipherController{
|
|||||||
|
|
||||||
@GetMapping("/decode")
|
@GetMapping("/decode")
|
||||||
public ObjectNode decodeAtbash(@RequestBody ObjectNode cipherParams){
|
public ObjectNode decodeAtbash(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Atbash");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ATBASH_CIPHER_NAME);
|
||||||
log.info("Decoding Atbash");
|
log.info("Decoding {}", CipherInfoUtil.ATBASH_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifyAtbashParams(cipherParams);
|
CipherParameterUtil.verifyAtbashParams(cipherParams);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
||||||
import com.mattrixwv.cipherstream.monosubstitution.Autokey;
|
import com.mattrixwv.cipherstream.monosubstitution.Autokey;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/cipherStream/autokey")
|
@RequestMapping("/cipherStream/autokey")
|
||||||
public class AutokeyCipherController{
|
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")
|
@GetMapping("/encode")
|
||||||
public ObjectNode encodeAutokey(@RequestBody ObjectNode cipherParams){
|
public ObjectNode encodeAutokey(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Autokey");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.AUTOKEY_CIPHER_NAME);
|
||||||
log.info("Encoding Autokey");
|
log.info("Encoding {}", CipherInfoUtil.AUTOKEY_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
|
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
|
||||||
@@ -44,8 +54,8 @@ public class AutokeyCipherController{
|
|||||||
|
|
||||||
@GetMapping("/decode")
|
@GetMapping("/decode")
|
||||||
public ObjectNode decodeAutokey(@RequestBody ObjectNode cipherParams){
|
public ObjectNode decodeAutokey(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Autokey");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.AUTOKEY_CIPHER_NAME);
|
||||||
log.info("Decoding Autokey");
|
log.info("Decoding {}", CipherInfoUtil.AUTOKEY_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
|
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
||||||
import com.mattrixwv.cipherstream.monosubstitution.Baconian;
|
import com.mattrixwv.cipherstream.monosubstitution.Baconian;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/cipherStream/baconian")
|
@RequestMapping("/cipherStream/baconian")
|
||||||
public class BaconianCipherController{
|
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")
|
@GetMapping("/encode")
|
||||||
public ObjectNode encodeBaconian(@RequestBody ObjectNode cipherParams){
|
public ObjectNode encodeBaconian(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Baconian");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Baconian");
|
||||||
log.info("Encoding Baconian");
|
log.info("Encoding {}", CipherInfoUtil.BACONIAN_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifyBaconianParams(cipherParams);
|
CipherParameterUtil.verifyBaconianParams(cipherParams);
|
||||||
@@ -42,7 +52,7 @@ public class BaconianCipherController{
|
|||||||
@GetMapping("/decode")
|
@GetMapping("/decode")
|
||||||
public ObjectNode decodeBaconian(@RequestBody ObjectNode cipherParams){
|
public ObjectNode decodeBaconian(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Baconian");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Baconian");
|
||||||
log.info("Decoding Baconian");
|
log.info("Decoding {}", CipherInfoUtil.BACONIAN_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifyBaconianParams(cipherParams);
|
CipherParameterUtil.verifyBaconianParams(cipherParams);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
||||||
import com.mattrixwv.cipherstream.monosubstitution.BaseX;
|
import com.mattrixwv.cipherstream.monosubstitution.BaseX;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/cipherStream/basex")
|
@RequestMapping("/cipherStream/basex")
|
||||||
public class BaseXCipherController{
|
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")
|
@GetMapping("/encode")
|
||||||
public ObjectNode encodeBaseX(@RequestBody ObjectNode cipherParams){
|
public ObjectNode encodeBaseX(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "BaseX");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.BASE_X_CIPHER_NAME);
|
||||||
log.info("Encoding BaseX");
|
log.info("Encoding {}", CipherInfoUtil.BASE_X_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifyBaseXParams(cipherParams);
|
CipherParameterUtil.verifyBaseXParams(cipherParams);
|
||||||
@@ -41,8 +51,8 @@ public class BaseXCipherController{
|
|||||||
|
|
||||||
@GetMapping("/decode")
|
@GetMapping("/decode")
|
||||||
public ObjectNode decodeBaseX(@RequestBody ObjectNode cipherParams){
|
public ObjectNode decodeBaseX(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "BaseX");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.BASE_X_CIPHER_NAME);
|
||||||
log.info("Decoding BaseX");
|
log.info("Decoding {}", CipherInfoUtil.BASE_X_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifyBaseXParams(cipherParams);
|
CipherParameterUtil.verifyBaseXParams(cipherParams);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
||||||
import com.mattrixwv.cipherstream.monosubstitution.Beaufort;
|
import com.mattrixwv.cipherstream.monosubstitution.Beaufort;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/cipherStream/beaufort")
|
@RequestMapping("/cipherStream/beaufort")
|
||||||
public class BeaufortCipherController{
|
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")
|
@GetMapping("/encode")
|
||||||
public ObjectNode encodeBeaufort(@RequestBody ObjectNode cipherParams){
|
public ObjectNode encodeBeaufort(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Beaufort");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.BEAUFORT_CIPHER_NAME);
|
||||||
log.info("Encoding Beaufort");
|
log.info("Encoding {}", CipherInfoUtil.BEAUFORT_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
|
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
|
||||||
@@ -44,8 +54,8 @@ public class BeaufortCipherController{
|
|||||||
|
|
||||||
@GetMapping("/decode")
|
@GetMapping("/decode")
|
||||||
public ObjectNode decodeBeaufort(@RequestBody ObjectNode cipherParams){
|
public ObjectNode decodeBeaufort(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Beaufort");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.BEAUFORT_CIPHER_NAME);
|
||||||
log.info("Decoding Beaufort");
|
log.info("Decoding {}", CipherInfoUtil.BEAUFORT_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
|
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
||||||
import com.mattrixwv.cipherstream.monosubstitution.Caesar;
|
import com.mattrixwv.cipherstream.monosubstitution.Caesar;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/cipherStream/caesar")
|
@RequestMapping("/cipherStream/caesar")
|
||||||
public class CaesarCipherController{
|
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")
|
@GetMapping("/encode")
|
||||||
public ObjectNode encodeCaesar(@RequestBody ObjectNode cipherParams){
|
public ObjectNode encodeCaesar(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Caesar");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.CAESAR_CIPHER_NAME);
|
||||||
log.info("Encoding Caesar");
|
log.info("Encoding {}", CipherInfoUtil.CAESAR_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifyCaesarParams(cipherParams);
|
CipherParameterUtil.verifyCaesarParams(cipherParams);
|
||||||
@@ -44,8 +54,8 @@ public class CaesarCipherController{
|
|||||||
|
|
||||||
@GetMapping("/decode")
|
@GetMapping("/decode")
|
||||||
public ObjectNode decodeCaesar(@RequestBody ObjectNode cipherParams){
|
public ObjectNode decodeCaesar(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Caesar");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.CAESAR_CIPHER_NAME);
|
||||||
log.info("Decoding Caesar");
|
log.info("Decoding {}", CipherInfoUtil.CAESAR_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifyCaesarParams(cipherParams);
|
CipherParameterUtil.verifyCaesarParams(cipherParams);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
||||||
import com.mattrixwv.cipherstream.monosubstitution.OneTimePad;
|
import com.mattrixwv.cipherstream.monosubstitution.OneTimePad;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/cipherStream/oneTimePad")
|
@RequestMapping("/cipherStream/oneTimePad")
|
||||||
public class OneTimePadCipherController{
|
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")
|
@GetMapping("/encode")
|
||||||
public ObjectNode encodeOneTimePad(@RequestBody ObjectNode cipherParams){
|
public ObjectNode encodeOneTimePad(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "One-Time Pad");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ONE_TIME_PAD_CIPHER_NAME);
|
||||||
log.info("Encoding One Time Pad");
|
log.info("Encoding {}", CipherInfoUtil.ONE_TIME_PAD_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
|
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
|
||||||
@@ -44,8 +54,8 @@ public class OneTimePadCipherController{
|
|||||||
|
|
||||||
@GetMapping("/decode")
|
@GetMapping("/decode")
|
||||||
public ObjectNode decodeOneTimePad(@RequestBody ObjectNode cipherParams){
|
public ObjectNode decodeOneTimePad(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "One-Time Pad");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ONE_TIME_PAD_CIPHER_NAME);
|
||||||
log.info("Decoding One Time Pad");
|
log.info("Decoding {}", CipherInfoUtil.ONE_TIME_PAD_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
|
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
||||||
import com.mattrixwv.cipherstream.monosubstitution.Porta;
|
import com.mattrixwv.cipherstream.monosubstitution.Porta;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/cipherStream/porta")
|
@RequestMapping("/cipherStream/porta")
|
||||||
public class PortaCipherController{
|
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")
|
@GetMapping("/encode")
|
||||||
public ObjectNode encodePorta(@RequestBody ObjectNode cipherParams){
|
public ObjectNode encodePorta(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Porta");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.PORTA_CIPHER_NAME);
|
||||||
log.info("Encoding Porta");
|
log.info("Encoding {}", CipherInfoUtil.PORTA_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
|
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
|
||||||
@@ -44,8 +54,8 @@ public class PortaCipherController{
|
|||||||
|
|
||||||
@GetMapping("/decode")
|
@GetMapping("/decode")
|
||||||
public ObjectNode decodePorta(@RequestBody ObjectNode cipherParams){
|
public ObjectNode decodePorta(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Porta");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.PORTA_CIPHER_NAME);
|
||||||
log.info("Decoding Porta");
|
log.info("Decoding {}", CipherInfoUtil.PORTA_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
|
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
||||||
import com.mattrixwv.cipherstream.monosubstitution.Substitution;
|
import com.mattrixwv.cipherstream.monosubstitution.Substitution;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/cipherStream/substitution")
|
@RequestMapping("/cipherStream/substitution")
|
||||||
public class SubstitutionCipherController{
|
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")
|
@GetMapping("/encode")
|
||||||
public ObjectNode encodeSubstitution(@RequestBody ObjectNode cipherParams){
|
public ObjectNode encodeSubstitution(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Substitution");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.SUBSTITUTION_CIPHER_NAME);
|
||||||
log.info("Encoding Substitution");
|
log.info("Encoding {}", CipherInfoUtil.SUBSTITUTION_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
|
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
|
||||||
@@ -44,8 +54,8 @@ public class SubstitutionCipherController{
|
|||||||
|
|
||||||
@GetMapping("/decode")
|
@GetMapping("/decode")
|
||||||
public ObjectNode decodeSubstitution(@RequestBody ObjectNode cipherParams){
|
public ObjectNode decodeSubstitution(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Substitution");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.SUBSTITUTION_CIPHER_NAME);
|
||||||
log.info("Decoding Substitution");
|
log.info("Decoding {}", CipherInfoUtil.SUBSTITUTION_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
|
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
|
||||||
import com.mattrixwv.cipherstream.monosubstitution.Vigenere;
|
import com.mattrixwv.cipherstream.monosubstitution.Vigenere;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -19,10 +20,19 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/cipherStream/vigenere")
|
@RequestMapping("/cipherStream/vigenere")
|
||||||
public class VigenereCipherController{
|
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")
|
@GetMapping("/encode")
|
||||||
public ObjectNode encodeVigenere(@RequestBody ObjectNode cipherParams){
|
public ObjectNode encodeVigenere(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Vigenere");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.VIGENERE_CIPHER_NAME);
|
||||||
log.info("Encoding Vigenere");
|
log.info("Encoding {}", CipherInfoUtil.VIGENERE_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
|
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
|
||||||
@@ -44,8 +54,8 @@ public class VigenereCipherController{
|
|||||||
|
|
||||||
@GetMapping("/decode")
|
@GetMapping("/decode")
|
||||||
public ObjectNode decodeVigenere(@RequestBody ObjectNode cipherParams){
|
public ObjectNode decodeVigenere(@RequestBody ObjectNode cipherParams){
|
||||||
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, "Vigenere");
|
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.VIGENERE_CIPHER_NAME);
|
||||||
log.info("Decoding Vigenere");
|
log.info("Decoding {}", CipherInfoUtil.VIGENERE_CIPHER_NAME);
|
||||||
|
|
||||||
|
|
||||||
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
|
CipherParameterUtil.verifyParamsWithKeyword(cipherParams);
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -46,7 +46,7 @@ public class FullFilterIntegrationTest{
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDoFilterInternal() throws Exception{
|
public void testDoFilterInternal() throws Exception{
|
||||||
mockMvc.perform(get("/cipherStream")
|
mockMvc.perform(get("/cipherStream/caesar")
|
||||||
.header("X-Request-Id", requestId)
|
.header("X-Request-Id", requestId)
|
||||||
.header("X-Forwarded-For", ipAddresses)
|
.header("X-Forwarded-For", ipAddresses)
|
||||||
.param("param1", "value1")
|
.param("param1", "value1")
|
||||||
@@ -63,7 +63,7 @@ public class FullFilterIntegrationTest{
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDoFilterInternal_NoParameters() throws Exception{
|
public void testDoFilterInternal_NoParameters() throws Exception{
|
||||||
mockMvc.perform(get("/cipherStream")
|
mockMvc.perform(get("/cipherStream/caesar")
|
||||||
.header("X-Request-Id", requestId)
|
.header("X-Request-Id", requestId)
|
||||||
.header("X-Forwarded-For", ipAddresses))
|
.header("X-Forwarded-For", ipAddresses))
|
||||||
.andExpect(status().isOk());
|
.andExpect(status().isOk());
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
||||||
|
|
||||||
|
|
||||||
@@ -51,6 +53,27 @@ public class AdfgvxCipherControllerIntegrationTest extends CipherStreamControlle
|
|||||||
encodedNode.put(CipherParameterUtil.OUTPUT_STRING, decodedString);
|
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
|
@Test
|
||||||
public void testEncodeAdfgvx() throws Exception{
|
public void testEncodeAdfgvx() throws Exception{
|
||||||
mockMvc.perform(get(url + "/encode")
|
mockMvc.perform(get(url + "/encode")
|
||||||
@@ -65,7 +88,7 @@ public class AdfgvxCipherControllerIntegrationTest extends CipherStreamControlle
|
|||||||
//Filter
|
//Filter
|
||||||
super.verifyFilter(url + "/encode");
|
super.verifyFilter(url + "/encode");
|
||||||
//Controller
|
//Controller
|
||||||
verify(adfgvxLogger, times(1)).info("Encoding ADFGVX");
|
verify(adfgvxLogger, times(1)).info("Encoding {}", CipherInfoUtil.ADFGVX_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
||||||
}
|
}
|
||||||
@@ -84,7 +107,7 @@ public class AdfgvxCipherControllerIntegrationTest extends CipherStreamControlle
|
|||||||
//Filter
|
//Filter
|
||||||
super.verifyFilter(url + "/decode");
|
super.verifyFilter(url + "/decode");
|
||||||
//Controller
|
//Controller
|
||||||
verify(adfgvxLogger, times(1)).info("Decoding ADFGVX");
|
verify(adfgvxLogger, times(1)).info("Decoding {}", CipherInfoUtil.ADFGVX_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
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
|
@Test
|
||||||
public void testEncodeAdfgx() throws Exception{
|
public void testEncodeAdfgx() throws Exception{
|
||||||
mockMvc.perform(get(url + "/encode")
|
mockMvc.perform(get(url + "/encode")
|
||||||
@@ -66,7 +88,7 @@ public class AdfgxCipherControllerIntegrationTest extends CipherStreamController
|
|||||||
//Filter
|
//Filter
|
||||||
super.verifyFilter(url + "/encode");
|
super.verifyFilter(url + "/encode");
|
||||||
//Controller
|
//Controller
|
||||||
verify(adfgxLogger, times(1)).info("Encoding ADFGX");
|
verify(adfgxLogger, times(1)).info("Encoding {}", CipherInfoUtil.ADFGX_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
||||||
}
|
}
|
||||||
@@ -85,7 +107,7 @@ public class AdfgxCipherControllerIntegrationTest extends CipherStreamController
|
|||||||
//Filter
|
//Filter
|
||||||
super.verifyFilter(url + "/decode");
|
super.verifyFilter(url + "/decode");
|
||||||
//Controller
|
//Controller
|
||||||
verify(adfgxLogger, times(1)).info("Decoding ADFGX");
|
verify(adfgxLogger, times(1)).info("Decoding {}", CipherInfoUtil.ADFGX_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
||||||
|
|
||||||
|
|
||||||
@@ -51,6 +53,27 @@ public class AffineCipherControllerIntegrationTest extends CipherStreamControlle
|
|||||||
encodedNode.put(CipherParameterUtil.OUTPUT_STRING, decodedString);
|
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
|
@Test
|
||||||
public void testEncodeAffine() throws Exception{
|
public void testEncodeAffine() throws Exception{
|
||||||
mockMvc.perform(get(url + "/encode")
|
mockMvc.perform(get(url + "/encode")
|
||||||
@@ -65,7 +88,7 @@ public class AffineCipherControllerIntegrationTest extends CipherStreamControlle
|
|||||||
//Filter
|
//Filter
|
||||||
super.verifyFilter(url + "/encode");
|
super.verifyFilter(url + "/encode");
|
||||||
//Controller
|
//Controller
|
||||||
verify(affineLogger, times(1)).info("Encoding Affine");
|
verify(affineLogger, times(1)).info("Encoding {}", CipherInfoUtil.AFFINE_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
||||||
}
|
}
|
||||||
@@ -84,7 +107,7 @@ public class AffineCipherControllerIntegrationTest extends CipherStreamControlle
|
|||||||
//Filter
|
//Filter
|
||||||
super.verifyFilter(url + "/decode");
|
super.verifyFilter(url + "/decode");
|
||||||
//Controller
|
//Controller
|
||||||
verify(affineLogger, times(1)).info("Decoding Affine");
|
verify(affineLogger, times(1)).info("Decoding {}", CipherInfoUtil.AFFINE_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
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
|
@Test
|
||||||
public void testEncodeAtbash() throws Exception{
|
public void testEncodeAtbash() throws Exception{
|
||||||
mockMvc.perform(get(url + "/encode")
|
mockMvc.perform(get(url + "/encode")
|
||||||
@@ -60,7 +82,7 @@ public class AtbashCipherControllerIntegrationTest extends CipherStreamControlle
|
|||||||
//Filter
|
//Filter
|
||||||
super.verifyFilter(url + "/encode");
|
super.verifyFilter(url + "/encode");
|
||||||
//Controller
|
//Controller
|
||||||
verify(atbashLogger, times(1)).info("Encoding Atbash");
|
verify(atbashLogger, times(1)).info("Encoding {}", CipherInfoUtil.ATBASH_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
||||||
}
|
}
|
||||||
@@ -79,7 +101,7 @@ public class AtbashCipherControllerIntegrationTest extends CipherStreamControlle
|
|||||||
//Filter
|
//Filter
|
||||||
super.verifyFilter(url + "/decode");
|
super.verifyFilter(url + "/decode");
|
||||||
//Controller
|
//Controller
|
||||||
verify(atbashLogger, times(1)).info("Decoding Atbash");
|
verify(atbashLogger, times(1)).info("Decoding {}", CipherInfoUtil.ATBASH_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
||||||
|
|
||||||
|
|
||||||
@@ -49,6 +51,27 @@ public class AutokeyCipherControllerIntegrationTest extends CipherStreamControll
|
|||||||
encodedNode.put(CipherParameterUtil.OUTPUT_STRING, decodedString);
|
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
|
@Test
|
||||||
public void testEncodeAutokey() throws Exception{
|
public void testEncodeAutokey() throws Exception{
|
||||||
mockMvc.perform(get(url + "/encode")
|
mockMvc.perform(get(url + "/encode")
|
||||||
@@ -63,7 +86,7 @@ public class AutokeyCipherControllerIntegrationTest extends CipherStreamControll
|
|||||||
//Filter
|
//Filter
|
||||||
super.verifyFilter(url + "/encode");
|
super.verifyFilter(url + "/encode");
|
||||||
//Controller
|
//Controller
|
||||||
verify(autokeyLogger, times(1)).info("Encoding Autokey");
|
verify(autokeyLogger, times(1)).info("Encoding {}", CipherInfoUtil.AUTOKEY_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
||||||
}
|
}
|
||||||
@@ -82,7 +105,7 @@ public class AutokeyCipherControllerIntegrationTest extends CipherStreamControll
|
|||||||
//Filter
|
//Filter
|
||||||
super.verifyFilter(url + "/decode");
|
super.verifyFilter(url + "/decode");
|
||||||
//Controller
|
//Controller
|
||||||
verify(autokeyLogger, times(1)).info("Decoding Autokey");
|
verify(autokeyLogger, times(1)).info("Decoding {}", CipherInfoUtil.AUTOKEY_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
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]", ""));
|
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
|
@Test
|
||||||
public void testEncodeBaconian() throws Exception{
|
public void testEncodeBaconian() throws Exception{
|
||||||
mockMvc.perform(get(url + "/encode")
|
mockMvc.perform(get(url + "/encode")
|
||||||
@@ -59,7 +82,7 @@ public class BaconianCipherControllerIntegrationTest extends CipherStreamControl
|
|||||||
//Filter
|
//Filter
|
||||||
super.verifyFilter(url + "/encode");
|
super.verifyFilter(url + "/encode");
|
||||||
//Controller
|
//Controller
|
||||||
verify(baconianLogger, times(1)).info("Encoding Baconian");
|
verify(baconianLogger, times(1)).info("Encoding {}", CipherInfoUtil.BACONIAN_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
||||||
}
|
}
|
||||||
@@ -78,7 +101,7 @@ public class BaconianCipherControllerIntegrationTest extends CipherStreamControl
|
|||||||
//Filter
|
//Filter
|
||||||
super.verifyFilter(url + "/decode");
|
super.verifyFilter(url + "/decode");
|
||||||
//Controller
|
//Controller
|
||||||
verify(baconianLogger, times(1)).info("Decoding Baconian");
|
verify(baconianLogger, times(1)).info("Decoding {}", CipherInfoUtil.BACONIAN_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
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
|
@Test
|
||||||
public void testEncodeBaseXEncode() throws Exception{
|
public void testEncodeBaseXEncode() throws Exception{
|
||||||
mockMvc.perform(get(url + "/encode")
|
mockMvc.perform(get(url + "/encode")
|
||||||
@@ -63,7 +85,7 @@ public class BaseXCipherControllerIntegrationTest extends CipherStreamController
|
|||||||
//Filter
|
//Filter
|
||||||
super.verifyFilter(url + "/encode");
|
super.verifyFilter(url + "/encode");
|
||||||
//Controller
|
//Controller
|
||||||
verify(baseXLogger, times(1)).info("Encoding BaseX");
|
verify(baseXLogger, times(1)).info("Encoding {}", CipherInfoUtil.BASE_X_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
||||||
}
|
}
|
||||||
@@ -82,7 +104,7 @@ public class BaseXCipherControllerIntegrationTest extends CipherStreamController
|
|||||||
//Filter
|
//Filter
|
||||||
super.verifyFilter(url + "/decode");
|
super.verifyFilter(url + "/decode");
|
||||||
//Controller
|
//Controller
|
||||||
verify(baseXLogger, times(1)).info("Decoding BaseX");
|
verify(baseXLogger, times(1)).info("Decoding {}", CipherInfoUtil.BASE_X_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
||||||
|
|
||||||
|
|
||||||
@@ -48,6 +50,27 @@ public class BeaufortCipherControllerIntegrationTest extends CipherStreamControl
|
|||||||
encodedNode.put(CipherParameterUtil.OUTPUT_STRING, decodedString);
|
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
|
@Test
|
||||||
public void testEncodeBeaufort() throws Exception{
|
public void testEncodeBeaufort() throws Exception{
|
||||||
mockMvc.perform(get(url + "/encode")
|
mockMvc.perform(get(url + "/encode")
|
||||||
@@ -62,7 +85,7 @@ public class BeaufortCipherControllerIntegrationTest extends CipherStreamControl
|
|||||||
//Filter
|
//Filter
|
||||||
super.verifyFilter(url + "/encode");
|
super.verifyFilter(url + "/encode");
|
||||||
//Controller
|
//Controller
|
||||||
verify(beaufortLogger, times(1)).info("Encoding Beaufort");
|
verify(beaufortLogger, times(1)).info("Encoding {}", CipherInfoUtil.BEAUFORT_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
||||||
}
|
}
|
||||||
@@ -81,7 +104,7 @@ public class BeaufortCipherControllerIntegrationTest extends CipherStreamControl
|
|||||||
//Filter
|
//Filter
|
||||||
super.verifyFilter(url + "/decode");
|
super.verifyFilter(url + "/decode");
|
||||||
//Controller
|
//Controller
|
||||||
verify(beaufortLogger, times(1)).info("Decoding Beaufort");
|
verify(beaufortLogger, times(1)).info("Decoding {}", CipherInfoUtil.BEAUFORT_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
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
|
@Test
|
||||||
public void testEncodeCaesar() throws Exception{
|
public void testEncodeCaesar() throws Exception{
|
||||||
mockMvc.perform(get(url + "/encode")
|
mockMvc.perform(get(url + "/encode")
|
||||||
@@ -63,7 +85,7 @@ public class CaesarCipherControllerIntegrationTest extends CipherStreamControlle
|
|||||||
//Filter
|
//Filter
|
||||||
super.verifyFilter(url + "/encode");
|
super.verifyFilter(url + "/encode");
|
||||||
//Controller
|
//Controller
|
||||||
verify(caesarLogger, times(1)).info("Encoding Caesar");
|
verify(caesarLogger, times(1)).info("Encoding {}", CipherInfoUtil.CAESAR_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
||||||
}
|
}
|
||||||
@@ -82,7 +104,7 @@ public class CaesarCipherControllerIntegrationTest extends CipherStreamControlle
|
|||||||
//Filter
|
//Filter
|
||||||
super.verifyFilter(url + "/decode");
|
super.verifyFilter(url + "/decode");
|
||||||
//Controller
|
//Controller
|
||||||
verify(caesarLogger, times(1)).info("Decoding Caesar");
|
verify(caesarLogger, times(1)).info("Decoding {}", CipherInfoUtil.CAESAR_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
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
|
@Test
|
||||||
public void testEncodeOneTimePad() throws Exception{
|
public void testEncodeOneTimePad() throws Exception{
|
||||||
mockMvc.perform(get(url + "/encode")
|
mockMvc.perform(get(url + "/encode")
|
||||||
@@ -63,7 +85,7 @@ public class OneTimePadCipherControllerIntegrationTest extends CipherStreamContr
|
|||||||
//Filter
|
//Filter
|
||||||
super.verifyFilter(url + "/encode");
|
super.verifyFilter(url + "/encode");
|
||||||
//Controller
|
//Controller
|
||||||
verify(oneTimePadLogger, times(1)).info("Encoding One Time Pad");
|
verify(oneTimePadLogger, times(1)).info("Encoding {}", CipherInfoUtil.ONE_TIME_PAD_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
||||||
}
|
}
|
||||||
@@ -82,7 +104,7 @@ public class OneTimePadCipherControllerIntegrationTest extends CipherStreamContr
|
|||||||
//Filter
|
//Filter
|
||||||
super.verifyFilter(url + "/decode");
|
super.verifyFilter(url + "/decode");
|
||||||
//Controller
|
//Controller
|
||||||
verify(oneTimePadLogger, times(1)).info("Decoding One Time Pad");
|
verify(oneTimePadLogger, times(1)).info("Decoding {}", CipherInfoUtil.ONE_TIME_PAD_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
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
|
@Test
|
||||||
public void testEncodePorta() throws Exception{
|
public void testEncodePorta() throws Exception{
|
||||||
mockMvc.perform(get(url + "/encode")
|
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)).put("url", url + "/encode");
|
||||||
verify(mdc, times(1)).clear();
|
verify(mdc, times(1)).clear();
|
||||||
//Controller
|
//Controller
|
||||||
verify(portaLogger, times(1)).info("Encoding Porta");
|
verify(portaLogger, times(1)).info("Encoding {}", CipherInfoUtil.PORTA_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
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)).put("url", url + "/decode");
|
||||||
verify(mdc, times(1)).clear();
|
verify(mdc, times(1)).clear();
|
||||||
//Controller
|
//Controller
|
||||||
verify(portaLogger, times(1)).info("Decoding Porta");
|
verify(portaLogger, times(1)).info("Decoding {}", CipherInfoUtil.PORTA_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
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
|
@Test
|
||||||
public void testEncodeSubstitution() throws Exception{
|
public void testEncodeSubstitution() throws Exception{
|
||||||
mockMvc.perform(get(url + "/encode")
|
mockMvc.perform(get(url + "/encode")
|
||||||
@@ -63,7 +85,7 @@ public class SubstitutionCipherControllerIntegrationTest extends CipherStreamCon
|
|||||||
//Filter
|
//Filter
|
||||||
super.verifyFilter(url + "/encode");
|
super.verifyFilter(url + "/encode");
|
||||||
//Controller
|
//Controller
|
||||||
verify(substitutionLogger, times(1)).info("Encoding Substitution");
|
verify(substitutionLogger, times(1)).info("Encoding {}", CipherInfoUtil.SUBSTITUTION_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
||||||
}
|
}
|
||||||
@@ -82,7 +104,7 @@ public class SubstitutionCipherControllerIntegrationTest extends CipherStreamCon
|
|||||||
//Filter
|
//Filter
|
||||||
super.verifyFilter(url + "/decode");
|
super.verifyFilter(url + "/decode");
|
||||||
//Controller
|
//Controller
|
||||||
verify(substitutionLogger, times(1)).info("Decoding Substitution");
|
verify(substitutionLogger, times(1)).info("Decoding {}", CipherInfoUtil.SUBSTITUTION_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
import com.mattrixwv.cipherstream.controller.CipherStreamControllerIntegrationTestBase;
|
||||||
|
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
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
|
@Test
|
||||||
public void testEncodeVigenere() throws Exception{
|
public void testEncodeVigenere() throws Exception{
|
||||||
mockMvc.perform(get(url + "/encode")
|
mockMvc.perform(get(url + "/encode")
|
||||||
@@ -63,7 +85,7 @@ public class VigenereCipherControllerIntegrationTest extends CipherStreamControl
|
|||||||
//Filter
|
//Filter
|
||||||
super.verifyFilter(url + "/encode");
|
super.verifyFilter(url + "/encode");
|
||||||
//Controller
|
//Controller
|
||||||
verify(vigenereLogger, times(1)).info("Encoding Vigenere");
|
verify(vigenereLogger, times(1)).info("Encoding {}", CipherInfoUtil.VIGENERE_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
||||||
}
|
}
|
||||||
@@ -82,7 +104,7 @@ public class VigenereCipherControllerIntegrationTest extends CipherStreamControl
|
|||||||
//Filter
|
//Filter
|
||||||
super.verifyFilter(url + "/decode");
|
super.verifyFilter(url + "/decode");
|
||||||
//Controller
|
//Controller
|
||||||
verify(vigenereLogger, times(1)).info("Decoding Vigenere");
|
verify(vigenereLogger, times(1)).info("Decoding {}", CipherInfoUtil.VIGENERE_CIPHER_NAME);
|
||||||
//Cipher Aspect
|
//Cipher Aspect
|
||||||
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user