From 8c50daeb6455b314067d0209fc4af76ebadee4da Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Fri, 7 Apr 2023 12:41:20 -0400 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9Java=20=E7=9A=84=20JDK=2017?= =?UTF-8?q?=20=E4=BD=BF=E7=94=A8=20Docker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 4 ++-- .../visafn/sharkfly/WeChatTest.java | 24 +++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2f8a2f7..e9c96ce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -FROM adoptopenjdk/openjdk11-openj9:alpine +FROM eclipse-temurin:17-jdk-alpine VOLUME /tmp COPY target/*.jar app.jar -EXPOSE 8282 +EXPOSE 8080 ENTRYPOINT ["java","-jar","/app.jar"] \ No newline at end of file diff --git a/src/test/java/com/northtecom/visafn/sharkfly/WeChatTest.java b/src/test/java/com/northtecom/visafn/sharkfly/WeChatTest.java index c945d15..39533f8 100644 --- a/src/test/java/com/northtecom/visafn/sharkfly/WeChatTest.java +++ b/src/test/java/com/northtecom/visafn/sharkfly/WeChatTest.java @@ -52,6 +52,30 @@ class WeChatTest { Document document = null; WeChatMessage weChatMessage = new WeChatMessage(); + try { + document = xmlReader.read(IOUtils.toInputStream(wechatMessageStr, StandardCharsets.UTF_8)); + + weChatMessage.setToUserName(document.getRootElement().element("ToUserName").getText()); + weChatMessage.setFromUserName(document.getRootElement().element("FromUserName").getText()); + weChatMessage.setCreateTime(NumberUtils.toLong(document.getRootElement().element("CreateTime").getText())); + weChatMessage.setMsgType(document.getRootElement().element("MsgType").getText()); + weChatMessage.setContent(document.getRootElement().element("Content").getText()); + weChatMessage.setMsgId(document.getRootElement().element("MsgId").getText()); + weChatMessage.setMsgDataId(document.getRootElement().element("MsgDataId").getText()); + weChatMessage.setIdx(document.getRootElement().element("Idx").getText()); + + + log.debug("WeChat Message Content - [{}]", weChatMessage.getContent()); + } catch (DocumentException e) { + throw new RuntimeException(e); + } + } + + @Test + public void testWeChatServiceWeChatMessage() { + SAXReader xmlReader = new SAXReader(); + Document document = null; + WeChatMessage weChatMessage = new WeChatMessage(); try { document = xmlReader.read(IOUtils.toInputStream(wechatMessageStr, StandardCharsets.UTF_8));