|
@@ -16,12 +16,12 @@ import io.netty.buffer.Unpooled;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
import java.net.InetAddress;
|
|
|
import java.net.UnknownHostException;
|
|
|
+import java.nio.charset.Charset;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.Executors;
|
|
@@ -30,7 +30,7 @@ import java.util.concurrent.ThreadPoolExecutor;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
@Slf4j
|
|
|
-@SpringBootTest
|
|
|
+//@SpringBootTest
|
|
|
public class EvpCommServerApplicationTests {
|
|
|
|
|
|
public static final EvpsCenter rCenter = EvpsCenter.builder()
|
|
@@ -43,7 +43,7 @@ public class EvpCommServerApplicationTests {
|
|
|
.dump(false)
|
|
|
.build();
|
|
|
|
|
|
- @Autowired
|
|
|
+// @Autowired
|
|
|
private KafkaProducerService kafkaService;
|
|
|
public static String toString( Date date ) {
|
|
|
|
|
@@ -74,6 +74,7 @@ public class EvpCommServerApplicationTests {
|
|
|
log.info("{}", toString(new Date()));
|
|
|
log.info("{}", TimeUtils.now());
|
|
|
}
|
|
|
+
|
|
|
@Test
|
|
|
void sendTopicService() {
|
|
|
KafkaEvpsServiceDto data = KafkaEvpsServiceDto.builder()
|
|
@@ -107,6 +108,40 @@ public class EvpCommServerApplicationTests {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ void testHangul() throws UnsupportedEncodingException {
|
|
|
+ String data = "BCADB4EBC0FCBFAAB3D7B0C5B8AE0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
|
|
|
+ byte[] inBytes = ByteUtils.hexToByteArray(data);
|
|
|
+ String eucKrString = new String(inBytes, "EUC-KR");
|
|
|
+
|
|
|
+ String decString1 = new String(inBytes);
|
|
|
+ String decString2 = new String(inBytes, Charset.defaultCharset());
|
|
|
+ String decString3 = new String(inBytes, StandardCharsets.UTF_8);
|
|
|
+
|
|
|
+ log.info("{}", Charset.defaultCharset());
|
|
|
+ log.info("eucKrString: {}", eucKrString);
|
|
|
+
|
|
|
+ log.info("{}", decString1);
|
|
|
+ log.info("{}", decString2);
|
|
|
+ log.info("{}", decString3);
|
|
|
+ log.info("{}", new String(decString1.getBytes("euc-kr")));
|
|
|
+ log.info("{}", new String(decString1.getBytes(StandardCharsets.UTF_8)));
|
|
|
+ log.info("{}", new String(decString1.getBytes(StandardCharsets.ISO_8859_1)));
|
|
|
+ log.info("{}", new String(decString1.getBytes(StandardCharsets.US_ASCII)));
|
|
|
+ log.info("{}", new String(decString1.getBytes(StandardCharsets.UTF_16)));
|
|
|
+ log.info("{}", new String(decString1.getBytes(StandardCharsets.UTF_16BE)));
|
|
|
+ log.info("{}", new String(decString1.getBytes(StandardCharsets.UTF_16LE)));
|
|
|
+
|
|
|
+ log.info("EUC-KR: {}", new String(inBytes, "EUC-KR"));
|
|
|
+
|
|
|
+ log.info("{}", new String(inBytes, StandardCharsets.UTF_8));
|
|
|
+ log.info("{}", new String(inBytes, StandardCharsets.ISO_8859_1));
|
|
|
+ log.info("{}", new String(inBytes, StandardCharsets.US_ASCII));
|
|
|
+ log.info("{}", new String(inBytes, StandardCharsets.UTF_16));
|
|
|
+ log.info("{}", new String(inBytes, StandardCharsets.UTF_16BE));
|
|
|
+ log.info("{}", new String(inBytes, StandardCharsets.UTF_16LE));
|
|
|
+ //new String(value, UTF_8)
|
|
|
+ }
|
|
|
@Test
|
|
|
void testSignal() {
|
|
|
String data = "55451700010001000107E80A07083713313833323032343130303730383535313930300084000A00000164000000E10100030300000001630000021D01000202000000016200000308010003030000000161000004A2010002020000000160000005AA0100020200000007290000070301000303000000015F0000075C01000303000000015E0000084B01000101000000015D0000098901000303000000015C00000C8A0100020200";
|
|
@@ -382,8 +417,8 @@ public class EvpCommServerApplicationTests {
|
|
|
lists.add(param);
|
|
|
|
|
|
int phaseCount = ((buffer[idx++] & 0xFF) << 8) | (buffer[idx++] & 0xFF);
|
|
|
-// log.info("[{}], EvpsNode.response: node({}), phaseCount({}). nodeName({})", center.getLogKey(), nodeId, phaseCount, getHangul(node.getNodeNm()));
|
|
|
- log.info("[{}], EvpsNode.response: node({}), phaseCount({}).", center.getLogKey(), nodeId, phaseCount);
|
|
|
+ log.info("[{}], EvpsNode.response: node({}), phaseCount({}). nodeName({})", center.getLogKey(), nodeId, phaseCount, getHangul(node.getNodeNm()));
|
|
|
+// log.info("[{}], EvpsNode.response: node({}), phaseCount({}).", center.getLogKey(), nodeId, phaseCount);
|
|
|
int reqPhaseDataSize = EvpsProtocolConst.NODE_DATA_PHASE_SIZE * phaseCount;
|
|
|
if ((buffer.length - idx) < reqPhaseDataSize) {
|
|
|
log.error("[{}], EvpsNode.response: Phase Data Length Error: Required data length({}), Cur({}). will be closed.",
|