}
protected void setUp() throws Exception {
super.setUp();
ModifiableRootModel rootModel = null;
final ModuleRootManager rootManager = ModuleRootManager.getInstance(getModule());
if (isConfigureSourceFolder()) {
rootModel = ModuleRootManager.getInstance(getModule()).getModifiableModel();
final String testDir = getTestFolderPath();
// Configure source folder
final File dir = new File(testDir);
assertTrue(dir.exists());
VirtualFile vDir = LocalFileSystem.getInstance().
refreshAndFindFileByPath(dir.getCanonicalPath().replace(File.separatorChar, '/'));
assertNotNull(vDir);
ContentEntry contentEntry = rootModel.addContentEntry(vDir);
contentEntry.addSourceFolder(vDir, false);
}
// Add Clojure Library
OrderEnumerator libs = rootManager.orderEntries().librariesOnly();
final List<Library.ModifiableModel> libModels = new ArrayList<Library.ModifiableModel>();
rootModel = TestUtils.addLibrary(rootModel, rootManager, libs, libModels, "clojureLib", TestUtils.getMockClojureLib(), null);
rootModel = TestUtils.addLibrary(rootModel, rootManager, libs, libModels, "clojureContrib", TestUtils.getMockClojureContribLib(), null);
if (rootModel != null || !libModels.isEmpty()) {
final ModifiableRootModel finalRootModel = rootModel;
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
for (Library.ModifiableModel model : libModels) {
model.commit();
}
if (finalRootModel != null) {
finalRootModel.commit();
}
final StartupManagerImpl startupManager = (StartupManagerImpl) StartupManager.getInstance(ourProject);
startupManager.startCacheUpdate();
}
});