db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r795166 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/mailjdbc: MailJdbc.java README.txt utils/DbTasks.java
Date Fri, 17 Jul 2009 17:45:35 GMT
Author: kmarsden
Date: Fri Jul 17 17:45:35 2009
New Revision: 795166

URL: http://svn.apache.org/viewvc?rev=795166&view=rev
Log:
DERBY-4203 (partial) Change mailjdbc  system test to be able to restart with the existing
database instead of creating a new one so it can be used for upgrade testing

This patch does not include the sttest changes.

Contrubuted by Lily Wei (lilywei at yahoo dot com)


Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/mailjdbc/MailJdbc.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/mailjdbc/README.txt
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/mailjdbc/utils/DbTasks.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/mailjdbc/MailJdbc.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/mailjdbc/MailJdbc.java?rev=795166&r1=795165&r2=795166&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/mailjdbc/MailJdbc.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/mailjdbc/MailJdbc.java
Fri Jul 17 17:45:35 2009
@@ -31,10 +31,13 @@
 	public static LogFile logAct = new LogFile("Activity.out");
 
 	public static void main(String[] args) throws Exception {
+		boolean useexistingdb = false;
 		String type = args[0];
+		if (args.length > 1 && args[1].equals("samedb"))
+			useexistingdb = true;
 		System.out.println("Test started with " + type + " driver");
 		//Loads the driver
-		DbTasks.jdbcLoad(type);
+		DbTasks.jdbcLoad(type, useexistingdb);
 		//Starts all 4 threads
 		ThreadUtils.startThreads();
 	}

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/mailjdbc/README.txt
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/mailjdbc/README.txt?rev=795166&r1=795165&r2=795166&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/mailjdbc/README.txt (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/mailjdbc/README.txt Fri
Jul 17 17:45:35 2009
@@ -28,7 +28,7 @@
 
 1. About the Mailjdbc test
 
- This test will mimic how a typical mail client can  use Derby as their database
+ This test will mimic how a typical mail client can use Derby as their database
 
 2. Design
 
@@ -91,6 +91,10 @@
 3. Run java org.apache.derbyTesting.system.mailjdbc.MailJdbc embedded
  or
  java org.apache.derbyTesting.system.mailjdbc.MailJdbc NetworkServer (To run in the NetworkServer
mode you should start the n/w server manually)
+4. If you want to use the same database as the previous run, 
+   Run java org.apache.derbyTesting.system.mailjdbc.MailJdbc embedded samedb
+ or
+  java org.apache.derbyTesting.system.mailjdbc.MailJdbc NetworkServer samedb (To run in the
NetworkServer mode you should start the n/w server manually)
 
 There are 2 output files. 
 1. Activity.out - which will give all the activities done by the test

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/mailjdbc/utils/DbTasks.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/mailjdbc/utils/DbTasks.java?rev=795166&r1=795165&r2=795166&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/mailjdbc/utils/DbTasks.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/mailjdbc/utils/DbTasks.java
Fri Jul 17 17:45:35 2009
@@ -57,8 +57,12 @@
 	public static int blob_count = 0;
 
 	public static Random Rn = new Random();
-
-	public static void jdbcLoad(String driverType) {
+	/**
+	 * jdbcLoad - Create url, schema and set driver and database system property that will be
use later in the test.
+	 * @param driverType - "embedded" or "NetworkServer" 
+	 * @param useexistingdb - whether to use existing database or not
+	 */
+	public static void jdbcLoad(String driverType, boolean useexistingdb) {
 
 		if (driverType.equalsIgnoreCase("embedded")) {
 			setSystemProperty("driver", "org.apache.derby.jdbc.EmbeddedDriver");
@@ -69,13 +73,22 @@
 					.logMsg("\n\n*****************************************************");
 			// setting the properties like user, password etc for both the
 			// database and the backup database
-			setSystemProperty("database", "jdbc:derby:mailsdb;create=true");
+			if (useexistingdb)
+		        setSystemProperty("database", "jdbc:derby:mailsdb");
+			else
+		        setSystemProperty("database", "jdbc:derby:mailsdb;create=true");			
 			setSystemProperty("ij.user", "REFRESH");
 			setSystemProperty("ij.password", "Refresh");
 		} else {
 			setSystemProperty("driver", "org.apache.derby.jdbc.ClientDriver");
-			setSystemProperty("database",
-					"jdbc:derby://localhost:1527/mailsdb;create=true;user=REFRESH;password=Refresh");
+			if (useexistingdb)
+				setSystemProperty("database",
+					"jdbc:derby://localhost:1527/mailsdb");
+			else
+				setSystemProperty("database",
+					"jdbc:derby://localhost:1527/mailsdb;create=true");
+			setSystemProperty("ij.user", "REFRESH");
+			setSystemProperty("ij.password", "Refresh");
 			MailJdbc.logAct
 					.logMsg(" \n*****************************************************");
 			MailJdbc.logAct
@@ -84,6 +97,12 @@
 					.logMsg("\n\n*****************************************************");
 		}
 		try {
+			if (useexistingdb)
+			{
+				MailJdbc.logAct
+				.logMsg("Useing the existing database...");
+				return;
+			}
 			// Create the schema (tables)
 			long s_schema = System.currentTimeMillis();
 			org.apache.derby.tools.ij



Mime
View raw message