|
@@ -28,6 +28,7 @@ import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Optional;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
+
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
|
|
@Slf4j
|
|
@@ -43,6 +44,47 @@ public class ItsOpServerApplicationTests {
|
|
|
@Autowired
|
|
|
private SqlSessionFactory sqlSessionFactory;
|
|
|
|
|
|
+ @Test
|
|
|
+ void testJsonParse() {
|
|
|
+ //String text = "{\"evt\":{\"uid\":6\tid:366773\tstat:\"4\"\ttm:\"20230412T162709.408\"\tetm:\"20230412T162710.531\"\ttype:7\tobj:{\"id\":2164885\ttype:\"2\"\tvattr:\"4\"\tbox:[0.336\t0.697\t0.081\t0.164]\tspeed:26.899}}}";
|
|
|
+ //String text = "{\"evt\":{\"uid\":6,id:366773,stat:\"4\",tm:\"20230412T162709.408\",etm:\"20230412T162710.531\",type:7,obj:{\"id\":2164885,type:\"2\",vattr:\"4\",box:[0.336,0.697,0.081,0.164],speed:26.899}}}";
|
|
|
+ String text = "{\"evt\":{\"uid\":6,\"id\":366773,\"stat\":\"4\",\"tm\":\"20230412T162709.408\",\"etm\":\"20230412T162710.531\",\"type\":7,\"obj\":{\"id\":2164885,\"type\":\"2\",\"vattr\":\"4\",\"box\":[0.336,0.697,0.081,0.164],\"speed\":26.899}}}";
|
|
|
+// JSONParser jsonParser = new JSONParser();
|
|
|
+// JSONObject jsonObject = null;
|
|
|
+// try {
|
|
|
+// jsonObject = (JSONObject)jsonParser.parse(text);
|
|
|
+// } catch (ParseException e) {
|
|
|
+// log.error("XXXXXXXXXXXXXXX: {}", e.toString());
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// log.info("{}", jsonObject.toString());
|
|
|
+// Iterator<String> iterator = jsonObject.keySet().iterator();
|
|
|
+// while(iterator.hasNext()) {
|
|
|
+// String key = iterator.next();
|
|
|
+// log.info("{}", key);
|
|
|
+// JSONObject objList = (JSONObject)jsonObject.get(key);
|
|
|
+// log.info("{}", objList);
|
|
|
+// if ("evt".equals(key)) {
|
|
|
+// log.info("Receive Event Data");
|
|
|
+// String uid = objList.get("uid").toString();
|
|
|
+// String stat = objList.get("stat").toString();
|
|
|
+// String tm = objList.get("tm").toString();
|
|
|
+// String id = objList.get("id").toString();
|
|
|
+// String etm = objList.get("etm").toString();
|
|
|
+// String type = objList.get("type").toString();
|
|
|
+// log.info("uid: {}", uid);
|
|
|
+// log.info("stat: {}", stat);
|
|
|
+// log.info("tm: {}", tm);
|
|
|
+// log.info("id: {}", id);
|
|
|
+// log.info("etm: {}", etm);
|
|
|
+// log.info("type: {}", type);
|
|
|
+// if ("7".equals(type) || "13".equals(type)) {
|
|
|
+// JSONObject itemList = (JSONObject) objList.get("obj");
|
|
|
+// log.info("obj: {}", itemList.toString());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+ }
|
|
|
@Test
|
|
|
void status_check_return_ok() {
|
|
|
TestRestTemplate rest = new TestRestTemplate();
|