|
|
@ -3,6 +3,8 @@ package com.fr.design.mainframe.template.info; |
|
|
|
import com.fr.config.MarketConfig; |
|
|
|
import com.fr.config.MarketConfig; |
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
|
import com.fr.invoke.Reflect; |
|
|
|
import com.fr.invoke.Reflect; |
|
|
|
|
|
|
|
import com.fr.json.JSON; |
|
|
|
|
|
|
|
import com.fr.json.JSONFactory; |
|
|
|
import com.fr.json.JSONObject; |
|
|
|
import com.fr.json.JSONObject; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.xml.XMLableReader; |
|
|
|
import com.fr.stable.xml.XMLableReader; |
|
|
@ -105,18 +107,18 @@ public class TemplateInfoTest { |
|
|
|
assertJsonStringEquals("{\"uid\":71113,\"originID\":\"\",\"create_time\":\"2020-05-07 17:28\"," + |
|
|
|
assertJsonStringEquals("{\"uid\":71113,\"originID\":\"\",\"create_time\":\"2020-05-07 17:28\"," + |
|
|
|
"\"saveRecord\":\"{\\\"time\\\":1588843693000,\\\"consume\\\":4}\"," + |
|
|
|
"\"saveRecord\":\"{\\\"time\\\":1588843693000,\\\"consume\\\":4}\"," + |
|
|
|
"\"templateID\":\"aac1139e-018b-4481-867a-a18fc6d6f3e6\"," + |
|
|
|
"\"templateID\":\"aac1139e-018b-4481-867a-a18fc6d6f3e6\"," + |
|
|
|
"\"uuid\":\"6b6699ff-ec63-43b0-9deb-b580a5f10411\"}", new JSONObject(consumingMap).toString()); |
|
|
|
"\"uuid\":\"6b6699ff-ec63-43b0-9deb-b580a5f10411\"}", JSONFactory.createJSON(JSON.OBJECT, consumingMap).toString()); |
|
|
|
|
|
|
|
|
|
|
|
assertJsonStringEquals("{\"uid\":71113,\"originID\":\"aac1139e-018b-4481-867a-a18fc6d6f3e6\"," + |
|
|
|
assertJsonStringEquals("{\"uid\":71113,\"originID\":\"aac1139e-018b-4481-867a-a18fc6d6f3e6\"," + |
|
|
|
"\"create_time\":\"2020-05-07 17:45\",\"saveRecord\":\"{\\\"time\\\":1588844751000,\\\"consume\\\":1058}\"," + |
|
|
|
"\"create_time\":\"2020-05-07 17:45\",\"saveRecord\":\"{\\\"time\\\":1588844751000,\\\"consume\\\":1058}\"," + |
|
|
|
"\"templateID\":\"2521d03c-b238-41a5-9a1d-2498efff3a97\"," + |
|
|
|
"\"templateID\":\"2521d03c-b238-41a5-9a1d-2498efff3a97\"," + |
|
|
|
"\"uuid\":\"6b6699ff-ec63-43b0-9deb-b580a5f10411\"}", new JSONObject(consumingMap1).toString()); |
|
|
|
"\"uuid\":\"6b6699ff-ec63-43b0-9deb-b580a5f10411\"}", JSONFactory.createJSON(JSON.OBJECT, consumingMap1).toString()); |
|
|
|
assertJsonStringEquals("{\"process\":\"\",\"float_count\":0,\"widget_count\":0,\"cell_count\":3," + |
|
|
|
assertJsonStringEquals("{\"process\":\"\",\"float_count\":0,\"widget_count\":0,\"cell_count\":3," + |
|
|
|
"\"paraApply\":0,\"block_count\":0,\"report_type\":0,\"components_info\":\"[]\"," + |
|
|
|
"\"paraApply\":0,\"block_count\":0,\"report_type\":0,\"components_info\":\"[]\"," + |
|
|
|
"\"templateID\":\"aac1139e-018b-4481-867a-a18fc6d6f3e6\"}", new JSONObject(processMap).toString()); |
|
|
|
"\"templateID\":\"aac1139e-018b-4481-867a-a18fc6d6f3e6\"}", JSONFactory.createJSON(JSON.OBJECT, processMap).toString()); |
|
|
|
assertJsonStringEquals("{\"process\":\"\",\"float_count\":0,\"widget_count\":0,\"cell_count\":3," + |
|
|
|
assertJsonStringEquals("{\"process\":\"\",\"float_count\":0,\"widget_count\":0,\"cell_count\":3," + |
|
|
|
"\"paraApply\":0,\"block_count\":0,\"report_type\":0,\"components_info\":\"[]\"," + |
|
|
|
"\"paraApply\":0,\"block_count\":0,\"report_type\":0,\"components_info\":\"[]\"," + |
|
|
|
"\"templateID\":\"2521d03c-b238-41a5-9a1d-2498efff3a97\"}", new JSONObject(processMap1).toString()); |
|
|
|
"\"templateID\":\"2521d03c-b238-41a5-9a1d-2498efff3a97\"}", JSONFactory.createJSON(JSON.OBJECT, processMap1).toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private TemplateInfo createTemplateInfo(String xmlContent) throws XMLStreamException { |
|
|
|
private TemplateInfo createTemplateInfo(String xmlContent) throws XMLStreamException { |
|
|
@ -126,16 +128,16 @@ public class TemplateInfoTest { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testGetSaveTime(){ |
|
|
|
public void testGetSaveTime() { |
|
|
|
Map consumingMap = Reflect.on(templateInfo).field("consumingMap").get(); |
|
|
|
Map consumingMap = Reflect.on(templateInfo).field("consumingMap").get(); |
|
|
|
String saveRecord = (String) consumingMap.get("saveRecord"); |
|
|
|
String saveRecord = (String) consumingMap.get("saveRecord"); |
|
|
|
JSONObject object = new JSONObject(saveRecord); |
|
|
|
JSONObject object = JSONFactory.createJSON(JSON.OBJECT, saveRecord); |
|
|
|
Assert.assertEquals(1588843693000L, object.optLong("time")); |
|
|
|
Assert.assertEquals(1588843693000L, object.optLong("time")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testGetTemplateCreateTime(){ |
|
|
|
public void testGetTemplateCreateTime() { |
|
|
|
Map consumingMap = Reflect.on(templateInfo).field("consumingMap").get(); |
|
|
|
Map consumingMap = Reflect.on(templateInfo).field("consumingMap").get(); |
|
|
|
Assert.assertEquals("2020-05-07 17:28", (String)consumingMap.get("create_time")); |
|
|
|
Assert.assertEquals("2020-05-07 17:28", (String) consumingMap.get("create_time")); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|