Update cipher descriptions
This commit is contained in:
@@ -13,6 +13,7 @@ import org.slf4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
@@ -27,16 +28,20 @@ import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
||||
public class AdfgvxCipherControllerIntegrationTest extends CipherStreamControllerIntegrationTestBase{
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
@Autowired
|
||||
private AdfgvxCipherController adfgvxCipherController;
|
||||
//Loggers
|
||||
@Mock(name = "com.mattrixwv.cipherstream.controller.combination.AdfgvxCipherController")
|
||||
private Logger adfgvxLogger;
|
||||
//Fields
|
||||
private String url = "/adfgvx";
|
||||
private String decodedString = "Message to^encode";
|
||||
private String encodedString = "AXgvdavfxgagfa afag^aaxdxfgdagda";
|
||||
private String keyword = "keyword";
|
||||
private String squareKeyword = "SquareKeyword";
|
||||
private static final ObjectNode blankNode = mapper.createObjectNode();
|
||||
private static final String url = "/adfgvx";
|
||||
private static final String decodedString = "Message to^encode";
|
||||
private static final String encodedString = "AXgvdavfxgagfa afag^aaxdxfgdagda";
|
||||
private static final String keyword = "keyword";
|
||||
private static final String squareKeyword = "SquareKeyword";
|
||||
private static final String adfgvxName = "adfgvxName";
|
||||
private static final String adfgvxDescription = "adfgvxDescription";
|
||||
|
||||
|
||||
@BeforeEach
|
||||
@@ -58,26 +63,29 @@ public class AdfgvxCipherControllerIntegrationTest extends CipherStreamControlle
|
||||
encodedNode.put(CipherParameterUtil.SQUARE_KEYWORD, squareKeyword);
|
||||
encodedNode.put(CipherParameterUtil.INPUT_STRING, encodedString);
|
||||
encodedNode.put(CipherParameterUtil.OUTPUT_STRING, decodedString);
|
||||
|
||||
ReflectionTestUtils.setField(adfgvxCipherController, "adfgvxName", adfgvxName);
|
||||
ReflectionTestUtils.setField(adfgvxCipherController, "adfgvxDescription", adfgvxDescription);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testGetCipherInfo() throws Exception{
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(CipherInfoUtil.ADFGVX_CIPHER_NAME, CipherInfoUtil.ADFGVX_CIPHER_DESCRIPTION);
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(adfgvxName, adfgvxDescription);
|
||||
|
||||
mockMvc.perform(get(url)
|
||||
.header("X-Request-Id", requestId)
|
||||
.header("X-Forwarded-For", ipAddress))
|
||||
.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));
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(adfgvxName))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(adfgvxDescription));
|
||||
|
||||
//Filter
|
||||
super.verifyFilter(url);
|
||||
//Controller
|
||||
verify(adfgvxLogger, times(1)).info("Getting info for {}", CipherInfoUtil.ADFGVX_CIPHER_NAME);
|
||||
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGVX_CIPHER_NAME);
|
||||
verify(adfgvxLogger, times(1)).info("Getting info for {}", adfgvxName);
|
||||
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, adfgvxName);
|
||||
//Cipher Aspect
|
||||
verify(aspectLogger, times(1)).info("CipherStream log {}", infoNode);
|
||||
}
|
||||
@@ -96,8 +104,8 @@ public class AdfgvxCipherControllerIntegrationTest extends CipherStreamControlle
|
||||
//Filter
|
||||
super.verifyFilter(url + "/encode");
|
||||
//Controller
|
||||
verify(adfgvxLogger, times(1)).info("Encoding {}", CipherInfoUtil.ADFGVX_CIPHER_NAME);
|
||||
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGVX_CIPHER_NAME);
|
||||
verify(adfgvxLogger, times(1)).info("Encoding {}", adfgvxName);
|
||||
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, adfgvxName);
|
||||
//Cipher Aspect
|
||||
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
||||
}
|
||||
@@ -116,8 +124,8 @@ public class AdfgvxCipherControllerIntegrationTest extends CipherStreamControlle
|
||||
//Filter
|
||||
super.verifyFilter(url + "/encode");
|
||||
//Controller
|
||||
verify(adfgvxLogger, times(1)).info("Encoding {}", CipherInfoUtil.ADFGVX_CIPHER_NAME);
|
||||
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGVX_CIPHER_NAME);
|
||||
verify(adfgvxLogger, times(1)).info("Encoding {}", adfgvxName);
|
||||
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, adfgvxName);
|
||||
//Cipher Aspect
|
||||
verifyNoInteractions(aspectLogger);
|
||||
}
|
||||
@@ -136,8 +144,8 @@ public class AdfgvxCipherControllerIntegrationTest extends CipherStreamControlle
|
||||
//Filter
|
||||
super.verifyFilter(url + "/decode");
|
||||
//Controller
|
||||
verify(adfgvxLogger, times(1)).info("Decoding {}", CipherInfoUtil.ADFGVX_CIPHER_NAME);
|
||||
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGVX_CIPHER_NAME);
|
||||
verify(adfgvxLogger, times(1)).info("Decoding {}", adfgvxName);
|
||||
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, adfgvxName);
|
||||
//Cipher Aspect
|
||||
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
||||
}
|
||||
@@ -156,8 +164,8 @@ public class AdfgvxCipherControllerIntegrationTest extends CipherStreamControlle
|
||||
//Filter
|
||||
super.verifyFilter(url + "/decode");
|
||||
//Controller
|
||||
verify(adfgvxLogger, times(1)).info("Decoding {}", CipherInfoUtil.ADFGVX_CIPHER_NAME);
|
||||
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGVX_CIPHER_NAME);
|
||||
verify(adfgvxLogger, times(1)).info("Decoding {}", adfgvxName);
|
||||
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, adfgvxName);
|
||||
//Cipher Aspect
|
||||
verifyNoInteractions(aspectLogger);
|
||||
}
|
||||
|
||||
@@ -3,11 +3,13 @@ package com.mattrixwv.cipherstream.controller.combination;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
@@ -23,16 +25,24 @@ public class AdfgvxCipherControllerTest{
|
||||
private AdfgvxCipherController adfgvxCipherController;
|
||||
//Fields
|
||||
private static final ObjectMapper mapper = new ObjectMapper();
|
||||
private static final ObjectNode blankNode = mapper.createObjectNode();
|
||||
private static final String KEYWORD = CipherParameterUtil.KEYWORD;
|
||||
private static final String SQUARE_KEYWORD = CipherParameterUtil.SQUARE_KEYWORD;
|
||||
private static final String INPUT_STRING = "Message to-encode";
|
||||
private static final String OUTPUT_STRING = "AXgvdavfxgagfa afag-aaxdxfgdagda";
|
||||
private static final ObjectNode blankNode = mapper.createObjectNode();
|
||||
private static final String adfgvxName = "adfgvxName";
|
||||
private static final String adfgvxDescription = "adfgvxDescription";
|
||||
|
||||
|
||||
@BeforeEach
|
||||
public void setup(){
|
||||
ReflectionTestUtils.setField(adfgvxCipherController, "adfgvxName", adfgvxName);
|
||||
ReflectionTestUtils.setField(adfgvxCipherController, "adfgvxDescription", adfgvxDescription);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tetGetCipherInfo(){
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(CipherInfoUtil.ADFGVX_CIPHER_NAME, CipherInfoUtil.ADFGVX_CIPHER_DESCRIPTION);
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(adfgvxName, adfgvxDescription);
|
||||
|
||||
|
||||
ObjectNode returnedJson = adfgvxCipherController.getCipherInfo();
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.slf4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
@@ -27,16 +28,20 @@ import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
||||
public class AdfgxCipherControllerIntegrationTest extends CipherStreamControllerIntegrationTestBase{
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
@Autowired
|
||||
private AdfgxCipherController adfgxCipherController;
|
||||
//Loggers
|
||||
@Mock(name = "com.mattrixwv.cipherstream.controller.combination.AdfgxCipherController")
|
||||
private Logger adfgxLogger;
|
||||
//Fields
|
||||
private String url = "/adfgx";
|
||||
private String decodedString = "Message to^encode";
|
||||
private String encodedString = "AAgagadfagaxxd axdx^adafafxddgdf";
|
||||
private String keyword = "keyword";
|
||||
private String squareKeyword = "SquareKeyword";
|
||||
private static final ObjectNode blankNode = mapper.createObjectNode();
|
||||
private static final String url = "/adfgx";
|
||||
private static final String decodedString = "Message to^encode";
|
||||
private static final String encodedString = "AAgagadfagaxxd axdx^adafafxddgdf";
|
||||
private static final String keyword = "keyword";
|
||||
private static final String squareKeyword = "SquareKeyword";
|
||||
private static final String adfgxName = "adfgxName";
|
||||
private static final String adfgxDescription = "adfgxDescription";
|
||||
|
||||
|
||||
@BeforeEach
|
||||
@@ -58,26 +63,29 @@ public class AdfgxCipherControllerIntegrationTest extends CipherStreamController
|
||||
encodedNode.put(CipherParameterUtil.SQUARE_KEYWORD, squareKeyword);
|
||||
encodedNode.put(CipherParameterUtil.INPUT_STRING, encodedString);
|
||||
encodedNode.put(CipherParameterUtil.OUTPUT_STRING, decodedString);
|
||||
|
||||
ReflectionTestUtils.setField(adfgxCipherController, "adfgxName", adfgxName);
|
||||
ReflectionTestUtils.setField(adfgxCipherController, "adfgxDescription", adfgxDescription);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testGetCipherInfo() throws Exception{
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(CipherInfoUtil.ADFGX_CIPHER_NAME, CipherInfoUtil.ADFGX_CIPHER_DESCRIPTION);
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(adfgxName, adfgxDescription);
|
||||
|
||||
mockMvc.perform(get(url)
|
||||
.header("X-Request-Id", requestId)
|
||||
.header("X-Forwarded-For", ipAddress))
|
||||
.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));
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(adfgxName))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(adfgxDescription));
|
||||
|
||||
//Filter
|
||||
super.verifyFilter(url);
|
||||
//Controller
|
||||
verify(adfgxLogger, times(1)).info("Getting info for {}", CipherInfoUtil.ADFGX_CIPHER_NAME);
|
||||
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGX_CIPHER_NAME);
|
||||
verify(adfgxLogger, times(1)).info("Getting info for {}", adfgxName);
|
||||
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, adfgxName);
|
||||
//Cipher Aspect
|
||||
verify(aspectLogger, times(1)).info("CipherStream log {}", infoNode);
|
||||
}
|
||||
@@ -96,8 +104,8 @@ public class AdfgxCipherControllerIntegrationTest extends CipherStreamController
|
||||
//Filter
|
||||
super.verifyFilter(url + "/encode");
|
||||
//Controller
|
||||
verify(adfgxLogger, times(1)).info("Encoding {}", CipherInfoUtil.ADFGX_CIPHER_NAME);
|
||||
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGX_CIPHER_NAME);
|
||||
verify(adfgxLogger, times(1)).info("Encoding {}", adfgxName);
|
||||
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, adfgxName);
|
||||
//Cipher Aspect
|
||||
verify(aspectLogger, times(1)).info("CipherStream log {}", decodedNode);
|
||||
}
|
||||
@@ -116,8 +124,8 @@ public class AdfgxCipherControllerIntegrationTest extends CipherStreamController
|
||||
//Filter
|
||||
super.verifyFilter(url + "/encode");
|
||||
//Controller
|
||||
verify(adfgxLogger, times(1)).info("Encoding {}", CipherInfoUtil.ADFGX_CIPHER_NAME);
|
||||
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGX_CIPHER_NAME);
|
||||
verify(adfgxLogger, times(1)).info("Encoding {}", adfgxName);
|
||||
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, adfgxName);
|
||||
//Cipher Aspect
|
||||
verifyNoInteractions(aspectLogger);
|
||||
}
|
||||
@@ -136,8 +144,8 @@ public class AdfgxCipherControllerIntegrationTest extends CipherStreamController
|
||||
//Filter
|
||||
super.verifyFilter(url + "/decode");
|
||||
//Controller
|
||||
verify(adfgxLogger, times(1)).info("Decoding {}", CipherInfoUtil.ADFGX_CIPHER_NAME);
|
||||
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGX_CIPHER_NAME);
|
||||
verify(adfgxLogger, times(1)).info("Decoding {}", adfgxName);
|
||||
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, adfgxName);
|
||||
//Cipher Aspect
|
||||
verify(aspectLogger, times(1)).info("CipherStream log {}", encodedNode);
|
||||
}
|
||||
@@ -156,8 +164,8 @@ public class AdfgxCipherControllerIntegrationTest extends CipherStreamController
|
||||
//Filter
|
||||
super.verifyFilter(url + "/decode");
|
||||
//Controller
|
||||
verify(adfgxLogger, times(1)).info("Decoding {}", CipherInfoUtil.ADFGX_CIPHER_NAME);
|
||||
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.ADFGX_CIPHER_NAME);
|
||||
verify(adfgxLogger, times(1)).info("Decoding {}", adfgxName);
|
||||
verify(mdc, times(1)).put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, adfgxName);
|
||||
//Cipher Aspect
|
||||
verifyNoInteractions(aspectLogger);
|
||||
}
|
||||
|
||||
@@ -3,11 +3,13 @@ package com.mattrixwv.cipherstream.controller.combination;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
@@ -23,16 +25,24 @@ public class AdfgxCipherControllerTest{
|
||||
private AdfgxCipherController adfgxCipherController;
|
||||
//Fields
|
||||
private static final ObjectMapper mapper = new ObjectMapper();
|
||||
private static final ObjectNode blankNode = mapper.createObjectNode();
|
||||
private static final String ADFGX_KEYWORD = CipherParameterUtil.KEYWORD;
|
||||
private static final String ADFGX_SQUARE_KEYWORD = CipherParameterUtil.SQUARE_KEYWORD;
|
||||
private static final String ADFGX_INPUT_STRING = "Message to^encode";
|
||||
private static final String ADFGX_OUTPUT_STRING = "AAgagadfagaxxd axdx^adafafxddgdf";
|
||||
private static final ObjectNode blankNode = mapper.createObjectNode();
|
||||
private static final String adfgxName = "adfgxName";
|
||||
private static final String adfgxDescription = "adfgxDescription";
|
||||
|
||||
|
||||
@BeforeEach
|
||||
public void setup(){
|
||||
ReflectionTestUtils.setField(adfgxCipherController, "adfgxName", adfgxName);
|
||||
ReflectionTestUtils.setField(adfgxCipherController, "adfgxDescription", adfgxDescription);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCipherInfo(){
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(CipherInfoUtil.ADFGX_CIPHER_NAME, CipherInfoUtil.ADFGX_CIPHER_DESCRIPTION);
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(adfgxName, adfgxDescription);
|
||||
|
||||
|
||||
ObjectNode returnedJson = adfgxCipherController.getCipherInfo();
|
||||
|
||||
Reference in New Issue
Block a user