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

@@ -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);
}