1 64 65 package com.jcorporate.expresso.ext.tests; 66 67 import com.jcorporate.expresso.core.controller.ControllerRequest; 68 import com.jcorporate.expresso.core.db.DBConnection; 69 import com.jcorporate.expresso.core.db.DBException; 70 import com.jcorporate.expresso.core.dbobj.DBObject; 71 import com.jcorporate.expresso.core.dbobj.SecuredDBObject; 72 73 74 80 public class StressTestObject 81 extends SecuredDBObject { 82 83 86 public StressTestObject() 87 throws DBException { 88 super(); 89 } 90 91 98 public StressTestObject(DBConnection dbConnection) 99 throws DBException { 100 super(dbConnection); 101 } 102 103 106 public StressTestObject(int uid) 107 throws DBException { 108 super(uid); 109 } 110 111 117 public StressTestObject(ControllerRequest request) 118 throws DBException { 119 super(request); 120 } 121 122 public DBObject getThisDBObj() 123 throws com.jcorporate.expresso.core.db.DBException { 124 return (DBObject) new StressTestObject(); 125 } 126 127 131 public synchronized void add() 132 throws com.jcorporate.expresso.core.db.DBException { 133 setField("UpdateCount", "0"); 134 super.add(); 135 } 136 137 public synchronized void update() 138 throws com.jcorporate.expresso.core.db.DBException { 139 int fieldCount = this.getFieldInt("UpdateCount"); 140 fieldCount++; 141 this.setField("UpdateCount", Integer.toString(fieldCount)); 142 super.update(); 143 } 144 145 protected void setupFields() 146 throws com.jcorporate.expresso.core.db.DBException { 147 setTargetTable("EXPRESSOSTRESS"); 148 setDescription("Expresso Stress Test Table"); 149 setCharset("ISO-8859-1"); 150 addField("RecordID", "auto-inc", 0, false, "Record ID Number"); 151 addField("UpdateCount", "int", 0, false, "Update Count"); 152 addField("SomeData", "varchar", 256, false, "Some Random Data"); 153 addField("SomeMoreData", "varchar", 256, false, "Some More RandomData"); 154 addKey("RecordID"); 155 } 156 } | Popular Tags |