Search in sources :

Example 1 with MavenRepositoryLibraryDownloader

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());
}
Also used : MutablePicoContainer(org.picocontainer.MutablePicoContainer) AppEngineSupportConfigurable(com.google.cloud.tools.intellij.appengine.facet.standard.AppEngineStandardSupportProvider.AppEngineSupportConfigurable) AppEngineStandardMavenLibrary(com.google.cloud.tools.intellij.appengine.facet.standard.AppEngineStandardMavenLibrary) CloudSdkInternals(com.google.cloud.tools.intellij.appengine.sdk.CloudSdkInternals) CloudSdkService(com.google.cloud.tools.intellij.appengine.sdk.CloudSdkService) MavenRepositoryLibraryDownloader(com.google.cloud.tools.intellij.appengine.facet.standard.MavenRepositoryLibraryDownloader) Module(com.intellij.openapi.module.Module) FrameworkSupportInModuleConfigurable(com.intellij.framework.addSupport.FrameworkSupportInModuleConfigurable) CloudSdkServiceManager(com.google.cloud.tools.intellij.appengine.sdk.CloudSdkServiceManager)

Aggregations

AppEngineStandardMavenLibrary (com.google.cloud.tools.intellij.appengine.facet.standard.AppEngineStandardMavenLibrary)1 AppEngineSupportConfigurable (com.google.cloud.tools.intellij.appengine.facet.standard.AppEngineStandardSupportProvider.AppEngineSupportConfigurable)1 MavenRepositoryLibraryDownloader (com.google.cloud.tools.intellij.appengine.facet.standard.MavenRepositoryLibraryDownloader)1 CloudSdkInternals (com.google.cloud.tools.intellij.appengine.sdk.CloudSdkInternals)1 CloudSdkService (com.google.cloud.tools.intellij.appengine.sdk.CloudSdkService)1 CloudSdkServiceManager (com.google.cloud.tools.intellij.appengine.sdk.CloudSdkServiceManager)1 FrameworkSupportInModuleConfigurable (com.intellij.framework.addSupport.FrameworkSupportInModuleConfigurable)1 Module (com.intellij.openapi.module.Module)1 MutablePicoContainer (org.picocontainer.MutablePicoContainer)1