@Before public void setUp() { // TODO: remove after Batik fix is available in IDEA itself - happens when SVG icons are used. // See b4df0c72ee3e88bf3cf48fde0a1e19fb948757fe in IJ Community Git. ThreadTracker.longRunningThreadCreated( ApplicationManager.getApplication(), "Batik CleanerThread"); }
@Before public void setUp() { when(stop.getCallback()).thenReturn(callback); when(stop.getHelper()).thenReturn(helper); when(stop.getDeploymentConfiguration()).thenReturn(configuration); when(stop.getHelper().stageCredentials(any())).thenReturn(Optional.of(Paths.get("/some/file"))); task = new AppEngineStopTask(stop, "myModule", "myVersion"); // TODO: consider shutting down timer instead when clear what is creating the timer. ThreadTracker.longRunningThreadCreated(ApplicationManager.getApplication(), "Timer-0"); }
@Before public void setUp() throws Exception { ThreadTracker.longRunningThreadCreated( ApplicationManager.getApplication(), CloudDebugProcessStateController.LIST_BREAKPOINTS_TIMER_NAME); XDebugSession session = mock(XDebugSession.class); when(session.getProject()).thenReturn(testFixture.getProject()); process = spy(new CloudDebugProcess(session)); }
@Before public void setUp() { GcsTestUtils.setupVirtualFileWithBucketMocks(bucketVirtualFile); when(loginService.isLoggedIn()).thenReturn(true); when(directoryBlob.isDirectory()).thenReturn(true); when(directoryBlob.getName()).thenReturn(DIR_NAME); when(binaryBlob.isDirectory()).thenReturn(false); when(binaryBlob.getName()).thenReturn(BLOB_NAME); when(binaryBlob.getSize()).thenReturn(1024L); when(binaryBlob.getContentType()).thenReturn(BLOB_CONTENT_TYPE); when(binaryBlob.getUpdateTime()).thenReturn(0L); when(binaryBlobInDirectory.getName()).thenReturn(NESTED_BLOB_FULL_NAME); // TODO: consider shutting down timer instead when clear what is creating the timer. ThreadTracker.longRunningThreadCreated(ApplicationManager.getApplication(), "Timer-0"); }
@Before public void setUp() { // add timer thread to one not to be checked for 'leaks' ThreadTracker.longRunningThreadCreated( ApplicationManager.getApplication(), ManagedCloudSdkUpdateService.SDK_UPDATER_THREAD_NAME); when(mockPluginInfoService.shouldEnable(GctFeature.MANAGED_SDK_UPDATE)).thenReturn(true); when(mockSdkServiceManager.getCloudSdkService()).thenReturn(mockSdkService); ManagedCloudSdkServiceUiPresenter.setInstance(mockUiPresenter); doReturn(mockClock).when(managedCloudSdkUpdateService).getClock(); doReturn(mockUiTimer).when(managedCloudSdkUpdateService).createUiTimer(anyInt()); when(mockUiPresenter.notifyManagedSdkUpdate(any(), any())).thenReturn(mockNotification); // directly execute scheduled tasks. doAnswer( invocationOnMock -> { ((TimerTask) invocationOnMock.getArgument(0)).run(); return null; }) .when(managedCloudSdkUpdateService) .schedule(any(), anyLong(), anyLong()); // directly call task assigned to UI timer. doAnswer( invocationOnMock -> { ((ActionListener) invocationOnMock.getArgument(0)) .actionPerformed(mock(ActionEvent.class)); return null; }) .when(mockUiTimer) .addActionListener(any()); CloudSdkServiceUserSettings.reset(); }
@Before public void setUp() throws IOException { when(googleLoginService.getLoggedInUser("user")).thenReturn(Optional.of(user)); when(progressManager.getProgressIndicator()).thenReturn(progressIndicator); when(apiClientFactory.getIamClient(any())).thenReturn(iam); when(apiClientFactory.getCloudResourceManagerClient(any())).thenReturn(resourceManager); setupFakeServiceAccount(); setupFakeServiceAccountKey(); setupFakePolicy(); setupMockIamClient(); setupMockResourceManagerClient(); testFixture .getProject() .getMessageBus() .connect() .subscribe(Notifications.TOPIC, notifications); // TODO: consider shutting down timer instead when clear what is creating the timer. ThreadTracker.longRunningThreadCreated(ApplicationManager.getApplication(), "Timer-0"); }
@Before public void setUp() throws UnsupportedOsException { // add timer thread to one not to be checked for 'leaks' ThreadTracker.longRunningThreadCreated( ApplicationManager.getApplication(), ManagedCloudSdkUpdateService.SDK_UPDATER_THREAD_NAME); doReturn(mockManagedCloudSdk).when(sdkService).createManagedSdk(); // TODO(ivanporty) remove once test logging system is done via CloudToolsRule sdkService.setLogger(new TestInMemoryLogger()); // make sure everything in test is done synchronously ExecutorService directExecutorService = MoreExecutors.newDirectExecutorService(); ThreadUtil.getInstance().setBackgroundExecutorService(directExecutorService); // run UI updates synchronously doAnswer( invocation -> { ((Runnable) invocation.getArgument(0)).run(); return null; }) .when(sdkService) .invokeOnApplicationUIThread(any()); // replace UI presenter for verifications ManagedCloudSdkServiceUiPresenter.setInstance(mockUiPresenter); when(mockUiPresenter.createProgressListener(any())).thenReturn(mockProgressListener); // init SDK, most tests require initialized state. sdkService.initManagedSdk(); }