1 21 package com.db4o.test; 22 23 import java.io.*; 24 25 import com.db4o.*; 26 27 30 public class RegressionCS extends Regression { 31 32 36 private static final boolean START_IN_PROCESS_SERVER = true; 37 38 41 private static final String HOST_NAME = "localhost"; 42 43 46 private static final int SERVER_PORT = 4044; 47 48 51 private static final String USER = "db4o"; 52 53 56 private static final String PASSWORD = "db4o"; 57 58 61 private static final String SERVER_FILE = "server.yap"; 62 63 66 private ObjectServer server = null; 67 68 69 public static void main(String [] args) { 70 System.out.println("Client Server Regression Test"); 71 Db4o.configure().messageLevel(-1); 72 73 new RegressionCS().run(); 74 } 75 76 public RegressionCS(){ 77 if (START_IN_PROCESS_SERVER) { 78 new File(SERVER_FILE).delete(); 79 try { 80 server = Db4o.openServer(SERVER_FILE, SERVER_PORT); 81 server.grantAccess(USER, PASSWORD); 82 Thread.sleep(3000); 84 } catch (Exception e) { 85 e.printStackTrace(); 86 } 87 } else { 88 new File(Regression.FILE).delete(); 89 } 90 } 91 92 public void completed(){ 93 if (START_IN_PROCESS_SERVER) { 94 server.close(); 95 } 96 } 97 98 public ObjectContainer openContainer() { 99 configure(); 100 try { 101 108 109 return server.openClient(); 110 111 113 } catch (Exception e) { 114 e.printStackTrace(); 115 System.out.println("Could not connect to server. Settings:"); 116 System.out.println("Host Name: " + HOST_NAME + " Port:" + SERVER_PORT); 117 System.out.println("User: " + USER + " Password:" + PASSWORD); 118 System.out.println("Check the variables in RegressionCS.java"); 119 } 120 return null; 121 } 122 123 } 124 | Popular Tags |