net.sf.farrago.test.regression
Class FarragoSorterTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.eigenbase.test.DiffTestCase
              extended by net.sf.farrago.test.ResultSetTestCase
                  extended by net.sf.farrago.test.FarragoTestCase
                      extended by net.sf.farrago.test.regression.FarragoSorterTest
All Implemented Interfaces:
Test

public class FarragoSorterTest
extends FarragoTestCase

FarragoSorterTest tests the sorter with various data sizes and distributions (TODO: and types).

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/test/regression/FarragoSorterTest.java#15 $
Author:
John V. Sichi

Nested Class Summary
private static class FarragoSorterTest.DistributionGenerator
           
private static class FarragoSorterTest.RampDistributionGenerator
           
private static class FarragoSorterTest.UniformDistributionGenerator
           
 
Nested classes/interfaces inherited from class net.sf.farrago.test.FarragoTestCase
FarragoTestCase.Cleanup, FarragoTestCase.CleanupFactory
 
Field Summary
private static long DUP_FACTOR
          Ratio of record count to value range for duplicate-heavy sort.
private static long EXTERNAL_SCALE_FACTOR
          Ratio of data sort size to cache size for external sort.
private static long externalCount
           
private static long IN_MEM_COUNT
          Number of records to generate for in-memory sort.
private static long SPARSE_FACTOR
          Ratio of value range to record count for sparse sort.
private static File testdataDir
           
 
Fields inherited from class net.sf.farrago.test.FarragoTestCase
allocOwner, connection, preparedStmt, repos, stmt, tracer
 
Fields inherited from class net.sf.farrago.test.ResultSetTestCase
resultSet
 
Fields inherited from class org.eigenbase.test.DiffTestCase
logFile, logOutputStream, refFile
 
Constructor Summary
FarragoSorterTest(String testName)
           
 
Method Summary
 void _testExternalSparse()
          Tests an external sort with mostly distinct values.
private static void computeExternalCount()
           
private  void createForeignTable()
           
private static void initializeDataDir()
           
static void staticSetUp()
           
static Test suite()
           
private  void testDistribution(FarragoSorterTest.DistributionGenerator gen)
           
 void testInMemoryDegenerate()
          Tests an in-memory sort with all values the same.
 void testInMemoryDups()
          Tests an in-memory sort with many duplicate values.
 void testInMemoryPresortedDups()
          Tests an in-memory sort with duplicate values already sorted.
 void testInMemoryPresortedDupsReverse()
          Tests an in-memory sort with duplicate values already in reverse sort order.
 void testInMemoryPresortedSparse()
          Tests an in-memory sort with sparse values already sorted.
 void testInMemoryPresortedSparseReverse()
          Tests an in-memory sort with sparse values already in reverse sort order.
 void testInMemorySparse()
          Tests an in-memory sort with mostly distinct values.
 
Methods inherited from class net.sf.farrago.test.FarragoTestCase
forceShutdown, getJdbcUri, getSession, getTestlogRoot, getTestlogRootStatic, newConnection, newJdbcEngineDriver, restoreParameters, restoreParameters, runCleanup, runSqlLineTest, runSqlLineTest, saveParameters, saveParameters, setRefFileDiffMasks, setUp, shouldDiff, staticTearDown, tearDown, tearDownImpl, wrappedSuite, wrappedSuite
 
Methods inherited from class net.sf.farrago.test.ResultSetTestCase
compareResultList, compareResultLists, compareResultSet, compareResultSetWithDelta, compareResultSetWithPattern, getResultSetCount
 
Methods inherited from class org.eigenbase.test.DiffTestCase
addDiffMask, addIgnorePattern, diffFile, diffLines, diffTestLog, fileContents, openTestLog, openTestLogOutputStream, setGC, setVerbose
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

testdataDir

private static File testdataDir

externalCount

private static long externalCount

IN_MEM_COUNT

private static final long IN_MEM_COUNT
Number of records to generate for in-memory sort.

See Also:
Constant Field Values

SPARSE_FACTOR

private static final long SPARSE_FACTOR
Ratio of value range to record count for sparse sort.

See Also:
Constant Field Values

DUP_FACTOR

private static final long DUP_FACTOR
Ratio of record count to value range for duplicate-heavy sort.

See Also:
Constant Field Values

EXTERNAL_SCALE_FACTOR

private static final long EXTERNAL_SCALE_FACTOR
Ratio of data sort size to cache size for external sort.

See Also:
Constant Field Values
Constructor Detail

FarragoSorterTest

public FarragoSorterTest(String testName)
                  throws Exception
Throws:
Exception
Method Detail

suite

public static Test suite()

staticSetUp

public static void staticSetUp()
                        throws Exception
Throws:
Exception

initializeDataDir

private static void initializeDataDir()

createForeignTable

private void createForeignTable()
                         throws Exception
Throws:
Exception

computeExternalCount

private static void computeExternalCount()

testDistribution

private void testDistribution(FarragoSorterTest.DistributionGenerator gen)
                       throws Exception
Throws:
Exception

testInMemorySparse

public void testInMemorySparse()
                        throws Exception
Tests an in-memory sort with mostly distinct values.

Throws:
Exception

testInMemoryDups

public void testInMemoryDups()
                      throws Exception
Tests an in-memory sort with many duplicate values.

Throws:
Exception

testInMemoryDegenerate

public void testInMemoryDegenerate()
                            throws Exception
Tests an in-memory sort with all values the same.

Throws:
Exception

testInMemoryPresortedSparse

public void testInMemoryPresortedSparse()
                                 throws Exception
Tests an in-memory sort with sparse values already sorted.

Throws:
Exception

testInMemoryPresortedDups

public void testInMemoryPresortedDups()
                               throws Exception
Tests an in-memory sort with duplicate values already sorted.

Throws:
Exception

testInMemoryPresortedSparseReverse

public void testInMemoryPresortedSparseReverse()
                                        throws Exception
Tests an in-memory sort with sparse values already in reverse sort order.

Throws:
Exception

testInMemoryPresortedDupsReverse

public void testInMemoryPresortedDupsReverse()
                                      throws Exception
Tests an in-memory sort with duplicate values already in reverse sort order.

Throws:
Exception

_testExternalSparse

public void _testExternalSparse()
                         throws Exception
Tests an external sort with mostly distinct values.

Throws:
Exception