public void test() throws Exception { DefaultXmlFileLoader loader = new DefaultXmlFileLoader(); TaskInfoNode load = loader.load( new File( "F:/zh-private/gree/workspace/origin-gm/webroot/config/test_docInfo_config.xml")); assertEquals("4A44F49F", load.getBosType()); assertEquals("费用报销单", load.getBosTypeName()); assertEquals("fuKuan", load.getDefaultView()); List<ViewNode> viewNodes = load.getViewNodes(); assertEquals(4, viewNodes.size()); SimpleViewNode sv = (SimpleViewNode) viewNodes.get(0); assertEquals(2, sv.getTables().size()); GridViewNode gv = (GridViewNode) viewNodes.get(1); assertEquals(5, gv.getCellNodes().size()); gv = (GridViewNode) viewNodes.get(2); assertEquals(4, gv.getCellNodes().size()); assertEquals(3, gv.getSubGridViews().size()); gv = (GridViewNode) viewNodes.get(3); assertEquals(3, gv.getCellNodes().size()); assertEquals(1, gv.getSubGridViews().size()); }
public void testStorerAndLoader() throws Exception { TaskInfoNode taskInfoNode = new TaskInfoNode(); taskInfoNode.setBosType("ABCDEF"); taskInfoNode.setBosTypeName("请求申请单"); taskInfoNode.setDefaultView("default"); taskInfoNode.addViewNode(buildSimpleViewNode()); taskInfoNode.addViewNode(buildGridViewNode(true)); new DefaultXmlFileStorer().storerToXml(taskInfoNode, "c://test.xml"); DefaultXmlFileLoader loader = new DefaultXmlFileLoader(); TaskInfoNode load = loader.load(new File("c://test.xml")); new DefaultXmlFileStorer().storerToXml(load, "c://test2.xml"); }