db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r328515 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/MultiTest.java
Date Wed, 26 Oct 2005 00:34:18 GMT
Author: djd
Date: Tue Oct 25 17:34:12 2005
New Revision: 328515

URL: http://svn.apache.org/viewcvs?rev=328515&view=rev
Log:
DERBY-647 Fix code in MultiTest to generate correct log file names
when the path contains a dot. Previous code was trying to be too
smart, simplified to pass in directory and file name required.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/MultiTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/MultiTest.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/MultiTest.java?rev=328515&r1=328514&r2=328515&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/MultiTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/MultiTest.java
Tue Oct 25 17:34:12 2005
@@ -120,7 +120,7 @@
 		suite.setRoot(inputDir);
 		suite.init();
 	
-		log = openFile(outputDir, testName, ".log");
+		log = openFile(outputDir, testName + ".log");
 
 		try
 		{
@@ -143,7 +143,7 @@
 			String tester = "Tester" + (i+1);
 			try 
 			{
-				LocalizedOutput out = openFile(outputDir, tester, ".out");
+				LocalizedOutput out = openFile(outputDir, tester + ".out");
 				testers[i] = new mtTester(tester, suite, out, log);
 			} catch (IOException e) {
 				System.out.println("MultiTest ERROR: unable open output file "+e);
@@ -362,31 +362,13 @@
 	** Figure out the name of the log file and open
 	** it 
 	*/
-	private static LocalizedOutput openFile(String dir, String fileName, String suffix) 
+	private static LocalizedOutput openFile(String dir, String fileName) 
 			throws IOException
 	{
-		String filePath;
-		String base;
-		int	dotSpot;
-		String newFile;
-		filePath = (dir == null) ? fileName : (dir + "/" + fileName);
+		
+		java.io.File file = new java.io.File(dir, fileName);
 
-		if (suffix != null)
-		{
-			dotSpot = filePath.lastIndexOf(".");
-			if (dotSpot == -1)
-			{
-				dotSpot = filePath.length();
-			}
-
-			base = filePath.substring(0, dotSpot);
-			newFile = base + suffix;
-		}
-		else
-		{
-			newFile = filePath;
-		}	
-		return new LocalizedOutput(new FileOutputStream(newFile));
+		return new LocalizedOutput(new FileOutputStream(file));
 	}
 	/**
 	** Sequentially run scripts
@@ -409,8 +391,11 @@
 		while (e.hasMoreElements())
 		{
 			testCase = (mtTestCase)e.nextElement();
-			System.out.println("...running "+descr+" via "+testCase.getFile());	
-			out = openFile(outputDir, testCase.getFile(), ".out");
+			String testName = testCase.getFile();
+			System.out.println("...running "+descr+" via "+testName);
+			String logFileName = 
+				testName.substring(0, testName.lastIndexOf('.'));
+			out = openFile(outputDir, logFileName + ".out");
 			in = testCase.initialize(inputDir);
 			testCase.runMe(log, out, in);
 		}



Mime
View raw message