Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Blocker
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:WinXP, j2sdk1.4.2
-
Number of attachments :
Description
When the scalability code was moved from src/test to src/main, a dependency between src/main and src/test was created. If one compiles src/main without putting src/test in the classpath (which one shouldn't have to do), the following error will ocurr...
[javac] Found 1 semantic error compiling "D:/myclasses/Prevayler/CVS_Reposit
ories/Prevayler2_2003-02-20/prevayler/src/main/org/prevayler/demos/scalability/p
revayler/PrevaylerQuerySubject.java":
[javac] 10. import org.prevayler.implementation.PrevalenceTest;
[javac] -----------------------------------------
[javac] *** Semantic Error: The import "org/prevayler/implementation/Prevale
nceTest" is not valid, since it does not name a type in a package.
[javac] Found 1 semantic error compiling "D:/myclasses/Prevayler/CVS_Reposit
ories/Prevayler2_2003-02-20/prevayler/src/main/org/prevayler/demos/scalability/p
revayler/PrevaylerTransactionSubject.java":
[javac] 10. import org.prevayler.implementation.PrevalenceTest;
[javac] -----------------------------------------
[javac] *** Semantic Error: The import "org/prevayler/implementation/Prevale
nceTest" is not valid, since it does not name a type in a package.
This happens because PrevalenceTest is located under src/test. It is a JUnit testcase that was being dual purposed for both the normal tests and the scalability tests.
There is a relatively simple solution, but it involves essentially duplicating the PrevalenceTest class between src/test and src/main. Copy PrevalenceTest to package org.prevayler.demos.scalability.prevayler, leave out the JUnit stuff, and then comment out the imports of org.prevayler.implementation.PrevalenceTest in PrevaylerQuerySubject and PrevaylerTransactionSubject. Here is PrevalenceTest.java....
package org.prevayler.demos.scalability.prevayler;
import java.io.File;
import java.io.FileFilter;
public class PrevalenceTest {
static public void delete(String dir)
{ delete(new File(dir)); } static private void delete(File file) {
if (file.isDirectory()) deleteDirectoryContents(file);
if (!file.delete())
}
static private void deleteDirectoryContents(File directory)
{ File[] files = directory.listFiles(new PrevalenceFilter()); if (files == null) return; for (int i = 0; i < files.length; i++) delete(files[i]); } static private class PrevalenceFilter implements FileFilter {
public boolean accept(File file)
}
}
Not sure if this is the solution that is desired, otherwise I'd check this in right away.
Jake
I've applied the changes described previously to Prevayler's CVS. If this is not the desired solution, somone else can back this out and provide their own solution. Otherwise, this bug can be considered fixed.
Jake