1 21 22 package org.apache.derbyTesting.unitTests.store; 23 24 import org.apache.derbyTesting.unitTests.harness.T_Generic; 26 import org.apache.derbyTesting.unitTests.harness.T_Fail; 27 28 import org.apache.derby.impl.store.access.heap.*; 29 30 import java.util.Properties ; 31 32 import java.io.PrintWriter ; 33 34 import org.apache.derby.iapi.services.context.ContextService; 35 36 import org.apache.derby.iapi.services.monitor.Monitor; 37 import org.apache.derby.iapi.services.stream.HeaderPrintWriter; 38 39 import org.apache.derby.iapi.error.StandardException; 40 import org.apache.derby.iapi.store.access.AccessFactory; 41 import org.apache.derby.iapi.store.access.ConglomerateController; 42 import org.apache.derby.iapi.store.access.Qualifier; 43 import org.apache.derby.iapi.types.RowLocation; 44 import org.apache.derby.iapi.store.access.ScanController; 45 import org.apache.derby.iapi.store.access.TransactionController; 46 47 import org.apache.derby.iapi.reference.Property; 48 49 import java.util.Properties ; 50 51 public class T_Heap extends T_Generic 52 { 53 private static final String testService = "heapTest"; 54 57 58 public String getModuleToTestProtocolName() { 59 return AccessFactory.MODULE; 60 } 61 62 65 protected void runTests() throws T_Fail 66 { 67 AccessFactory store = null; 68 TransactionController tc = null; 69 boolean pass = false; 70 71 out.println("executing heap test"); 72 73 if (startParams == null) { 75 startParams = new Properties (); 76 } 77 startParams.put(Property.NO_AUTO_BOOT, Boolean.TRUE.toString()); 78 startParams.put(Property.DELETE_ON_CREATE, Boolean.TRUE.toString()); 80 81 startParams = T_Util.setEncryptionParam(startParams); 83 84 try { 85 store = (AccessFactory) Monitor.createPersistentService(getModuleToTestProtocolName(), 86 testService, startParams); 87 } catch (StandardException mse) { 88 throw T_Fail.exceptionFail(mse); 89 } 90 91 if (store == null) { 92 throw T_Fail.testFailMsg(getModuleToTestProtocolName() + " service not started."); 93 } 94 REPORT("(unitTestMain) Testing " + testService); 95 96 try { 97 98 tc = store.getTransaction( 99 ContextService.getFactory().getCurrentContextManager()); 100 101 if (t_001(tc)) 102 { 103 pass = true; 104 } 105 106 tc.commit(); 107 tc.destroy(); 108 } 109 catch (StandardException e) 110 { 111 System.out.println("got an exception."); 112 String msg = e.getMessage(); 113 if (msg == null) 114 msg = e.getClass().getName(); 115 REPORT(msg); 116 throw T_Fail.exceptionFail(e); 117 } 118 119 if (!pass) 120 throw T_Fail.testFailMsg("T_Heap test failed"); 121 } 122 123 126 protected boolean t_001(TransactionController tc) 127 throws StandardException, T_Fail 128 { 129 REPORT("Starting t_001"); 130 131 T_QualifierTest q_test = 132 new T_QualifierTest( 133 "heap", null, false, out, 137 T_QualifierTest.ORDER_NONE); 139 boolean test_result = q_test.t_testqual(tc); 140 141 if (!test_result) 142 throw T_Fail.testFailMsg("T_Heap.t_001 failed"); 143 144 REPORT("Ending t_001"); 145 146 return(test_result); 147 } 148 } 149 | Popular Tags |