/** Reads PounderModel from XML data on given InputStream. * */ public PounderModel readModel(InputStream in) throws Exception { PounderData pd = read(in); PounderModel ret = new PounderModel(); if (pd.testInstanceFactory != null) ret.getLoadedTestObjects().addElement(pd.testInstanceFactory.getSetupClass()); ret.setTestInstanceFactory(pd.testInstanceFactory); ret.getRecord().addItems(pd.items); PlainDocument comment = ret.getComment(); comment.remove(0, comment.getLength()); if (pd.comment != null) comment.insertString(0, pd.comment, null); return ret; }
/** Read data from given File and place it in given PounderModel. * */ public void readToModel(PounderModel pm, File f) throws Exception { PounderData pd = read(new FileInputStream(f)); PounderModel ret = new PounderModel(); if (pd.testInstanceFactory != null) pm.getLoadedTestObjects().addElement(pd.testInstanceFactory.getSetupClass()); pm.setTestInstanceFactory(pd.testInstanceFactory); pm.getRecord().clear(); pm.getRecord().addItems(pd.items); pm.getFileModel().setFile(f); PlainDocument comment = pm.getComment(); comment.remove(0, comment.getLength()); if (pd.comment != null) comment.insertString(0, pd.comment, null); }