1 19 20 package org.netbeans.test.db.derby; 21 22 import junit.extensions.TestSetup; 23 import junit.framework.Test; 24 import junit.framework.TestSuite; 25 import org.netbeans.jellytools.actions.ActionNoBlock; 26 import org.netbeans.jellytools.modules.db.nodes.ConnectionNode; 27 import org.netbeans.jellytools.modules.db.nodes.DatabasesNode; 28 import org.netbeans.modules.db.explorer.nodes.DatabaseNode; 29 import org.netbeans.modules.derby.DerbyOptions; 30 import org.netbeans.test.db.derby.lib.CreateDerbyDatabaseOperator; 31 32 36 public class CreateDatabaseTest extends DbJellyTestCase { 37 private static String location=""; 38 39 private static String USER="czesiu"; 40 41 private static String PASSWORD="czesiu"; 42 43 private static String DB="newdatabase"; 44 45 private static String URL="jdbc:derby://localhost:1527/newdatabase"; 46 47 public CreateDatabaseTest(String s) { 48 super(s); 49 } 50 51 public void testCreateDatabase(){ 52 debug("Creating Java DB Database"); 53 new ActionNoBlock("Tools|Java DB Database|Create Java DB Database...", null).perform(); 54 CreateDerbyDatabaseOperator operator=new CreateDerbyDatabaseOperator(); 55 operator.typeDatabaseName(DB); 56 operator.typeUserName(USER); 57 operator.typePassword(PASSWORD); 58 operator.ok(); 59 debug("Database created"); 60 sleep(2000); 61 62 } 63 64 public void testConnect() throws Exception { 65 debug("Connection to Java DB server"); 66 ConnectionNode connection=ConnectionNode.invoke(URL,USER,PASSWORD); 67 connection.connect(); 68 debug("Disconecting"); 69 sleep(2000); 70 connection.disconnect(); 71 sleep(1000); 72 } 73 74 75 public void testStopServer(){ 76 debug("Stopping database derver"); 77 new ActionNoBlock("Tools|Java DB Database|Stop Java DB Server", null).perform(); 78 } 79 80 public static Test suite() { 81 TestSuite suite=new TestSuite(); 82 suite.addTest(new CreateDatabaseTest("testCreateDatabase")); 83 suite.addTest(new CreateDatabaseTest("testConnect")); 84 suite.addTest(new CreateDatabaseTest("testStopServer")); 85 TestSetup setup=new TestSetup(suite){ 86 public void setUp() throws Exception { 87 init(); 88 } 89 90 }; 91 return setup; 92 93 } 94 95 public static void init() throws Exception { 96 String systemHome=System.getProperty("xtest.tmpdir"); 98 DerbyOptions.getDefault().setSystemHome(systemHome); 100 } 101 102 103 104 105 106 } 107 | Popular Tags |