1 19 20 package org.netbeans.test.web.core.syntax; 21 22 import java.io.File ; 23 import java.lang.reflect.InvocationTargetException ; 24 import javax.swing.SwingUtilities ; 25 import org.netbeans.test.web.FileObjectFilter; 26 import org.netbeans.test.web.RecurrentSuiteFactory; 27 import org.openide.filesystems.FileObject; 28 import junit.framework.Test; 29 import org.netbeans.api.db.explorer.ConnectionManager; 30 import org.netbeans.api.db.explorer.DatabaseConnection; 31 32 36 public class J2EECompletionTest extends CompletionTest{ 37 38 39 public J2EECompletionTest(String name, FileObject testFileObj) { 40 super(name, testFileObj); 41 debug = false; 42 } 43 44 public static Test suite() { 45 File datadir = new J2EECompletionTest(null, null).getDataDir(); 47 File projectsDir = new File (datadir, "J2EECompletionTestProjects"); 48 FileObjectFilter filter = new FileObjectFilter() { 49 public boolean accept(FileObject fo) { 50 String ext = fo.getExt(); 51 String name = fo.getName(); 52 return (name.startsWith("test") || name.startsWith("Test")) 53 && (xmlExts.contains(ext) || jspExts.contains(ext) || ext.equals("java")); 54 } 55 }; 56 57 int time=0; 59 while ((ConnectionManager.getDefault().getConnections().length==0)&&(time<=12)){ 60 time++; 61 try{ 62 Thread.currentThread().sleep(5000); 63 }catch(Exception e){ 64 e.printStackTrace(System.err); 65 } 66 } 67 if (time>12) { 68 System.err.println("IMPOSSIBLE TO CONNECT THE DATABASE"); 69 } else { 70 final DatabaseConnection dbconn = ConnectionManager.getDefault().getConnections()[0]; 71 try { 72 SwingUtilities.invokeAndWait(new Runnable () { 73 public void run() { 74 ConnectionManager.getDefault().showConnectionDialog(dbconn); 75 } 76 }); 77 } catch (InterruptedException e) { 78 } catch (InvocationTargetException e) { 79 } 80 } 81 82 return RecurrentSuiteFactory.createSuite(J2EECompletionTest.class, 83 projectsDir, filter); 84 } 85 } 86 | Popular Tags |