首次提交代码

This commit is contained in:
zhouxiunai
2018-11-23 09:08:15 +08:00
commit 047ae94f64
21 changed files with 857 additions and 0 deletions
@@ -0,0 +1,16 @@
package com.gzzn.omms.msgexchangeapi;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class MsgexchangeApiApplicationTests {
@Test
public void contextLoads() {
}
}
@@ -0,0 +1,47 @@
package com.gzzn.omms.msgexchangeapi.service;
import java.io.IOException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ExchangeServiceImplTest {
@Autowired
private IExchangeService exchangeService;
@Test
public void testXmlToJson() throws JsonParseException, JsonMappingException, IOException {
String xmlString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
"<MSG xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"unisysaodbsis.xsd\">\r\n" +
" <META>\r\n" +
" <SNDR>AODB</SNDR>\r\n" +
"<SEQN>754508</SEQN>\r\n" +
"<DTTM>20181112221954</DTTM>\r\n" +
"<TYPE>FLOP</TYPE>\r\n" +
"<STYP>PSDT</STYP>\r\n" +
"</META>\r\n" +
"<FLOP>\r\n" +
"<FLID>11450149</FLID>\r\n" +
"<FFID>MU-MU5851-A-12NOV182250-D</FFID>\r\n" +
"<PSDT PSNO = \"1\">\r\n" +
"<PSST>343</PSST>\r\n" +
"<STST>12NOV182230</STST>\r\n" +
"<STET>12NOV182300</STET>\r\n" +
"</PSDT>\r\n" +
"</FLOP>\r\n" +
"</MSG>";
String jsonString = exchangeService.xmlToJson(xmlString);
System.out.println(jsonString);
//assertThat(jsonPath("$.", matcher)).
}
}