net.sf.farrago.test
Class FarragoTestUDR

java.lang.Object
  extended by net.sf.farrago.test.FarragoTestUDR

public abstract class FarragoTestUDR
extends Object

FarragoTestUDR contains definitions for user-defined routines used by tests.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/test/FarragoTestUDR.java#37 $
Author:
John V. Sichi

Constructor Summary
FarragoTestUDR()
           
 
Method Summary
static int accessSql()
           
private static void addOutputColumn(List<Integer> returnColumns, ResultSet inputSet, PreparedStatement resultInserter, int offset)
           
static int atoi(String s)
           
static Integer atoiWithNullForErr(String s)
           
static void badStringifyColumns1(ResultSet inputSet, List columns, String delimiter, PreparedStatement resultInserter)
           
static void badStringifyColumns2(ResultSet inputSet, List<Integer> columns, String delimiter, PreparedStatement resultInserter)
           
static void badStringifyColumns3(ResultSet inputSet, Map<String,Integer> columns, String delimiter, PreparedStatement resultInserter)
           
private static void buildColumnMap(List<String> columns, int nInputCols, ResultSetMetaData metaData, List<Integer> returnColumns)
           
static void combineStringifyColumns(ResultSet inputSet1, List<String> columns1, ResultSet inputSet2, List<String> columns2, String delimiter, PreparedStatement resultInserter)
           
static void combineStringifyColumnsJumbledArgs(List<String> columns2, ResultSet inputSet1, String delimiter, ResultSet inputSet2, List<String> columns1, PreparedStatement resultInserter)
           
static String convertUnicodeToEscapedForm(String s)
           
static BigDecimal decimalAbs(BigDecimal dec)
           
static String decryptPublicKey(byte[] keyBytes)
           
protected static String describeInputOutput(ResultSet inputSet, PreparedStatement resultInserter)
           
static void digest(ResultSet inputSet, PreparedStatement resultInserter)
           
private static void emitUdxRow(PreparedStatement resultInserter, Object[] row)
           
static void foreignTime(Timestamp ts, String tsZoneId, String foreignZoneId, PreparedStatement resultInserter)
           
static int gargle()
           
static long generateRandomNumber(long seed)
           
private static void generateRows(ResultSet inputSet, List<String> columns, String delimiter, PreparedStatement resultInserter)
           
static String generateUnicodeString()
           
static void generateUnicodeStringUdx(PreparedStatement resultInserter)
           
static String generateUnicodeSupplementalString()
           
static void generateUnicodeTestCsv(String charsetName)
           
static String itoa(int i)
           
static String itoaWithNulForErr(int i)
           
static void longerRamp(int n, PreparedStatement resultInserter)
           
static String noargs()
           
static void noiseWithCancel(long n, long seed, long cancelDelayMillis, PreparedStatement resultInserter)
           
static void nullableRamp(Integer n, PreparedStatement resultInserter)
           
static void ramp(int n, PreparedStatement resultInserter)
           
static void removeDupsFromPresortedCursor(ResultSet inputSet, PreparedStatement resultInserter)
           
static String repeat(String s, int n)
           
static void returnInput(ResultSet inputSet, List<String> columns, PreparedStatement resultInserter)
          Returns some subset of the input columns as specified by the columns parameter.
static void returnTwoInputs(ResultSet inputSet1, ResultSet inputSet2, List<String> columns1, List<String> columns2, PreparedStatement resultInserter)
          Returns subsets of columns from two inputs.
static void setFarragoProperty(String name, String value)
           
static void setLabel(String labelName)
          Sets a label within a UDR.
static void setSessionVariable(String name, String value)
           
static void setSystemProperty(String name, String value)
           
static void simulateCatalogRecovery()
           
static void stringify(ResultSet inputSet, String delimiter, PreparedStatement resultInserter)
           
static void stringify2ColumnLists(List<String> columns1, List<String> columns2, ResultSet inputSet, String delimiter, PreparedStatement resultInserter)
           
static void stringifyColumns(ResultSet inputSet, List<String> columns, String delimiter, PreparedStatement resultInserter)
           
static String substring24(String in)
           
static int throwNPE()
           
static int throwSQLException()
           
static String toHexString(int i)
           
static String toHexString(Integer i)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FarragoTestUDR

public FarragoTestUDR()
Method Detail

noargs

public static String noargs()

substring24

public static String substring24(String in)

toHexString

public static String toHexString(int i)

toHexString

public static String toHexString(Integer i)

decimalAbs

public static BigDecimal decimalAbs(BigDecimal dec)

repeat

public static String repeat(String s,
                            int n)

atoi

public static int atoi(String s)

atoiWithNullForErr

public static Integer atoiWithNullForErr(String s)

itoa

public static String itoa(int i)

itoaWithNulForErr

public static String itoaWithNulForErr(int i)

setSystemProperty

public static void setSystemProperty(String name,
                                     String value)

setFarragoProperty

public static void setFarragoProperty(String name,
                                      String value)

accessSql

public static int accessSql()

generateUnicodeString

public static String generateUnicodeString()

generateUnicodeSupplementalString

public static String generateUnicodeSupplementalString()

generateUnicodeStringUdx

public static void generateUnicodeStringUdx(PreparedStatement resultInserter)
                                     throws Exception
Throws:
Exception

convertUnicodeToEscapedForm

public static String convertUnicodeToEscapedForm(String s)

generateUnicodeTestCsv

public static void generateUnicodeTestCsv(String charsetName)
                                   throws Exception
Throws:
Exception

decryptPublicKey

public static String decryptPublicKey(byte[] keyBytes)

throwSQLException

public static int throwSQLException()
                             throws SQLException
Throws:
SQLException

throwNPE

public static int throwNPE()

generateRandomNumber

public static long generateRandomNumber(long seed)

gargle

public static int gargle()

ramp

public static void ramp(int n,
                        PreparedStatement resultInserter)
                 throws SQLException
Throws:
SQLException

nullableRamp

public static void nullableRamp(Integer n,
                                PreparedStatement resultInserter)
                         throws SQLException
Throws:
SQLException

noiseWithCancel

public static void noiseWithCancel(long n,
                                   long seed,
                                   long cancelDelayMillis,
                                   PreparedStatement resultInserter)
                            throws Exception
Throws:
Exception

stringify

public static void stringify(ResultSet inputSet,
                             String delimiter,
                             PreparedStatement resultInserter)
                      throws SQLException
Throws:
SQLException

stringifyColumns

public static void stringifyColumns(ResultSet inputSet,
                                    List<String> columns,
                                    String delimiter,
                                    PreparedStatement resultInserter)
                             throws SQLException
Throws:
SQLException

stringify2ColumnLists

public static void stringify2ColumnLists(List<String> columns1,
                                         List<String> columns2,
                                         ResultSet inputSet,
                                         String delimiter,
                                         PreparedStatement resultInserter)
                                  throws SQLException
Throws:
SQLException

combineStringifyColumns

public static void combineStringifyColumns(ResultSet inputSet1,
                                           List<String> columns1,
                                           ResultSet inputSet2,
                                           List<String> columns2,
                                           String delimiter,
                                           PreparedStatement resultInserter)
                                    throws SQLException
Throws:
SQLException

combineStringifyColumnsJumbledArgs

public static void combineStringifyColumnsJumbledArgs(List<String> columns2,
                                                      ResultSet inputSet1,
                                                      String delimiter,
                                                      ResultSet inputSet2,
                                                      List<String> columns1,
                                                      PreparedStatement resultInserter)
                                               throws SQLException
Throws:
SQLException

generateRows

private static void generateRows(ResultSet inputSet,
                                 List<String> columns,
                                 String delimiter,
                                 PreparedStatement resultInserter)
                          throws SQLException
Throws:
SQLException

badStringifyColumns1

public static void badStringifyColumns1(ResultSet inputSet,
                                        List columns,
                                        String delimiter,
                                        PreparedStatement resultInserter)
                                 throws SQLException
Throws:
SQLException

badStringifyColumns2

public static void badStringifyColumns2(ResultSet inputSet,
                                        List<Integer> columns,
                                        String delimiter,
                                        PreparedStatement resultInserter)
                                 throws SQLException
Throws:
SQLException

badStringifyColumns3

public static void badStringifyColumns3(ResultSet inputSet,
                                        Map<String,Integer> columns,
                                        String delimiter,
                                        PreparedStatement resultInserter)
                                 throws SQLException
Throws:
SQLException

digest

public static void digest(ResultSet inputSet,
                          PreparedStatement resultInserter)
                   throws SQLException
Throws:
SQLException

describeInputOutput

protected static String describeInputOutput(ResultSet inputSet,
                                            PreparedStatement resultInserter)
                                     throws SQLException
Throws:
SQLException

longerRamp

public static void longerRamp(int n,
                              PreparedStatement resultInserter)
                       throws SQLException
Throws:
SQLException

removeDupsFromPresortedCursor

public static void removeDupsFromPresortedCursor(ResultSet inputSet,
                                                 PreparedStatement resultInserter)
                                          throws SQLException
Throws:
SQLException

emitUdxRow

private static void emitUdxRow(PreparedStatement resultInserter,
                               Object[] row)
                        throws SQLException
Throws:
SQLException

foreignTime

public static void foreignTime(Timestamp ts,
                               String tsZoneId,
                               String foreignZoneId,
                               PreparedStatement resultInserter)
                        throws SQLException
Throws:
SQLException

setSessionVariable

public static void setSessionVariable(String name,
                                      String value)
                               throws SQLException
Throws:
SQLException

simulateCatalogRecovery

public static void simulateCatalogRecovery()
                                    throws Exception
Throws:
Exception

setLabel

public static void setLabel(String labelName)
                     throws Exception
Sets a label within a UDR. This currently results in an exception.

Parameters:
labelName - name of the label or null
Throws:
Exception

returnInput

public static void returnInput(ResultSet inputSet,
                               List<String> columns,
                               PreparedStatement resultInserter)
                        throws SQLException
Returns some subset of the input columns as specified by the columns parameter.

Parameters:
inputSet - the input rows
columns - the list of column names that determine which columns from the input to return, as well as the order of the columns
resultInserter - used to return the resulting output
Throws:
SQLException

buildColumnMap

private static void buildColumnMap(List<String> columns,
                                   int nInputCols,
                                   ResultSetMetaData metaData,
                                   List<Integer> returnColumns)
                            throws SQLException
Throws:
SQLException

addOutputColumn

private static void addOutputColumn(List<Integer> returnColumns,
                                    ResultSet inputSet,
                                    PreparedStatement resultInserter,
                                    int offset)
                             throws SQLException
Throws:
SQLException

returnTwoInputs

public static void returnTwoInputs(ResultSet inputSet1,
                                   ResultSet inputSet2,
                                   List<String> columns1,
                                   List<String> columns2,
                                   PreparedStatement resultInserter)
                            throws SQLException
Returns subsets of columns from two inputs. Both inputs must have the same number of rows, as the subsets of columns will be concatenated side by side into the result rows. Note that this UDX is NOT doing a join between the two inputs.

Parameters:
inputSet1 - first set of input rows
inputSet2 - second set of input rows
columns1 - subset of column names from the first input
columns2 - subset of column names from the second input
resultInserter - used to return the resulting output
Throws:
SQLException