[DS-446] New ant step - test_database

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@4658 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Stuart Lewis
2010-01-06 21:30:42 +00:00
parent de65b78ca6
commit b2570f59e5
4 changed files with 57 additions and 1 deletions

View File

@@ -1787,6 +1787,39 @@ public class DatabaseManager
} }
} }
/**
* Main method used to perform tests on the database
*
* @param args The command line arguments
*/
public static void main(String[] args)
{
// Get something from dspace.cfg to get the log lines out the way
String url = ConfigurationManager.getProperty("db.url");
// Try to connect to the database
System.out.println("\nAttempting to connect to database: ");
System.out.println(" - URL: " + url);
System.out.println(" - Driver: " + ConfigurationManager.getProperty("db.driver"));
System.out.println(" - Username: " + ConfigurationManager.getProperty("db.username"));
System.out.println(" - Password: " + ConfigurationManager.getProperty("db.password"));
System.out.println(" - Schema: " + ConfigurationManager.getProperty("db.schema"));
System.out.println("\nTesting connection...");
try
{
Connection connection = DatabaseManager.getConnection();
}
catch (SQLException sqle)
{
System.err.println("\nError: ");
System.err.println(" - " + sqle);
System.err.println("\nPlease see the DSpace documentation for assistance.\n");
System.exit(1);
}
System.out.println("Connected succesfully!\n");
}
} }
/** /**

View File

@@ -74,6 +74,8 @@
- [DS-389] Misleading label: "Submit to This Collection" - [DS-389] Misleading label: "Submit to This Collection"
- [DS-424] Export metadata button displayed in JSPUI Administration List of withdrawn items - [DS-424] Export metadata button displayed in JSPUI Administration List of withdrawn items
- [DS-442] Enable RSS feeds by default - [DS-442] Enable RSS feeds by default
- [DS-445] New Bitstream.findAll() method
- [DS-446] New ant step - test_database
(Larry Stone) (Larry Stone)
- [DS-284] alternate odd and even styles correctly on table rows in Item Summary view - [DS-284] alternate odd and even styles correctly on table rows in Item Summary view

View File

@@ -247,6 +247,14 @@
</step> </step>
</command> </command>
<command>
<name>test-database</name>
<description>Test the DSpace database connection is OK</description>
<step>
<class>org.dspace.storage.rdbms.DatabaseManager</class>
</step>
</command>
<command> <command>
<name>sub-daily</name> <name>sub-daily</name>
<description>Send daily subscription notices</description> <description>Send daily subscription notices</description>

View File

@@ -590,6 +590,19 @@ Common usage:
</target> </target>
<!-- ============================================================= -->
<!-- Check the connection to the database -->
<!-- ============================================================= -->
<!-- Test the connection to the database -->
<target name="test_database">
<java classname="org.dspace.storage.rdbms.DatabaseManager" classpathref="class.path" fork="yes" failonerror="yes">
<sysproperty key="log4j.configuration" value="file:config/log4j-console.properties" />
<sysproperty key="dspace.log.init.disable" value="true" />
<sysproperty key="dspace.configuration" value="${config}" />
</java>
</target>
<!-- ============================================================= --> <!-- ============================================================= -->
<!-- Create the database tables --> <!-- Create the database tables -->
@@ -677,7 +690,7 @@ Common usage:
<!-- Do a fresh system install --> <!-- Do a fresh system install -->
<!-- ============================================================= --> <!-- ============================================================= -->
<target name="fresh_install" depends="init_installation,init_configs,setup_database,load_registries" description="Do a fresh install of the system, overwriting any data"> <target name="fresh_install" depends="test_database,init_installation,init_configs,setup_database,load_registries" description="Do a fresh install of the system, overwriting any data">
<delete failonerror="no"> <delete failonerror="no">
<fileset dir="${dspace.dir}/bin" includes="**/*" /> <fileset dir="${dspace.dir}/bin" includes="**/*" />