use of com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl in project android by JetBrains.
the class ArtifactsByConfigurationModuleSetupStepTest method testDoSetUpModuleWithCompiledJar.
public void testDoSetUpModuleWithCompiledJar() throws IOException {
Module module = getModule();
String moduleName = module.getName();
File buildFolderPath = createTempDir("build");
File jarFilePath = new File(buildFolderPath, moduleName + ".jar");
createIfDoesntExist(jarFilePath);
Project project = getProject();
IdeModifiableModelsProvider modelsProvider = new IdeModifiableModelsProviderImpl(project);
Map<String, Set<File>> artifactsByConfiguration = new HashMap<>();
artifactsByConfiguration.put("default", Collections.singleton(jarFilePath));
JavaModuleModel model = new JavaModuleModel(moduleName, Collections.emptyList(), Collections.emptyList(), artifactsByConfiguration, null, buildFolderPath, null, true, false);
mySetupStep.doSetUpModule(module, modelsProvider, model, null, null);
ApplicationManager.getApplication().runWriteAction(modelsProvider::commit);
LibraryTable libraryTable = ProjectLibraryTable.getInstance(project);
Library[] libraries = libraryTable.getLibraries();
assertThat(libraries).isEmpty();
assertAbout(libraryDependencies()).that(module).isEmpty();
// No libraries were created, nothing should be marked as "used".
verify(myLibraryRegistry, never()).markAsUsed(any(), any());
}
use of com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl in project android by JetBrains.
the class DependenciesModuleSetupStepTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
initMocks(this);
myModelsProvider = new IdeModifiableModelsProviderImpl(getProject());
mySetupStep = new DependenciesModuleSetupStep(myDependenciesSetup);
}
use of com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl in project android by JetBrains.
the class JavaLanguageLevelModuleSetupStepTest method testSetUpModuleWithLanguageLevelInJavaProject.
public void testSetUpModuleWithLanguageLevelInJavaProject() {
IdeModifiableModelsProvider modelsProvider = new IdeModifiableModelsProviderImpl(getProject());
when(myJavaModuleModel.getJavaLanguageLevel()).thenReturn(JDK_1_7);
Module module = getModule();
mySetupStep.setUpModule(module, modelsProvider, myJavaModuleModel, null, null);
// Commit changes to verify results.
ApplicationManager.getApplication().runWriteAction(modelsProvider::commit);
verifyLanguageLevel(module, JDK_1_7);
}
use of com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl in project android by JetBrains.
the class JavaLanguageLevelModuleSetupStepTest method testSetUpModuleWithNoLanguageLevel.
public void testSetUpModuleWithNoLanguageLevel() {
IdeModifiableModelsProvider modelsProvider = new IdeModifiableModelsProviderImpl(getProject());
when(myJavaModuleModel.getJavaLanguageLevel()).thenReturn(null);
Module module = getModule();
mySetupStep.setUpModule(module, modelsProvider, myJavaModuleModel, null, null);
// Commit changes to verify results.
ApplicationManager.getApplication().runWriteAction(modelsProvider::commit);
verifyLanguageLevel(module, JDK_1_6);
}
use of com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl in project android by JetBrains.
the class JavaLanguageLevelModuleSetupStepTest method testSetUpModuleWithLanguageLevelComingFromAndroidModules.
public void testSetUpModuleWithLanguageLevelComingFromAndroidModules() {
createAndroidModule("app", JDK_1_7);
createAndroidModule("androidLib", JDK_1_8);
IdeModifiableModelsProvider modelsProvider = new IdeModifiableModelsProviderImpl(getProject());
when(myJavaModuleModel.getJavaLanguageLevel()).thenReturn(null);
Module module = getModule();
mySetupStep.setUpModule(module, modelsProvider, myJavaModuleModel, null, null);
// Commit changes to verify results.
ApplicationManager.getApplication().runWriteAction(modelsProvider::commit);
verifyLanguageLevel(module, JDK_1_7);
}
Aggregations