1 21 package com.db4o.test; 22 23 import com.db4o.*; 24 25 public class VMTermination { 26 27 private String str; 28 29 public VMTermination(){} 30 31 public VMTermination(String str){ 32 this.str = str; 33 } 34 35 public static void main(String [] args) throws Exception { 36 37 38 42 43 45 int step = 0; 46 47 switch(step){ 48 case 0: 49 Test.statistics(); 51 break; 52 case 1: 53 killSingleUser(); 54 break; 55 case 2: 56 testSingleUser(); 57 break; 58 case 3: 59 killServer1(); 60 break; 61 case 4: 62 testServer1(); 63 break; 64 case 5: 65 killServer2(); 66 break; 67 case 6: 68 testServer2(); 69 break; 70 } 71 72 } 73 74 public static void killSingleUser() throws Exception { 75 Test.runServer = false; 76 Test.clientServer = false; 77 Test.delete(); 78 ObjectContainer con = Test.open(); 79 con.set(new VMTermination("willbethere")); 80 con.commit(); 81 82 85 System.exit(0); 86 } 87 88 public static void testSingleUser() { 89 Test.runServer = false; 90 Test.clientServer = false; 91 ObjectContainer con = Test.open(); 92 Test.ensureOccurrences(new VMTermination(), 1); 93 Test.logAll(); 94 Test.end(); 95 } 96 97 public static void killServer1() throws Exception { 98 Test.runServer = true; 99 Test.clientServer = true; 100 Test.delete(); 101 ObjectContainer con = Test.open(); 102 con.set(new VMTermination("willbethere")); 103 con.commit(); 104 105 System.exit(0); 108 } 109 110 public static void testServer1(){ 111 Test.runServer = true; 112 Test.clientServer = true; 113 ObjectContainer con = Test.open(); 114 Test.ensureOccurrences(new VMTermination(), 1); 115 Test.logAll(); 116 Test.end(); 117 } 118 119 public static void killServer2() throws Exception { 120 Test.runServer = true; 121 Test.clientServer = true; 122 ObjectContainer con = Test.open(); 123 con.set(new VMTermination("willbethere")); 124 125 126 con.commit(); 130 } 131 132 public static void testServer2(){ 133 Test.runServer = true; 134 Test.clientServer = true; 135 ObjectContainer con = Test.open(); 136 Test.ensureOccurrences(new VMTermination(), 2); 137 Test.logAll(); 138 Test.end(); 139 } 140 141 142 143 144 145 146 } 147 148 | Popular Tags |