use of com.intellij.openapi.externalSystem.model.DataNode in project android by JetBrains.
the class ModulesToImportDialogSelectionTest method createModule.
@NotNull
private static DataNode<ModuleData> createModule(@NotNull String name) {
String path = "~/project/" + name;
ModuleData data = new ModuleData(name, GradleConstants.SYSTEM_ID, StdModuleTypes.JAVA.getId(), name, path, path);
return new DataNode<>(MODULE, data, null);
}
use of com.intellij.openapi.externalSystem.model.DataNode in project android by JetBrains.
the class ModulesToImportDialogSelectionTest method testSaveAndLoad.
public void testSaveAndLoad() throws Exception {
File file = FileUtil.createTempFile("selection", ".xml", true);
List<DataNode<ModuleData>> modules = Lists.newArrayList();
modules.add(createModule("project"));
modules.add(createModule("app"));
ModulesToImportDialog.Selection.save(modules, file);
List<String> moduleNames = ModulesToImportDialog.Selection.load(file);
assertThat(moduleNames).containsExactly("project", "app");
}
use of com.intellij.openapi.externalSystem.model.DataNode in project android by JetBrains.
the class GradleModuleModelDataServiceTest method testImportData.
public void testImportData() {
String appModuleName = "app";
Module appModule = createModule(appModuleName);
GradleModuleModel model = new GradleModuleModel(appModuleName, Collections.emptyList(), ":app", null, null);
DataNode<GradleModuleModel> dataNode = new DataNode<>(GRADLE_MODULE_MODEL, model, null);
Collection<DataNode<GradleModuleModel>> dataNodes = Collections.singleton(dataNode);
myDataService.importData(dataNodes, null, getProject(), myModelsProvider);
verify(myModuleSetup).setUpModule(appModule, myModelsProvider, model);
}
use of com.intellij.openapi.externalSystem.model.DataNode in project android by JetBrains.
the class ModuleDisposalDataServiceTest method testImportDataWithAndroidStudioAndSuccessfulSync.
public void testImportDataWithAndroidStudioAndSuccessfulSync() {
when(myIdeInfo.isAndroidStudio()).thenReturn(true);
when(mySyncState.lastSyncFailedOrHasIssues()).thenReturn(false);
IdeaModule moduleModel = mock(IdeaModule.class);
when(moduleModel.getName()).thenReturn(getModule().getName());
ImportedModule importedModule = new ImportedModule(moduleModel);
// This module should be disposed.
Module libModule = createModule("lib");
Project project = getProject();
IdeModifiableModelsProvider modelsProvider = new IdeModifiableModelsProviderImpl(project);
Collection<DataNode<ImportedModule>> nodes = Collections.singleton(new DataNode<>(IMPORTED_MODULE, importedModule, null));
myDataService.importData(nodes, null, project, modelsProvider);
ApplicationManager.getApplication().runWriteAction(modelsProvider::dispose);
Collection<Module> modulesToDispose = Collections.singletonList(libModule);
verify(myModuleDisposer).disposeModulesAndMarkImlFilesForDeletion(modulesToDispose, getProject(), modelsProvider);
}
use of com.intellij.openapi.externalSystem.model.DataNode in project android by JetBrains.
the class NdkModuleModelDataServiceTest method testImportData.
public void testImportData() {
myModelsProvider = new IdeModifiableModelsProviderImpl(getProject());
String appModuleName = "app";
Module appModule = createModule(appModuleName);
NdkModuleModel model = mock(NdkModuleModel.class);
when(model.getModuleName()).thenReturn(appModuleName);
DataNode<NdkModuleModel> dataNode = new DataNode<>(NDK_MODEL, model, null);
Collection<DataNode<NdkModuleModel>> dataNodes = Collections.singleton(dataNode);
myDataService.importData(dataNodes, null, getProject(), myModelsProvider);
verify(myModuleSetup).setUpModule(appModule, myModelsProvider, model, null, null);
}
Aggregations