1 19 package org.netbeans.tests.xml; 20 21 import org.netbeans.jellytools.EditorOperator; 22 import org.netbeans.jellytools.EditorWindowOperator; 23 import org.netbeans.jellytools.NewWizardOperator; 24 import org.netbeans.modules.css.CSSObject; 25 import org.openide.loaders.DataObject; 26 import org.openide.util.NbBundle; 27 28 58 59 public abstract class AbstractTemplatesTest extends JXTest { 60 61 public AbstractTemplatesTest(String testName) { 62 super(testName); 63 } 64 65 67 71 protected abstract String [][] getTemplateList(); 72 73 74 protected abstract AbstractTestUtil testUtil(); 75 76 78 public void testNewFromTemplate() throws Exception { 79 String templates[][] = getTemplateList(); 80 81 String folder = getFilesystemName() + DELIM + getDataPackageName(DELIM) + DELIM + "templates"; 83 for (int i = 0; i < templates.length; i++) { 85 String name = templates[i][0]; 86 String ext = templates[i][1]; 87 System.out.println("templates/" + name + "." + ext); 88 DataObject dao = testUtil().findData("templates/" + name + "." + ext); 89 System.out.println(dao); 90 if (dao != null) dao.delete(); 91 NewWizardOperator.create("XML" + DELIM + name, folder, name); 92 new EditorOperator(name); 93 } 94 95 for (int i = 0; i < templates.length; i++) { 97 String name = templates[i][0]; 98 String ext = templates[i][1]; 99 DataObject dataObject = testUtil().findData("templates/" + name + "." + ext); 100 ref("\n+++ Document: " + dataObject.getName()); 101 102 String str = testUtil().dataObjectToString(dataObject); 103 if (dataObject instanceof CSSObject) { 104 str = testUtil().replaceString(str, "/*", "*/", "/* REMOVED */"); 105 } else { 106 str = testUtil().replaceString(str, "<!--", "-->", "<!-- REMOVED -->"); 107 } 108 ref(str); 109 } 110 new EditorWindowOperator().closeDiscard(); 112 compareReferenceFiles(); 113 } 114 } 115 | Popular Tags |