Fix problem in configuration with copy runtime jar

Jar with runtime wasn't copied to library with configured classpath if runtime jar was present in default directory.

Mute configure dialog for tests
This commit is contained in:
Nikolay Krasko
2014-07-18 19:20:31 +04:00
parent ae4bac06b2
commit b20b406d8e
6 changed files with 85 additions and 17 deletions
@@ -16,13 +16,13 @@
package org.jetbrains.jet.plugin.configuration;
import com.intellij.openapi.application.PathMacros;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.testFramework.PlatformTestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.utils.PathUtil;
import java.io.File;
@@ -38,6 +38,21 @@ public class ConfigureKotlinTest extends PlatformTestCase {
private static final KotlinJavaModuleConfigurator JAVA_CONFIGURATOR = new KotlinJavaModuleConfigurator();
private static final KotlinJsModuleConfigurator JS_CONFIGURATOR = new KotlinJsModuleConfigurator();
@Override
protected void tearDown() throws Exception {
PathMacros.getInstance().removeMacro("TEMP_TEST_DIR");
super.tearDown();
}
@Override
protected void initApplication() throws Exception {
super.initApplication();
File tempLibDir = FileUtil.createTempDirectory("temp", null);
PathMacros.getInstance().setMacro("TEMP_TEST_DIR", tempLibDir.getAbsolutePath());
}
public void testNewLibrary_copyJar() {
doTestOneJavaModule(FileState.COPY, LibraryState.NEW_LIBRARY);
}
@@ -88,6 +103,16 @@ public class ConfigureKotlinTest extends PlatformTestCase {
}
}
public void testLibraryNonDefault_libExistInDefault() throws IOException {
Module module = getModule();
assertFalse("Module " + module.getName() + " should not be configured", JAVA_CONFIGURATOR.isConfigured(module));
JAVA_CONFIGURATOR.configure(myProject);
assertTrue("Module " + module.getName() + " should be configured", JAVA_CONFIGURATOR.isConfigured(getModule()));
assertFalse("Module " + getModule().getName() + " should not be configured as JavaScript Module",
JS_CONFIGURATOR.isConfigured(getModule()));
}
public void testNewLibrary_jarExists_js() {
doTestOneJsModule(FileState.EXISTS, LibraryState.NEW_LIBRARY);
}