use of com.google.cloud.tools.intellij.appengine.facet.standard.MavenRepositoryLibraryDownloader in project google-cloud-intellij by GoogleCloudPlatform.
the class AppEngineStandardSupportProviderTest method setupAppEngine.
private void setupAppEngine(AppEngineStandardLibraryPanel libraryPanel, Library library) {
CloudSdkService sdkService = mock(CloudSdkService.class);
CloudSdkServiceManager sdkServiceManager = mock(CloudSdkServiceManager.class);
when(sdkServiceManager.getCloudSdkService()).thenReturn(sdkService);
CloudSdkInternals mockSdkInternals = mock(CloudSdkInternals.class);
when(mockSdkInternals.getLibraries()).thenReturn(new File[] {});
CloudSdkInternals.setInstance(mockSdkInternals);
MavenRepositoryLibraryDownloader libraryDownloader = mock(MavenRepositoryLibraryDownloader.class);
when(libraryDownloader.downloadLibrary(any(Module.class), any(AppEngineStandardMavenLibrary.class))).thenReturn(library);
MutablePicoContainer applicationContainer = (MutablePicoContainer) ApplicationManager.getApplication().getPicoContainer();
applicationContainer.unregisterComponent(CloudSdkService.class.getName());
applicationContainer.registerComponentInstance(CloudSdkService.class.getName(), sdkService);
applicationContainer.unregisterComponent(MavenRepositoryLibraryDownloader.class.getName());
applicationContainer.registerComponentInstance(MavenRepositoryLibraryDownloader.class.getName(), libraryDownloader);
FrameworkSupportInModuleConfigurable configurable = selectFramework(AppEngineStandardFrameworkType.ID);
if (libraryPanel != null && configurable instanceof AppEngineSupportConfigurable) {
((AppEngineSupportConfigurable) configurable).setAppEngineStandardLibraryPanel(libraryPanel);
}
CloudSdkServiceUserSettings.getInstance().setCustomSdkPath(AppEngineCodeInsightTestCase.getSdkPath());
}
Aggregations