Java Doc for DerbyJUnitTest.java in  » Database-DBMS » db-derby-10.2 » org » apache » derbyTesting » functionTests » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derbyTesting.functionTests.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.derbyTesting.functionTests.util.DerbyJUnitTest

All known Subclasses:   org.apache.derbyTesting.functionTests.tests.junitTests.compatibility.CompatibilitySuite,
DerbyJUnitTest
public class DerbyJUnitTest extends TestCase (Code)


Field Summary
final public static  intDATABASE_URL
    
final public static  StringDEBUG_FLAG
     If you set this startup property to true, you will get chatty output.
final public static  StringDEFAULT_DATABASE_NAME
    
final public static  StringDEFAULT_PASSWORD
    
final public static  StringDEFAULT_USER_NAME
    
final public static  intDRIVER_NAME
    
final public static  intFAILURE_EXIT
    
final public static  intFRAMEWORK_NAME
    
final protected static  intJDBC_BOOLEAN
    
final public static  String[][]LEGAL_CLIENTS
    
final public static  intSUCCESS_EXIT
    

Constructor Summary
public  DerbyJUnitTest()
    

Vacuous constructor for JUnit machinery.


Method Summary
public static  voidalarm(String text)
    

Print a message regardless of whether we are running in debug mode.

public  voidassertColumnEquals(ResultSet rs, int columnNumber, Object[] expectedValues)
    

Assert the values in a ResultSet for a given column across all rows.

public  voidassertColumnEquals(String message, ResultSet rs, int columnNumber, Object expectedValue)
    

Assert a column's value.

public  voidassertRow(ResultSet rs, Object[] expectedRow)
    

Assert the values of a whole row.

public  voidassertScalar(Connection conn, String queryText, Object expectedResult)
    

Assert a scalar result from a query.

protected static  voidclose(ResultSet rs)
    

Close a ResultSet.

protected static  voidclose(Statement statement)
    

Close a Statement.

protected static  voidclose(Connection conn)
    

Close a Connection.

public  voidcompareBytes(String message, Object left, Object right)
    

Assert two byte arrays are equal, allowing nulls to be equal.

public  voidcompareDates(String message, Object left, Object right)
    

Assert two Dates are equal, allowing nulls to be equal.

public  voidcompareObjects(String message, Object left, Object right)
    

Assert two objects are equal, allowing nulls to be equal.

protected  voidcreateDB(String databaseName)
    

Create an empty database.

protected static  voiddropFunction(Connection conn, String name)
    

Drop a function regardless of whether it exists.

protected static  voiddropProcedure(Connection conn, String name)
    

Drop a procedure regardless of whether it exists.

protected static  voiddropSchemaObject(Connection conn, String genus, String objectName)
    

Drop a schema object regardless of whether it exists.

protected static  voiddropTable(Connection conn, String name)
    

Drop a table regardless of whether it exists.

protected static  voidexecute(Connection conn, String text)
    

Execute a SQL statement, given by the text argument.

protected static  voidexecuteDDL(Connection conn, String text)
    

Execute DDL statement.

public  voidexit(int exitStatus)
    

Return a meaningful exit status so that calling scripts can take evasive action.

protected static  booleanfaultInDriver(String[] clientSettings)
    

Load a client driver, given its particulars.

public static  voidfindClientFromProperties()
    

Determine the client to use based on system properties.

public static  String[]getClientSettings()
    

Get the client we're using.

protected  ObjectgetColumn(ResultSet rs, String columnName, int jdbcType)
    

Read a column from a ResultSet given its column name and expected jdbc type.

protected  ObjectgetColumn(ResultSet rs, int param, Object value)
    

Read a column from a ResultSet given its column position and an expected Java type.

protected static  ConnectiongetConnection()
    

Get a connection to a database, using the default client.

protected static  ConnectiongetConnection(String[] clientSettings, String databaseName, Properties properties)
    

Get a connection to a database, using the specified client.

protected  ObjectgetOutArg(CallableStatement cs, int arg, int jdbcType)
    

Read an output argument from a CallableStatement given its 1-based argument position and expected jdbc type.

public static  voidinitializeForOldHarness(String[] args)
    

Initialize a test suite to run under the old test harness.

public static  booleanparseDebug()
    

Look for the system property which tells us whether to run chattily.

protected static  PreparedStatementprepare(Connection conn, String text)
    

Prepare a SQL statement, given by the text argument.

protected static  CallableStatementprepareCall(Connection conn, String text)
    

Prepare a SQL call statement, given by the text argument.

public static  voidprintStackTrace(Throwable t)
    

Print out a stack trace.

public static  voidprintln(String text)
    

Debug code to print chatty informational messages.

public static  voidrunUnderOldHarness(String[] args, Test suite)
    

Run under the old harness.

public static  voidsetClient(String[] client)
    

Set the client we're going to use.

public static  voidsetDatabaseName(String databaseName)
    

Set the database name.

public static  voidsetDebug(boolean value)
    

Force the debugging state.

protected  voidsetParameter(PreparedStatement ps, int param, int jdbcType, Object value)
    

Stuff a PreparedStatement parameter given its 1-based parameter position and expected jdbc type.

protected  voidsetParameter(PreparedStatement ps, int param, Object value)
    

Stuff a PreparedStatement parameter given its 1-based parameter position. The appropriate setXXX() method is determined by the Java type of the value being stuffed.

protected  StringsingleQuote(String text)
    

Single quote a string.

protected static  voidtruncateTable(Connection conn, String name)
    

Scour out all the rows from a table.

public  booleanusingDB2Client()
    
public  booleanusingDerbyClient()
    
public  booleanusingEmbeddedClient()
    

Return true if we're using the embedded driver.


Field Detail
DATABASE_URL
final public static int DATABASE_URL(Code)



DEBUG_FLAG
final public static String DEBUG_FLAG(Code)
If you set this startup property to true, you will get chatty output.



DEFAULT_DATABASE_NAME
final public static String DEFAULT_DATABASE_NAME(Code)



DEFAULT_PASSWORD
final public static String DEFAULT_PASSWORD(Code)



DEFAULT_USER_NAME
final public static String DEFAULT_USER_NAME(Code)



DRIVER_NAME
final public static int DRIVER_NAME(Code)



FAILURE_EXIT
final public static int FAILURE_EXIT(Code)



FRAMEWORK_NAME
final public static int FRAMEWORK_NAME(Code)



JDBC_BOOLEAN
final protected static int JDBC_BOOLEAN(Code)



LEGAL_CLIENTS
final public static String[][] LEGAL_CLIENTS(Code)



SUCCESS_EXIT
final public static int SUCCESS_EXIT(Code)




Constructor Detail
DerbyJUnitTest
public DerbyJUnitTest()(Code)

Vacuous constructor for JUnit machinery.





Method Detail
alarm
public static void alarm(String text)(Code)

Print a message regardless of whether we are running in debug mode.




assertColumnEquals
public void assertColumnEquals(ResultSet rs, int columnNumber, Object[] expectedValues) throws Exception(Code)

Assert the values in a ResultSet for a given column across all rows.




assertColumnEquals
public void assertColumnEquals(String message, ResultSet rs, int columnNumber, Object expectedValue) throws Exception(Code)

Assert a column's value.




assertRow
public void assertRow(ResultSet rs, Object[] expectedRow) throws Exception(Code)

Assert the values of a whole row.




assertScalar
public void assertScalar(Connection conn, String queryText, Object expectedResult) throws Exception(Code)

Assert a scalar result from a query.




close
protected static void close(ResultSet rs)(Code)

Close a ResultSet. This method factors out the check for whether the ResultSet was created in the first place. This tidies up the caller's cleanup logic. If an error occurs, print it. Because this method swallows the exception after printing it, do not call this method if you want your test to halt on error.




close
protected static void close(Statement statement)(Code)

Close a Statement. This method factors out the check for whether the Statement was created in the first place. This tidies up the caller's cleanup logic. If an error occurs, print it. Because this method swallows the exception after printing it, do not call this method if you want your test to halt on error.




close
protected static void close(Connection conn)(Code)

Close a Connection. This method factors out the check for whether the Connection was created in the first place. This tidies up the caller's cleanup logic. If an error occurs, print it. Because this method swallows the exception after printing it, do not call this method if you want your test to halt on error.




compareBytes
public void compareBytes(String message, Object left, Object right) throws Exception(Code)

Assert two byte arrays are equal, allowing nulls to be equal.




compareDates
public void compareDates(String message, Object left, Object right) throws Exception(Code)

Assert two Dates are equal, allowing nulls to be equal.




compareObjects
public void compareObjects(String message, Object left, Object right) throws Exception(Code)

Assert two objects are equal, allowing nulls to be equal.




createDB
protected void createDB(String databaseName) throws Exception(Code)

Create an empty database.




dropFunction
protected static void dropFunction(Connection conn, String name)(Code)

Drop a function regardless of whether it exists. If the function does not exist, don't log an error unless running in debug mode. This method is to be used for reinitializing a schema in case a previous test run failed to clean up after itself. Do not use this method if you need to verify that the function really exists.




dropProcedure
protected static void dropProcedure(Connection conn, String name)(Code)

Drop a procedure regardless of whether it exists. If the procedure does not exist, don't log an error unless running in debug mode. This method is to be used for reinitializing a schema in case a previous test run failed to clean up after itself. Do not use this method if you need to verify that the procedure really exists.




dropSchemaObject
protected static void dropSchemaObject(Connection conn, String genus, String objectName)(Code)

Drop a schema object regardless of whether it exists. If the object does not exist, don't log an error unless running in debug mode. This method is to be used for reinitializing a schema in case a previous test run failed to clean up after itself. Do not use this method if you need to verify that the object really exists.




dropTable
protected static void dropTable(Connection conn, String name)(Code)

Drop a table regardless of whether it exists. If the table does not exist, don't log an error unless running in debug mode. This method is to be used for reinitializing a schema in case a previous test run failed to clean up after itself. Do not use this method if you need to verify that the table really exists.




execute
protected static void execute(Connection conn, String text) throws SQLException(Code)

Execute a SQL statement, given by the text argument. This thin wrapper around the JDBC machinery logs the statement text when running in debug mode.




executeDDL
protected static void executeDDL(Connection conn, String text) throws SQLException(Code)

Execute DDL statement.




exit
public void exit(int exitStatus)(Code)

Return a meaningful exit status so that calling scripts can take evasive action.




faultInDriver
protected static boolean faultInDriver(String[] clientSettings)(Code)

Load a client driver, given its particulars.




findClientFromProperties
public static void findClientFromProperties() throws Exception(Code)

Determine the client to use based on system properties.




getClientSettings
public static String[] getClientSettings()(Code)

Get the client we're using.




getColumn
protected Object getColumn(ResultSet rs, String columnName, int jdbcType) throws Exception(Code)

Read a column from a ResultSet given its column name and expected jdbc type. This method is useful if you are want to verify the getXXX() logic most naturally fitting the declared SQL type.




getColumn
protected Object getColumn(ResultSet rs, int param, Object value) throws Exception(Code)

Read a column from a ResultSet given its column position and an expected Java type. This method is useful when comparing ResultSets against expected values.


Parameters:
  rs - The ResultSet to read.
Parameters:
  param - The column number (1-based)
Parameters:
  value - An object whose type is what we expect the column to be.



getConnection
protected static Connection getConnection() throws Exception(Code)

Get a connection to a database, using the default client.




getConnection
protected static Connection getConnection(String[] clientSettings, String databaseName, Properties properties) throws Exception(Code)

Get a connection to a database, using the specified client.




getOutArg
protected Object getOutArg(CallableStatement cs, int arg, int jdbcType) throws Exception(Code)

Read an output argument from a CallableStatement given its 1-based argument position and expected jdbc type. This is useful for exercising the getXXX() methods most natural to a declared SQL type.




initializeForOldHarness
public static void initializeForOldHarness(String[] args) throws Exception(Code)

Initialize a test suite to run under the old test harness.




parseDebug
public static boolean parseDebug()(Code)

Look for the system property which tells us whether to run chattily.




prepare
protected static PreparedStatement prepare(Connection conn, String text) throws SQLException(Code)

Prepare a SQL statement, given by the text argument. This thin wrapper around the JDBC machinery logs the statement text when running in debug mode.




prepareCall
protected static CallableStatement prepareCall(Connection conn, String text) throws SQLException(Code)

Prepare a SQL call statement, given by the text argument. This thin wrapper around the JDBC machinery logs the statement text when running in debug mode.




printStackTrace
public static void printStackTrace(Throwable t)(Code)

Print out a stack trace.




println
public static void println(String text)(Code)

Debug code to print chatty informational messages.




runUnderOldHarness
public static void runUnderOldHarness(String[] args, Test suite) throws Exception(Code)

Run under the old harness.




setClient
public static void setClient(String[] client)(Code)

Set the client we're going to use.




setDatabaseName
public static void setDatabaseName(String databaseName)(Code)

Set the database name.




setDebug
public static void setDebug(boolean value)(Code)

Force the debugging state. Useful for debugging under the test harness.




setParameter
protected void setParameter(PreparedStatement ps, int param, int jdbcType, Object value) throws Exception(Code)

Stuff a PreparedStatement parameter given its 1-based parameter position and expected jdbc type. This method is useful for testing the setXXX() methods most natural for a declared SQL type.




setParameter
protected void setParameter(PreparedStatement ps, int param, Object value) throws Exception(Code)

Stuff a PreparedStatement parameter given its 1-based parameter position. The appropriate setXXX() method is determined by the Java type of the value being stuffed. This method is useful for testing setXXX() methods other than the most natural fit for the declared SQL type.




singleQuote
protected String singleQuote(String text)(Code)

Single quote a string. This is a helper routine for use in generating SQL text.




truncateTable
protected static void truncateTable(Connection conn, String name) throws SQLException(Code)

Scour out all the rows from a table.




usingDB2Client
public boolean usingDB2Client()(Code)

Return true if we're using the db2 client




usingDerbyClient
public boolean usingDerbyClient()(Code)

Return true if we're using the derby client




usingEmbeddedClient
public boolean usingEmbeddedClient()(Code)

Return true if we're using the embedded driver.




www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.