修改Java 的 JDK 17 使用 Docker

This commit is contained in:
YuCheng Hu 2023-04-07 12:41:20 -04:00
parent 42b75586bf
commit 8c50daeb64
2 changed files with 26 additions and 2 deletions

View File

@ -1,5 +1,5 @@
FROM adoptopenjdk/openjdk11-openj9:alpine FROM eclipse-temurin:17-jdk-alpine
VOLUME /tmp VOLUME /tmp
COPY target/*.jar app.jar COPY target/*.jar app.jar
EXPOSE 8282 EXPOSE 8080
ENTRYPOINT ["java","-jar","/app.jar"] ENTRYPOINT ["java","-jar","/app.jar"]

View File

@ -52,6 +52,30 @@ class WeChatTest {
Document document = null; Document document = null;
WeChatMessage weChatMessage = new WeChatMessage(); 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 { try {
document = xmlReader.read(IOUtils.toInputStream(wechatMessageStr, StandardCharsets.UTF_8)); document = xmlReader.read(IOUtils.toInputStream(wechatMessageStr, StandardCharsets.UTF_8));