/*
* User: Michael Rettig
* Date: Aug 17, 2002
* Time: 3:05:39 PM
*/
package net.sourceforge.jaxor.example.tests;
import junit.textui.TestRunner;
import net.sourceforge.jaxor.MetaRow;
import net.sourceforge.jaxor.example.domain.AddressFinder;
import net.sourceforge.jaxor.example.domain.AddressMetaRow;
import net.sourceforge.jaxor.example.domain.ObjectFactory;
public class PerfTest extends TableTestCase {
protected MetaRow getRow() {
return new AddressMetaRow();
}
/**
* This should take a couple seconds. If not, something is wrong.
*/
public void testLargeInsertSet() {
int max = 10000;
for (int i = 0; i < max; i++)
ObjectFactory.createAddress(new Long(i));
commit();
assertEquals(max, AddressFinder.selectAll().size());
}
/**
* Should hit the cache for pk selects, so this should be quick.
*/
public void testPrimaryKeyCache() {
int max = 1000;
for (int i = 0; i < max; i++)
ObjectFactory.createAddress(new Long(i));
commit();
for (int i = 0; i < 100000; i++)
AddressFinder.selectByPrimaryKey(new Long(i % 1000));
}
public static void main(String[] args) {
TestRunner.run(PerfTest.class);
}
}
|